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

Commit 96d7f9c2 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Fix leakage of GestureExclusionListener

So the unregister/register are paired when launcher activity
is relaunched:

Launcher#onDestroy
 > mSplitWithKeyboardShortcutController.onDestroy()
+ > RecentsAnimationDeviceState#destroy
+  > unregisterExclusionListener

Launcher#onCreate
 > setupViews
  > new SplitWithKeyboardShortcutController
   > new RecentsAnimationDeviceState
    > onDisplayInfoChanged
     > registerExclusionListener

Bug: 319133753
Test: Toggle screen resolution many times and check the amount
      of DisplayContent#mSystemGestureExclusionListeners.
Change-Id: I2fb84415db71aaa14e653fea2592d6b9b5adad59
parent f2a31282
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public class SplitWithKeyboardShortcutController {

    private final QuickstepLauncher mLauncher;
    private final SplitSelectStateController mController;
    private final RecentsAnimationDeviceState mDeviceState;
    private final OverviewComponentObserver mOverviewComponentObserver;

    private final int mSplitPlaceholderSize;
@@ -62,10 +63,9 @@ public class SplitWithKeyboardShortcutController {
            SplitSelectStateController controller) {
        mLauncher = launcher;
        mController = controller;
        RecentsAnimationDeviceState deviceState = new RecentsAnimationDeviceState(
                launcher.getApplicationContext());
        mDeviceState = new RecentsAnimationDeviceState(launcher.getApplicationContext());
        mOverviewComponentObserver = new OverviewComponentObserver(launcher.getApplicationContext(),
                deviceState);
                mDeviceState);

        mSplitPlaceholderSize = mLauncher.getResources().getDimensionPixelSize(
                R.dimen.split_placeholder_size);
@@ -97,6 +97,7 @@ public class SplitWithKeyboardShortcutController {

    public void onDestroy() {
        mOverviewComponentObserver.onDestroy();
        mDeviceState.destroy();
    }

    private class SplitWithKeyboardShortcutRecentsAnimationListener implements