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

Commit 2670756d authored by Yisroel Forta's avatar Yisroel Forta
Browse files

Limit service triggered app start info records to cold starts only

Warm start for non-activity starts is not really defined.
Remove for now and revisit introducing back in the future
along with a stronger and consistent definition.

Test: presubmit
Bug: 335429682
Change-Id: I751ceb01288a03b0a40f9a8be5f3bc68f82681f6
parent afa3947d
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -5725,14 +5725,11 @@ public final class ActiveServices {
                bringDownServiceLocked(r, enqueueOomAdj);
                return msg;
            }
            mAm.mProcessList.getAppStartInfoTracker().handleProcessServiceStart(startTimeNs, app, r,
                    true);
            mAm.mProcessList.getAppStartInfoTracker().handleProcessServiceStart(startTimeNs, app,
                    r);
            if (isolated) {
                r.isolationHostProc = app;
            }
        } else {
            mAm.mProcessList.getAppStartInfoTracker().handleProcessServiceStart(startTimeNs, app, r,
                    false);
        }

        if (r.fgRequired) {
+2 −3
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ public final class AppStartInfoTracker {
    }

    public void handleProcessServiceStart(long startTimeNs, ProcessRecord app,
                ServiceRecord serviceRecord, boolean cold) {
                ServiceRecord serviceRecord) {
        synchronized (mLock) {
            if (!mEnabled) {
                return;
@@ -325,8 +325,7 @@ public final class AppStartInfoTracker {
            start.setStartupState(ApplicationStartInfo.STARTUP_STATE_STARTED);
            start.addStartupTimestamp(
                    ApplicationStartInfo.START_TIMESTAMP_LAUNCH, startTimeNs);
            start.setStartType(cold ? ApplicationStartInfo.START_TYPE_COLD
                    : ApplicationStartInfo.START_TYPE_WARM);
            start.setStartType(ApplicationStartInfo.START_TYPE_COLD);

            // TODO: handle possible alarm service start.
            start.setReason(serviceRecord.permission != null
+2 −3
Original line number Diff line number Diff line
@@ -321,8 +321,7 @@ public class ApplicationStartInfoTest {
                app1PackageName);            // packageName
        ServiceRecord service = ServiceRecord.newEmptyInstanceForTest(mAms);

        mAppStartInfoTracker.handleProcessServiceStart(appStartTimestampService, app, service,
                false);
        mAppStartInfoTracker.handleProcessServiceStart(appStartTimestampService, app, service);
        list.clear();
        mAppStartInfoTracker.getStartInfo(app1PackageName, app1Uid, 0, 0, list);
        assertEquals(list.size(), 2);
@@ -336,7 +335,7 @@ public class ApplicationStartInfoTest {
                app1ProcessName,                                      // processName
                ApplicationStartInfo.START_REASON_SERVICE,            // reason
                ApplicationStartInfo.STARTUP_STATE_STARTED,           // startup state
                ApplicationStartInfo.START_TYPE_WARM,                 // state type
                ApplicationStartInfo.START_TYPE_COLD,                 // state type
                ApplicationStartInfo.LAUNCH_MODE_STANDARD);           // launch mode

        // Case 5: Create an instance of app1 with a different user started for a broadcast