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
This commit is contained in:
Evan Rosky
2021-07-02 17:16:04 -07:00
parent 5ca3820ae6
commit 17b6a3939f
3 changed files with 23 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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];
}
}
}

View File

@@ -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 */,