Loading core/java/android/app/ITaskStackListener.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,11 @@ oneway interface ITaskStackListener { */ void onRecentTaskListFrozenChanged(boolean frozen); /** * Called when a task is removed from the recent tasks list as a result of adding a new task. */ void onRecentTaskRemovedForAddTask(int taskId); /** * Called when a task gets or loses focus. * Loading core/java/android/app/TaskStackListener.java +4 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,10 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { public void onRecentTaskListFrozenChanged(boolean frozen) { } @Override public void onRecentTaskRemovedForAddTask(int taskId) { } @Override public void onTaskFocusChanged(int taskId, boolean focused) { } Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/TaskStackListenerCallback.java +3 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,9 @@ public interface TaskStackListenerCallback { default void onRecentTaskListFrozenChanged(boolean frozen) { } /** A task is removed from recents as a result of another task being added to recent tasks. */ default void onRecentTaskRemovedForAddTask(int taskId) { } @BinderThread default void onTaskStackChangedBackground() { } Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/TaskStackListenerImpl.java +13 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler. private static final int ON_TASK_LIST_FROZEN_UNFROZEN = 18; private static final int ON_TASK_DESCRIPTION_CHANGED = 19; private static final int ON_ACTIVITY_ROTATION = 20; private static final int ON_RECENT_TASK_REMOVED_FOR_ADD_TASK = 21; /** * List of {@link TaskStackListenerCallback} registered from {@link #addListener}. Loading Loading @@ -131,6 +132,11 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler. 0 /* unused */).sendToTarget(); } @Override public void onRecentTaskRemovedForAddTask(int taskId) { mMainHandler.obtainMessage(ON_RECENT_TASK_REMOVED_FOR_ADD_TASK, taskId).sendToTarget(); } @Override public void onTaskStackChanged() { // Call the task changed callback for the non-ui thread listeners first. Copy to a set Loading Loading @@ -408,6 +414,13 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler. } break; } case ON_RECENT_TASK_REMOVED_FOR_ADD_TASK: { final int taskId = (int) msg.obj; for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) { mTaskStackListeners.get(i).onRecentTaskRemovedForAddTask(taskId); } break; } case ON_TASK_DESCRIPTION_CHANGED: { final ActivityManager.RunningTaskInfo info = (ActivityManager.RunningTaskInfo) msg.obj; Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +12 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.recents; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.Display.INVALID_DISPLAY; import static com.android.wm.shell.Flags.enableShellTopTaskTracking; import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TASK_OBSERVER; Loading Loading @@ -282,6 +283,17 @@ public class RecentTasksController implements TaskStackListenerCallback, notifyRecentTasksChanged(); } /** * This method only gets notified when a task is removed from recents as a result of another * task being added to recent tasks. */ @Override public void onRecentTaskRemovedForAddTask(int taskId) { mDesktopRepository.ifPresent( repo -> repo.removeFreeformTask(INVALID_DISPLAY, taskId) ); } public void onTaskAdded(RunningTaskInfo taskInfo) { notifyRunningTaskAppeared(taskInfo); } Loading Loading
core/java/android/app/ITaskStackListener.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,11 @@ oneway interface ITaskStackListener { */ void onRecentTaskListFrozenChanged(boolean frozen); /** * Called when a task is removed from the recent tasks list as a result of adding a new task. */ void onRecentTaskRemovedForAddTask(int taskId); /** * Called when a task gets or loses focus. * Loading
core/java/android/app/TaskStackListener.java +4 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,10 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { public void onRecentTaskListFrozenChanged(boolean frozen) { } @Override public void onRecentTaskRemovedForAddTask(int taskId) { } @Override public void onTaskFocusChanged(int taskId, boolean focused) { } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/TaskStackListenerCallback.java +3 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,9 @@ public interface TaskStackListenerCallback { default void onRecentTaskListFrozenChanged(boolean frozen) { } /** A task is removed from recents as a result of another task being added to recent tasks. */ default void onRecentTaskRemovedForAddTask(int taskId) { } @BinderThread default void onTaskStackChangedBackground() { } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/TaskStackListenerImpl.java +13 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler. private static final int ON_TASK_LIST_FROZEN_UNFROZEN = 18; private static final int ON_TASK_DESCRIPTION_CHANGED = 19; private static final int ON_ACTIVITY_ROTATION = 20; private static final int ON_RECENT_TASK_REMOVED_FOR_ADD_TASK = 21; /** * List of {@link TaskStackListenerCallback} registered from {@link #addListener}. Loading Loading @@ -131,6 +132,11 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler. 0 /* unused */).sendToTarget(); } @Override public void onRecentTaskRemovedForAddTask(int taskId) { mMainHandler.obtainMessage(ON_RECENT_TASK_REMOVED_FOR_ADD_TASK, taskId).sendToTarget(); } @Override public void onTaskStackChanged() { // Call the task changed callback for the non-ui thread listeners first. Copy to a set Loading Loading @@ -408,6 +414,13 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler. } break; } case ON_RECENT_TASK_REMOVED_FOR_ADD_TASK: { final int taskId = (int) msg.obj; for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) { mTaskStackListeners.get(i).onRecentTaskRemovedForAddTask(taskId); } break; } case ON_TASK_DESCRIPTION_CHANGED: { final ActivityManager.RunningTaskInfo info = (ActivityManager.RunningTaskInfo) msg.obj; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +12 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.recents; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.PackageManager.FEATURE_PC; import static android.view.Display.INVALID_DISPLAY; import static com.android.wm.shell.Flags.enableShellTopTaskTracking; import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TASK_OBSERVER; Loading Loading @@ -282,6 +283,17 @@ public class RecentTasksController implements TaskStackListenerCallback, notifyRecentTasksChanged(); } /** * This method only gets notified when a task is removed from recents as a result of another * task being added to recent tasks. */ @Override public void onRecentTaskRemovedForAddTask(int taskId) { mDesktopRepository.ifPresent( repo -> repo.removeFreeformTask(INVALID_DISPLAY, taskId) ); } public void onTaskAdded(RunningTaskInfo taskInfo) { notifyRunningTaskAppeared(taskInfo); } Loading