Merge "[Bugfix][RemoteAnimation] Fix IndexOutOfBoundsException in onAnimationFinished of RemoteAnimationController" am: 4b7206b8d8 am: b7e86b3e01 am: 8d5e476385 am: 0bb4677873 am: a32d2dc9dd

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

Change-Id: Ia47e16488f4dd3f7be69e2e702dae5cbffb5c4e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Chris Li
2022-07-11 08:53:32 +00:00
committed by Automerger Merge Worker

View File

@@ -71,6 +71,7 @@ class RemoteAnimationController implements DeathRecipient {
final ArrayList<NonAppWindowAnimationAdapter> mPendingNonAppAnimations = new ArrayList<>();
private final Handler mHandler;
private final Runnable mTimeoutRunnable = () -> cancelAnimation("timeoutRunnable");
private boolean mIsFinishing;
private FinishedCallback mFinishedCallback;
private final boolean mIsActivityEmbedding;
@@ -275,6 +276,7 @@ class RemoteAnimationController implements DeathRecipient {
mPendingAnimations.size());
mHandler.removeCallbacks(mTimeoutRunnable);
synchronized (mService.mGlobalLock) {
mIsFinishing = true;
unlinkToDeathOfRunner();
releaseFinishedCallback();
mService.openSurfaceTransaction();
@@ -319,6 +321,7 @@ class RemoteAnimationController implements DeathRecipient {
throw e;
} finally {
mService.closeSurfaceTransaction("RemoteAnimationController#finished");
mIsFinishing = false;
}
}
// Reset input for all activities when the remote animation is finished.
@@ -558,6 +561,9 @@ class RemoteAnimationController implements DeathRecipient {
@Override
public void onAnimationCancelled(SurfaceControl animationLeash) {
if (mIsFinishing) {
return;
}
if (mRecord.mAdapter == this) {
mRecord.mAdapter = null;
} else {