Verify Bundle is not null before using it

It's possible the Bundle has not been initialized when determining if
the ANGLE dialog box should be shown, due to how early that check is
performed. This change will verify the Bundle is not null before using
it and fall back to using the Context if it is.

Bug: 130185493
Test: atest CtsAngleIntegrationHostTestCases
Test: Enable Toast Message and then atest CtsAngleIntegrationHostTestCases
Change-Id: I39f48bdf20616298c66b2bb36082149cb24e908c
(cherry picked from commit 5da6a95eab)
This commit is contained in:
Tim Van Patten
2019-04-08 17:30:17 -06:00
committed by Cody Northrop
parent 7abea9fa92
commit 5973ec9678

View File

@@ -453,14 +453,22 @@ public class GraphicsEnvironment {
final boolean appIsProfileable = isProfileable(context);
final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
if (appIsDebuggable || appIsProfileable || deviceIsDebuggable) {
String debugPackage;
String debugPackage =
coreSettings.getString(Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE);
if (coreSettings != null) {
debugPackage =
coreSettings.getString(Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE);
} else {
ContentResolver contentResolver = context.getContentResolver();
debugPackage = Settings.Global.getString(contentResolver,
Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE);
}
if ((debugPackage != null) && (!debugPackage.isEmpty())) {
return debugPackage;
}
}
return "";
}