Fix a couple issues with tracking launch cookies
- Fix NPE when there is no running task
- Fix issue where we were defaulting to a prediction icon when
there was no launch cookie
- Don't use a launch cookie when we are launching from a non-workspace
item, just fallback to the package name matching in that case
Fixes: 186653036
Fixes: 186593373
Test: Swipe up from various apps launched from predictions, also
launch an app from all apps and swipe up and ensure it
doesn't match a prediction
Change-Id: Ie8f5da010c140a5056045ac268d082c80271ab68
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index 7aae38c..910e473 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -443,6 +443,19 @@
if (info == null) {
return;
}
+ switch (info.container) {
+ case LauncherSettings.Favorites.CONTAINER_DESKTOP:
+ case LauncherSettings.Favorites.CONTAINER_HOTSEAT:
+ // Fall through and continue it's on the workspace (we don't support swiping back
+ // to other containers like all apps or the hotseat predictions (which can change)
+ break;
+ default:
+ if (info.container >= 0) {
+ // Also allow swiping to folders
+ break;
+ }
+ return;
+ }
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 61803aa..883b029 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -1095,8 +1095,10 @@
final RemoteAnimationTargetCompat runningTaskTarget = mRecentsAnimationTargets != null
? mRecentsAnimationTargets.findTask(mGestureState.getRunningTaskId())
: null;
- HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(
- runningTaskTarget.taskInfo.launchCookies, duration);
+ final ArrayList<IBinder> cookies = runningTaskTarget != null
+ ? runningTaskTarget.taskInfo.launchCookies
+ : new ArrayList<>();
+ HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(cookies, duration);
mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome()
&& runningTaskTarget != null
&& runningTaskTarget.taskInfo.pictureInPictureParams != null
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index dd35d68..2ea34d7 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -244,8 +244,9 @@
return null;
}
- // Find the associated item info for the launch cookie (if available)
- int launchCookieItemId = -1;
+ // Find the associated item info for the launch cookie (if available), note that predicted
+ // apps actually have an id of -1, so use another default id here
+ int launchCookieItemId = -2;
for (IBinder cookie : launchCookies) {
Integer itemId = ObjectWrapper.unwrap(cookie);
if (itemId != null) {