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
This commit is contained in:
Taran Singh
2021-10-28 21:18:03 +00:00
committed by Prabir Pradhan
parent f62ba689d6
commit d4e6b2aad7

View File

@@ -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