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
This commit is contained in:
Tracy Zhou
2023-10-06 18:49:41 -07:00
parent 9633e5b74c
commit fbc01a0b4f
@@ -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(),