Fix issue #6373340: Cannot unlock to app if app was the...

...foreground app when the device was put to sleep

This is because of activities being kept in the stopped state
while the lock screen is shown, so we never get to the point of
it becoming visible again to know to proceed.

Just at this point consider the lock screen hidden so the
activity can be resumed and run as normal; the whole point of
this is to soon hide the lock screen, anyway.

Change-Id: I3a713a2f87b8e4412ff66724c051f09a2675be00
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 8f69d2f..529537c 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4116,6 +4116,10 @@
     public void dismissKeyguardOnNextActivity() {
         enforceNotIsolatedCaller("dismissKeyguardOnNextActivity");
         synchronized (this) {
+            if (mLockScreenShown) {
+                mLockScreenShown = false;
+                comeOutOfSleepIfNeededLocked();
+            }
             mMainStack.dismissKeyguardOnNextActivityLocked();
         }
     }