From 0028bed674c62f9ea103e9ed5df2ee971fa22ff4 Mon Sep 17 00:00:00 2001 From: Saumya Prakash Date: Thu, 21 Nov 2024 21:58:25 +0000 Subject: [PATCH] Fix Taskbar not auto stashing from multi instance menu This change addresses an issue where touching the bottom of the screen would result in the dismissal of the multi instance menu, but leave the taskbar in a state that it would not auto stash. This is because the view was being removed through another way leading to taskbar being in a bad state. Now when the view is removed, the taskbar is correctly reset. Fix: 380304394 Bug: 315989246 Test: Manually launch the menu then tap the bottom of the screen. Ensure that taskbar eventually auto stashes. Flag: com.android.launcher3.enable_multi_instance_menu_taskbar Change-Id: Ie6bae803a42cf0bcd0ff6362473a63cb22a841eb --- .../taskbar/ManageWindowsTaskbarShortcut.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/ManageWindowsTaskbarShortcut.kt b/quickstep/src/com/android/launcher3/taskbar/ManageWindowsTaskbarShortcut.kt index c0c2a024b2..50ada18c85 100644 --- a/quickstep/src/com/android/launcher3/taskbar/ManageWindowsTaskbarShortcut.kt +++ b/quickstep/src/com/android/launcher3/taskbar/ManageWindowsTaskbarShortcut.kt @@ -130,6 +130,22 @@ class ManageWindowsTaskbarShortcut( onOutsideClickListener, controllers, ) + + // If the view is removed from elsewhere, reset the state to allow the taskbar to auto-stash + taskbarShortcutAllWindowsView.menuView.rootView.addOnAttachStateChangeListener( + object : View.OnAttachStateChangeListener { + override fun onViewAttachedToWindow(v: View) { + return + } + + override fun onViewDetachedFromWindow(v: View) { + controllers.taskbarAutohideSuspendController.updateFlag( + FLAG_AUTOHIDE_SUSPEND_MULTI_INSTANCE_MENU_OPEN, + false, + ) + } + } + ) } /** @@ -214,7 +230,6 @@ class ManageWindowsTaskbarShortcut( FLAG_AUTOHIDE_SUSPEND_MULTI_INSTANCE_MENU_OPEN, false, ) - controllers.taskbarStashController.updateAndAnimateTransientTaskbar(true) taskbarOverlayContext.dragLayer?.removeView(menuView.rootView) taskbarOverlayContext.dragLayer.removeTouchController(this) }