OSDN Git Service

Check for null appToken
authorchaviw <chaviw@google.com>
Wed, 23 Aug 2017 19:29:02 +0000 (12:29 -0700)
committerchaviw <chaviw@google.com>
Thu, 24 Aug 2017 21:19:39 +0000 (14:19 -0700)
AppWindowToken can be null for non-app windows.

Test: Existing tests pass
Fixes: 65018183

Change-Id: I81c7e4e2bec40c588771cc46e4a8061c7112765a

services/core/java/com/android/server/wm/WindowStateAnimator.java

index 053ee97..dd887e0 100644 (file)
@@ -1646,14 +1646,17 @@ class WindowStateAnimator {
                 // hidden while the screen is turning off.
                 // TODO(b/63773439): These cases should be eliminated, though we probably still
                 // want to process mTurnOnScreen in this way for clarity.
-                if (mWin.mTurnOnScreen && mWin.mAppToken.canTurnScreenOn()) {
+                if (mWin.mTurnOnScreen &&
+                        (mWin.mAppToken == null || mWin.mAppToken.canTurnScreenOn())) {
                     if (DEBUG_VISIBILITY) Slog.v(TAG, "Show surface turning screen on: " + mWin);
                     mWin.mTurnOnScreen = false;
 
                     // The window should only turn the screen on once per resume, but
                     // prepareSurfaceLocked can be called multiple times. Set canTurnScreenOn to
                     // false so the window doesn't turn the screen on again during this resume.
-                    mWin.mAppToken.setCanTurnScreenOn(false);
+                    if (mWin.mAppToken != null) {
+                        mWin.mAppToken.setCanTurnScreenOn(false);
+                    }
                     mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN;
                 }
             }