Merge "Remove keyguard unlock listener to fix leak." into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-12 15:19:49 +00:00
committed by Android (Google) Code Review
2 changed files with 28 additions and 16 deletions

View File

@@ -130,6 +130,24 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
}
};
private final KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener
mKeyguardUnlockAnimationListener =
new KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener() {
@Override
public void onSmartspaceSharedElementTransitionStarted() {
// The smartspace needs to be able to translate out of bounds in order to
// end up where the launcher's smartspace is, while its container is being
// swiped off the top of the screen.
setClipChildrenForUnlock(false);
}
@Override
public void onUnlockAnimationFinished() {
// For performance reasons, reset this once the unlock animation ends.
setClipChildrenForUnlock(true);
}
};
@Inject
public KeyguardClockSwitchController(
KeyguardClockSwitch keyguardClockSwitch,
@@ -162,22 +180,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mUiExecutor = uiExecutor;
mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
mDumpManager = dumpManager;
mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(
new KeyguardUnlockAnimationController.KeyguardUnlockAnimationListener() {
@Override
public void onSmartspaceSharedElementTransitionStarted() {
// The smartspace needs to be able to translate out of bounds in order to
// end up where the launcher's smartspace is, while its container is being
// swiped off the top of the screen.
setClipChildrenForUnlock(false);
}
@Override
public void onUnlockAnimationFinished() {
// For performance reasons, reset this once the unlock animation ends.
setClipChildrenForUnlock(true);
}
});
}
/**
@@ -272,6 +274,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
);
updateDoubleLineClock();
mKeyguardUnlockAnimationController.addKeyguardUnlockAnimationListener(
mKeyguardUnlockAnimationListener);
}
int getNotificationIconAreaHeight() {
@@ -287,6 +292,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mView.setClockPlugin(null, mStatusBarStateController.getState());
mSecureSettings.unregisterContentObserver(mDoubleLineClockObserver);
mKeyguardUnlockAnimationController.removeKeyguardUnlockAnimationListener(
mKeyguardUnlockAnimationListener);
}
/**

View File

@@ -389,6 +389,10 @@ class KeyguardUnlockAnimationController @Inject constructor(
listeners.add(listener)
}
fun removeKeyguardUnlockAnimationListener(listener: KeyguardUnlockAnimationListener) {
listeners.remove(listener)
}
/**
* Called from [KeyguardViewMediator] to tell us that the RemoteAnimation on the surface behind
* the keyguard has started successfully. We can use these parameters to directly manipulate the