Remove played transitions from KGTransitionHandler
This was leaking binders. Test: atest --iterations 100 KeyguardTransitionTests # and check count Bug: 282855967 Change-Id: Ie91d7d8e150093d6b2a8d3d731eb22a9393d1ab8
This commit is contained in:
@@ -181,6 +181,7 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
|
||||
public void onTransitionFinished(
|
||||
WindowContainerTransaction wct, SurfaceControl.Transaction sct) {
|
||||
mMainExecutor.execute(() -> {
|
||||
mStartedTransitions.remove(transition);
|
||||
finishCallback.onTransitionFinished(wct, null);
|
||||
});
|
||||
}
|
||||
@@ -201,7 +202,7 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
|
||||
final IRemoteTransition playing = mStartedTransitions.get(currentTransition);
|
||||
|
||||
if (playing == null) {
|
||||
ProtoLog.e(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
|
||||
ProtoLog.e(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
|
||||
"unknown keyguard transition %s", currentTransition);
|
||||
return;
|
||||
}
|
||||
@@ -212,14 +213,17 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
|
||||
// the device sleeping/waking, so it's best to ignore this and keep playing anyway.
|
||||
return;
|
||||
} else {
|
||||
finishAnimationImmediately(currentTransition);
|
||||
finishAnimationImmediately(currentTransition, playing);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionConsumed(IBinder transition, boolean aborted,
|
||||
SurfaceControl.Transaction finishTransaction) {
|
||||
finishAnimationImmediately(transition);
|
||||
final IRemoteTransition playing = mStartedTransitions.remove(transition);
|
||||
if (playing != null) {
|
||||
finishAnimationImmediately(transition, playing);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -229,21 +233,17 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
|
||||
return null;
|
||||
}
|
||||
|
||||
private void finishAnimationImmediately(IBinder transition) {
|
||||
final IRemoteTransition playing = mStartedTransitions.get(transition);
|
||||
|
||||
if (playing != null) {
|
||||
final IBinder fakeTransition = new Binder();
|
||||
final TransitionInfo fakeInfo = new TransitionInfo(TRANSIT_SLEEP, 0x0);
|
||||
final SurfaceControl.Transaction fakeT = new SurfaceControl.Transaction();
|
||||
final FakeFinishCallback fakeFinishCb = new FakeFinishCallback();
|
||||
try {
|
||||
playing.mergeAnimation(fakeTransition, fakeInfo, fakeT, transition, fakeFinishCb);
|
||||
} catch (RemoteException e) {
|
||||
// There is no good reason for this to happen because the player is a local object
|
||||
// implementing an AIDL interface.
|
||||
Log.wtf(TAG, "RemoteException thrown from KeyguardService transition", e);
|
||||
}
|
||||
private void finishAnimationImmediately(IBinder transition, IRemoteTransition playing) {
|
||||
final IBinder fakeTransition = new Binder();
|
||||
final TransitionInfo fakeInfo = new TransitionInfo(TRANSIT_SLEEP, 0x0);
|
||||
final SurfaceControl.Transaction fakeT = new SurfaceControl.Transaction();
|
||||
final FakeFinishCallback fakeFinishCb = new FakeFinishCallback();
|
||||
try {
|
||||
playing.mergeAnimation(fakeTransition, fakeInfo, fakeT, transition, fakeFinishCb);
|
||||
} catch (RemoteException e) {
|
||||
// There is no good reason for this to happen because the player is a local object
|
||||
// implementing an AIDL interface.
|
||||
Log.wtf(TAG, "RemoteException thrown from KeyguardService transition", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user