Loading core/java/android/window/flags/windowing_frontend.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,17 @@ flag { is_fixed_read_only: true } flag { name: "bg_priority_for_occluded_freeform_tasks" namespace: "windowing_frontend" description: "Background priority for occluded freeform tasks" bug: "325594711" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "fifo_priority_for_major_ui_processes" namespace: "windowing_frontend" Loading services/core/java/com/android/server/am/OomAdjuster.java +4 −0 Original line number Diff line number Diff line Loading @@ -1582,6 +1582,10 @@ public abstract class OomAdjuster { // Currently the only case is from freeform apps which are not close to top. schedGroup = SCHED_GROUP_FOREGROUND_WINDOW; mAdjType = "vis-multi-window-activity"; } else if ((flags & WindowProcessController.ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM) != 0) { schedGroup = SCHED_GROUP_BACKGROUND; mAdjType = "occluded-freeform-activity"; } foregroundActivities = true; mHasVisibleActivities = true; Loading services/core/java/com/android/server/wm/WindowProcessController.java +5 −1 Original line number Diff line number Diff line Loading @@ -335,6 +335,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio public static final int ACTIVITY_STATE_FLAG_RESUMED_SPLIT_SCREEN = 1 << 23; public static final int ACTIVITY_STATE_FLAG_PERCEPTIBLE_FREEFORM = 1 << 24; public static final int ACTIVITY_STATE_FLAG_VISIBLE_MULTI_WINDOW_MODE = 1 << 25; public static final int ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM = 1 << 26; public static final int ACTIVITY_STATE_FLAG_MASK_MIN_TASK_LAYER = 0x0000ffff; /** Loading Loading @@ -1332,7 +1333,10 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio if (hasResumedFreeform // Exclude task layer 1 because it is already the top most. && minTaskLayer > 1) { if (minTaskLayer <= 1 + MAX_NUM_PERCEPTIBLE_FREEFORM if (com.android.window.flags.Flags.bgPriorityForOccludedFreeformTasks() && nonOccludedRatio == 0) { stateFlags |= ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM; } else if (minTaskLayer <= 1 + MAX_NUM_PERCEPTIBLE_FREEFORM || nonOccludedRatio >= PERCEPTIBLE_FREEFORM_VISIBLE_RATIO) { stateFlags |= ACTIVITY_STATE_FLAG_PERCEPTIBLE_FREEFORM; } else { Loading services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,14 @@ public class MockingOomAdjusterTests { SCHED_GROUP_FOREGROUND_WINDOW); assertEquals("vis-multi-window-activity", app.mState.getAdjType()); assertCpuTime(app); doReturn(ACTIVITY_STATE_FLAG_IS_VISIBLE | WindowProcessController.ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM) .when(wpc).getActivityStateFlags(); updateOomAdj(app); assertProcStates(app, PROCESS_STATE_TOP, VISIBLE_APP_ADJ, SCHED_GROUP_BACKGROUND); assertEquals("occluded-freeform-activity", app.mState.getAdjType()); assertCpuTime(app); } @SuppressWarnings("GuardedBy") @Test Loading Loading
core/java/android/window/flags/windowing_frontend.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,17 @@ flag { is_fixed_read_only: true } flag { name: "bg_priority_for_occluded_freeform_tasks" namespace: "windowing_frontend" description: "Background priority for occluded freeform tasks" bug: "325594711" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "fifo_priority_for_major_ui_processes" namespace: "windowing_frontend" Loading
services/core/java/com/android/server/am/OomAdjuster.java +4 −0 Original line number Diff line number Diff line Loading @@ -1582,6 +1582,10 @@ public abstract class OomAdjuster { // Currently the only case is from freeform apps which are not close to top. schedGroup = SCHED_GROUP_FOREGROUND_WINDOW; mAdjType = "vis-multi-window-activity"; } else if ((flags & WindowProcessController.ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM) != 0) { schedGroup = SCHED_GROUP_BACKGROUND; mAdjType = "occluded-freeform-activity"; } foregroundActivities = true; mHasVisibleActivities = true; Loading
services/core/java/com/android/server/wm/WindowProcessController.java +5 −1 Original line number Diff line number Diff line Loading @@ -335,6 +335,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio public static final int ACTIVITY_STATE_FLAG_RESUMED_SPLIT_SCREEN = 1 << 23; public static final int ACTIVITY_STATE_FLAG_PERCEPTIBLE_FREEFORM = 1 << 24; public static final int ACTIVITY_STATE_FLAG_VISIBLE_MULTI_WINDOW_MODE = 1 << 25; public static final int ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM = 1 << 26; public static final int ACTIVITY_STATE_FLAG_MASK_MIN_TASK_LAYER = 0x0000ffff; /** Loading Loading @@ -1332,7 +1333,10 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio if (hasResumedFreeform // Exclude task layer 1 because it is already the top most. && minTaskLayer > 1) { if (minTaskLayer <= 1 + MAX_NUM_PERCEPTIBLE_FREEFORM if (com.android.window.flags.Flags.bgPriorityForOccludedFreeformTasks() && nonOccludedRatio == 0) { stateFlags |= ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM; } else if (minTaskLayer <= 1 + MAX_NUM_PERCEPTIBLE_FREEFORM || nonOccludedRatio >= PERCEPTIBLE_FREEFORM_VISIBLE_RATIO) { stateFlags |= ACTIVITY_STATE_FLAG_PERCEPTIBLE_FREEFORM; } else { Loading
services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,14 @@ public class MockingOomAdjusterTests { SCHED_GROUP_FOREGROUND_WINDOW); assertEquals("vis-multi-window-activity", app.mState.getAdjType()); assertCpuTime(app); doReturn(ACTIVITY_STATE_FLAG_IS_VISIBLE | WindowProcessController.ACTIVITY_STATE_FLAG_OCCLUDED_FREEFORM) .when(wpc).getActivityStateFlags(); updateOomAdj(app); assertProcStates(app, PROCESS_STATE_TOP, VISIBLE_APP_ADJ, SCHED_GROUP_BACKGROUND); assertEquals("occluded-freeform-activity", app.mState.getAdjType()); assertCpuTime(app); } @SuppressWarnings("GuardedBy") @Test Loading