From 17b6a3939f46a02bfe3c049ca2c87419213ce584 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Fri, 2 Jul 2021 17:16:04 -0700 Subject: [PATCH] Hooks for interracting with stage split components using legacy recentsanimation Recents is pretty complicated, so the best way to deal with this is to have launcher notify/query shell when entering recents. This gives shell a chance to prepare and then provide relevant leashes (for now just the bar, but it may include others in the future like side- outline). Bug: 192292305 Test: Enable SPLIT_SELECT and go to recents from split. Change-Id: Iff6b14a1b0b95f207bdaa341c62fc6582659e923 --- .../wm/shell/splitscreen/ISplitScreen.aidl | 7 +++++++ .../shell/splitscreen/SplitScreenController.java | 15 +++++++++++++++ .../wm/shell/splitscreen/StageCoordinator.java | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl index 2427d53f48422..df1f5e67e4e2e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl @@ -90,4 +90,11 @@ interface ISplitScreen { oneway void startTasksWithLegacyTransition(int mainTaskId, in Bundle mainOptions, int sideTaskId, in Bundle sideOptions, int sidePosition, in RemoteAnimationAdapter adapter) = 11; + + /** + * Blocking call that notifies and gets additional split-screen targets when entering + * recents (for example: the dividerBar). + * @param cancel is true if leaving recents back to split (eg. the gesture was cancelled). + */ + RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) = 12; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 197409d6d07f1..36b2777ec3c44 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -40,6 +40,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.util.Slog; import android.view.RemoteAnimationAdapter; +import android.view.RemoteAnimationTarget; import android.window.IRemoteTransition; import androidx.annotation.BinderThread; @@ -267,6 +268,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, return options; } + RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) { + if (!isSplitScreenVisible()) return null; + return new RemoteAnimationTarget[]{mStageCoordinator.getDividerBarLegacyTarget()}; + } + public void dump(@NonNull PrintWriter pw, String prefix) { pw.println(prefix + TAG); if (mStageCoordinator != null) { @@ -466,5 +472,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, controller.startIntent(intent, fillInIntent, stage, position, options); }); } + + @Override + public RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) { + final RemoteAnimationTarget[][] out = new RemoteAnimationTarget[][]{null}; + executeRemoteCallWithTaskPermission(mController, "onGoingToRecentsLegacy", + (controller) -> out[0] = controller.onGoingToRecentsLegacy(cancel), + true /* blocking */); + return out[0]; + } } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index bc4827315f824..4e91193f65551 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -970,7 +970,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, } } - private RemoteAnimationTarget getDividerBarLegacyTarget() { + RemoteAnimationTarget getDividerBarLegacyTarget() { final Rect bounds = mSplitLayout.getDividerBounds(); return new RemoteAnimationTarget(-1 /* taskId */, -1 /* mode */, mSplitLayout.getDividerLeash(), false /* isTranslucent */, null /* clipRect */,