From e7b4a4cf60295b63c12076de9cba5e3f57c9ffc5 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Wed, 27 Jul 2022 13:34:36 -0700 Subject: [PATCH] Stylus shouldnt trigger gestures during handwriting Exclude navbar from stylus gesture when handwriting is in progress. Layer the input consumer surface for handwriting above so that stylus touches dont go to gesture navbar or 3-botton navbar while handwriting is ongoing. User can still swip to home with finger. Fix: 240451878 Test: atest StylusHandwritingTest and Manually: 1. build & flash 2. start a handwriting session 3. while session is inprogress, attempt to swipe to home with stylus 4. gesture shouldn't work. 5. Repeat same with finger and it should work. Change-Id: I5c7194d45beb4ba0a0f629f3860fc713270815f1 --- .../inputmethod/HandwritingEventReceiverSurface.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java b/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java index 8180e66166d93..0c889c2765bb3 100644 --- a/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java +++ b/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java @@ -32,11 +32,10 @@ final class HandwritingEventReceiverSurface { public static final String TAG = HandwritingEventReceiverSurface.class.getSimpleName(); static final boolean DEBUG = HandwritingModeController.DEBUG; - // Place the layer below the highest layer to place it under gesture monitors. If the surface - // is above gesture monitors, then edge-back and swipe-up gestures won't work when this surface - // is intercepting. + // Place the layer at the highest layer so stylus cannot trigger gesture monitors + // (e.g. navigation bar, edge-back, etc) while handwriting is ongoing. // TODO(b/217538817): Specify the ordering in WM by usage. - private static final int HANDWRITING_SURFACE_LAYER = Integer.MAX_VALUE - 1; + private static final int HANDWRITING_SURFACE_LAYER = Integer.MAX_VALUE; private final InputWindowHandle mWindowHandle; private final InputChannel mClientChannel;