Merge "Make sure launcher side can animate divider" into sc-v2-dev
This commit is contained in:
@@ -363,7 +363,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) {
|
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())
|
final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
|
||||||
.setContainerLayer()
|
.setContainerLayer()
|
||||||
.setName("RecentsAnimationSplitTasks")
|
.setName("RecentsAnimationSplitTasks")
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
private boolean mExitSplitScreenOnHide;
|
private boolean mExitSplitScreenOnHide;
|
||||||
private boolean mKeyguardOccluded;
|
private boolean mKeyguardOccluded;
|
||||||
private boolean mDeviceSleep;
|
private boolean mDeviceSleep;
|
||||||
|
private boolean mIsDividerRemoteAnimating;
|
||||||
|
|
||||||
@StageType
|
@StageType
|
||||||
private int mDismissTop = NO_DISMISS;
|
private int mDismissTop = NO_DISMISS;
|
||||||
@@ -364,6 +365,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
||||||
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
||||||
float splitRatio, RemoteAnimationAdapter adapter) {
|
float splitRatio, RemoteAnimationAdapter adapter) {
|
||||||
|
// Init divider first to make divider leash for remote animation target.
|
||||||
|
setDividerVisibility(true /* visible */);
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
// Need to add another wrapper here in shell so that we can inject the divider bar
|
// Need to add another wrapper here in shell so that we can inject the divider bar
|
||||||
// and also manage the process elevation via setRunningRemote
|
// and also manage the process elevation via setRunningRemote
|
||||||
@@ -374,12 +377,23 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
RemoteAnimationTarget[] wallpapers,
|
RemoteAnimationTarget[] wallpapers,
|
||||||
RemoteAnimationTarget[] nonApps,
|
RemoteAnimationTarget[] nonApps,
|
||||||
final IRemoteAnimationFinishedCallback finishedCallback) {
|
final IRemoteAnimationFinishedCallback finishedCallback) {
|
||||||
|
mIsDividerRemoteAnimating = true;
|
||||||
RemoteAnimationTarget[] augmentedNonApps =
|
RemoteAnimationTarget[] augmentedNonApps =
|
||||||
new RemoteAnimationTarget[nonApps.length + 1];
|
new RemoteAnimationTarget[nonApps.length + 1];
|
||||||
for (int i = 0; i < nonApps.length; ++i) {
|
for (int i = 0; i < nonApps.length; ++i) {
|
||||||
augmentedNonApps[i] = nonApps[i];
|
augmentedNonApps[i] = nonApps[i];
|
||||||
}
|
}
|
||||||
augmentedNonApps[augmentedNonApps.length - 1] = getDividerBarLegacyTarget();
|
augmentedNonApps[augmentedNonApps.length - 1] = getDividerBarLegacyTarget();
|
||||||
|
|
||||||
|
IRemoteAnimationFinishedCallback wrapCallback =
|
||||||
|
new IRemoteAnimationFinishedCallback.Stub() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationFinished() throws RemoteException {
|
||||||
|
mIsDividerRemoteAnimating = false;
|
||||||
|
mSyncQueue.runInSync(t -> applyDividerVisibility(t));
|
||||||
|
finishedCallback.onAnimationFinished();
|
||||||
|
}
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
|
ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
|
||||||
@@ -388,8 +402,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
Slog.e(TAG, "Unable to boost animation thread. This should only happen"
|
Slog.e(TAG, "Unable to boost animation thread. This should only happen"
|
||||||
+ " during unit tests");
|
+ " during unit tests");
|
||||||
}
|
}
|
||||||
adapter.getRunner().onAnimationStart(transit, apps, wallpapers, nonApps,
|
adapter.getRunner().onAnimationStart(transit, apps, wallpapers,
|
||||||
finishedCallback);
|
augmentedNonApps, wrapCallback);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Error starting remote animation", e);
|
Slog.e(TAG, "Error starting remote animation", e);
|
||||||
}
|
}
|
||||||
@@ -397,6 +411,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationCancelled() {
|
public void onAnimationCancelled() {
|
||||||
|
mIsDividerRemoteAnimating = false;
|
||||||
try {
|
try {
|
||||||
adapter.getRunner().onAnimationCancelled();
|
adapter.getRunner().onAnimationCancelled();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -832,7 +847,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDividerVisibility(boolean visible) {
|
private void setDividerVisibility(boolean visible) {
|
||||||
if (mDividerVisible == visible) return;
|
if (mIsDividerRemoteAnimating || mDividerVisible == visible) return;
|
||||||
mDividerVisible = visible;
|
mDividerVisible = visible;
|
||||||
if (visible) {
|
if (visible) {
|
||||||
mSplitLayout.init();
|
mSplitLayout.init();
|
||||||
@@ -880,10 +895,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyDividerVisibility(SurfaceControl.Transaction t) {
|
private void applyDividerVisibility(SurfaceControl.Transaction t) {
|
||||||
|
if (mIsDividerRemoteAnimating) return;
|
||||||
|
|
||||||
final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash();
|
final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash();
|
||||||
if (dividerLeash == null) {
|
if (dividerLeash == null) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDividerVisible) {
|
if (mDividerVisible) {
|
||||||
t.show(dividerLeash)
|
t.show(dividerLeash)
|
||||||
|
|||||||
Reference in New Issue
Block a user