OSDN Git Service

Reload tasks when doing drag gesture
authorJorim Jaggi <jjaggi@google.com>
Tue, 24 Nov 2015 23:09:30 +0000 (15:09 -0800)
committerJorim Jaggi <jjaggi@google.com>
Tue, 24 Nov 2015 23:09:30 +0000 (15:09 -0800)
To make sure we always have the updated stack id's
for the task.

Change-Id: I8bfda33aa26b470cb5f087cee9e8e8560c0e3ba2

packages/SystemUI/src/com/android/systemui/recents/IRecentsNonSystemUserCallbacks.aidl
packages/SystemUI/src/com/android/systemui/recents/Recents.java
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java

index 69e9359..b36b95a 100644 (file)
@@ -24,7 +24,8 @@ package com.android.systemui.recents;
 oneway interface IRecentsNonSystemUserCallbacks {
     void preloadRecents();
     void cancelPreloadingRecents();
-    void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate);
+    void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate,
+            boolean reloadTasks);
     void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
     void toggleRecents();
     void onConfigurationChanged();
index f5c6914..c98ecb5 100644 (file)
@@ -215,7 +215,8 @@ public class Recents extends SystemUI
 
         int currentUser = sSystemServicesProxy.getCurrentUser();
         if (sSystemServicesProxy.isSystemUser(currentUser)) {
-            mImpl.showRecents(triggeredFromAltTab, false /* draggingInRecents */, true /* animate */);
+            mImpl.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
+                    true /* animate */, false /* reloadTasks */);
         } else {
             if (mSystemUserCallbacks != null) {
                 IRecentsNonSystemUserCallbacks callbacks =
@@ -223,7 +224,7 @@ public class Recents extends SystemUI
                 if (callbacks != null) {
                     try {
                         callbacks.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
-                                true /* animate */);
+                                true /* animate */, false /* reloadTasks */);
                     } catch (RemoteException e) {
                         Log.e(TAG, "Callback failed", e);
                     }
index 92978f2..16b1592 100644 (file)
@@ -448,6 +448,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
         launchState.launchedToTaskId = -1;
         launchState.launchedWithAltTab = false;
         launchState.launchedHasConfigurationChanged = false;
+        launchState.launchedViaDragGesture = false;
 
         MetricsLogger.hidden(this, MetricsLogger.OVERVIEW_ACTIVITY);
     }
index a1e5118..8dd9e47 100644 (file)
@@ -46,6 +46,7 @@ public class RecentsActivityLaunchState {
         launchedReuseTaskStackViews = false;
         // Set this flag to indicate that the configuration has changed since Recents last launched
         launchedHasConfigurationChanged = true;
+        launchedViaDragGesture = false;
     }
 
     /** Returns whether the status bar scrim should be animated when shown for the first time. */
index 4e08081..ee57863 100644 (file)
@@ -144,6 +144,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
     boolean mBootCompleted;
     boolean mCanReuseTaskStackViews = true;
     boolean mDraggingInRecents;
+    boolean mReloadTasks;
 
     // Task launching
     Rect mSearchBarBounds = new Rect();
@@ -168,7 +169,8 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
         public void run() {
             // When this fires, then the user has not released alt-tab for at least
             // FAST_ALT_TAB_DELAY_MS milliseconds
-            showRecents(mTriggeredFromAltTab, false /* draggingInRecents */, true /* animate */);
+            showRecents(mTriggeredFromAltTab, false /* draggingInRecents */, true /* animate */,
+                    false /* reloadTasks */);
         }
     });
 
@@ -252,9 +254,10 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
 
     @Override
     public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents,
-            boolean animate) {
+            boolean animate, boolean reloadTasks) {
         mTriggeredFromAltTab = triggeredFromAltTab;
         mDraggingInRecents = draggingInRecents;
+        mReloadTasks = reloadTasks;
         if (mFastAltTabTrigger.hasTriggered()) {
             // We are calling this from the doze trigger, so just fall through to show Recents
             mFastAltTabTrigger.resetTrigger();
@@ -543,7 +546,8 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
         if (topTask != null && !SystemServicesProxy.isHomeStack(topTask.stackId)) {
             ssp.moveTaskToDockedStack(topTask.id,
                     ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT, initialBounds);
-            showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */);
+            showRecents(false /* triggeredFromAltTab */, draggingInRecents, false /* animate */,
+                    true /* reloadTasks*/);
         }
     }
 
@@ -800,12 +804,13 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
         reloadHeaderBarLayout(false /* tryAndBindSearchWidget */);
 
         // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we
-        // should always preload the tasks now
-        if (mTriggeredFromAltTab ||sInstanceLoadPlan == null) {
+        // should always preload the tasks now. If we are dragging in recents, reload them as
+        // the stacks might have changed.
+        if (mReloadTasks || mTriggeredFromAltTab ||sInstanceLoadPlan == null) {
             // Create a new load plan if preloadRecents() was never triggered
             sInstanceLoadPlan = loader.createLoadPlan(mContext);
         }
-        if (mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) {
+        if (mReloadTasks || mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) {
             loader.preloadTasks(sInstanceLoadPlan, isTopTaskHome);
         }
         TaskStack stack = sInstanceLoadPlan.getTaskStack();