Merge "ANGLE: Reorder debug package check" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-05-08 19:46:13 +00:00
committed by Android (Google) Code Review

View File

@@ -618,28 +618,36 @@ public class GraphicsEnvironment {
return false; return false;
} }
final String anglePkgName = getAnglePackageName(pm); ApplicationInfo angleInfo = null;
if (anglePkgName.isEmpty()) {
Log.e(TAG, "Failed to find ANGLE package.");
return false;
}
final ApplicationInfo angleInfo; // If the developer has specified a debug package over ADB, attempt to find it
String angleDebugPackage = getAngleDebugPackage(context, bundle); String anglePkgName = getAngleDebugPackage(context, bundle);
if (!angleDebugPackage.isEmpty()) { if (!anglePkgName.isEmpty()) {
Log.i(TAG, "ANGLE debug package enabled: " + angleDebugPackage); Log.i(TAG, "ANGLE debug package enabled: " + anglePkgName);
try { try {
// Note the debug package does not have to be pre-installed // Note the debug package does not have to be pre-installed
angleInfo = pm.getApplicationInfo(angleDebugPackage, 0); angleInfo = pm.getApplicationInfo(anglePkgName, 0);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "ANGLE debug package '" + angleDebugPackage + "' not installed"); Log.w(TAG, "ANGLE debug package '" + anglePkgName + "' not installed");
return false; return false;
} }
} else { }
try {
angleInfo = pm.getApplicationInfo(anglePkgName, PackageManager.MATCH_SYSTEM_ONLY); // Otherwise, check to see if ANGLE is properly installed
} catch (PackageManager.NameNotFoundException e) { if (angleInfo == null) {
Log.w(TAG, "ANGLE package '" + anglePkgName + "' not installed"); anglePkgName = getAnglePackageName(pm);
if (!anglePkgName.isEmpty()) {
Log.i(TAG, "ANGLE package enabled: " + anglePkgName);
try {
// Production ANGLE libraries must be pre-installed as a system app
angleInfo = pm.getApplicationInfo(anglePkgName,
PackageManager.MATCH_SYSTEM_ONLY);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "ANGLE package '" + anglePkgName + "' not installed");
return false;
}
} else {
Log.e(TAG, "Failed to find ANGLE package.");
return false; return false;
} }
} }
@@ -700,7 +708,7 @@ public class GraphicsEnvironment {
private boolean setupAndUseAngle(Context context, String packageName) { private boolean setupAndUseAngle(Context context, String packageName) {
// Need to make sure we are evaluating ANGLE usage for the correct circumstances // Need to make sure we are evaluating ANGLE usage for the correct circumstances
if (!setupAngle(context, null, context.getPackageManager(), packageName)) { if (!setupAngle(context, null, context.getPackageManager(), packageName)) {
Log.v(TAG, "Package '" + packageName + "' should use not ANGLE"); Log.v(TAG, "Package '" + packageName + "' should not use ANGLE");
return false; return false;
} }