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
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index ce901f2..6dfd243 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.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 @@
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(),