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

Commit 0bd1bf62 authored by Chilun's avatar Chilun Committed by Chilun Huang
Browse files

Avoid killing instrumentation process while start process

The case is a test using the same package name as default home.
Launching the instrumentation of the test will cause default home to
be killed. But AM has a mechanism to restart the default home and that
will cause the instrumentation process to be killed.

This patch add a condition check to avoid killing instrumentation
process while starting process.

Test: atest CtsAppTestCases:ServiceTest
Bug: 120107272
Change-Id: I6da0c4ca355aa324ed76571c3bc47ac2d962d192
parent 708e111e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1613,6 +1613,13 @@ public final class ProcessList {
                app.addPackage(info.packageName, info.versionCode, mService.mProcessStats);
                checkSlow(startTime, "startProcess: done, added package to proc");
                return app;
            } else if (app.getActiveInstrumentation() != null) {
                // We don't want to kill running instrumentation.
                if (DEBUG_PROCESSES) {
                    Slog.v(TAG_PROCESSES, "Instrumentation already running: " + app);
                }
                checkSlow(startTime, "startProcess: keep instrumentation proc");
                return app;
            }

            // An application record is attached to a previous process,