Merge "[GUP] Hard code the name of the whitelist file."

This commit is contained in:
TreeHugger Robot
2019-01-03 03:24:18 +00:00
committed by Android (Google) Code Review

View File

@@ -58,7 +58,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 PROPERTY_GFX_DRIVER_WHITELIST = "ro.gfx.driver.whitelist.0";
private static final String GUP_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";
@@ -567,22 +567,11 @@ public class GraphicsEnvironment {
private static boolean onWhitelist(Context context, String driverPackageName,
String applicationPackageName) {
String whitelistName = SystemProperties.get(PROPERTY_GFX_DRIVER_WHITELIST);
// Empty whitelist implies no updatable graphics driver. Typically, the pre-installed
// updatable graphics driver is supposed to be a place holder and contains no graphics
// driver and whitelist.
if (whitelistName == null || whitelistName.isEmpty()) {
if (DEBUG) {
Log.w(TAG, "No whitelist found.");
}
return false;
}
try {
Context driverContext = context.createPackageContext(driverPackageName,
Context.CONTEXT_RESTRICTED);
AssetManager assets = driverContext.getAssets();
InputStream stream = assets.open(whitelistName);
InputStream stream = assets.open(GUP_WHITELIST_FILENAME);
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
for (String packageName; (packageName = reader.readLine()) != null; ) {
if (packageName.equals(applicationPackageName)) {