Skip to content

Commit e6dfd1c

Browse files
hex539Android Build Coastguard Worker
authored andcommitted
Cancel current animation instead of candidate
Otherwise everything along the way confidently ignores this and Keyguard doesn't even see the timeout and force-abort coming when it hits. This leaves an animation timer running for 950ms which sets occlude status on finish callback and causes unpleasant race conditions. Test: atest android.server.wm.KeyguardTests Test: specific case to be added in b/274003805 Bug: 275650364 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8ffedf11e398f9a6aa8b30cff5f06b102fd54536) Merged-In: I7b3dcd06e7483fde745a1d56dfee7c4efc262ed7 Change-Id: I7b3dcd06e7483fde745a1d56dfee7c4efc262ed7
1 parent 7c8d5d5 commit e6dfd1c

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,20 @@ public void onAnimationFinished() throws RemoteException {
260260
);
261261
}
262262

263-
public void mergeAnimation(IBinder transition, TransitionInfo info,
264-
SurfaceControl.Transaction t, IBinder mergeTarget,
265-
IRemoteTransitionFinishedCallback finishCallback) {
263+
public void mergeAnimation(IBinder candidateTransition, TransitionInfo candidateInfo,
264+
SurfaceControl.Transaction candidateT, IBinder currentTransition,
265+
IRemoteTransitionFinishedCallback candidateFinishCallback) {
266266
try {
267-
final IRemoteTransitionFinishedCallback origFinishCB;
267+
final IRemoteTransitionFinishedCallback currentFinishCB;
268268
synchronized (mFinishCallbacks) {
269-
origFinishCB = mFinishCallbacks.remove(transition);
269+
currentFinishCB = mFinishCallbacks.remove(currentTransition);
270270
}
271-
info.releaseAllSurfaces();
272-
t.close();
273-
if (origFinishCB == null) {
274-
// already finished (or not started yet), so do nothing.
271+
if (currentFinishCB == null) {
272+
Slog.e(TAG, "Called mergeAnimation, but finish callback is missing");
275273
return;
276274
}
277275
runner.onAnimationCancelled(false /* isKeyguardOccluded */);
278-
origFinishCB.onTransitionFinished(null /* wct */, null /* t */);
276+
currentFinishCB.onTransitionFinished(null /* wct */, null /* t */);
279277
} catch (RemoteException e) {
280278
// nothing, we'll just let it finish on its own I guess.
281279
}

packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,10 +958,15 @@ public LaunchAnimator.State createAnimatorState() {
958958

959959
@Override
960960
public void onAnimationCancelled(boolean isKeyguardOccluded) {
961-
if (mOccludeByDreamAnimator != null) {
962-
mOccludeByDreamAnimator.cancel();
963-
}
964-
setOccluded(isKeyguardOccluded /* isOccluded */, false /* animate */);
961+
mContext.getMainExecutor().execute(() -> {
962+
if (mOccludeByDreamAnimator != null) {
963+
mOccludeByDreamAnimator.cancel();
964+
}
965+
});
966+
// The value of isKeyguardOccluded here may come from mergeAnimation, which
967+
// isn't reliable. In all cases, after running or cancelling this animation,
968+
// keyguard should be occluded.
969+
setOccluded(true /* isOccluded */, false /* animate */);
965970
if (DEBUG) {
966971
Log.d(TAG, "Occlude by Dream animation cancelled. Occluded state is now: "
967972
+ mOccluded);

0 commit comments

Comments
 (0)