Update dock divider during recents animation.

- Move all wrapper calls to the bg thread
- Account for position now that the task leash is in the app animation
  layer

Bug: 73118672
Change-Id: I5b680a688c0ad4ca34c76e22e1d5cee24133f40f
This commit is contained in:
Winson Chung 2018-03-16 12:10:55 -07:00
parent 8ad31511a6
commit dbff75e3de
3 changed files with 45 additions and 4 deletions

Binary file not shown.

View File

@ -28,7 +28,9 @@ public class RecentsAnimationWrapper {
public RecentsAnimationControllerCompat controller;
public RemoteAnimationTargetCompat[] targets;
private boolean mInputConsumerEnabled;
private boolean mInputConsumerEnabled = false;
private boolean mBehindSystemBars = true;
private boolean mSplitScreenMinimized = false;
public synchronized void setController(
RecentsAnimationControllerCompat controller, RemoteAnimationTargetCompat[] targets) {
@ -75,4 +77,42 @@ public class RecentsAnimationWrapper {
});
}
}
public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
if (mBehindSystemBars == behindSystemBars) {
return;
}
mBehindSystemBars = behindSystemBars;
BackgroundExecutor.get().submit(() -> {
synchronized (this) {
TraceHelper.partitionSection("RecentsController",
"Setting behind system bars on " + controller);
if (controller != null) {
controller.setAnimationTargetsBehindSystemBars(behindSystemBars);
}
}
});
}
/**
* NOTE: As a workaround for conflicting animations (Launcher animating the task leash, and
* SystemUI resizing the docked stack, which resizes the task), we currently only set the
* minimized mode, and not the inverse.
* TODO: Synchronize the minimize animation with the launcher animation
*/
public void setSplitScreenMinimizedForTransaction(boolean minimized) {
if (mSplitScreenMinimized || !minimized) {
return;
}
mSplitScreenMinimized = minimized;
BackgroundExecutor.get().submit(() -> {
synchronized (this) {
TraceHelper.partitionSection("RecentsController",
"Setting minimize dock on " + controller);
if (controller != null) {
controller.setSplitScreenMinimized(minimized);
}
}
});
}
}

View File

@ -497,6 +497,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
TransactionCompat transaction = new TransactionCompat();
for (RemoteAnimationTargetCompat app : mRecentsAnimationWrapper.targets) {
if (app.mode == MODE_CLOSING) {
mTmpMatrix.postTranslate(app.position.x, app.position.y);
transaction.setMatrix(app.leash, mTmpMatrix)
.setWindowCrop(app.leash, mClipRect);
@ -534,10 +535,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
}
}
if (mRecentsAnimationWrapper.controller != null) {
// TODO: This logic is spartanic!
mRecentsAnimationWrapper.controller.setAnimationTargetsBehindSystemBars(
shift < 0.12f);
boolean passedThreshold = shift > 0.12f;
mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold);
mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold);
}
};
if (Looper.getMainLooper() == Looper.myLooper()) {