OSDN Git Service

Fix NPE if app context is null
authorJohn Reck <jreck@google.com>
Wed, 7 Mar 2018 19:06:41 +0000 (11:06 -0800)
committerJohn Reck <jreck@google.com>
Wed, 7 Mar 2018 19:08:39 +0000 (11:08 -0800)
Change-Id: Ic21ae50e5421a8c711e133ffe2ff218160382297
Fixes: 74260094
Test: builds, boots, and graphicsstats still works

core/java/android/view/ThreadedRenderer.java

index e996ea1..8d076f7 100644 (file)
@@ -1068,11 +1068,15 @@ public final class ThreadedRenderer {
             mInitialized = true;
             mAppContext = context.getApplicationContext();
 
-            nSetDebuggingEnabled(
-                    (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
-                    || Build.IS_DEBUGGABLE);
             initSched(renderProxy);
-            initGraphicsStats();
+
+            if (mAppContext != null) {
+                final boolean appDebuggable =
+                        (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)
+                        != 0;
+                nSetDebuggingEnabled(appDebuggable || Build.IS_DEBUGGABLE);
+                initGraphicsStats();
+            }
         }
 
         private void initSched(long renderProxy) {