Merge "Game Driver: rename GUP to Game Driver"
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ea5775448
@@ -63,7 +63,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 ANGLE_RULES_FILE = "a4a_rules.json";
|
||||
private static final String ANGLE_TEMP_RULES = "debug.angle.rules";
|
||||
private static final String ACTION_ANGLE_FOR_ANDROID = "android.app.action.ANGLE_FOR_ANDROID";
|
||||
@@ -529,44 +529,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));
|
||||
@@ -652,7 +653,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)) {
|
||||
|
||||
@@ -12241,33 +12241,33 @@ public final class Settings {
|
||||
"angle_whitelist";
|
||||
|
||||
/**
|
||||
* 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. <pkg1>,<pkg2>,...,<pkgN>
|
||||
* @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. <pkg1>,<pkg2>,...,<pkgN>
|
||||
* @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.
|
||||
|
||||
Reference in New Issue
Block a user