diff options
8 files changed, 28 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index f33ef654eaf7..aab45b5d02f6 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -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 */); diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java index cf74519624ea..0352161be570 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java @@ -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; + } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java index 5eeda72637ea..16385c9ab358 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryAdapter.java @@ -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); } @@ -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(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java index 4d1c552f2687..193bfffffd9f 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java +++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java @@ -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. @@ -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); @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskStackHorizontalGridView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskStackHorizontalGridView.java index 4458639acfad..cf8c9bb38b7c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskStackHorizontalGridView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskStackHorizontalGridView.java @@ -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); @@ -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)); } } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index 92356736763e..db97e8f95b55 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -632,7 +632,8 @@ public class RecentsView extends FrameLayout { AnimationProps stackAnim = new AnimationProps( TaskStackView.DEFAULT_SYNC_STACK_DURATION, Interpolators.FAST_OUT_SLOW_IN); - mTaskStackView.getStack().removeTask(event.task, stackAnim); + mTaskStackView.getStack().removeTask(event.task, stackAnim, + true /* fromDockGesture */); } })); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java index 84590f25149f..33d5bb7b0c99 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java @@ -150,8 +150,7 @@ public class RecentsViewTouchHandler { mTaskView.setTranslationY(y); mVisibleDockStates.clear(); - if (ActivityManager.supportsMultiWindow() && - !ssp.hasDockedTask() && mRv.getTaskStack().getTaskCount() > 1) { + if (ActivityManager.supportsMultiWindow() && !ssp.hasDockedTask()) { if (!event.task.isDockable) { Toast.makeText(mRv.getContext(), R.string.recents_drag_non_dockable_task_message, Toast.LENGTH_SHORT).show(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 93b5b6c12904..0b20d21d806c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -1395,7 +1395,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal */ @Override public void onStackTaskRemoved(TaskStack stack, Task removedTask, boolean wasFrontMostTask, - Task newFrontMostTask, AnimationProps animation) { + Task newFrontMostTask, AnimationProps animation, boolean fromDockGesture) { if (mFocusedTask == removedTask) { resetFocusedTask(removedTask); } @@ -1426,7 +1426,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // If there are no remaining tasks, then just close recents if (mStack.getTaskCount() == 0) { - EventBus.getDefault().send(new AllTaskViewsDismissedEvent()); + EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture + ? R.string.recents_empty_message + : R.string.recents_empty_message_dismissed_all)); } } @@ -1599,7 +1601,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal tv.dismissTask(); } else { // Otherwise, remove the task from the stack immediately - mStack.removeTask(t, AnimationProps.IMMEDIATE); + mStack.removeTask(t, AnimationProps.IMMEDIATE, false /* fromDockGesture */); } } } @@ -1937,7 +1939,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Remove the task from the stack mStack.removeTask(task, new AnimationProps(DEFAULT_SYNC_STACK_DURATION, - Interpolators.FAST_OUT_SLOW_IN)); + Interpolators.FAST_OUT_SLOW_IN), false /* fromDockGesture */); } /** |