Merge "Cancel current animation instead of candidate" into tm-qpr-dev

This commit is contained in:
Treehugger Robot
2023-04-13 22:33:51 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 14 deletions

View File

@@ -260,22 +260,20 @@ public class KeyguardService extends Service {
); );
} }
public void mergeAnimation(IBinder transition, TransitionInfo info, public void mergeAnimation(IBinder candidateTransition, TransitionInfo candidateInfo,
SurfaceControl.Transaction t, IBinder mergeTarget, SurfaceControl.Transaction candidateT, IBinder currentTransition,
IRemoteTransitionFinishedCallback finishCallback) { IRemoteTransitionFinishedCallback candidateFinishCallback) {
try { try {
final IRemoteTransitionFinishedCallback origFinishCB; final IRemoteTransitionFinishedCallback currentFinishCB;
synchronized (mFinishCallbacks) { synchronized (mFinishCallbacks) {
origFinishCB = mFinishCallbacks.remove(transition); currentFinishCB = mFinishCallbacks.remove(currentTransition);
} }
info.releaseAllSurfaces(); if (currentFinishCB == null) {
t.close(); Slog.e(TAG, "Called mergeAnimation, but finish callback is missing");
if (origFinishCB == null) {
// already finished (or not started yet), so do nothing.
return; return;
} }
runner.onAnimationCancelled(false /* isKeyguardOccluded */); runner.onAnimationCancelled(false /* isKeyguardOccluded */);
origFinishCB.onTransitionFinished(null /* wct */, null /* t */); currentFinishCB.onTransitionFinished(null /* wct */, null /* t */);
} catch (RemoteException e) { } catch (RemoteException e) {
// nothing, we'll just let it finish on its own I guess. // nothing, we'll just let it finish on its own I guess.
} }

View File

@@ -951,10 +951,15 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
@Override @Override
public void onAnimationCancelled(boolean isKeyguardOccluded) { public void onAnimationCancelled(boolean isKeyguardOccluded) {
if (mOccludeByDreamAnimator != null) { mContext.getMainExecutor().execute(() -> {
mOccludeByDreamAnimator.cancel(); if (mOccludeByDreamAnimator != null) {
} mOccludeByDreamAnimator.cancel();
setOccluded(isKeyguardOccluded /* isOccluded */, false /* animate */); }
});
// The value of isKeyguardOccluded here may come from mergeAnimation, which
// isn't reliable. In all cases, after running or cancelling this animation,
// keyguard should be occluded.
setOccluded(true /* isOccluded */, false /* animate */);
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "Occlude by Dream animation cancelled. Occluded state is now: " Log.d(TAG, "Occlude by Dream animation cancelled. Occluded state is now: "
+ mOccluded); + mOccluded);