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
This commit is contained in:
Riddle Hsu
2024-01-10 17:59:28 +08:00
parent f2a31282da
commit 96d7f9c2d7
@@ -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