From a7b6be8ad6c7261cc52b8a4b237bd9f285de9c13 Mon Sep 17 00:00:00 2001 From: Mohammed Rashidy Date: Wed, 5 Apr 2023 15:11:59 +0100 Subject: [PATCH] Remove ActivityRecords for sandbox activities when App/sandbox died Bug: 277051501 Test: ag/22464148 Change-Id: Ief10f1cab49baa5c3ef99fd061bf46b18bc89baf --- .../core/java/com/android/server/wm/ActivityRecord.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 76d4925ee703a..f5cb613601fe1 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4144,7 +4144,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ void handleAppDied() { final boolean remove; - if ((mRelaunchReason == RELAUNCH_REASON_WINDOWING_MODE_RESIZE + if (Process.isSdkSandboxUid(getUid())) { + // Sandbox activities are created for SDKs run in the sandbox process, when the sandbox + // process dies, the SDKs are unloaded and can not handle the activity, so sandbox + // activity records should be removed. + remove = true; + } else if ((mRelaunchReason == RELAUNCH_REASON_WINDOWING_MODE_RESIZE || mRelaunchReason == RELAUNCH_REASON_FREE_RESIZE) && launchCount < 3 && !finishing) { // If the process crashed during a resize, always try to relaunch it, unless it has