diff options
4 files changed, 12 insertions, 10 deletions
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json index 7d5c06cbed1a..13cf82e51b22 100644 --- a/data/etc/services.core.protolog.json +++ b/data/etc/services.core.protolog.json @@ -2047,12 +2047,6 @@ "group": "WM_DEBUG_WINDOW_TRANSITIONS_MIN", "at": "com\/android\/server\/wm\/TransitionController.java" }, - "-262984451": { - "message": "Relaunch failed %s", - "level": "INFO", - "group": "WM_DEBUG_STATES", - "at": "com\/android\/server\/wm\/ActivityRecord.java" - }, "-251259736": { "message": "No longer freezing: %s", "level": "VERBOSE", diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index d231cf300806..ca3a84752fc4 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -9854,7 +9854,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A ProtoLog.i(WM_DEBUG_STATES, "Moving to %s Relaunching %s callers=%s" , (andResume ? "RESUMED" : "PAUSED"), this, Debug.getCallers(6)); forceNewConfig = false; - startRelaunching(); final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(pendingResults, pendingNewIntents, configChangeFlags, new MergedConfiguration(getProcessGlobalConfiguration(), @@ -9871,11 +9870,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A transaction.addCallback(callbackItem); transaction.setLifecycleStateRequest(lifecycleItem); mAtmService.getLifecycleManager().scheduleTransaction(transaction); + startRelaunching(); // Note: don't need to call pauseIfSleepingLocked() here, because the caller will only // request resume if this activity is currently resumed, which implies we aren't // sleeping. } catch (RemoteException e) { - ProtoLog.i(WM_DEBUG_STATES, "Relaunch failed %s", e); + Slog.w(TAG, "Failed to relaunch " + this + ": " + e); } if (andResume) { diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java index be9058840492..ee05e355e8ef 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimation.java +++ b/services/core/java/com/android/server/wm/RecentsAnimation.java @@ -16,6 +16,7 @@ package com.android.server.wm; +import static android.app.ActivityManager.PROCESS_STATE_CACHED_ACTIVITY; import static android.app.ActivityManager.START_TASK_TO_FRONT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; @@ -117,6 +118,11 @@ class RecentsAnimation implements RecentsAnimationCallbacks, OnRootTaskOrderChan return; } if (targetActivity.attachedToProcess()) { + 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. + return; + } // The activity may be relaunched if it cannot handle the current configuration // changes. The activity will be paused state if it is relaunched, otherwise it // keeps the original stopped state. diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java index de3a526573f8..491d5b56c8e2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java @@ -16,6 +16,7 @@ package com.android.server.wm; +import static android.app.ActivityManager.PROCESS_STATE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; @@ -148,8 +149,9 @@ public class RecentsAnimationTest extends WindowTestsBase { anyInt() /* startFlags */, any() /* profilerInfo */); // Assume its process is alive because the caller should be the recents service. - mSystemServicesTestRule.addProcess(aInfo.packageName, aInfo.processName, 12345 /* pid */, - aInfo.applicationInfo.uid); + final WindowProcessController proc = mSystemServicesTestRule.addProcess(aInfo.packageName, + aInfo.processName, 12345 /* pid */, aInfo.applicationInfo.uid); + proc.setCurrentProcState(PROCESS_STATE_HOME); Intent recentsIntent = new Intent().setComponent(mRecentsComponent); // Null animation indicates to preload. |