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

Commit a7beee5b authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Remove task from repo onRecentTaskRemoved

...when the task is removed through adding a new task.

Fix: 378478539
Test: atest RecentTasksTest
Flag: EXEMPT Bugfix
Change-Id: Ic75fa231e9e583a284ca8a0d6d7a116b5cbe8abf
parent 6c99a727
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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.
     *
+4 −0
Original line number Diff line number Diff line
@@ -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) {
    }
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
        <item name="android:navigationBarColor">@android:color/transparent</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:windowAnimationStyle">@null</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>

    <style name="Animation.ForcedResizable" parent="@android:style/Animation">
+3 −0
Original line number Diff line number Diff line
@@ -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() { }

+13 −0
Original line number Diff line number Diff line
@@ -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}.
@@ -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
@@ -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