Loading services/core/java/com/android/server/am/OomAdjuster.java +2 −3 Original line number Diff line number Diff line Loading @@ -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 { Loading services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +1 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +8 −6 Original line number Diff line number Diff line Loading @@ -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) Loading services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -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 */); Loading Loading
services/core/java/com/android/server/am/OomAdjuster.java +2 −3 Original line number Diff line number Diff line Loading @@ -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 { Loading
services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +1 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +8 −6 Original line number Diff line number Diff line Loading @@ -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) Loading
services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -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 */); Loading