diff options
| author | 2021-09-30 13:49:12 +0100 | |
|---|---|---|
| committer | 2021-10-01 10:52:36 +0100 | |
| commit | 24e9fb2b65621efab5848c0c5597e11968c177d2 (patch) | |
| tree | 48a51ecdd9acc8a523e6118dbbae53b591bef980 | |
| parent | 87e09cb81b8b43b2a4e673ff014b1f5aca51d5b1 (diff) | |
Listen for ComponentCallback.onConfigurationChanged in TaskbarDelegate
Bug: 201265004
Test: Back gesture works after switching screen and/or rotation on both edges
Change-Id: Ic231029337c2d7fa840be3b83a479e468d6c868f
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java index 71d2a73c73f6..fa6169210609 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java @@ -20,6 +20,7 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; +import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE; @@ -34,9 +35,13 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S import android.app.StatusBarManager; import android.app.StatusBarManager.WindowVisibleState; +import android.content.ComponentCallbacks; import android.content.Context; +import android.content.res.Configuration; +import android.hardware.display.DisplayManager; import android.inputmethodservice.InputMethodService; import android.os.IBinder; +import android.view.Display; import android.view.InsetsVisibilities; import android.view.View; import android.view.WindowInsetsController.Behavior; @@ -55,7 +60,8 @@ import javax.inject.Singleton; @Singleton public class TaskbarDelegate implements CommandQueue.Callbacks, - OverviewProxyService.OverviewProxyListener, NavigationModeController.ModeChangedListener { + OverviewProxyService.OverviewProxyListener, NavigationModeController.ModeChangedListener, + ComponentCallbacks { private final EdgeBackGestureHandler mEdgeBackGestureHandler; @@ -71,11 +77,16 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, private int mDisabledFlags; private @WindowVisibleState int mTaskBarWindowState = WINDOW_STATE_SHOWING; private @Behavior int mBehavior; + private final Context mContext; + private final DisplayManager mDisplayManager; + private Context mWindowContext; @Inject public TaskbarDelegate(Context context) { mEdgeBackGestureHandler = Dependency.get(EdgeBackGestureHandler.Factory.class) .create(context); + mContext = context; + mDisplayManager = mContext.getSystemService(DisplayManager.class); } public void setOverviewProxyService(CommandQueue commandQueue, @@ -97,6 +108,10 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, mNavigationModeController.removeListener(this); mNavigationBarA11yHelper.removeA11yEventListener(mNavA11yEventListener); mEdgeBackGestureHandler.onNavBarDetached(); + if (mWindowContext != null) { + mWindowContext.unregisterComponentCallbacks(this); + mWindowContext = null; + } } public void init(int displayId) { @@ -107,6 +122,10 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, mNavigationModeController.addListener(this)); mNavigationBarA11yHelper.registerA11yEventListener(mNavA11yEventListener); mEdgeBackGestureHandler.onNavBarAttached(); + // Initialize component callback + Display display = mDisplayManager.getDisplay(displayId); + mWindowContext = mContext.createWindowContext(display, TYPE_APPLICATION, null); + mWindowContext.registerComponentCallbacks(this); // Set initial state for any listeners updateSysuiFlags(); } @@ -193,4 +212,12 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, private boolean allowSystemGestureIgnoringBarVisibility() { return mBehavior != BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; } + + @Override + public void onConfigurationChanged(Configuration configuration) { + mEdgeBackGestureHandler.onConfigurationChanged(configuration); + } + + @Override + public void onLowMemory() {} } |