Restore correct app State when combing "-D" and "--suspend" flags

Starting an app in debug (-D), suspended (--suspend) mode will
result in the app unable to restore its initial state.

ActivityManagerService.setDebugApp has side effects. It saves a
state that is only restore later during the app booting. Calling
it twice in a row, "double saves" which resulting forgetting the
initial state.

Test: Manual
Bug: 266233210

Change-Id: I7819a3c0f7e46994548c584c4c5d61f6d24faf61
This commit is contained in:
Fabien Sanglard
2023-01-20 23:53:02 +00:00
parent 17a7bc4adf
commit cb8031e1e0

View File

@@ -17842,11 +17842,9 @@ public class ActivityManagerService extends IActivityManager.Stub
*/
synchronized (wmLock) {
if ((startFlags & ActivityManager.START_FLAG_DEBUG) != 0) {
setDebugApp(aInfo.processName, true, false);
}
if ((startFlags & ActivityManager.START_FLAG_DEBUG_SUSPEND) != 0) {
setDebugApp(aInfo.processName, true, false, true);
boolean suspend =
(startFlags & ActivityManager.START_FLAG_DEBUG_SUSPEND) != 0;
setDebugApp(aInfo.processName, true, false, suspend);
}
if ((startFlags & ActivityManager.START_FLAG_NATIVE_DEBUGGING) != 0) {