diff options
author | Winson Chung <winsonc@google.com> | 2015-01-20 11:44:05 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2015-01-20 11:44:05 -0800 |
commit | 2cf8b221fca18dbee3703388ae7970491c86ec7f (patch) | |
tree | 1e7833868f454dd2beb6b8d471d377a246a8f786 /packages/SystemUI/src/com/android/systemui/recents/Recents.java | |
parent | 8d2e8e2bf7341aa8d4b5c0ea5ce038e745275324 (diff) | |
download | frameworks_base-2cf8b221fca18dbee3703388ae7970491c86ec7f.zip frameworks_base-2cf8b221fca18dbee3703388ae7970491c86ec7f.tar.gz frameworks_base-2cf8b221fca18dbee3703388ae7970491c86ec7f.tar.bz2 |
Cherry picking recents fixes to screen pinning and visibility.
Screen pinning fix - 98e8f7ac5e75a47abaa0061aab343b9f06770258
Visibility fix - 5675f018681faefeb50c9003bc9e02cd9ce5659d
Bug 18986736, 18802531
Change-Id: Ia37dbcd4f82e80f47f9c0686ed2ad4f534f946a7
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recents/Recents.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/Recents.java | 62 |
1 files changed, 16 insertions, 46 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 7d7766b..3c75aac 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -88,9 +88,9 @@ public class Recents extends SystemUI final static int sMinToggleDelay = 350; - final static String sToggleRecentsAction = "com.android.systemui.recents.SHOW_RECENTS"; - final static String sRecentsPackage = "com.android.systemui"; - final static String sRecentsActivity = "com.android.systemui.recents.RecentsActivity"; + public final static String sToggleRecentsAction = "com.android.systemui.recents.SHOW_RECENTS"; + public final static String sRecentsPackage = "com.android.systemui"; + public final static String sRecentsActivity = "com.android.systemui.recents.RecentsActivity"; /** * An implementation of ITaskStackListener, that allows us to listen for changes to the system @@ -114,10 +114,11 @@ public class Recents extends SystemUI public void run() { RecentsConfiguration config = RecentsConfiguration.getInstance(); if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) { - ActivityManager.RunningTaskInfo runningTaskInfo = getTopMostTask(); + RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); + SystemServicesProxy ssp = loader.getSystemServicesProxy(); + ActivityManager.RunningTaskInfo runningTaskInfo = ssp.getTopMostTask(); // Load the next task only if we aren't svelte - RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext); loader.preloadTasks(plan, true /* isTopTaskHome */); RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options(); @@ -300,8 +301,8 @@ public class Recents extends SystemUI void hideRecentsInternal(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { if (mBootCompleted) { - ActivityManager.RunningTaskInfo topTask = getTopMostTask(); - if (topTask != null && isRecentsTopMost(topTask, null)) { + ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); + if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, null)) { // Notify recents to hide itself Intent intent = createLocalBroadcastIntent(mContext, ACTION_HIDE_RECENTS_ACTIVITY); intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, triggeredFromAltTab); @@ -369,7 +370,7 @@ public class Recents extends SystemUI // Return early if there are no tasks if (stack.getTaskCount() == 0) return; - ActivityManager.RunningTaskInfo runningTask = getTopMostTask(); + ActivityManager.RunningTaskInfo runningTask = mSystemServicesProxy.getTopMostTask(); // Return early if there is no running task (can't determine affiliated tasks in this case) if (runningTask == null) return; // Return early if the running task is in the home stack (optimization) @@ -515,38 +516,6 @@ public class Recents extends SystemUI } } - /** Gets the top task. */ - ActivityManager.RunningTaskInfo getTopMostTask() { - SystemServicesProxy ssp = mSystemServicesProxy; - List<ActivityManager.RunningTaskInfo> tasks = ssp.getRunningTasks(1); - if (!tasks.isEmpty()) { - return tasks.get(0); - } - return null; - } - - /** Returns whether the recents is currently running */ - boolean isRecentsTopMost(ActivityManager.RunningTaskInfo topTask, AtomicBoolean isHomeTopMost) { - SystemServicesProxy ssp = mSystemServicesProxy; - if (topTask != null) { - ComponentName topActivity = topTask.topActivity; - - // Check if the front most activity is recents - if (topActivity.getPackageName().equals(sRecentsPackage) && - topActivity.getClassName().equals(sRecentsActivity)) { - if (isHomeTopMost != null) { - isHomeTopMost.set(false); - } - return true; - } - - if (isHomeTopMost != null) { - isHomeTopMost.set(ssp.isInHomeStack(topTask.id)); - } - } - return false; - } - /** Toggles the recents activity */ void toggleRecentsActivity() { // If the user has toggled it too quickly, then just eat up the event here (it's better than @@ -558,9 +527,9 @@ public class Recents extends SystemUI // If Recents is the front most activity, then we should just communicate with it directly // to launch the first task or dismiss itself - ActivityManager.RunningTaskInfo topTask = getTopMostTask(); + ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); AtomicBoolean isTopTaskHome = new AtomicBoolean(true); - if (topTask != null && isRecentsTopMost(topTask, isTopTaskHome)) { + if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) { // Notify recents to toggle itself Intent intent = createLocalBroadcastIntent(mContext, ACTION_TOGGLE_RECENTS_ACTIVITY); mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); @@ -575,9 +544,9 @@ public class Recents extends SystemUI /** Starts the recents activity if it is not already running */ void startRecentsActivity() { // Check if the top task is in the home stack, and start the recents activity - ActivityManager.RunningTaskInfo topTask = getTopMostTask(); + ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); AtomicBoolean isTopTaskHome = new AtomicBoolean(true); - if (topTask == null || !isRecentsTopMost(topTask, isTopTaskHome)) { + if (topTask == null || !mSystemServicesProxy.isRecentsTopMost(topTask, isTopTaskHome)) { startRecentsActivity(topTask, isTopTaskHome.get()); } } @@ -677,12 +646,13 @@ public class Recents extends SystemUI /** Starts the recents activity */ void startRecentsActivity(ActivityManager.RunningTaskInfo topTask, boolean isTopTaskHome) { + RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); + RecentsConfiguration.reinitialize(mContext, mSystemServicesProxy); + if (sInstanceLoadPlan == null) { // Create a new load plan if onPreloadRecents() was never triggered - RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); sInstanceLoadPlan = loader.createLoadPlan(mContext); } - RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); loader.preloadTasks(sInstanceLoadPlan, isTopTaskHome); TaskStack stack = sInstanceLoadPlan.getTaskStack(); |