Include whether in touch mode for WindowlessWindowManager

Fix: 179583920
Test: manually with a windowless button
Change-Id: Ice37c3182a44c6284ffa8950996507025c59270b
This commit is contained in:
Chris Li
2021-02-06 20:39:37 -08:00
parent 114246c80e
commit ded0e32b80

View File

@@ -162,7 +162,10 @@ public class WindowlessWindowManager implements IWindowSession {
mStateForWindow.put(window.asBinder(), state); mStateForWindow.put(window.asBinder(), state);
} }
return WindowManagerGlobal.ADD_OKAY | WindowManagerGlobal.ADD_FLAG_APP_VISIBLE; final int res = WindowManagerGlobal.ADD_OKAY | WindowManagerGlobal.ADD_FLAG_APP_VISIBLE;
// Include whether the window is in touch mode.
return isInTouchMode() ? res | WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE : res;
} }
/** /**
@@ -210,6 +213,15 @@ public class WindowlessWindowManager implements IWindowSession {
return !PixelFormat.formatHasAlpha(attrs.format); return !PixelFormat.formatHasAlpha(attrs.format);
} }
private boolean isInTouchMode() {
try {
return WindowManagerGlobal.getWindowSession().getInTouchMode();
} catch (RemoteException e) {
Log.e(TAG, "Unable to check if the window is in touch mode", e);
}
return false;
}
/** @hide */ /** @hide */
@Nullable @Nullable
protected SurfaceControl getSurfaceControl(View rootView) { protected SurfaceControl getSurfaceControl(View rootView) {
@@ -276,7 +288,8 @@ public class WindowlessWindowManager implements IWindowSession {
} }
} }
return 0; // Include whether the window is in touch mode.
return isInTouchMode() ? WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE : 0;
} }
@Override @Override