From fbc01a0b4fd89bc7ebd7d4c818c17dd19d10912d Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 6 Oct 2023 18:49:41 -0700 Subject: [PATCH] Fix transient task bar not automatically stashed in app when ENABLE_TASKBAR_NO_RECREATION is enabled Currently the task bar root layout consumes all the events and does not pass the events to drag layer, without explictly routing those events Fixes: 303910224 Test: go to an app, swipe home, and then go back to the app. Make sure the task bar is stashed Change-Id: I6f5e481c267dad25544118134ff95b0cb9bb1a45 --- .../android/launcher3/taskbar/TaskbarManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index ce901f2767..6dfd2434a6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -48,6 +48,7 @@ import android.os.Trace; import android.provider.Settings; import android.util.Log; import android.view.Display; +import android.view.MotionEvent; import android.view.WindowManager; import android.widget.FrameLayout; @@ -211,7 +212,18 @@ public class TaskbarManager { mContext = service.createWindowContext(display, TYPE_NAVIGATION_BAR_PANEL, null); if (ENABLE_TASKBAR_NO_RECREATION.get()) { mWindowManager = mContext.getSystemService(WindowManager.class); - mTaskbarRootLayout = new FrameLayout(mContext); + mTaskbarRootLayout = new FrameLayout(mContext) { + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + // The motion events can be outside the view bounds of task bar, and hence + // manually dispatching them to the drag layer here. + if (mTaskbarActivityContext != null + && mTaskbarActivityContext.getDragLayer().isAttachedToWindow()) { + return mTaskbarActivityContext.getDragLayer().dispatchTouchEvent(ev); + } + return super.dispatchTouchEvent(ev); + } + }; } mNavButtonController = new TaskbarNavButtonController(service, SystemUiProxy.INSTANCE.get(mContext), new Handler(),