Merge "Apply transaction before calling onFinish" into udc-dev am: 766485bece

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22613584

Change-Id: I25326d54363f61b20b708e9d05f05d754d0d48e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-13 04:19:39 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 9 deletions

View File

@@ -51,6 +51,8 @@ import com.android.wm.shell.R;
import com.android.wm.shell.common.ScreenshotUtils;
import com.android.wm.shell.common.SurfaceUtils;
import java.util.function.Consumer;
/**
* Handles split decor like showing resizing hint for a specific split.
*/
@@ -251,7 +253,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
}
/** Stops showing resizing hint. */
public void onResized(SurfaceControl.Transaction t, Runnable animFinishedCallback) {
public void onResized(SurfaceControl.Transaction t, Consumer<Boolean> animFinishedCallback) {
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
mScreenshotAnimator.cancel();
}
@@ -281,7 +283,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
mScreenshot = null;
if (mRunningAnimationCount == 0 && animFinishedCallback != null) {
animFinishedCallback.run();
animFinishedCallback.accept(true);
}
}
});
@@ -313,12 +315,12 @@ public class SplitDecorManager extends WindowlessWindowManager {
}
}
if (mShown) {
fadeOutDecor(animFinishedCallback);
fadeOutDecor(()-> animFinishedCallback.accept(true));
} else {
// Decor surface is hidden so release it directly.
releaseDecor(t);
if (mRunningAnimationCount == 0 && animFinishedCallback != null) {
animFinishedCallback.run();
animFinishedCallback.accept(false);
}
}
}

View File

@@ -208,11 +208,13 @@ class SplitScreenTransitions {
mAnimations.add(va);
decor.setScreenshotIfNeeded(change.getSnapshot(), startTransaction);
decor.onResized(startTransaction, () -> {
mTransitions.getMainExecutor().execute(() -> {
mAnimations.remove(va);
onFinish(null /* wct */, null /* wctCB */);
});
decor.onResized(startTransaction, animated -> {
mAnimations.remove(va);
if (animated) {
mTransitions.getMainExecutor().execute(() -> {
onFinish(null /* wct */, null /* wctCB */);
});
}
});
}
}