Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c49da480 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 4fd0b291 5781577d
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -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);
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -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