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

Commit b38183be authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue Committed by Android (Google) Code Review
Browse files

Merge "Fix bindApplication starting activities late" into main

parents 96961d3e 752c49b6
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -4799,9 +4799,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            updateLruProcessLocked(app, false, null);
            checkTime(startTime, "attachApplicationLocked: after updateLruProcessLocked");
            updateOomAdjLocked(app, OOM_ADJ_REASON_PROCESS_BEGIN);
            checkTime(startTime, "attachApplicationLocked: after updateOomAdjLocked");
            final long now = SystemClock.uptimeMillis();
            synchronized (mAppProfiler.mProfilerLock) {
                app.mProfile.setLastRequestedGc(now);
@@ -4815,6 +4812,15 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
            mProcessesOnHold.remove(app);
            // See if the top visible activity is waiting to run in this process...
            if (com.android.server.am.Flags.expediteActivityLaunchOnColdStart()) {
                if (normalMode) {
                    mAtmInternal.attachApplication(app.getWindowProcessController());
                }
            }
            updateOomAdjLocked(app, OOM_ADJ_REASON_PROCESS_BEGIN);
            checkTime(startTime, "attachApplicationLocked: after updateOomAdjLocked");
            if (!mConstants.mEnableWaitForFinishAttachApplication) {
                finishAttachApplicationInner(startSeq, callingUid, pid);
            }
@@ -4880,20 +4886,23 @@ public class ActivityManagerService extends IActivityManager.Stub
            // Mark the finish attach application phase as completed
            mProcessStateController.setPendingFinishAttach(app, false);
            final boolean normalMode = mProcessesReady || isAllowedWhileBooting(app.info);
            final String processName = app.processName;
            boolean badApp = false;
            boolean didSomething = false;
            // See if the top visible activity is waiting to run in this process...
            if (!com.android.server.am.Flags.expediteActivityLaunchOnColdStart()) {
                final boolean normalMode = mProcessesReady || isAllowedWhileBooting(app.info);
                if (normalMode) {
                    try {
                    didSomething = mAtmInternal.attachApplication(app.getWindowProcessController());
                        didSomething |= mAtmInternal.attachApplication(
                                app.getWindowProcessController());
                    } catch (Exception e) {
                        Slog.wtf(TAG, "Exception thrown launching activities in " + app, e);
                        badApp = true;
                    }
                }
            }
            // Find any services that should be running in this process...
            if (!badApp) {
+10 −0
Original line number Diff line number Diff line
@@ -288,3 +288,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "expedite_activity_launch_on_cold_start"
    namespace: "system_performance"
    description: "Notify ActivityTaskManager of cold starts early to fix app launch behavior."
    bug: "319519089"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}