From c4db14e72dd7d661254815a43ff27794073534fd Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 24 Jan 2019 14:45:53 -0800 Subject: [PATCH] Game Driver: rename GUP to Game Driver Bug: 119221883 Test: Build, flash, boot and make RunSettingsRoboTests Change-Id: I39724917b516b4871c6b1b1f0d30aa0f793942a4 Merged-In: I39724917b516b4871c6b1b1f0d30aa0f793942a4 --- core/java/android/os/GraphicsEnvironment.java | 33 +++++++++++----------- core/java/android/provider/Settings.java | 18 ++++++------ core/proto/android/providers/settings/global.proto | 20 ++++++------- .../src/android/provider/SettingsBackupTest.java | 8 +++--- .../providers/settings/SettingsProtoDumpUtil.java | 16 +++++------ proto/src/metrics_constants.proto | 4 +-- .../android/server/am/CoreSettingsObserver.java | 9 +++--- 7 files changed, 55 insertions(+), 53 deletions(-) diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java index 802aca00b38b..d46cf3cb974a 100644 --- a/core/java/android/os/GraphicsEnvironment.java +++ b/core/java/android/os/GraphicsEnvironment.java @@ -57,7 +57,7 @@ public class GraphicsEnvironment { private static final boolean DEBUG = false; private static final String TAG = "GraphicsEnvironment"; private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0"; - private static final String GUP_WHITELIST_FILENAME = "whitelist.txt"; + private static final String GAME_DRIVER_WHITELIST_FILENAME = "whitelist.txt"; private static final String GAME_DRIVER_BLACKLIST_FLAG = "blacklist"; private static final int BASE64_FLAGS = Base64.NO_PADDING | Base64.NO_WRAP; @@ -195,44 +195,45 @@ public class GraphicsEnvironment { return; } - // GUP_DEV_ALL_APPS + // GAME_DRIVER_ALL_APPS // 0: Default (Invalid values fallback to default as well) // 1: All apps use Game Driver // 2: All apps use system graphics driver - int gupDevAllApps = coreSettings.getInt(Settings.Global.GUP_DEV_ALL_APPS, 0); - if (gupDevAllApps == 2) { + int gameDriverAllApps = coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0); + if (gameDriverAllApps == 2) { if (DEBUG) { - Log.w(TAG, "GUP is turned off on this device"); + Log.w(TAG, "Game Driver is turned off on this device"); } return; } - if (gupDevAllApps != 1) { - // GUP_DEV_OPT_OUT_APPS has higher priority than GUP_DEV_OPT_IN_APPS - if (getGlobalSettingsString(coreSettings, Settings.Global.GUP_DEV_OPT_OUT_APPS) + if (gameDriverAllApps != 1) { + // GAME_DRIVER_OPT_OUT_APPS has higher priority than GAME_DRIVER_OPT_IN_APPS + if (getGlobalSettingsString(coreSettings, Settings.Global.GAME_DRIVER_OPT_OUT_APPS) .contains(ai.packageName)) { if (DEBUG) { - Log.w(TAG, ai.packageName + " opts out from GUP."); + Log.w(TAG, ai.packageName + " opts out from Game Driver."); } return; } - boolean isDevOptIn = getGlobalSettingsString(coreSettings, - Settings.Global.GUP_DEV_OPT_IN_APPS) - .contains(ai.packageName); + boolean isOptIn = + getGlobalSettingsString(coreSettings, Settings.Global.GAME_DRIVER_OPT_IN_APPS) + .contains(ai.packageName); - if (!isDevOptIn && !onWhitelist(context, driverPackageName, ai.packageName)) { + if (!isOptIn && !onWhitelist(context, driverPackageName, ai.packageName)) { if (DEBUG) { Log.w(TAG, ai.packageName + " is not on the whitelist."); } return; } - if (!isDevOptIn) { + if (!isOptIn) { // At this point, the application is on the whitelist only, check whether it's // on the blacklist, terminate early when it's on the blacklist. try { // TODO(b/121350991) Switch to DeviceConfig with property listener. - String base64String = coreSettings.getString(Settings.Global.GUP_BLACKLIST); + String base64String = + coreSettings.getString(Settings.Global.GAME_DRIVER_BLACKLIST); if (base64String != null && !base64String.isEmpty()) { Blacklists blacklistsProto = Blacklists.parseFrom( Base64.decode(base64String, BASE64_FLAGS)); @@ -318,7 +319,7 @@ public class GraphicsEnvironment { Context driverContext = context.createPackageContext(driverPackageName, Context.CONTEXT_RESTRICTED); AssetManager assets = driverContext.getAssets(); - InputStream stream = assets.open(GUP_WHITELIST_FILENAME); + InputStream stream = assets.open(GAME_DRIVER_WHITELIST_FILENAME); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); for (String packageName; (packageName = reader.readLine()) != null; ) { if (packageName.equals(applicationPackageName)) { diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index e8ae85e038d6..a0e4d0dcb90e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -11446,33 +11446,33 @@ public final class Settings { public static final String GPU_DEBUG_APP = "gpu_debug_app"; /** - * Game Update Package global preference for all Apps. + * Game Driver global preference for all Apps. * 0 = Default - * 1 = All Apps use Game Update Package + * 1 = All Apps use Game Driver * 2 = All Apps use system graphics driver * @hide */ - public static final String GUP_DEV_ALL_APPS = "gup_dev_all_apps"; + public static final String GAME_DRIVER_ALL_APPS = "game_driver_all_apps"; /** - * List of Apps selected to use Game Update Package. + * List of Apps selected to use Game Driver. * i.e. ,,..., * @hide */ - public static final String GUP_DEV_OPT_IN_APPS = "gup_dev_opt_in_apps"; + public static final String GAME_DRIVER_OPT_IN_APPS = "game_driver_opt_in_apps"; /** - * List of Apps selected not to use Game Update Package. + * List of Apps selected not to use Game Driver. * i.e. ,,..., * @hide */ - public static final String GUP_DEV_OPT_OUT_APPS = "gup_dev_opt_out_apps"; + public static final String GAME_DRIVER_OPT_OUT_APPS = "game_driver_opt_out_apps"; /** - * Apps on the blacklist that are forbidden to use Game Update Package. + * Apps on the blacklist that are forbidden to use Game Driver. * @hide */ - public static final String GUP_BLACKLIST = "gup_blacklist"; + public static final String GAME_DRIVER_BLACKLIST = "game_driver_blacklist"; /** * Apps on the whitelist that are allowed to use Game Driver. diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto index ac2b36e957da..5aa3992d73f0 100644 --- a/core/proto/android/providers/settings/global.proto +++ b/core/proto/android/providers/settings/global.proto @@ -384,20 +384,20 @@ message GlobalSettingsProto { // App allowed to load GPU debug layers. optional SettingProto debug_app = 1; optional SettingProto debug_layers = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; - // GUP - Game Update Package global preference for all Apps + // Game Driver - global preference for all Apps // 0 = Default - // 1 = All Apps use Game Update Package + // 1 = All Apps use Game Driver // 2 = All Apps use system graphics driver - optional SettingProto gup_dev_all_apps = 8; - // GUP - List of Apps selected to use Game Update Package + optional SettingProto game_driver_all_apps = 8; + // Game Driver - List of Apps selected to use Game Driver // i.e. ,,..., - optional SettingProto gup_dev_opt_in_apps = 9; - // GUP - List of Apps selected not to use Game Update Package + optional SettingProto game_driver_opt_in_apps = 9; + // Game Driver - List of Apps selected not to use Game Driver // i.e. ,,..., - optional SettingProto gup_dev_opt_out_apps = 10; - // GUP - List of Apps that are forbidden to use Game Update Package - optional SettingProto gup_blacklist = 11; - // List of Apps that are allowed to use Game Driver package. + optional SettingProto game_driver_opt_out_apps = 10; + // Game Driver - List of Apps that are forbidden to use Game Driver + optional SettingProto game_driver_blacklist = 11; + // Game Driver - List of Apps that are allowed to use Game Driver optional SettingProto game_driver_whitelist = 12; } optional Gpu gpu = 59; diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index 612b92305f55..c1664087fb31 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -444,10 +444,10 @@ public class SettingsBackupTest { Settings.Global.ENABLE_GPU_DEBUG_LAYERS, Settings.Global.GPU_DEBUG_APP, Settings.Global.GPU_DEBUG_LAYERS, - Settings.Global.GUP_DEV_ALL_APPS, - Settings.Global.GUP_DEV_OPT_IN_APPS, - Settings.Global.GUP_DEV_OPT_OUT_APPS, - Settings.Global.GUP_BLACKLIST, + Settings.Global.GAME_DRIVER_ALL_APPS, + Settings.Global.GAME_DRIVER_OPT_IN_APPS, + Settings.Global.GAME_DRIVER_OPT_OUT_APPS, + Settings.Global.GAME_DRIVER_BLACKLIST, Settings.Global.GAME_DRIVER_WHITELIST, Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT, diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index dcfc3e52c7fc..43c1a267468e 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -648,17 +648,17 @@ class SettingsProtoDumpUtil { Settings.Global.GPU_DEBUG_LAYERS, GlobalSettingsProto.Gpu.DEBUG_LAYERS); dumpSetting(s, p, - Settings.Global.GUP_DEV_ALL_APPS, - GlobalSettingsProto.Gpu.GUP_DEV_ALL_APPS); + Settings.Global.GAME_DRIVER_ALL_APPS, + GlobalSettingsProto.Gpu.GAME_DRIVER_ALL_APPS); dumpSetting(s, p, - Settings.Global.GUP_DEV_OPT_IN_APPS, - GlobalSettingsProto.Gpu.GUP_DEV_OPT_IN_APPS); + Settings.Global.GAME_DRIVER_OPT_IN_APPS, + GlobalSettingsProto.Gpu.GAME_DRIVER_OPT_IN_APPS); dumpSetting(s, p, - Settings.Global.GUP_DEV_OPT_OUT_APPS, - GlobalSettingsProto.Gpu.GUP_DEV_OPT_OUT_APPS); + Settings.Global.GAME_DRIVER_OPT_OUT_APPS, + GlobalSettingsProto.Gpu.GAME_DRIVER_OPT_OUT_APPS); dumpSetting(s, p, - Settings.Global.GUP_BLACKLIST, - GlobalSettingsProto.Gpu.GUP_BLACKLIST); + Settings.Global.GAME_DRIVER_BLACKLIST, + GlobalSettingsProto.Gpu.GAME_DRIVER_BLACKLIST); dumpSetting(s, p, Settings.Global.GAME_DRIVER_WHITELIST, GlobalSettingsProto.Gpu.GAME_DRIVER_WHITELIST); diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index a589426fd81b..6902a706e91f 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -6492,10 +6492,10 @@ message MetricsEvent { // OS: Q ACTION_EMERGENCY_DIALER_FROM_POWER_MENU = 1569; - // OPEN: Settings > Developer Options > Game Update Packages + // OPEN: Settings > Developer Options > Game Driver Preference // CATEGORY: SETTINGS // OS: Q - SETTINGS_GUP_DASHBOARD = 1613; + SETTINGS_GAME_DRIVER_DASHBOARD = 1613; // ---- End Q Constants, all Q constants go above this line ---- diff --git a/services/core/java/com/android/server/am/CoreSettingsObserver.java b/services/core/java/com/android/server/am/CoreSettingsObserver.java index 4172c9534dbe..75da9b54c662 100644 --- a/services/core/java/com/android/server/am/CoreSettingsObserver.java +++ b/services/core/java/com/android/server/am/CoreSettingsObserver.java @@ -55,10 +55,11 @@ final class CoreSettingsObserver extends ContentObserver { // add other system settings here... sGlobalSettingToTypeMap.put(Settings.Global.DEBUG_VIEW_ATTRIBUTES, int.class); - sGlobalSettingToTypeMap.put(Settings.Global.GUP_DEV_ALL_APPS, int.class); - sGlobalSettingToTypeMap.put(Settings.Global.GUP_DEV_OPT_IN_APPS, String.class); - sGlobalSettingToTypeMap.put(Settings.Global.GUP_DEV_OPT_OUT_APPS, String.class); - sGlobalSettingToTypeMap.put(Settings.Global.GUP_BLACKLIST, String.class); + sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_ALL_APPS, int.class); + sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_OPT_IN_APPS, String.class); + sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_OPT_OUT_APPS, String.class); + sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_BLACKLIST, String.class); + sGlobalSettingToTypeMap.put(Settings.Global.GAME_DRIVER_WHITELIST, String.class); // add other global settings here... } -- 2.11.0