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
This commit is contained in:
Tim Van Patten
2019-04-08 17:30:17 -06:00
parent d135418cbc
commit 5da6a95eab

View File

@@ -344,14 +344,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 "";
}