Loading core/java/android/app/IActivityTaskManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,7 @@ interface IActivityTaskManager { int getFrontActivityScreenCompatMode(); void setFrontActivityScreenCompatMode(int mode); void setFocusedTask(int taskId); boolean setTaskIsPerceptible(int taskId, boolean isPerceptible); boolean removeTask(int taskId); void removeAllVisibleRecentTasks(); List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, boolean filterOnlyVisibleRecents, Loading packages/SystemUI/shared/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ android_library { "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib", "//frameworks/libs/systemui:msdl", "//frameworks/libs/systemui:view_capture", "am_flags_lib", ], resource_dirs: [ "res", Loading packages/SystemUI/shared/res/values/bools.xml +4 −1 Original line number Diff line number Diff line Loading @@ -22,4 +22,7 @@ <resources> <!-- Whether to add padding at the bottom of the complication clock --> <bool name="dream_overlay_complication_clock_bottom_padding">false</bool> <!-- Whether to mark tasks that are present in the UI as perceptible tasks. --> <bool name="config_usePerceptibleTasks">false</bool> </resources> packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +21 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import android.view.Display; import android.window.TaskSnapshot; import com.android.internal.app.IVoiceInteractionManagerService; import com.android.server.am.Flags; import com.android.systemui.shared.R; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; Loading Loading @@ -226,6 +228,17 @@ public class ActivityManagerWrapper { } } /** * Sets whether or not the specified task is perceptible. */ public boolean setTaskIsPerceptible(int taskId, boolean isPerceptible) { try { return getService().setTaskIsPerceptible(taskId, isPerceptible); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Removes a task by id. */ Loading Loading @@ -310,6 +323,14 @@ public class ActivityManagerWrapper { || freeformDevOption); } /** * Returns true if tasks with a presence in the UI should be marked as perceptible tasks. */ public static boolean usePerceptibleTasks(Context context) { return Flags.perceptibleTasks() && context.getResources().getBoolean(R.bool.config_usePerceptibleTasks); } /** * Returns true if the running task represents the home task */ Loading services/core/java/com/android/server/am/OomAdjuster.java +25 −1 Original line number Diff line number Diff line Loading @@ -446,6 +446,8 @@ public class OomAdjuster { private static final int CACHING_UI_SERVICE_CLIENT_ADJ_THRESHOLD = Flags.raiseBoundUiServiceThreshold() ? SERVICE_ADJ : PERCEPTIBLE_APP_ADJ; static final long PERCEPTIBLE_TASK_TIMEOUT_MILLIS = 5 * 60 * 1000; @VisibleForTesting public static class Injector { boolean isChangeEnabled(@CachedCompatChangeId int cachedCompatChangeId, Loading Loading @@ -1847,7 +1849,7 @@ public class OomAdjuster { mHasVisibleActivities = false; } void onOtherActivity() { void onOtherActivity(long perceptibleTaskStoppedTimeMillis) { if (procState > PROCESS_STATE_CACHED_ACTIVITY) { procState = PROCESS_STATE_CACHED_ACTIVITY; mAdjType = "cch-act"; Loading @@ -1856,6 +1858,28 @@ public class OomAdjuster { "Raise procstate to cached activity: " + app); } } if (Flags.perceptibleTasks() && adj > PERCEPTIBLE_MEDIUM_APP_ADJ) { if (perceptibleTaskStoppedTimeMillis >= 0) { final long now = mInjector.getUptimeMillis(); if (now - perceptibleTaskStoppedTimeMillis < PERCEPTIBLE_TASK_TIMEOUT_MILLIS) { adj = PERCEPTIBLE_MEDIUM_APP_ADJ; mAdjType = "perceptible-act"; if (procState > PROCESS_STATE_IMPORTANT_BACKGROUND) { procState = PROCESS_STATE_IMPORTANT_BACKGROUND; } maybeSetProcessFollowUpUpdateLocked(app, perceptibleTaskStoppedTimeMillis + PERCEPTIBLE_TASK_TIMEOUT_MILLIS, now); } else if (adj > PREVIOUS_APP_ADJ) { adj = PREVIOUS_APP_ADJ; mAdjType = "stale-perceptible-act"; if (procState > PROCESS_STATE_LAST_ACTIVITY) { procState = PROCESS_STATE_LAST_ACTIVITY; } } } } mHasVisibleActivities = false; } } Loading Loading
core/java/android/app/IActivityTaskManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,7 @@ interface IActivityTaskManager { int getFrontActivityScreenCompatMode(); void setFrontActivityScreenCompatMode(int mode); void setFocusedTask(int taskId); boolean setTaskIsPerceptible(int taskId, boolean isPerceptible); boolean removeTask(int taskId); void removeAllVisibleRecentTasks(); List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, boolean filterOnlyVisibleRecents, Loading
packages/SystemUI/shared/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ android_library { "//frameworks/libs/systemui:com_android_systemui_shared_flags_lib", "//frameworks/libs/systemui:msdl", "//frameworks/libs/systemui:view_capture", "am_flags_lib", ], resource_dirs: [ "res", Loading
packages/SystemUI/shared/res/values/bools.xml +4 −1 Original line number Diff line number Diff line Loading @@ -22,4 +22,7 @@ <resources> <!-- Whether to add padding at the bottom of the complication clock --> <bool name="dream_overlay_complication_clock_bottom_padding">false</bool> <!-- Whether to mark tasks that are present in the UI as perceptible tasks. --> <bool name="config_usePerceptibleTasks">false</bool> </resources>
packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +21 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import android.view.Display; import android.window.TaskSnapshot; import com.android.internal.app.IVoiceInteractionManagerService; import com.android.server.am.Flags; import com.android.systemui.shared.R; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; Loading Loading @@ -226,6 +228,17 @@ public class ActivityManagerWrapper { } } /** * Sets whether or not the specified task is perceptible. */ public boolean setTaskIsPerceptible(int taskId, boolean isPerceptible) { try { return getService().setTaskIsPerceptible(taskId, isPerceptible); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Removes a task by id. */ Loading Loading @@ -310,6 +323,14 @@ public class ActivityManagerWrapper { || freeformDevOption); } /** * Returns true if tasks with a presence in the UI should be marked as perceptible tasks. */ public static boolean usePerceptibleTasks(Context context) { return Flags.perceptibleTasks() && context.getResources().getBoolean(R.bool.config_usePerceptibleTasks); } /** * Returns true if the running task represents the home task */ Loading
services/core/java/com/android/server/am/OomAdjuster.java +25 −1 Original line number Diff line number Diff line Loading @@ -446,6 +446,8 @@ public class OomAdjuster { private static final int CACHING_UI_SERVICE_CLIENT_ADJ_THRESHOLD = Flags.raiseBoundUiServiceThreshold() ? SERVICE_ADJ : PERCEPTIBLE_APP_ADJ; static final long PERCEPTIBLE_TASK_TIMEOUT_MILLIS = 5 * 60 * 1000; @VisibleForTesting public static class Injector { boolean isChangeEnabled(@CachedCompatChangeId int cachedCompatChangeId, Loading Loading @@ -1847,7 +1849,7 @@ public class OomAdjuster { mHasVisibleActivities = false; } void onOtherActivity() { void onOtherActivity(long perceptibleTaskStoppedTimeMillis) { if (procState > PROCESS_STATE_CACHED_ACTIVITY) { procState = PROCESS_STATE_CACHED_ACTIVITY; mAdjType = "cch-act"; Loading @@ -1856,6 +1858,28 @@ public class OomAdjuster { "Raise procstate to cached activity: " + app); } } if (Flags.perceptibleTasks() && adj > PERCEPTIBLE_MEDIUM_APP_ADJ) { if (perceptibleTaskStoppedTimeMillis >= 0) { final long now = mInjector.getUptimeMillis(); if (now - perceptibleTaskStoppedTimeMillis < PERCEPTIBLE_TASK_TIMEOUT_MILLIS) { adj = PERCEPTIBLE_MEDIUM_APP_ADJ; mAdjType = "perceptible-act"; if (procState > PROCESS_STATE_IMPORTANT_BACKGROUND) { procState = PROCESS_STATE_IMPORTANT_BACKGROUND; } maybeSetProcessFollowUpUpdateLocked(app, perceptibleTaskStoppedTimeMillis + PERCEPTIBLE_TASK_TIMEOUT_MILLIS, now); } else if (adj > PREVIOUS_APP_ADJ) { adj = PREVIOUS_APP_ADJ; mAdjType = "stale-perceptible-act"; if (procState > PROCESS_STATE_LAST_ACTIVITY) { procState = PROCESS_STATE_LAST_ACTIVITY; } } } } mHasVisibleActivities = false; } } Loading