From d4e6b2aad76a9c5e98a321341f3df36364814235 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Thu, 28 Oct 2021 21:18:03 +0000 Subject: [PATCH] Add an input feature for a stylus interceptor A stylus interceptor is a window that receives all stylus events within its touchable bounds, while letting all other events be dispatched to windows behind it. This makes it possible for the framework to create a stylus interceptor on top of another app to implement handwriting recognition. The feature has no effect when the window flag FLAG_NOT_TOUCHABLE is not set. The feature has no effect when the window is not a trusted overlay. Test: manual Change-Id: Ia481ee8d831643bc99445b47659a7f5e9875c388 --- core/java/android/view/WindowManager.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index aa6cb83085575..32646113fd310 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -3363,6 +3363,22 @@ public interface WindowManager extends ViewManager { */ public static final int INPUT_FEATURE_SPY = 0x00000020; + /** + * When used with the window flag {@link #FLAG_NOT_TOUCHABLE}, this window will continue + * to receive events from a stylus device within its touchable region. All other pointer + * events, such as from a mouse or touchscreen, will be dispatched to the windows behind it. + * + * This input feature has no effect when the window flag {@link #FLAG_NOT_TOUCHABLE} is + * not set. + * + * The window must be a trusted overlay to use this input feature. + * + * @see #FLAG_NOT_TOUCHABLE + * + * @hide + */ + public static final int INPUT_FEATURE_INTERCEPTS_STYLUS = 0x00000040; + /** * An internal annotation for flags that can be specified to {@link #inputFeatures}. * @@ -3373,6 +3389,7 @@ public interface WindowManager extends ViewManager { INPUT_FEATURE_DISABLE_POINTER_GESTURES, INPUT_FEATURE_NO_INPUT_CHANNEL, INPUT_FEATURE_DISABLE_USER_ACTIVITY, + INPUT_FEATURE_INTERCEPTS_STYLUS, }) public @interface InputFeatureFlags {} @@ -3382,6 +3399,7 @@ public interface WindowManager extends ViewManager { * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES * @see #INPUT_FEATURE_NO_INPUT_CHANNEL * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY + * @see #INPUT_FEATURE_INTERCEPTS_STYLUS * @hide */ @InputFeatureFlags