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

Commit 465e26cb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Avoid duplicate unfreezeProcess" into tm-dev

parents d67a04ec 06873556
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -16998,8 +16998,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        @Override
        public void addPendingTopUid(int uid, int pid) {
            mPendingStartActivityUids.add(uid, pid);
            // If the next top activity is in cached and frozen mode, WM should raise its priority
            // to unfreeze it. This is done by calling AMS.updateOomAdj that will lower its oom adj.
            // However, WM cannot hold the AMS clock here so the updateOomAdj operation is performed
@@ -17007,9 +17005,13 @@ public class ActivityManagerService extends IActivityManager.Stub
            // next top activity on time. This race will fail the following binder transactions WM
            // sends to the activity. After this race issue between WM/ATMS and AMS is solved, this
            // workaround can be removed. (b/213288355)
            if (!isPendingTopUid(uid)) {
                mOomAdjuster.mCachedAppOptimizer.unfreezeProcess(pid);
            }
            mPendingStartActivityUids.add(uid, pid);
        }
        @Override
        public void deletePendingTopUid(int uid) {
            mPendingStartActivityUids.delete(uid);
+2 −2
Original line number Diff line number Diff line
@@ -1048,16 +1048,16 @@ public final class CachedAppOptimizer {
     * This quick function works around the race condition between WM/ATMS and AMS, allowing
     * the former to directly unfreeze a frozen process before the latter runs updateOomAdj.
     * After the race issue is solved, this workaround can be removed. (b/213288355)
     * The caller of this function should still trigger updateOomAdj for AMS to unfreeze the app.
     * @param pid pid of the process to be unfrozen
     */
    @GuardedBy({"mFreezerLock"})
    void unfreezeProcess(int pid) {
        synchronized (mFreezerLock) {
            ProcessRecord app = mFrozenProcesses.get(pid);
            if (app == null) {
                return;
            }
            Slog.i(TAG_AM, "quick sync unfreeze " + pid);
            Slog.d(TAG_AM, "quick sync unfreeze " + pid);
            try {
                freezeBinder(pid, false);
            } catch (RuntimeException e) {