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

Commit 57478fe0 authored by Josh Tsuji's avatar Josh Tsuji
Browse files

Remove keyguard unlock listener to fix leak.

Fixes: 221870458
Test: atest SystemUITests
Change-Id: I58f02735a386e1621873166d1793f592cb2f9249
parent aac5468c
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