Set non-starting visible resumed activity as resumed activity for the stack
When ensuring visible activities for a stack we check to see if there is
already a resumed activity on the stack, so if we need to start an
activity that needs to be visible, we start it in the paused state
if there is already a resumed activity in the stack. This was't
taking into account a non-starting, visible, and resumed activity.
One case this can happen is if the currently resumed activity in
the stack becomes translucent and the activity behind it needs to
be started because it was previously destroyed due to low memory.
Bug: 19636839
Change-Id: I31670fd64d3bcbbf41823f51518ca603c7412e92
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 33f915f..62d70d2 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1331,6 +1331,9 @@
}
} catch(RemoteException e) {
}
+ if (r.state == ActivityState.RESUMED) {
+ noStackActivityResumed = false;
+ }
} else {
// This activity is not currently visible, but is running.
// Tell it to become visible.
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index c5bdbb0..d7542ee 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2345,7 +2345,6 @@
boolean reportNewConfig = false;
WindowState attachedWindow = null;
- WindowState win = null;
long origId;
final int type = attrs.type;
@@ -2482,7 +2481,7 @@
addToken = true;
}
- win = new WindowState(this, session, client, token,
+ WindowState win = new WindowState(this, session, client, token,
attachedWindow, appOp[0], seq, attrs, viewVisibility, displayContent);
if (win.mDeathRecipient == null) {
// Client has apparently died, so there is no reason to
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index ec70879..c50974c 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1709,7 +1709,7 @@
pw.println(mWallpaperDisplayOffsetY);
}
if (mDrawLock != null) {
- pw.println("mDrawLock=" + mDrawLock);
+ pw.print(prefix); pw.println("mDrawLock=" + mDrawLock);
}
}