• Show log

    Commit

  • Hash : fca3eb6b
    Author : Peiyong Lin
    Date : 2023-12-12T23:00:41

    Refactor ANGLE settings UI.
    
    This patch refactors the ANGLE settings UI to make sure it aligns better
    with the settings global variables. This patch:
    
    1) moves all ANGLE rule parsing logic to its own class, the parsing will
       only parse the rule and store them, it currently does not set the
       settings global variables;
    2) removes the global enablement as it is now an option in Developer
       options and that one has better guarding condition;
    3) refactors the logic to query all packages in the system, instead of
       constructing them with raw package name, use application name to
       allow a more user-friendly UI, and also allow to toggle for system
       applications.
    4) adds two new entries to allow building ANGLE apk without any ANGLE
       libraries;
    5) adds a README.md file to document the design.
    6) removes unused functions and variables and minor renames.
    
    Bug: b/293503000
    Test: manual
    Change-Id: I7287935791c00040b0eacba7dce3e4df5eb4de3e
    Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5118135
    Reviewed-by: Cody Northrop <cnorthrop@google.com>
    Commit-Queue: Peiyong Lin <lpy@google.com>
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/angle.git
    Git SSH git@git.kmx.io:kc3-lang/angle.git
    Public access ? public
    Description

    A conformant OpenGL ES implementation for Windows, Mac, Linux, iOS and Android.

    Homepage

    Github

    Users
    kc3_lang_org thodg_w www_kmx_io thodg_l thodg thodg_m
    Tags

  • README.md

  • ANGLE Settings UI

    Introduction

    ANGLE Settings UI is a UI shipped as part of the ANGLE apk. The ANGLE apk can ship with a list rules of applications using different OpenGL ES driver. The UI provides two functionalities:

    1. Enable to show a message when ANGLE is loaded into the launched application;
    2. Allow to select driver choice in the UI for applications.

    The rule file

    Currently the ANGLE apk supports two rules: ANGLE and native OpenGL ES driver.

    The rule file is a file that contains a JSON string, the format is shown below:

    {
        "rules":[
            {
                "description": "Applications in this list will use ANGLE",
                "choice": "angle",
                "apps": [
                    {
                        "packageName": "com.android.example.a"
                    },
                    {
                        "packageName": "com.android.example.b"
                    }
                ]
            },
            {
                "description": "Applications in this list will not use ANGLE",
                "choice": "native",
                "apps":[
                    {
                        "packageName": "com.android.example.c"
                    }
                ]
            }
        ]
    }

    The ANGLE JSON rules are parsed only when ACTION_BOOT_COMPLETED or ACTION_MY_PACKAGE_REPLACED is received. After the JSON rules are parsed, the result will be stored in SharedPreferences as key-value pair, with the key being the package name and the value being the driver selection choice. The JSON parsing code is in AngleRuleHelper.

    TODO(b/314409902): Set settings global variables when the either intent is received.

    The UI logic is mainly in MainFragment, and the GlobalSettings is merely for manipulating settings global variables and updating SharedPreferences. When a user changes the driver choice of an application, the update will go into GlobalSettings and SharedPreferences respectively.

    The SharedPreferences is the source of truth and the code should always query the driver choice from it with the package name. The SharedPreferences should only be updated within GlobalSettings and AngleRuleHelper.

    The settings global variables may also be changed via adb command by the users, often time ANGLE for Android developers. Note that every time a boot event happens, it is expected that all previous values in settings global variables will be cleared and only values from the ANGLE JSON rule file will take effect.

    Developer options

    The ANGLE Settings UI is registered as a dynamic setting entry in the development component via

    <intent-filter>
        <action android:name="com.android.settings.action.IA_SETTINGS" />
    </intent-filter>
    <meta-data android:name="com.android.settings.category"
            android:value="com.android.settings.category.ia.development" />

    And hence the UI shows up in Developer options. If the Developer options are disabled, all settings global variables will be cleared.