From: John Reck Date: Wed, 7 Mar 2018 19:06:41 +0000 (-0800) Subject: Fix NPE if app context is null X-Git-Tag: android-x86-9.0-r1~185^2~13^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f1b961033f611ce41132367e0dbf0da100e8fbb5;p=android-x86%2Fframeworks-base.git Fix NPE if app context is null Change-Id: Ic21ae50e5421a8c711e133ffe2ff218160382297 Fixes: 74260094 Test: builds, boots, and graphicsstats still works --- diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java index e996ea160126..8d076f75ddbb 100644 --- a/core/java/android/view/ThreadedRenderer.java +++ b/core/java/android/view/ThreadedRenderer.java @@ -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) {