OSDN Git Service

[Game Driver] Add global whitelist option.
authorPeiyong Lin <lpy@google.com>
Wed, 13 Feb 2019 22:46:54 +0000 (14:46 -0800)
committerYiwei Zhang <zzyiwei@google.com>
Fri, 19 Apr 2019 17:49:03 +0000 (10:49 -0700)
Allow a '*' at the beginning of the whitelist file to mean whitelist
everything.

BUG: 120869311
Test: Build, flash and boot. Verify with apk
Change-Id: Ia1b772f545a04acb7f5b4ccbe5489e43ecddb9d2
Merged-In: Ia1b772f545a04acb7f5b4ccbe5489e43ecddb9d2

core/java/android/os/GraphicsEnvironment.java

index da911df..ab4d32c 100644 (file)
@@ -49,6 +49,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 GAME_DRIVER_WHITELIST_ALL = "*";
 
     private ClassLoader mClassLoader;
     private String mLayerPath;
@@ -208,9 +209,10 @@ public class GraphicsEnvironment {
             final boolean isOptIn =
                     getGlobalSettingsString(coreSettings, Settings.Global.GAME_DRIVER_OPT_IN_APPS)
                             .contains(ai.packageName);
-            if (!isOptIn
-                    && !getGlobalSettingsString(coreSettings, Settings.Global.GAME_DRIVER_WHITELIST)
-                        .contains(ai.packageName)) {
+            final List<String> whitelist = getGlobalSettingsString(coreSettings,
+                    Settings.Global.GAME_DRIVER_WHITELIST);
+            if (!isOptIn && whitelist.indexOf(GAME_DRIVER_WHITELIST_ALL) != 0
+                    && !whitelist.contains(ai.packageName)) {
                 if (DEBUG) {
                     Log.w(TAG, ai.packageName + " is not on the whitelist.");
                 }