Make sure launcher side can animate divider
Fix divider target should pass to remote animation runner and add mIsDividerRemoteAnimating flag to eusure launcher side controlling the divider surface and shell side do not controll until remote animation finished. Bug: 202914644 Test: manual Test: pass existing tests Change-Id: I6411a609268274355a38c72fcb5d628b76b2340c
This commit is contained in:
@@ -374,7 +374,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
|
||||
RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) {
|
||||
if (!isSplitScreenVisible()) return null;
|
||||
if (apps.length < 2) return null;
|
||||
final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
|
||||
.setContainerLayer()
|
||||
.setName("RecentsAnimationSplitTasks")
|
||||
|
||||
@@ -369,6 +369,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
||||
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
||||
float splitRatio, RemoteAnimationAdapter adapter) {
|
||||
// Init divider first to make divider leash for remote animation target.
|
||||
mSplitLayout.init();
|
||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
// Need to add another wrapper here in shell so that we can inject the divider bar
|
||||
// and also manage the process elevation via setRunningRemote
|
||||
@@ -385,6 +387,15 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
augmentedNonApps[i] = nonApps[i];
|
||||
}
|
||||
augmentedNonApps[augmentedNonApps.length - 1] = getDividerBarLegacyTarget();
|
||||
|
||||
IRemoteAnimationFinishedCallback wrapCallback =
|
||||
new IRemoteAnimationFinishedCallback.Stub() {
|
||||
@Override
|
||||
public void onAnimationFinished() throws RemoteException {
|
||||
mSyncQueue.runInSync(t -> setDividerVisibility(true, t));
|
||||
finishedCallback.onAnimationFinished();
|
||||
}
|
||||
};
|
||||
try {
|
||||
try {
|
||||
ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
|
||||
@@ -393,8 +404,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
Slog.e(TAG, "Unable to boost animation thread. This should only happen"
|
||||
+ " during unit tests");
|
||||
}
|
||||
adapter.getRunner().onAnimationStart(transit, apps, wallpapers, nonApps,
|
||||
finishedCallback);
|
||||
adapter.getRunner().onAnimationStart(transit, apps, wallpapers,
|
||||
augmentedNonApps, wrapCallback);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Error starting remote animation", e);
|
||||
}
|
||||
@@ -402,6 +413,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
|
||||
@Override
|
||||
public void onAnimationCancelled() {
|
||||
mSyncQueue.runInSync(t -> setDividerVisibility(true, t));
|
||||
try {
|
||||
adapter.getRunner().onAnimationCancelled();
|
||||
} catch (RemoteException e) {
|
||||
@@ -868,9 +880,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
|
||||
private void applyDividerVisibility(SurfaceControl.Transaction t) {
|
||||
final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash();
|
||||
if (dividerLeash == null) {
|
||||
return;
|
||||
}
|
||||
if (dividerLeash == null) return;
|
||||
|
||||
if (mDividerVisible) {
|
||||
t.show(dividerLeash);
|
||||
@@ -895,11 +905,15 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
}
|
||||
} else if (isSideStage) {
|
||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
mSplitLayout.init();
|
||||
// Make sure the main stage is active.
|
||||
mMainStage.activate(getMainStageBounds(), wct, true /* reparent */);
|
||||
mSideStage.moveToTop(getSideStageBounds(), wct);
|
||||
mSyncQueue.queue(wct);
|
||||
mSyncQueue.runInSync(t -> updateSurfaceBounds(mSplitLayout, t));
|
||||
mSyncQueue.runInSync(t -> {
|
||||
updateSurfaceBounds(mSplitLayout, t);
|
||||
setDividerVisibility(true, t);
|
||||
});
|
||||
}
|
||||
if (mMainStageListener.mHasChildren && mSideStageListener.mHasChildren) {
|
||||
mShouldUpdateRecents = true;
|
||||
|
||||
Reference in New Issue
Block a user