Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -749,7 +749,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD public final void onBusEvent(AllTaskViewsDismissedEvent event) { SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.hasDockedTask()) { mRecentsView.showEmptyView(R.string.recents_empty_message_dismissed_all); mRecentsView.showEmptyView(event.msgResId); } else { // Just go straight home (no animation necessary because there are no more task views) dismissRecentsToHome(false /* animateTaskViews */); Loading packages/SystemUI/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java +6 −1 Original line number Diff line number Diff line Loading @@ -22,5 +22,10 @@ import com.android.systemui.recents.events.EventBus; * This is sent whenever all the task views in a stack have been dismissed. */ public class AllTaskViewsDismissedEvent extends EventBus.Event { // Simple event public final int msgResId; public AllTaskViewsDismissedEvent(int msgResId) { this.msgResId = msgResId; } } packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -245,7 +245,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd if (row.getViewType() == TASK_ROW_VIEW_TYPE) { TaskRow taskRow = (TaskRow) row; Task task = taskRow.task; mStack.removeTask(task, AnimationProps.IMMEDIATE); mStack.removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */); EventBus.getDefault().send(new DeleteTaskDataEvent(task)); i = removeTaskRow(i); } Loading Loading @@ -326,7 +326,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd public void onTaskRemoved(Task task, int position) { // Since this is removed from the history, we need to update the stack as well to ensure // that the model is correct. Since the stack is hidden, we can update it immediately. mStack.removeTask(task, AnimationProps.IMMEDIATE); mStack.removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */); removeTaskRow(position); if (mRows.isEmpty()) { dismissHistory(); Loading packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java +6 −5 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ public class TaskStack { * Notifies when a task has been removed from the stack. */ void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, Task newFrontMostTask, AnimationProps animation); Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture); /** * Notifies when a task has been removed from the history. Loading Loading @@ -513,14 +513,15 @@ public class TaskStack { * Removes a task from the stack, with an additional {@param animation} hint to the callbacks on * how they should update themselves. */ public void removeTask(Task t, AnimationProps animation) { public void removeTask(Task t, AnimationProps animation, boolean fromDockGesture) { if (mStackTaskList.contains(t)) { boolean wasFrontMostTask = (getStackFrontMostTask(false /* includeFreeform */) == t); removeTaskImpl(mStackTaskList, t); Task newFrontMostTask = getStackFrontMostTask(false /* includeFreeform */); if (mCb != null) { // Notify that a task has been removed mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation); mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation, fromDockGesture); } } else if (mHistoryTaskList.contains(t)) { removeTaskImpl(mHistoryTaskList, t); Loading Loading @@ -558,9 +559,9 @@ public class TaskStack { if (notifyStackChanges) { // If we are notifying, then remove the task now, otherwise the raw task list // will be reset at the end of this method removeTask(task, AnimationProps.IMMEDIATE); removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */); mCb.onStackTaskRemoved(this, task, i == (taskCount - 1), null, AnimationProps.IMMEDIATE); AnimationProps.IMMEDIATE, false /* fromDockGesture */); } } task.setGroup(null); Loading packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskStackHorizontalGridView.java +4 −2 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T @Override public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, Task newFrontMostTask, AnimationProps animation) { Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture) { getAdapter().notifyItemRemoved(stack.getStackTasks().indexOf(removedTask)); if (mFocusedTask == removedTask) { resetFocusedTask(removedTask); Loading @@ -144,7 +144,9 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T if (mStack.getStackTaskCount() == 0) { boolean shouldFinishActivity = (mStack.getStackTaskCount() == 0); if (shouldFinishActivity) { EventBus.getDefault().send(new AllTaskViewsDismissedEvent()); EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture ? R.string.recents_empty_message : R.string.recents_empty_message_dismissed_all)); } } } Loading Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -749,7 +749,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD public final void onBusEvent(AllTaskViewsDismissedEvent event) { SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.hasDockedTask()) { mRecentsView.showEmptyView(R.string.recents_empty_message_dismissed_all); mRecentsView.showEmptyView(event.msgResId); } else { // Just go straight home (no animation necessary because there are no more task views) dismissRecentsToHome(false /* animateTaskViews */); Loading
packages/SystemUI/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java +6 −1 Original line number Diff line number Diff line Loading @@ -22,5 +22,10 @@ import com.android.systemui.recents.events.EventBus; * This is sent whenever all the task views in a stack have been dismissed. */ public class AllTaskViewsDismissedEvent extends EventBus.Event { // Simple event public final int msgResId; public AllTaskViewsDismissedEvent(int msgResId) { this.msgResId = msgResId; } }
packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -245,7 +245,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd if (row.getViewType() == TASK_ROW_VIEW_TYPE) { TaskRow taskRow = (TaskRow) row; Task task = taskRow.task; mStack.removeTask(task, AnimationProps.IMMEDIATE); mStack.removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */); EventBus.getDefault().send(new DeleteTaskDataEvent(task)); i = removeTaskRow(i); } Loading Loading @@ -326,7 +326,7 @@ public class RecentsHistoryAdapter extends RecyclerView.Adapter<RecentsHistoryAd public void onTaskRemoved(Task task, int position) { // Since this is removed from the history, we need to update the stack as well to ensure // that the model is correct. Since the stack is hidden, we can update it immediately. mStack.removeTask(task, AnimationProps.IMMEDIATE); mStack.removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */); removeTaskRow(position); if (mRows.isEmpty()) { dismissHistory(); Loading
packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java +6 −5 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ public class TaskStack { * Notifies when a task has been removed from the stack. */ void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, Task newFrontMostTask, AnimationProps animation); Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture); /** * Notifies when a task has been removed from the history. Loading Loading @@ -513,14 +513,15 @@ public class TaskStack { * Removes a task from the stack, with an additional {@param animation} hint to the callbacks on * how they should update themselves. */ public void removeTask(Task t, AnimationProps animation) { public void removeTask(Task t, AnimationProps animation, boolean fromDockGesture) { if (mStackTaskList.contains(t)) { boolean wasFrontMostTask = (getStackFrontMostTask(false /* includeFreeform */) == t); removeTaskImpl(mStackTaskList, t); Task newFrontMostTask = getStackFrontMostTask(false /* includeFreeform */); if (mCb != null) { // Notify that a task has been removed mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation); mCb.onStackTaskRemoved(this, t, wasFrontMostTask, newFrontMostTask, animation, fromDockGesture); } } else if (mHistoryTaskList.contains(t)) { removeTaskImpl(mHistoryTaskList, t); Loading Loading @@ -558,9 +559,9 @@ public class TaskStack { if (notifyStackChanges) { // If we are notifying, then remove the task now, otherwise the raw task list // will be reset at the end of this method removeTask(task, AnimationProps.IMMEDIATE); removeTask(task, AnimationProps.IMMEDIATE, false /* fromDockGesture */); mCb.onStackTaskRemoved(this, task, i == (taskCount - 1), null, AnimationProps.IMMEDIATE); AnimationProps.IMMEDIATE, false /* fromDockGesture */); } } task.setGroup(null); Loading
packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskStackHorizontalGridView.java +4 −2 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T @Override public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, Task newFrontMostTask, AnimationProps animation) { Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture) { getAdapter().notifyItemRemoved(stack.getStackTasks().indexOf(removedTask)); if (mFocusedTask == removedTask) { resetFocusedTask(removedTask); Loading @@ -144,7 +144,9 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T if (mStack.getStackTaskCount() == 0) { boolean shouldFinishActivity = (mStack.getStackTaskCount() == 0); if (shouldFinishActivity) { EventBus.getDefault().send(new AllTaskViewsDismissedEvent()); EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture ? R.string.recents_empty_message : R.string.recents_empty_message_dismissed_all)); } } } Loading