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

Commit 2fdf5019 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Remove task thumbnail from cache when receiving onRecentTaskRemoved(1/2)" into main

parents ae67b576 e099571e
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -114,4 +114,10 @@ public interface TaskStackChangeListener {
     * LockTaskController.
     * LockTaskController.
     */
     */
    default void onLockTaskModeChanged(int mode) { }
    default void onLockTaskModeChanged(int mode) { }

    /**
     * Called when a task is removed due to launching a new task. This normally means the previous
     * task is being replaced with a new one.
     */
    default void onRecentTaskRemovedForAddTask(int taskId) { }
}
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -142,6 +142,7 @@ public class TaskStackChangeListeners {
        private static final int ON_ACTIVITY_ROTATION = 22;
        private static final int ON_ACTIVITY_ROTATION = 22;
        private static final int ON_LOCK_TASK_MODE_CHANGED = 23;
        private static final int ON_LOCK_TASK_MODE_CHANGED = 23;
        private static final int ON_TASK_SNAPSHOT_INVALIDATED = 24;
        private static final int ON_TASK_SNAPSHOT_INVALIDATED = 24;
        private static final int ON_RECENTS_TASK_REMOVED_FOR_ADD_TASK = 25;


        /**
        /**
         * List of {@link TaskStackChangeListener} registered from {@link #addListener}.
         * List of {@link TaskStackChangeListener} registered from {@link #addListener}.
@@ -283,6 +284,11 @@ public class TaskStackChangeListeners {
            mHandler.obtainMessage(ON_TASK_CREATED, taskId, 0, componentName).sendToTarget();
            mHandler.obtainMessage(ON_TASK_CREATED, taskId, 0, componentName).sendToTarget();
        }
        }


        @Override
        public void onRecentTaskRemovedForAddTask(int taskId) {
            mHandler.obtainMessage(ON_RECENTS_TASK_REMOVED_FOR_ADD_TASK, taskId, 0).sendToTarget();
        }

        @Override
        @Override
        public void onTaskRemoved(int taskId) {
        public void onTaskRemoved(int taskId) {
            mHandler.obtainMessage(ON_TASK_REMOVED, taskId, 0).sendToTarget();
            mHandler.obtainMessage(ON_TASK_REMOVED, taskId, 0).sendToTarget();
@@ -512,6 +518,12 @@ public class TaskStackChangeListeners {
                        Trace.endSection();
                        Trace.endSection();
                        break;
                        break;
                    }
                    }
                    case ON_RECENTS_TASK_REMOVED_FOR_ADD_TASK: {
                        for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                            mTaskStackListeners.get(i).onRecentTaskRemovedForAddTask(msg.arg1);
                        }
                        break;
                    }
                }
                }
            }
            }
            if (msg.obj instanceof SomeArgs) {
            if (msg.obj instanceof SomeArgs) {