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
This commit is contained in:
Saumya Prakash
2024-11-21 21:58:25 +00:00
parent 16c14327ea
commit 0028bed674
@@ -130,6 +130,22 @@ class ManageWindowsTaskbarShortcut<T>(
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<T>(
FLAG_AUTOHIDE_SUSPEND_MULTI_INSTANCE_MENU_OPEN,
false,
)
controllers.taskbarStashController.updateAndAnimateTransientTaskbar(true)
taskbarOverlayContext.dragLayer?.removeView(menuView.rootView)
taskbarOverlayContext.dragLayer.removeTouchController(this)
}