Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +0 −9 Original line number Diff line number Diff line Loading @@ -283,8 +283,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView * Dismisses recents if we are already visible and the intent is to toggle the recents view. */ boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first Loading @@ -292,13 +290,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView mRecentsView.unfilterFilteredStacks()) return true; // If we have a focused Task, launch that Task now if (mRecentsView.launchFocusedTask()) return true; // If we launched from Home, then return to Home if (launchState.launchedFromHome) { dismissRecentsToHome(true); return true; } // Otherwise, try and return to the Task that Recents was launched from if (mRecentsView.launchPreviousTask()) return true; // If none of the other cases apply, then just go Home dismissRecentsToHome(true); return true; Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +37 −0 Original line number Diff line number Diff line Loading @@ -70,4 +70,41 @@ public class RecentsActivityLaunchState { RecentsConfiguration config = Recents.getConfiguration(); return !launchedWithNoRecentTasks && !config.hasTransposedNavBar; } /** * Returns the task to focus given the current launch state. */ public int getInitialFocusTaskIndex(int numTasks) { if (Constants.DebugFlags.App.EnableFastToggleRecents && !launchedWithAltTab) { // If we are fast toggling, then focus the next task depending on when you are on home // or coming in from another app if (launchedFromHome) { return numTasks - 1; } else { return numTasks - 2; } } if (launchedWithAltTab && launchedFromAppWithThumbnail) { // If alt-tabbing from another app, focus the next task return numTasks - 2; } else if ((launchedWithAltTab && launchedFromHome) || (!launchedWithAltTab && launchedFromAppWithThumbnail)) { // If alt-tabbing from home, or launching from an app normally, focus that task return numTasks - 1; } else { // Otherwise, we are launching recents from home normally, focus no tasks so that we // know to return home return -1; } } @Override public String toString() { return "RecentsActivityLaunchState altTab: " + launchedWithAltTab + ", noTasks: " + launchedWithNoRecentTasks + ", fromHome: " + launchedFromHome + ", fromSearchHome: " + launchedFromSearchHome + ", reuse: " + launchedReuseTaskStackViews; } } packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -272,7 +272,10 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask(); MutableBoolean isTopTaskHome = new MutableBoolean(true); if (topTask != null && ssp.isRecentsTopMost(topTask, isTopTaskHome)) { if (Constants.DebugFlags.App.EnableFastToggleRecents) { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); if (Constants.DebugFlags.App.EnableFastToggleRecents && !launchState.launchedWithAltTab) { // Notify recents to move onto the next task EventBus.getDefault().post(new IterateRecentsEvent()); } else { Loading Loading @@ -677,7 +680,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub */ private void startRecentsActivity(ActivityManager.RunningTaskInfo topTask, boolean isTopTaskHome) { SystemServicesProxy ssp = Recents.getSystemServices(); RecentsTaskLoader loader = Recents.getTaskLoader(); // Update the header bar if necessary Loading Loading @@ -717,6 +719,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition and do the animation from home if (!Constants.DebugFlags.App.DisableSearchBar && hasRecentTasks) { SystemServicesProxy ssp = Recents.getSystemServices(); String homeActivityPackage = ssp.getHomeActivityPackageName(); String searchWidgetPackage = Prefs.getString(mContext, Prefs.Key.SEARCH_APP_WIDGET_PACKAGE, null); Loading packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +0 −24 Original line number Diff line number Diff line Loading @@ -220,30 +220,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV return false; } /** Launches the task that Recents was launched from, if possible */ public boolean launchPreviousTask() { if (mTaskStackView != null) { TaskStack stack = mTaskStackView.getStack(); ArrayList<Task> tasks = stack.getTasks(); // Find the launch task in the stack // TODO: replace this with an event from RecentsActivity if (!tasks.isEmpty()) { int taskCount = tasks.size(); for (int j = 0; j < taskCount; j++) { if (tasks.get(j).isLaunchTarget) { Task task = tasks.get(j); TaskView tv = mTaskStackView.getChildViewForTask(task); onTaskViewClicked(mTaskStackView, tv, stack, task, false, false, null, INVALID_STACK_ID); return true; } } } } return false; } /** Requests all task stacks to start their enter-recents animation */ public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx) { // We have to increment/decrement the post animation trigger in case there are no children Loading packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +6 −9 Original line number Diff line number Diff line Loading @@ -824,15 +824,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Set the task focused state without requesting view focus, and leave the focus animations // until after the enter-animation if (!Constants.DebugFlags.App.EnableFastToggleRecents && launchTargetTask != null) { setFocusedTask(mStack.indexOfTask(launchTargetTask), false /* scrollToTask */, false /* animated */, false /* requestViewFocus */); } else { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); int taskOffset = launchState.launchedFromHome ? -1 : -2; setFocusedTask(mStack.getTaskCount() + taskOffset, false /* scrollToTask */, false /* animated */, false /* requestViewFocus */); int focusedTaskIndex = launchState.getInitialFocusTaskIndex(mStack.getTaskCount()); if (focusedTaskIndex != -1) { setFocusedTask(focusedTaskIndex, false /* scrollToTask */, false /* animated */, false /* requestViewFocus */); } // Start dozing Loading Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +0 −9 Original line number Diff line number Diff line Loading @@ -283,8 +283,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView * Dismisses recents if we are already visible and the intent is to toggle the recents view. */ boolean dismissRecentsToFocusedTaskOrHome(boolean checkFilteredStackState) { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); SystemServicesProxy ssp = Recents.getSystemServices(); if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) { // If we currently have filtered stacks, then unfilter those first Loading @@ -292,13 +290,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView mRecentsView.unfilterFilteredStacks()) return true; // If we have a focused Task, launch that Task now if (mRecentsView.launchFocusedTask()) return true; // If we launched from Home, then return to Home if (launchState.launchedFromHome) { dismissRecentsToHome(true); return true; } // Otherwise, try and return to the Task that Recents was launched from if (mRecentsView.launchPreviousTask()) return true; // If none of the other cases apply, then just go Home dismissRecentsToHome(true); return true; Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +37 −0 Original line number Diff line number Diff line Loading @@ -70,4 +70,41 @@ public class RecentsActivityLaunchState { RecentsConfiguration config = Recents.getConfiguration(); return !launchedWithNoRecentTasks && !config.hasTransposedNavBar; } /** * Returns the task to focus given the current launch state. */ public int getInitialFocusTaskIndex(int numTasks) { if (Constants.DebugFlags.App.EnableFastToggleRecents && !launchedWithAltTab) { // If we are fast toggling, then focus the next task depending on when you are on home // or coming in from another app if (launchedFromHome) { return numTasks - 1; } else { return numTasks - 2; } } if (launchedWithAltTab && launchedFromAppWithThumbnail) { // If alt-tabbing from another app, focus the next task return numTasks - 2; } else if ((launchedWithAltTab && launchedFromHome) || (!launchedWithAltTab && launchedFromAppWithThumbnail)) { // If alt-tabbing from home, or launching from an app normally, focus that task return numTasks - 1; } else { // Otherwise, we are launching recents from home normally, focus no tasks so that we // know to return home return -1; } } @Override public String toString() { return "RecentsActivityLaunchState altTab: " + launchedWithAltTab + ", noTasks: " + launchedWithNoRecentTasks + ", fromHome: " + launchedFromHome + ", fromSearchHome: " + launchedFromSearchHome + ", reuse: " + launchedReuseTaskStackViews; } }
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -272,7 +272,10 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask(); MutableBoolean isTopTaskHome = new MutableBoolean(true); if (topTask != null && ssp.isRecentsTopMost(topTask, isTopTaskHome)) { if (Constants.DebugFlags.App.EnableFastToggleRecents) { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); if (Constants.DebugFlags.App.EnableFastToggleRecents && !launchState.launchedWithAltTab) { // Notify recents to move onto the next task EventBus.getDefault().post(new IterateRecentsEvent()); } else { Loading Loading @@ -677,7 +680,6 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub */ private void startRecentsActivity(ActivityManager.RunningTaskInfo topTask, boolean isTopTaskHome) { SystemServicesProxy ssp = Recents.getSystemServices(); RecentsTaskLoader loader = Recents.getTaskLoader(); // Update the header bar if necessary Loading Loading @@ -717,6 +719,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition and do the animation from home if (!Constants.DebugFlags.App.DisableSearchBar && hasRecentTasks) { SystemServicesProxy ssp = Recents.getSystemServices(); String homeActivityPackage = ssp.getHomeActivityPackageName(); String searchWidgetPackage = Prefs.getString(mContext, Prefs.Key.SEARCH_APP_WIDGET_PACKAGE, null); Loading
packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +0 −24 Original line number Diff line number Diff line Loading @@ -220,30 +220,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV return false; } /** Launches the task that Recents was launched from, if possible */ public boolean launchPreviousTask() { if (mTaskStackView != null) { TaskStack stack = mTaskStackView.getStack(); ArrayList<Task> tasks = stack.getTasks(); // Find the launch task in the stack // TODO: replace this with an event from RecentsActivity if (!tasks.isEmpty()) { int taskCount = tasks.size(); for (int j = 0; j < taskCount; j++) { if (tasks.get(j).isLaunchTarget) { Task task = tasks.get(j); TaskView tv = mTaskStackView.getChildViewForTask(task); onTaskViewClicked(mTaskStackView, tv, stack, task, false, false, null, INVALID_STACK_ID); return true; } } } } return false; } /** Requests all task stacks to start their enter-recents animation */ public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx) { // We have to increment/decrement the post animation trigger in case there are no children Loading
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +6 −9 Original line number Diff line number Diff line Loading @@ -824,15 +824,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // Set the task focused state without requesting view focus, and leave the focus animations // until after the enter-animation if (!Constants.DebugFlags.App.EnableFastToggleRecents && launchTargetTask != null) { setFocusedTask(mStack.indexOfTask(launchTargetTask), false /* scrollToTask */, false /* animated */, false /* requestViewFocus */); } else { RecentsConfiguration config = Recents.getConfiguration(); RecentsActivityLaunchState launchState = config.getLaunchState(); int taskOffset = launchState.launchedFromHome ? -1 : -2; setFocusedTask(mStack.getTaskCount() + taskOffset, false /* scrollToTask */, false /* animated */, false /* requestViewFocus */); int focusedTaskIndex = launchState.getInitialFocusTaskIndex(mStack.getTaskCount()); if (focusedTaskIndex != -1) { setFocusedTask(focusedTaskIndex, false /* scrollToTask */, false /* animated */, false /* requestViewFocus */); } // Start dozing Loading