OSDN Git Service

Do not process set WindowAnimator param when screen is already on.
authorBryce Lee <brycelee@google.com>
Wed, 6 Sep 2017 21:55:48 +0000 (14:55 -0700)
committerBryce Lee <brycelee@google.com>
Fri, 8 Sep 2017 14:24:01 +0000 (07:24 -0700)
Doing so can lead to the param be processed during onPause,
potentially causing the device erroneously waking up.

Change-Id: Id0f0bc74873e6e41bd2b10dc423a435ca050947f
Fixes: 65412431
Bug: 65385210
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerActivityVisibilityTests#testTurnScreenOnActivity_withRelayout

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

index dd887e0..64ac7ac 100644 (file)
@@ -1657,7 +1657,14 @@ class WindowStateAnimator {
                     if (mWin.mAppToken != null) {
                         mWin.mAppToken.setCanTurnScreenOn(false);
                     }
-                    mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN;
+
+                    // We do not add {@code SET_TURN_ON_SCREEN} when the screen is already
+                    // interactive as the value may persist until the next animation, which could
+                    // potentially occurring while turning off the screen. This would lead to the
+                    // screen incorrectly turning back on.
+                    if (!mService.mPowerManager.isInteractive()) {
+                        mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN;
+                    }
                 }
             }
             if (hasSurface()) {