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

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

Merge "Use a separated method to indicate sched group adjustment"

parents 0f08a151 3bd7a849
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1641,11 +1641,10 @@ public class OomAdjuster {

        boolean foregroundActivities = false;
        boolean hasVisibleActivities = false;
        if (app == topApp && (PROCESS_STATE_CUR_TOP == PROCESS_STATE_TOP
                || PROCESS_STATE_CUR_TOP == PROCESS_STATE_IMPORTANT_FOREGROUND)) {
        if (app == topApp && PROCESS_STATE_CUR_TOP == PROCESS_STATE_TOP) {
            // The last app on the list is the foreground app.
            adj = ProcessList.FOREGROUND_APP_ADJ;
            if (PROCESS_STATE_CUR_TOP == PROCESS_STATE_TOP) {
            if (mService.mAtmInternal.useTopSchedGroupForTopProcess()) {
                schedGroup = ProcessList.SCHED_GROUP_TOP_APP;
                state.setAdjType("top-activity");
            } else {
+1 −0
Original line number Diff line number Diff line
@@ -313,6 +313,7 @@ public abstract class ActivityTaskManagerInternal {
    public abstract void onProcessRemoved(String name, int uid);
    public abstract void onCleanUpApplicationRecord(WindowProcessController proc);
    public abstract int getTopProcessState();
    public abstract boolean useTopSchedGroupForTopProcess();
    public abstract void clearHeavyWeightProcessIfEquals(WindowProcessController proc);
    public abstract void finishHeavyWeightApp();

+8 −6
Original line number Diff line number Diff line
@@ -5759,17 +5759,19 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        @HotPath(caller = HotPath.OOM_ADJUSTMENT)
        @Override
        public int getTopProcessState() {
            final int topState = mTopProcessState;
            if (mDemoteTopAppReasons != 0 && topState == ActivityManager.PROCESS_STATE_TOP) {
                // There may be a more important UI/animation than the top app.
                return ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
            }
            if (mRetainPowerModeAndTopProcessState) {
                // There is a launching app while device may be sleeping, force the top state so
                // the launching process can have top-app scheduling group.
                return ActivityManager.PROCESS_STATE_TOP;
            }
            return topState;
            return mTopProcessState;
        }

        @HotPath(caller = HotPath.OOM_ADJUSTMENT)
        @Override
        public boolean useTopSchedGroupForTopProcess() {
            // If it is non-zero, there may be a more important UI/animation than the top app.
            return mDemoteTopAppReasons == 0;
        }

        @HotPath(caller = HotPath.PROCESS_CHANGE)
+1 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ public class RecentsAnimationTest extends WindowTestsBase {
        assertTrue(recentActivity.mVisibleRequested);
        assertEquals(ActivityTaskManagerService.DEMOTE_TOP_REASON_ANIMATING_RECENTS,
                mAtm.mDemoteTopAppReasons);
        assertFalse(mAtm.mInternal.useTopSchedGroupForTopProcess());

        // Simulate the animation is cancelled without changing the stack order.
        recentsAnimation.onAnimationFinished(REORDER_KEEP_IN_PLACE, false /* sendUserLeaveHint */);