Merge "Rename game driver to updatable driver." into rvc-dev-plus-aosp am: 377b7f318d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12375470

Change-Id: Ief345ee98cd8758baa1adde984abe01a753dce5c
This commit is contained in:
TreeHugger Robot
2020-08-17 20:25:52 +00:00
committed by Automerger Merge Worker
8 changed files with 168 additions and 144 deletions

View File

@@ -64,10 +64,11 @@ public class GraphicsEnvironment {
private static final String SYSTEM_DRIVER_NAME = "system"; private static final String SYSTEM_DRIVER_NAME = "system";
private static final String SYSTEM_DRIVER_VERSION_NAME = ""; private static final String SYSTEM_DRIVER_VERSION_NAME = "";
private static final long SYSTEM_DRIVER_VERSION_CODE = 0; private static final long SYSTEM_DRIVER_VERSION_CODE = 0;
private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0"; private static final String PROPERTY_GFX_DRIVER_PRODUCTION = "ro.gfx.driver.0";
private static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1"; private static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
private static final String PROPERTY_GFX_DRIVER_BUILD_TIME = "ro.gfx.driver_build_time"; private static final String PROPERTY_GFX_DRIVER_BUILD_TIME = "ro.gfx.driver_build_time";
private static final String METADATA_DRIVER_BUILD_TIME = "com.android.gamedriver.build_time"; private static final String METADATA_DRIVER_BUILD_TIME =
"com.android.graphics.updatabledriver.build_time";
private static final String METADATA_DEVELOPER_DRIVER_ENABLE = private static final String METADATA_DEVELOPER_DRIVER_ENABLE =
"com.android.graphics.developerdriver.enable"; "com.android.graphics.developerdriver.enable";
private static final String METADATA_INJECT_LAYERS_ENABLE = private static final String METADATA_INJECT_LAYERS_ENABLE =
@@ -78,20 +79,20 @@ public class GraphicsEnvironment {
private static final String ACTION_ANGLE_FOR_ANDROID_TOAST_MESSAGE = private static final String ACTION_ANGLE_FOR_ANDROID_TOAST_MESSAGE =
"android.app.action.ANGLE_FOR_ANDROID_TOAST_MESSAGE"; "android.app.action.ANGLE_FOR_ANDROID_TOAST_MESSAGE";
private static final String INTENT_KEY_A4A_TOAST_MESSAGE = "A4A Toast Message"; private static final String INTENT_KEY_A4A_TOAST_MESSAGE = "A4A Toast Message";
private static final String GAME_DRIVER_ALLOWLIST_ALL = "*"; private static final String UPDATABLE_DRIVER_ALLOWLIST_ALL = "*";
private static final String GAME_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt"; private static final String UPDATABLE_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt";
private static final int VULKAN_1_0 = 0x00400000; private static final int VULKAN_1_0 = 0x00400000;
private static final int VULKAN_1_1 = 0x00401000; private static final int VULKAN_1_1 = 0x00401000;
// GAME_DRIVER_ALL_APPS // UPDATABLE_DRIVER_ALL_APPS
// 0: Default (Invalid values fallback to default as well) // 0: Default (Invalid values fallback to default as well)
// 1: All apps use Game Driver // 1: All apps use updatable production driver
// 2: All apps use Prerelease Driver // 2: All apps use updatable prerelease driver
// 3: All apps use system graphics driver // 3: All apps use system graphics driver
private static final int GAME_DRIVER_GLOBAL_OPT_IN_DEFAULT = 0; private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_DEFAULT = 0;
private static final int GAME_DRIVER_GLOBAL_OPT_IN_GAME_DRIVER = 1; private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_PRODUCTION_DRIVER = 1;
private static final int GAME_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER = 2; private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER = 2;
private static final int GAME_DRIVER_GLOBAL_OPT_IN_OFF = 3; private static final int UPDATABLE_DRIVER_GLOBAL_OPT_IN_OFF = 3;
private ClassLoader mClassLoader; private ClassLoader mClassLoader;
private String mLibrarySearchPaths; private String mLibrarySearchPaths;
@@ -722,14 +723,17 @@ public class GraphicsEnvironment {
* Return the driver package name to use. Return null for system driver. * Return the driver package name to use. Return null for system driver.
*/ */
private static String chooseDriverInternal(Bundle coreSettings, ApplicationInfo ai) { private static String chooseDriverInternal(Bundle coreSettings, ApplicationInfo ai) {
final String gameDriver = SystemProperties.get(PROPERTY_GFX_DRIVER); final String productionDriver = SystemProperties.get(PROPERTY_GFX_DRIVER_PRODUCTION);
final boolean hasGameDriver = gameDriver != null && !gameDriver.isEmpty(); final boolean hasProductionDriver = productionDriver != null && !productionDriver.isEmpty();
final String prereleaseDriver = SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE); final String prereleaseDriver = SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
final boolean hasPrereleaseDriver = prereleaseDriver != null && !prereleaseDriver.isEmpty(); final boolean hasPrereleaseDriver = prereleaseDriver != null && !prereleaseDriver.isEmpty();
if (!hasGameDriver && !hasPrereleaseDriver) { if (!hasProductionDriver && !hasPrereleaseDriver) {
if (DEBUG) Log.v(TAG, "Neither Game Driver nor prerelease driver is supported."); if (DEBUG) {
Log.v(TAG,
"Neither updatable production driver nor prerelease driver is supported.");
}
return null; return null;
} }
@@ -745,56 +749,59 @@ public class GraphicsEnvironment {
(ai.metaData != null && ai.metaData.getBoolean(METADATA_DEVELOPER_DRIVER_ENABLE)) (ai.metaData != null && ai.metaData.getBoolean(METADATA_DEVELOPER_DRIVER_ENABLE))
|| isDebuggable(); || isDebuggable();
// Priority for Game Driver settings global on confliction (Higher priority comes first): // Priority of updatable driver settings on confliction (Higher priority comes first):
// 1. GAME_DRIVER_ALL_APPS // 1. UPDATABLE_DRIVER_ALL_APPS
// 2. GAME_DRIVER_OPT_OUT_APPS // 2. UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS
// 3. GAME_DRIVER_PRERELEASE_OPT_IN_APPS // 3. UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS
// 4. GAME_DRIVER_OPT_IN_APPS // 4. UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS
// 5. GAME_DRIVER_DENYLIST // 5. UPDATABLE_DRIVER_PRODUCTION_DENYLIST
// 6. GAME_DRIVER_ALLOWLIST // 6. UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST
switch (coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0)) { switch (coreSettings.getInt(Settings.Global.UPDATABLE_DRIVER_ALL_APPS, 0)) {
case GAME_DRIVER_GLOBAL_OPT_IN_OFF: case UPDATABLE_DRIVER_GLOBAL_OPT_IN_OFF:
if (DEBUG) Log.v(TAG, "Game Driver is turned off on this device."); if (DEBUG) Log.v(TAG, "updatable driver is turned off on this device.");
return null; return null;
case GAME_DRIVER_GLOBAL_OPT_IN_GAME_DRIVER: case UPDATABLE_DRIVER_GLOBAL_OPT_IN_PRODUCTION_DRIVER:
if (DEBUG) Log.v(TAG, "All apps opt in to use Game Driver."); if (DEBUG) Log.v(TAG, "All apps opt in to use updatable production driver.");
return hasGameDriver ? gameDriver : null; return hasProductionDriver ? productionDriver : null;
case GAME_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER: case UPDATABLE_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER:
if (DEBUG) Log.v(TAG, "All apps opt in to use prerelease driver."); if (DEBUG) Log.v(TAG, "All apps opt in to use updatable prerelease driver.");
return hasPrereleaseDriver && enablePrereleaseDriver ? prereleaseDriver : null; return hasPrereleaseDriver && enablePrereleaseDriver ? prereleaseDriver : null;
case GAME_DRIVER_GLOBAL_OPT_IN_DEFAULT: case UPDATABLE_DRIVER_GLOBAL_OPT_IN_DEFAULT:
default: default:
break; break;
} }
final String appPackageName = ai.packageName; final String appPackageName = ai.packageName;
if (getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_OPT_OUT_APPS) if (getGlobalSettingsString(null, coreSettings,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS)
.contains(appPackageName)) { .contains(appPackageName)) {
if (DEBUG) Log.v(TAG, "App opts out for Game Driver."); if (DEBUG) Log.v(TAG, "App opts out for updatable production driver.");
return null; return null;
} }
if (getGlobalSettingsString( if (getGlobalSettingsString(
null, coreSettings, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS) null, coreSettings, Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS)
.contains(appPackageName)) { .contains(appPackageName)) {
if (DEBUG) Log.v(TAG, "App opts in for prerelease Game Driver."); if (DEBUG) Log.v(TAG, "App opts in for updatable prerelease driver.");
return hasPrereleaseDriver && enablePrereleaseDriver ? prereleaseDriver : null; return hasPrereleaseDriver && enablePrereleaseDriver ? prereleaseDriver : null;
} }
// Early return here since the rest logic is only for Game Driver. // Early return here since the rest logic is only for updatable production Driver.
if (!hasGameDriver) { if (!hasProductionDriver) {
if (DEBUG) Log.v(TAG, "Game Driver is not supported on the device."); if (DEBUG) Log.v(TAG, "Updatable production driver is not supported on the device.");
return null; return null;
} }
final boolean isOptIn = final boolean isOptIn =
getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_OPT_IN_APPS) getGlobalSettingsString(null, coreSettings,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS)
.contains(appPackageName); .contains(appPackageName);
final List<String> allowlist = final List<String> allowlist =
getGlobalSettingsString(null, coreSettings, Settings.Global.GAME_DRIVER_ALLOWLIST); getGlobalSettingsString(null, coreSettings,
if (!isOptIn && allowlist.indexOf(GAME_DRIVER_ALLOWLIST_ALL) != 0 Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST);
if (!isOptIn && allowlist.indexOf(UPDATABLE_DRIVER_ALLOWLIST_ALL) != 0
&& !allowlist.contains(appPackageName)) { && !allowlist.contains(appPackageName)) {
if (DEBUG) Log.v(TAG, "App is not on the allowlist for Game Driver."); if (DEBUG) Log.v(TAG, "App is not on the allowlist for updatable production driver.");
return null; return null;
} }
@@ -802,13 +809,13 @@ public class GraphicsEnvironment {
// terminate early if it's on the denylist and fallback to system driver. // terminate early if it's on the denylist and fallback to system driver.
if (!isOptIn if (!isOptIn
&& getGlobalSettingsString( && getGlobalSettingsString(
null, coreSettings, Settings.Global.GAME_DRIVER_DENYLIST) null, coreSettings, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST)
.contains(appPackageName)) { .contains(appPackageName)) {
if (DEBUG) Log.v(TAG, "App is on the denylist for Game Driver."); if (DEBUG) Log.v(TAG, "App is on the denylist for updatable production driver.");
return null; return null;
} }
return gameDriver; return productionDriver;
} }
/** /**
@@ -873,7 +880,7 @@ public class GraphicsEnvironment {
final String driverBuildTime = driverAppInfo.metaData.getString(METADATA_DRIVER_BUILD_TIME); final String driverBuildTime = driverAppInfo.metaData.getString(METADATA_DRIVER_BUILD_TIME);
if (driverBuildTime == null || driverBuildTime.isEmpty()) { if (driverBuildTime == null || driverBuildTime.isEmpty()) {
throw new IllegalArgumentException("com.android.gamedriver.build_time is not set"); Log.v(TAG, "com.android.graphics.updatabledriver.build_time is not set");
} }
// driver_build_time in the meta-data is in "L<Unix epoch timestamp>" format. e.g. L123456. // driver_build_time in the meta-data is in "L<Unix epoch timestamp>" format. e.g. L123456.
// Long.parseLong will throw if the meta-data "driver_build_time" is not set properly. // Long.parseLong will throw if the meta-data "driver_build_time" is not set properly.
@@ -901,7 +908,7 @@ public class GraphicsEnvironment {
final Context driverContext = final Context driverContext =
context.createPackageContext(driverPackageName, Context.CONTEXT_RESTRICTED); context.createPackageContext(driverPackageName, Context.CONTEXT_RESTRICTED);
final BufferedReader reader = new BufferedReader(new InputStreamReader( final BufferedReader reader = new BufferedReader(new InputStreamReader(
driverContext.getAssets().open(GAME_DRIVER_SPHAL_LIBRARIES_FILENAME))); driverContext.getAssets().open(UPDATABLE_DRIVER_SPHAL_LIBRARIES_FILENAME)));
final ArrayList<String> assetStrings = new ArrayList<>(); final ArrayList<String> assetStrings = new ArrayList<>();
for (String assetString; (assetString = reader.readLine()) != null;) { for (String assetString; (assetString = reader.readLine()) != null;) {
assetStrings.add(assetString); assetStrings.add(assetString);
@@ -913,7 +920,7 @@ public class GraphicsEnvironment {
} }
} catch (IOException e) { } catch (IOException e) {
if (DEBUG) { if (DEBUG) {
Log.w(TAG, "Failed to load '" + GAME_DRIVER_SPHAL_LIBRARIES_FILENAME + "'"); Log.w(TAG, "Failed to load '" + UPDATABLE_DRIVER_SPHAL_LIBRARIES_FILENAME + "'");
} }
} }
return ""; return "";

View File

@@ -12280,63 +12280,71 @@ public final class Settings {
"show_angle_in_use_dialog_box"; "show_angle_in_use_dialog_box";
/** /**
* Game Driver global preference for all Apps. * Updatable driver global preference for all Apps.
* 0 = Default * 0 = Default
* 1 = All Apps use Game Driver * 1 = All Apps use updatable production driver
* 2 = All Apps use system graphics driver * 2 = All apps use updatable prerelease driver
* 3 = All Apps use system graphics driver
* @hide * @hide
*/ */
public static final String GAME_DRIVER_ALL_APPS = "game_driver_all_apps"; public static final String UPDATABLE_DRIVER_ALL_APPS = "updatable_driver_all_apps";
/** /**
* List of Apps selected to use Game Driver. * List of Apps selected to use updatable production driver.
* i.e. <pkg1>,<pkg2>,...,<pkgN> * i.e. <pkg1>,<pkg2>,...,<pkgN>
* @hide * @hide
*/ */
public static final String GAME_DRIVER_OPT_IN_APPS = "game_driver_opt_in_apps"; public static final String UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS =
"updatable_driver_production_opt_in_apps";
/** /**
* List of Apps selected to use prerelease Game Driver. * List of Apps selected to use updatable prerelease driver.
* i.e. <pkg1>,<pkg2>,...,<pkgN> * i.e. <pkg1>,<pkg2>,...,<pkgN>
* @hide * @hide
*/ */
public static final String GAME_DRIVER_PRERELEASE_OPT_IN_APPS = public static final String UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS =
"game_driver_prerelease_opt_in_apps"; "updatable_driver_prerelease_opt_in_apps";
/** /**
* List of Apps selected not to use Game Driver. * List of Apps selected not to use updatable production driver.
* i.e. <pkg1>,<pkg2>,...,<pkgN> * i.e. <pkg1>,<pkg2>,...,<pkgN>
* @hide * @hide
*/ */
public static final String GAME_DRIVER_OPT_OUT_APPS = "game_driver_opt_out_apps"; public static final String UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS =
"updatable_driver_production_opt_out_apps";
/** /**
* Apps on the denylist that are forbidden to use Game Driver. * Apps on the denylist that are forbidden to use updatable production driver.
* @hide * @hide
*/ */
public static final String GAME_DRIVER_DENYLIST = "game_driver_denylist"; public static final String UPDATABLE_DRIVER_PRODUCTION_DENYLIST =
"updatable_driver_production_denylist";
/** /**
* List of denylists, each denylist is a denylist for a specific version of Game Driver. * List of denylists, each denylist is a denylist for a specific version of
* updatable production driver.
* @hide * @hide
*/ */
public static final String GAME_DRIVER_DENYLISTS = "game_driver_denylists"; public static final String UPDATABLE_DRIVER_PRODUCTION_DENYLISTS =
"updatable_driver_production_denylists";
/** /**
* Apps on the allowlist that are allowed to use Game Driver. * Apps on the allowlist that are allowed to use updatable production driver.
* The string is a list of application package names, seperated by comma. * The string is a list of application package names, seperated by comma.
* i.e. <apk1>,<apk2>,...,<apkN> * i.e. <apk1>,<apk2>,...,<apkN>
* @hide * @hide
*/ */
public static final String GAME_DRIVER_ALLOWLIST = "game_driver_allowlist"; public static final String UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST =
"updatable_driver_production_allowlist";
/** /**
* List of libraries in sphal accessible by Game Driver * List of libraries in sphal accessible by updatable driver
* The string is a list of library names, separated by colon. * The string is a list of library names, separated by colon.
* i.e. <lib1>:<lib2>:...:<libN> * i.e. <lib1>:<lib2>:...:<libN>
* @hide * @hide
*/ */
public static final String GAME_DRIVER_SPHAL_LIBRARIES = "game_driver_sphal_libraries"; public static final String UPDATABLE_DRIVER_SPHAL_LIBRARIES =
"updatable_driver_sphal_libraries";
/** /**
* Ordered GPU debug layer list for Vulkan * Ordered GPU debug layer list for Vulkan

View File

@@ -2310,10 +2310,10 @@ enum PageId {
// OS: Q // OS: Q
ZEN_CUSTOM_SETTINGS_DIALOG = 1612; ZEN_CUSTOM_SETTINGS_DIALOG = 1612;
// OPEN: Settings > Developer Options > Game Driver Preferences // OPEN: Settings > Developer Options > Graphics Driver Preferences
// CATEGORY: SETTINGS // CATEGORY: SETTINGS
// OS: Q // OS: Q
SETTINGS_GAME_DRIVER_DASHBOARD = 1613; SETTINGS_GRAPHICS_DRIVER_DASHBOARD = 1613;
// OPEN: Settings > Accessibility > Vibration > Ring vibration // OPEN: Settings > Accessibility > Vibration > Ring vibration
// CATEGORY: SETTINGS // CATEGORY: SETTINGS

View File

@@ -433,35 +433,36 @@ message GlobalSettingsProto {
// Ordered GPU debug layer list for GLES // Ordered GPU debug layer list for GLES
// i.e. <layer1>:<layer2>:...:<layerN> // i.e. <layer1>:<layer2>:...:<layerN>
optional SettingProto debug_layers_gles = 7; optional SettingProto debug_layers_gles = 7;
// Game Driver - global preference for all Apps // Updatable Driver - global preference for all Apps
// 0 = Default // 0 = Default
// 1 = All Apps use Game Driver // 1 = All Apps use updatable production driver
// 2 = All Apps use system graphics driver // 2 = All apps use updatable prerelease driver
optional SettingProto game_driver_all_apps = 8; // 3 = All Apps use system graphics driver
// Game Driver - List of Apps selected to use Game Driver optional SettingProto updatable_driver_all_apps = 8;
// Updatable Driver - List of Apps selected to use updatable production driver
// i.e. <pkg1>,<pkg2>,...,<pkgN> // i.e. <pkg1>,<pkg2>,...,<pkgN>
optional SettingProto game_driver_opt_in_apps = 9; optional SettingProto updatable_driver_production_opt_in_apps = 9;
// Game Driver - List of Apps selected not to use Game Driver // Updatable Driver - List of Apps selected not to use updatable production driver
// i.e. <pkg1>,<pkg2>,...,<pkgN> // i.e. <pkg1>,<pkg2>,...,<pkgN>
optional SettingProto game_driver_opt_out_apps = 10; optional SettingProto updatable_driver_production_opt_out_apps = 10;
// Game Driver - List of Apps that are forbidden to use Game Driver // Updatable Driver - List of Apps that are forbidden to use updatable production driver
optional SettingProto game_driver_denylist = 11; optional SettingProto updatable_driver_production_denylist = 11;
// Game Driver - List of Apps that are allowed to use Game Driver // Updatable Driver - List of Apps that are allowed to use updatable production driver
optional SettingProto game_driver_allowlist = 12; optional SettingProto updatable_driver_production_allowlist = 12;
// ANGLE - List of Apps that can check ANGLE rules // ANGLE - List of Apps that can check ANGLE rules
optional SettingProto angle_allowlist = 13; optional SettingProto angle_allowlist = 13;
// Game Driver - List of denylists, each denylist is a denylist for // Updatable Driver - List of denylists, each denylist is a denylist for
// a specific Game Driver version // a specific updatable production driver version
optional SettingProto game_driver_denylists = 14; optional SettingProto updatable_driver_production_denylists = 14;
// ANGLE - Show a dialog box when ANGLE is selected for the currently running PKG // ANGLE - Show a dialog box when ANGLE is selected for the currently running PKG
optional SettingProto show_angle_in_use_dialog = 15; optional SettingProto show_angle_in_use_dialog = 15;
// Game Driver - List of libraries in sphal accessible by Game Driver // Updatable Driver - List of libraries in sphal accessible by updatable driver
optional SettingProto game_driver_sphal_libraries = 16; optional SettingProto updatable_driver_sphal_libraries = 16;
// ANGLE - External package containing ANGLE libraries // ANGLE - External package containing ANGLE libraries
optional SettingProto angle_debug_package = 17; optional SettingProto angle_debug_package = 17;
// Game Driver - List of Apps selected to use prerelease Game Driver // Updatable Driver - List of Apps selected to use updatable prerelease driver
// i.e. <pkg1>,<pkg2>,...,<pkgN> // i.e. <pkg1>,<pkg2>,...,<pkgN>
optional SettingProto game_driver_prerelease_opt_in_apps = 18; optional SettingProto updatable_driver_prerelease_opt_in_apps = 18;
} }
optional Gpu gpu = 59; optional Gpu gpu = 59;

View File

@@ -773,29 +773,29 @@ class SettingsProtoDumpUtil {
Settings.Global.GPU_DEBUG_LAYERS_GLES, Settings.Global.GPU_DEBUG_LAYERS_GLES,
GlobalSettingsProto.Gpu.DEBUG_LAYERS_GLES); GlobalSettingsProto.Gpu.DEBUG_LAYERS_GLES);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_ALL_APPS, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
GlobalSettingsProto.Gpu.GAME_DRIVER_ALL_APPS); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_ALL_APPS);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_OPT_IN_APPS, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS,
GlobalSettingsProto.Gpu.GAME_DRIVER_OPT_IN_APPS); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
GlobalSettingsProto.Gpu.GAME_DRIVER_PRERELEASE_OPT_IN_APPS); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_OPT_OUT_APPS, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS,
GlobalSettingsProto.Gpu.GAME_DRIVER_OPT_OUT_APPS); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_DENYLIST, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST,
GlobalSettingsProto.Gpu.GAME_DRIVER_DENYLIST); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_PRODUCTION_DENYLIST);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_ALLOWLIST, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST,
GlobalSettingsProto.Gpu.GAME_DRIVER_ALLOWLIST); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_DENYLISTS, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS,
GlobalSettingsProto.Gpu.GAME_DRIVER_DENYLISTS); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS);
dumpSetting(s, p, dumpSetting(s, p,
Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, Settings.Global.UPDATABLE_DRIVER_SPHAL_LIBRARIES,
GlobalSettingsProto.Gpu.GAME_DRIVER_SPHAL_LIBRARIES); GlobalSettingsProto.Gpu.UPDATABLE_DRIVER_SPHAL_LIBRARIES);
p.end(gpuToken); p.end(gpuToken);
final long hdmiToken = p.start(GlobalSettingsProto.HDMI); final long hdmiToken = p.start(GlobalSettingsProto.HDMI);

View File

@@ -503,14 +503,14 @@ public class SettingsBackupTest {
Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_PKGS, Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_PKGS,
Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_VALUES, Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_VALUES,
Settings.Global.GLOBAL_SETTINGS_ANGLE_ALLOWLIST, Settings.Global.GLOBAL_SETTINGS_ANGLE_ALLOWLIST,
Settings.Global.GAME_DRIVER_ALL_APPS, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
Settings.Global.GAME_DRIVER_OPT_IN_APPS, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS,
Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
Settings.Global.GAME_DRIVER_OPT_OUT_APPS, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS,
Settings.Global.GAME_DRIVER_DENYLISTS, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS,
Settings.Global.GAME_DRIVER_DENYLIST, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST,
Settings.Global.GAME_DRIVER_ALLOWLIST, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST,
Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, Settings.Global.UPDATABLE_DRIVER_SPHAL_LIBRARIES,
Settings.Global.GLOBAL_SETTINGS_SHOW_ANGLE_IN_USE_DIALOG_BOX, Settings.Global.GLOBAL_SETTINGS_SHOW_ANGLE_IN_USE_DIALOG_BOX,
Settings.Global.GPU_DEBUG_LAYER_APP, Settings.Global.GPU_DEBUG_LAYER_APP,
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,

View File

@@ -100,15 +100,20 @@ final class CoreSettingsObserver extends ContentObserver {
sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYERS, String.class); sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYERS, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYERS_GLES, String.class); sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYERS_GLES, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYER_APP, String.class); sGlobalSettingToTypeMap.put(Settings.Global.GPU_DEBUG_LAYER_APP, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_ALL_APPS, int.class); sGlobalSettingToTypeMap.put(Settings.Global.UPDATABLE_DRIVER_ALL_APPS, int.class);
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_OPT_IN_APPS, String.class);
sGlobalSettingToTypeMap.put( sGlobalSettingToTypeMap.put(
Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, String.class); Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_OPT_OUT_APPS, String.class); sGlobalSettingToTypeMap.put(
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_DENYLIST, String.class); Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_ALLOWLIST, String.class); sGlobalSettingToTypeMap.put(
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_DENYLISTS, String.class); Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, String.class); sGlobalSettingToTypeMap.put(
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST, String.class);
sGlobalSettingToTypeMap.put(
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST, String.class);
sGlobalSettingToTypeMap.put(
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS, String.class);
sGlobalSettingToTypeMap.put(Settings.Global.UPDATABLE_DRIVER_SPHAL_LIBRARIES, String.class);
// add other global settings here... // add other global settings here...
sDeviceConfigEntries.add(new DeviceConfigEntry<Boolean>( sDeviceConfigEntries.add(new DeviceConfigEntry<Boolean>(

View File

@@ -65,7 +65,7 @@ public class GpuService extends SystemService {
private static final String PROD_DRIVER_PROPERTY = "ro.gfx.driver.0"; private static final String PROD_DRIVER_PROPERTY = "ro.gfx.driver.0";
private static final String DEV_DRIVER_PROPERTY = "ro.gfx.driver.1"; private static final String DEV_DRIVER_PROPERTY = "ro.gfx.driver.1";
private static final String GAME_DRIVER_ALLOWLIST_FILENAME = "allowlist.txt"; private static final String UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST_FILENAME = "allowlist.txt";
private static final int BASE64_FLAGS = Base64.NO_PADDING | Base64.NO_WRAP; private static final int BASE64_FLAGS = Base64.NO_PADDING | Base64.NO_WRAP;
private final Context mContext; private final Context mContext;
@@ -77,7 +77,7 @@ public class GpuService extends SystemService {
private final boolean mHasProdDriver; private final boolean mHasProdDriver;
private final boolean mHasDevDriver; private final boolean mHasDevDriver;
private ContentResolver mContentResolver; private ContentResolver mContentResolver;
private long mGameDriverVersionCode; private long mProdDriverVersionCode;
private SettingsObserver mSettingsObserver; private SettingsObserver mSettingsObserver;
private DeviceConfigListener mDeviceConfigListener; private DeviceConfigListener mDeviceConfigListener;
@GuardedBy("mLock") @GuardedBy("mLock")
@@ -88,7 +88,7 @@ public class GpuService extends SystemService {
mContext = context; mContext = context;
mProdDriverPackageName = SystemProperties.get(PROD_DRIVER_PROPERTY); mProdDriverPackageName = SystemProperties.get(PROD_DRIVER_PROPERTY);
mGameDriverVersionCode = -1; mProdDriverVersionCode = -1;
mDevDriverPackageName = SystemProperties.get(DEV_DRIVER_PROPERTY); mDevDriverPackageName = SystemProperties.get(DEV_DRIVER_PROPERTY);
mPackageManager = context.getPackageManager(); mPackageManager = context.getPackageManager();
mHasProdDriver = !TextUtils.isEmpty(mProdDriverPackageName); mHasProdDriver = !TextUtils.isEmpty(mProdDriverPackageName);
@@ -117,20 +117,20 @@ public class GpuService extends SystemService {
} }
mSettingsObserver = new SettingsObserver(); mSettingsObserver = new SettingsObserver();
mDeviceConfigListener = new DeviceConfigListener(); mDeviceConfigListener = new DeviceConfigListener();
fetchGameDriverPackageProperties(); fetchProductionDriverPackageProperties();
processDenylists(); processDenylists();
setDenylist(); setDenylist();
fetchDeveloperDriverPackageProperties(); fetchPrereleaseDriverPackageProperties();
} }
} }
private final class SettingsObserver extends ContentObserver { private final class SettingsObserver extends ContentObserver {
private final Uri mGameDriverDenylistsUri = private final Uri mProdDriverDenylistsUri =
Settings.Global.getUriFor(Settings.Global.GAME_DRIVER_DENYLISTS); Settings.Global.getUriFor(Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS);
SettingsObserver() { SettingsObserver() {
super(new Handler()); super(new Handler());
mContentResolver.registerContentObserver(mGameDriverDenylistsUri, false, this, mContentResolver.registerContentObserver(mProdDriverDenylistsUri, false, this,
UserHandle.USER_ALL); UserHandle.USER_ALL);
} }
@@ -140,7 +140,7 @@ public class GpuService extends SystemService {
return; return;
} }
if (mGameDriverDenylistsUri.equals(uri)) { if (mProdDriverDenylistsUri.equals(uri)) {
processDenylists(); processDenylists();
setDenylist(); setDenylist();
} }
@@ -157,9 +157,11 @@ public class GpuService extends SystemService {
@Override @Override
public void onPropertiesChanged(Properties properties) { public void onPropertiesChanged(Properties properties) {
synchronized (mDeviceConfigLock) { synchronized (mDeviceConfigLock) {
if (properties.getKeyset().contains(Settings.Global.GAME_DRIVER_DENYLISTS)) { if (properties.getKeyset().contains(
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS)) {
parseDenylists( parseDenylists(
properties.getString(Settings.Global.GAME_DRIVER_DENYLISTS, "")); properties.getString(
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS, ""));
setDenylist(); setDenylist();
} }
} }
@@ -186,10 +188,10 @@ public class GpuService extends SystemService {
case ACTION_PACKAGE_CHANGED: case ACTION_PACKAGE_CHANGED:
case ACTION_PACKAGE_REMOVED: case ACTION_PACKAGE_REMOVED:
if (isProdDriver) { if (isProdDriver) {
fetchGameDriverPackageProperties(); fetchProductionDriverPackageProperties();
setDenylist(); setDenylist();
} else if (isDevDriver) { } else if (isDevDriver) {
fetchDeveloperDriverPackageProperties(); fetchPrereleaseDriverPackageProperties();
} }
break; break;
default: default:
@@ -218,7 +220,7 @@ public class GpuService extends SystemService {
} }
} }
private void fetchGameDriverPackageProperties() { private void fetchProductionDriverPackageProperties() {
final ApplicationInfo driverInfo; final ApplicationInfo driverInfo;
try { try {
driverInfo = mPackageManager.getApplicationInfo(mProdDriverPackageName, driverInfo = mPackageManager.getApplicationInfo(mProdDriverPackageName,
@@ -241,15 +243,16 @@ public class GpuService extends SystemService {
// Reset the allowlist. // Reset the allowlist.
Settings.Global.putString(mContentResolver, Settings.Global.putString(mContentResolver,
Settings.Global.GAME_DRIVER_ALLOWLIST, ""); Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST, "");
mGameDriverVersionCode = driverInfo.longVersionCode; mProdDriverVersionCode = driverInfo.longVersionCode;
try { try {
final Context driverContext = mContext.createPackageContext(mProdDriverPackageName, final Context driverContext = mContext.createPackageContext(mProdDriverPackageName,
Context.CONTEXT_RESTRICTED); Context.CONTEXT_RESTRICTED);
assetToSettingsGlobal(mContext, driverContext, GAME_DRIVER_ALLOWLIST_FILENAME, assetToSettingsGlobal(mContext, driverContext,
Settings.Global.GAME_DRIVER_ALLOWLIST, ","); UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST_FILENAME,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST, ",");
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
if (DEBUG) { if (DEBUG) {
Slog.w(TAG, "driver package '" + mProdDriverPackageName + "' not installed"); Slog.w(TAG, "driver package '" + mProdDriverPackageName + "' not installed");
@@ -259,11 +262,11 @@ public class GpuService extends SystemService {
private void processDenylists() { private void processDenylists() {
String base64String = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_GAME_DRIVER, String base64String = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_GAME_DRIVER,
Settings.Global.GAME_DRIVER_DENYLISTS); Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS);
if (base64String == null) { if (base64String == null) {
base64String = base64String =
Settings.Global.getString(mContentResolver, Settings.Global.getString(mContentResolver,
Settings.Global.GAME_DRIVER_DENYLISTS); Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS);
} }
parseDenylists(base64String != null ? base64String : ""); parseDenylists(base64String != null ? base64String : "");
} }
@@ -288,16 +291,16 @@ public class GpuService extends SystemService {
private void setDenylist() { private void setDenylist() {
Settings.Global.putString(mContentResolver, Settings.Global.putString(mContentResolver,
Settings.Global.GAME_DRIVER_DENYLIST, ""); Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST, "");
synchronized (mLock) { synchronized (mLock) {
if (mDenylists == null) { if (mDenylists == null) {
return; return;
} }
List<Denylist> denylists = mDenylists.getDenylistsList(); List<Denylist> denylists = mDenylists.getDenylistsList();
for (Denylist denylist : denylists) { for (Denylist denylist : denylists) {
if (denylist.getVersionCode() == mGameDriverVersionCode) { if (denylist.getVersionCode() == mProdDriverVersionCode) {
Settings.Global.putString(mContentResolver, Settings.Global.putString(mContentResolver,
Settings.Global.GAME_DRIVER_DENYLIST, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST,
String.join(",", denylist.getPackageNamesList())); String.join(",", denylist.getPackageNamesList()));
return; return;
} }
@@ -305,7 +308,7 @@ public class GpuService extends SystemService {
} }
} }
private void fetchDeveloperDriverPackageProperties() { private void fetchPrereleaseDriverPackageProperties() {
final ApplicationInfo driverInfo; final ApplicationInfo driverInfo;
try { try {
driverInfo = mPackageManager.getApplicationInfo(mDevDriverPackageName, driverInfo = mPackageManager.getApplicationInfo(mDevDriverPackageName,