Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 917173f5 authored by Chilun's avatar Chilun Committed by Chilun Huang
Browse files

Restart the application only for the bad process

The case is a test using the same package name as default home.
Starting the instrumentation of the test will kill the home process.
When AM try to restart the default home, there is a wrong logic that
cause the instrumentation process to be killled.

The problem of original logic is always set knownToBeDead as true even
the existing process is ok.

Test: atest CtsAppTestCases#ServiceTest
Bug: 120107272
Change-Id: Ic2c3f6236c3631b0e386d24750bf5952d8227ea9
parent 1f343b5e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -947,6 +947,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        final WindowProcessController wpc =
                mService.getProcessController(r.processName, r.info.applicationInfo.uid);

        boolean knownToBeDead = false;
        if (wpc != null && wpc.hasThread()) {
            try {
                if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0
@@ -965,6 +966,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {

            // If a dead object exception was thrown -- fall through to
            // restart the application.
            knownToBeDead = true;
        }

        // Suppress transition until the new activity becomes ready, otherwise the keyguard can
@@ -978,7 +980,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        // ATMS lock held.
        final Message msg = PooledLambda.obtainMessage(
                ActivityManagerInternal::startProcess, mService.mAmInternal, r.processName,
                r.info.applicationInfo, true, "activity", r.intent.getComponent());
                r.info.applicationInfo, knownToBeDead, "activity", r.intent.getComponent());
        mService.mH.sendMessage(msg);
    }