From 32820e89e30aa04e46d8f7642295f100ecd578ab Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Wed, 3 Aug 2022 03:56:43 +0000 Subject: [PATCH] Fix no action menu for split pairs in overview panel The splitting tasks will be reparented to RecentAnimationSplitTasks overlay layer in order to animate them together. However, the other animating apps should also be placed to the same overlay layer so all of them can be layered properly during the transition. Bug: 239630217 Test: action menu shows above split pairs in overview panel Change-Id: I4dda71317bb61775664dcbfe1cee9a099aca872f --- .../quickstep/RecentsAnimationCallbacks.java | 20 ++++------- .../quickstep/TaskAnimationManager.java | 33 +++++++------------ 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java index 51ae56b96d..c60232424d 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java @@ -16,7 +16,6 @@ package com.android.quickstep; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; -import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME; import android.graphics.Rect; import android.util.ArraySet; @@ -97,18 +96,6 @@ public class RecentsAnimationCallbacks implements RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, Rect homeContentInsets, Rect minimizedHomeBounds) { - // Convert appTargets to type RemoteAnimationTarget for all apps except Home app - RemoteAnimationTarget[] nonHomeApps = Arrays.stream(appTargets) - .filter(remoteAnimationTarget -> - remoteAnimationTarget.activityType != ACTIVITY_TYPE_HOME) - .map(RemoteAnimationTargetCompat::unwrap) - .toArray(RemoteAnimationTarget[]::new); - - RemoteAnimationTarget[] nonAppTargets = mSystemUiProxy.onGoingToRecentsLegacy(nonHomeApps); - - RecentsAnimationTargets targets = new RecentsAnimationTargets(appTargets, - wallpaperTargets, RemoteAnimationTargetCompat.wrap(nonAppTargets), - homeContentInsets, minimizedHomeBounds); mController = new RecentsAnimationController(animationController, mAllowMinimizeSplitScreen, this::onAnimationFinished); @@ -116,6 +103,13 @@ public class RecentsAnimationCallbacks implements Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), mController::finishAnimationToApp); } else { + final RemoteAnimationTarget[] nonAppTargets = mSystemUiProxy.onGoingToRecentsLegacy( + Arrays.stream(appTargets).map(RemoteAnimationTargetCompat::unwrap) + .toArray(RemoteAnimationTarget[]::new)); + final RecentsAnimationTargets targets = new RecentsAnimationTargets(appTargets, + wallpaperTargets, RemoteAnimationTargetCompat.wrap(nonAppTargets), + homeContentInsets, minimizedHomeBounds); + Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> { for (RecentsAnimationListener listener : getListeners()) { listener.onRecentsAnimationStart(mController, targets); diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index fd7e3673b3..03147619e5 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -45,7 +45,7 @@ import com.android.systemui.shared.system.RemoteTransitionCompat; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.shared.system.TaskStackChangeListeners; -import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener { @@ -156,30 +156,21 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn public void onTasksAppeared(RemoteAnimationTargetCompat[] appearedTaskTargets) { RemoteAnimationTargetCompat appearedTaskTarget = appearedTaskTargets[0]; BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface(); - // Convert appTargets to type RemoteAnimationTarget for all apps except Home app - final ArrayList tmpNonHomeApps = new ArrayList<>(); - final ArrayList tmpHomeApps = new ArrayList<>(); + for (RemoteAnimationTargetCompat compat : appearedTaskTargets) { - if (compat.activityType != ACTIVITY_TYPE_HOME) { - tmpNonHomeApps.add(compat); - } else { - tmpHomeApps.add(compat); + if (compat.activityType == ACTIVITY_TYPE_HOME + && activityInterface.getCreatedActivity() instanceof RecentsActivity) { + // When receive opening home activity while recents is running, enter home + // and dismiss recents. + ((RecentsActivity) activityInterface.getCreatedActivity()).startHome(); + return; } } - RemoteAnimationTarget[] nonHomeApps = tmpNonHomeApps.stream() - .map(RemoteAnimationTargetCompat::unwrap) - .toArray(RemoteAnimationTarget[]::new); - RemoteAnimationTarget[] homeApps = tmpHomeApps.stream() - .map(RemoteAnimationTargetCompat::unwrap) - .toArray(RemoteAnimationTarget[]::new); - if (homeApps.length > 0 - && activityInterface.getCreatedActivity() instanceof RecentsActivity) { - ((RecentsActivity) activityInterface.getCreatedActivity()).startHome(); - return; - } - RemoteAnimationTarget[] nonAppTargets = - SystemUiProxy.INSTANCE.getNoCreate().onStartingSplitLegacy(nonHomeApps); + RemoteAnimationTarget[] nonAppTargets = SystemUiProxy.INSTANCE.getNoCreate() + .onStartingSplitLegacy(Arrays.stream(appearedTaskTargets) + .map(RemoteAnimationTargetCompat::unwrap) + .toArray(RemoteAnimationTarget[]::new)); if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityInterface.isInLiveTileMode() && activityInterface.getCreatedActivity() != null) {