OSDN Git Service

Revert behavior of Lockscreen Activity Launch to KK
authorAdam Lesinski <adamlesinski@google.com>
Mon, 22 Sep 2014 23:04:32 +0000 (16:04 -0700)
committerAdam Lesinski <adamlesinski@google.com>
Mon, 22 Sep 2014 23:04:32 +0000 (16:04 -0700)
There exists a lifecycle regression where launching an
app from the lockscreen (camera, etc.) causes a series
of onResume, onPause, onRestart, onStart, onResume.

This CL reverts the behavior to what it was in KK, which
is to say that the Launcher is first resumed/paused, then
the Activity being launched has a simple onRestart,onStart, onResume
lifecycle.

Bug:17459745
Change-Id: I04091d2f86a929ee972c8d6debc1beb033c135a8

services/core/java/com/android/server/am/ActivityManagerService.java

index 9228fc6..351bc4a 100755 (executable)
@@ -937,13 +937,6 @@ public final class ActivityManagerService extends ActivityManagerNative
     private boolean mRunningVoice = false;
 
     /**
-     * Set while the keyguard is waiting for an activity to draw.
-     * In this state, if we are sleeping, we allow Activities to launch
-     * so that they can draw before Keyguard dismisses itself.
-     */
-    private boolean mKeyguardWaitingForDraw = false;
-
-    /**
      * State of external calls telling us if the device is asleep.
      */
     private boolean mWentToSleep = false;
@@ -6249,7 +6242,10 @@ public final class ActivityManagerService extends ActivityManagerNative
             synchronized (this) {
                 if (DEBUG_LOCKSCREEN) logLockScreen("");
                 mWindowManager.keyguardWaitingForActivityDrawn();
-                mKeyguardWaitingForDraw = true;
+                if (mLockScreenShown) {
+                    mLockScreenShown = false;
+                    comeOutOfSleepIfNeededLocked();
+                }
             }
         } finally {
             Binder.restoreCallingIdentity(token);
@@ -9952,7 +9948,7 @@ public final class ActivityManagerService extends ActivityManagerNative
     }
 
     public boolean isSleeping() {
-        return mSleeping && !mKeyguardWaitingForDraw;
+        return mSleeping;
     }
 
     void goingToSleep() {
@@ -9973,7 +9969,6 @@ public final class ActivityManagerService extends ActivityManagerNative
         if (mWentToSleep && !mRunningVoice) {
             if (!mSleeping) {
                 mSleeping = true;
-                mKeyguardWaitingForDraw = false;
                 mStackSupervisor.goingToSleepLocked();
 
                 // Initialize the wake times of all processes.
@@ -10082,7 +10077,6 @@ public final class ActivityManagerService extends ActivityManagerNative
             try {
                 if (DEBUG_LOCKSCREEN) logLockScreen(" shown=" + shown);
                 mLockScreenShown = shown;
-                mKeyguardWaitingForDraw = false;
                 comeOutOfSleepIfNeededLocked();
             } finally {
                 Binder.restoreCallingIdentity(ident);