Allow to preload home if it was died on top while locked
RWC#attachApplication no longer starts sleeping non-occluded
activities, because there is no explicit request.
E.g. while device is locked, the process of top activity is
died. And then a service started in the same process.
Now the behavior is consistent that only explicit activity request
can make the activity start rather than from random component. So
the specified case should handle by itself. Such as preloading home,
which should check whether the activity has attached to the process.
Bug: 335396307
Test: Turn off screen. Kill home process.
Home activity should be restarted.
Change-Id: I83388a8cb2b7dd64748502b9576811d3cd18986a
diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java
index 7a3124d..469cc64 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimation.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimation.java
@@ -112,11 +112,11 @@
mTargetActivityType);
ActivityRecord targetActivity = getTargetActivity(targetRootTask);
if (targetActivity != null) {
- if (targetActivity.isVisibleRequested() || targetActivity.isTopRunningActivity()) {
- // The activity is ready.
- return;
- }
if (targetActivity.attachedToProcess()) {
+ if (targetActivity.isVisibleRequested() || targetActivity.isTopRunningActivity()) {
+ // The activity is ready.
+ return;
+ }
if (targetActivity.app.getCurrentProcState() >= PROCESS_STATE_CACHED_ACTIVITY) {
Slog.v(TAG, "Skip preload recents for cached proc " + targetActivity.app);
// The process may be frozen that cannot receive binder call.