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

Commit ad263c58 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Store the existence of home and previous process"

parents cf061c1f 1add173d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -247,6 +247,9 @@ public class AppProfiler {
    private int mMemWatchDumpUid;
    private boolean mMemWatchIsUserInitiated;

    boolean mHasHomeProcess;
    boolean mHasPreviousProcess;

    /**
     * Used to collect per-process CPU use for ANRs, battery stats, etc.
     * Must acquire this object's lock when accessing it.
@@ -961,8 +964,8 @@ public class AppProfiler {
            }
            int factor = numTrimming / 3;
            int minFactor = 2;
            if (mService.mAtmInternal.getHomeProcess() != null) minFactor++;
            if (mService.mAtmInternal.getPreviousProcess() != null) minFactor++;
            if (mHasHomeProcess) minFactor++;
            if (mHasPreviousProcess) minFactor++;
            if (factor < minFactor) factor = minFactor;
            int curLevel = ComponentCallbacks2.TRIM_MEMORY_COMPLETE;
            for (int i = 0; i < numOfLru; i++) {
+1 −0
Original line number Diff line number Diff line
@@ -500,6 +500,7 @@ public final class OomAdjuster {
        final ProcessRecord topApp = mService.getTopAppLocked();
        // Clear any pending ones because we are doing a full update now.
        mPendingProcessSet.clear();
        mService.mAppProfiler.mHasPreviousProcess = mService.mAppProfiler.mHasHomeProcess = false;
        updateOomAdjLockedInner(oomAdjReason, topApp , null, null, true, true);
    }

+12 −4
Original line number Diff line number Diff line
@@ -1875,16 +1875,24 @@ class ProcessRecord implements WindowProcessListener {

    boolean getCachedIsHomeProcess() {
        if (mCachedIsHomeProcess == VALUE_INVALID) {
            mCachedIsHomeProcess = getWindowProcessController().isHomeProcess()
                    ? VALUE_TRUE : VALUE_FALSE;
            if (getWindowProcessController().isHomeProcess()) {
                mCachedIsHomeProcess = VALUE_TRUE;
                mService.mAppProfiler.mHasHomeProcess = true;
            } else {
                mCachedIsHomeProcess = VALUE_FALSE;
            }
        }
        return mCachedIsHomeProcess == VALUE_TRUE;
    }

    boolean getCachedIsPreviousProcess() {
        if (mCachedIsPreviousProcess == VALUE_INVALID) {
            mCachedIsPreviousProcess = getWindowProcessController().isPreviousProcess()
                    ? VALUE_TRUE : VALUE_FALSE;
            if (getWindowProcessController().isPreviousProcess()) {
                mCachedIsPreviousProcess = VALUE_TRUE;
                mService.mAppProfiler.mHasPreviousProcess = true;
            } else {
                mCachedIsPreviousProcess = VALUE_FALSE;
            }
        }
        return mCachedIsPreviousProcess == VALUE_TRUE;
    }
+0 −3
Original line number Diff line number Diff line
@@ -533,9 +533,6 @@ public abstract class ActivityTaskManagerInternal {
    /** Flush recent tasks to disk. */
    public abstract void flushRecentTasks();

    public abstract WindowProcessController getHomeProcess();
    public abstract WindowProcessController getPreviousProcess();

    public abstract void clearLockedTasks(String reason);
    public abstract void updateUserConfiguration();
    public abstract boolean canShowErrorDialogs();
+0 −14
Original line number Diff line number Diff line
@@ -7323,20 +7323,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            mRecentTasks.flush();
        }

        @Override
        public WindowProcessController getHomeProcess() {
            synchronized (mGlobalLock) {
                return mHomeProcess;
            }
        }

        @Override
        public WindowProcessController getPreviousProcess() {
            synchronized (mGlobalLock) {
                return mPreviousProcess;
            }
        }

        @Override
        public void clearLockedTasks(String reason) {
            synchronized (mGlobalLock) {