Merge "Fix NPE if draging again while animating" into tm-dev am: a876e7b2d0

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

Change-Id: Id0d81889438bcf44e34184f074ca2749dc613c16
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tony Huang
2022-05-25 07:08:54 +00:00
committed by Automerger Merge Worker

View File

@@ -160,6 +160,15 @@ public class SplitDecorManager extends WindowlessWindowManager {
mBounds.set(newBounds);
}
final boolean show =
newBounds.width() > mBounds.width() || newBounds.height() > mBounds.height();
final boolean animate = show != mShown;
if (animate && mFadeAnimator != null && mFadeAnimator.isRunning()) {
// If we need to animate and animator still running, cancel it before we ensure both
// background and icon surfaces are non null for next animation.
mFadeAnimator.cancel();
}
if (mBackgroundLeash == null) {
mBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash,
RESIZING_BACKGROUND_SURFACE_NAME, mSurfaceSession);
@@ -183,11 +192,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
newBounds.width() / 2 - mIconSize / 2,
newBounds.height() / 2 - mIconSize / 2);
boolean show = newBounds.width() > mBounds.width() || newBounds.height() > mBounds.height();
if (show != mShown) {
if (mFadeAnimator != null && mFadeAnimator.isRunning()) {
mFadeAnimator.cancel();
}
if (animate) {
startFadeAnimation(show, false /* isResized */);
mShown = show;
}