Merge "Fix issue with animations that couldn't be started" into pi-dev
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.server.wm;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -88,4 +89,13 @@ class AnimatingAppWindowTokenRegistry {
|
||||
}
|
||||
mTmpRunnableList.clear();
|
||||
}
|
||||
|
||||
void dump(PrintWriter pw, String header, String prefix) {
|
||||
if (!mAnimatingTokens.isEmpty() || !mFinishedTokens.isEmpty()) {
|
||||
pw.print(prefix); pw.println(header);
|
||||
prefix = prefix + " ";
|
||||
pw.print(prefix); pw.print("mAnimatingTokens="); pw.println(mAnimatingTokens);
|
||||
pw.print(prefix); pw.print("mFinishedTokens="); pw.println(mFinishedTokens);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,11 +134,18 @@ class RemoteAnimationController {
|
||||
private RemoteAnimationTarget[] createAnimations() {
|
||||
final ArrayList<RemoteAnimationTarget> targets = new ArrayList<>();
|
||||
for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
|
||||
final RemoteAnimationAdapterWrapper wrapper = mPendingAnimations.get(i);
|
||||
final RemoteAnimationTarget target =
|
||||
mPendingAnimations.get(i).createRemoteAppAnimation();
|
||||
if (target != null) {
|
||||
targets.add(target);
|
||||
} else {
|
||||
|
||||
// We can't really start an animation but we still need to make sure to finish the
|
||||
// pending animation that was started by SurfaceAnimator
|
||||
if (wrapper.mCapturedFinishCallback != null) {
|
||||
wrapper.mCapturedFinishCallback.onAnimationFinished(wrapper);
|
||||
}
|
||||
mPendingAnimations.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1387,6 +1387,7 @@ public class TaskStack extends WindowContainer<Task> implements
|
||||
token.dump(pw, " ", dumpAll);
|
||||
}
|
||||
}
|
||||
mAnimatingAppWindowTokenRegistry.dump(pw, "AnimatingApps:", prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -197,4 +197,16 @@ public class RemoteAnimationControllerTest extends WindowTestsBase {
|
||||
assertEquals(1, appsCaptor.getValue().length);
|
||||
assertEquals(mMockLeash, appsCaptor.getValue()[0].leash);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemovedBeforeStarted() throws Exception {
|
||||
final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin");
|
||||
final AnimationAdapter adapter = mController.createAnimationAdapter(win.mAppToken,
|
||||
new Point(50, 100), new Rect(50, 100, 150, 150));
|
||||
adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback);
|
||||
win.mAppToken.removeImmediately();
|
||||
mController.goodToGo();
|
||||
verifyZeroInteractions(mMockRunner);
|
||||
verify(mFinishedCallback).onAnimationFinished(eq(adapter));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user