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

Commit e1d8c194 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Fix unit test dependency of WmTests

Also simplify checking of duplicated unfreeze.

Fix: 223327645
Test: atest ActivityRecordTests
Change-Id: I0f776353b88210e84b8b473d6c0048e4f263c307
parent 1024b074
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -16998,6 +16998,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        @Override
        @Override
        public void addPendingTopUid(int uid, int pid) {
        public void addPendingTopUid(int uid, int pid) {
            final boolean isNewPending = mPendingStartActivityUids.add(uid, pid);
            // If the next top activity is in cached and frozen mode, WM should raise its priority
            // 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.
            // 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
            // However, WM cannot hold the AMS clock here so the updateOomAdj operation is performed
@@ -17005,11 +17006,9 @@ public class ActivityManagerService extends IActivityManager.Stub
            // next top activity on time. This race will fail the following binder transactions WM
            // 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
            // sends to the activity. After this race issue between WM/ATMS and AMS is solved, this
            // workaround can be removed. (b/213288355)
            // workaround can be removed. (b/213288355)
            if (!isPendingTopUid(uid)) {
            if (isNewPending && mOomAdjuster != null) { // It can be null in unit test.
                mOomAdjuster.mCachedAppOptimizer.unfreezeProcess(pid);
                mOomAdjuster.mCachedAppOptimizer.unfreezeProcess(pid);
            }
            }
            mPendingStartActivityUids.add(uid, pid);
        }
        }
        @Override
        @Override
+4 −1
Original line number Original line Diff line number Diff line
@@ -46,10 +46,13 @@ final class PendingStartActivityUids {
        mContext = context;
        mContext = context;
    }
    }


    synchronized void add(int uid, int pid) {
    /** Returns {@code true} if the uid is put to the pending array. Otherwise it existed. */
    synchronized boolean add(int uid, int pid) {
        if (mPendingUids.get(uid) == null) {
        if (mPendingUids.get(uid) == null) {
            mPendingUids.put(uid, new Pair<>(pid, SystemClock.elapsedRealtime()));
            mPendingUids.put(uid, new Pair<>(pid, SystemClock.elapsedRealtime()));
            return true;
        }
        }
        return false;
    }
    }


    synchronized void delete(int uid) {
    synchronized void delete(int uid) {