Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Constants](https://developer.android.com/reference/com/google/wear/input/GestureInputManager#constants) \| [Fields](https://developer.android.com/reference/com/google/wear/input/GestureInputManager#lfields) \| [Methods](https://developer.android.com/reference/com/google/wear/input/GestureInputManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/com/google/wear/input/GestureInputManager#inhmethods)

# GestureInputManager


`
public

final

class
GestureInputManager
`


`

extends Object


`

`


`

|---|---|
| java.lang.Object ||
| ↳ | com.google.wear.input.GestureInputManager |

<br />

*** ** * ** ***

Manager for gesture inputs, allowing to subscribe to `https://developer.android.com/reference/com/google/wear/input/GestureEvent` events and query
different gesture related configurations.

To get an instance, use `https://developer.android.com/reference/com/google/wear/Sdk#getWearManager(android.content.Context,%20java.lang.Class<T>)` (i.e. `Sdk.getWearManager(context, GestureInputManager.class)`).

This API **requires the `https://developer.android.com/reference/com/google/wear/Sdk#FEATURE_WEAR_GESTURE_DETECTION` feature**to function.
Otherwise, the APIs in this class will be no-op (i.e. will do nothing).

### Functionalities

#### Subscribe for `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s

The manager provides APIs to subscribe to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s. See the following APIs:

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.Window,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.View,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(com.google.wear.input.ForegroundGestureSubscriptionParams,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#removeGestureEventListener(java.util.function.Consumer<com.google.wear.input.GestureEvent>)`

#### Get the device's support for gestures

The manager provides APIs to check what kind of gesture actions are supported by the device,
and which of these supported actions are currently enabled. See the following APIs:

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions()` / `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions(int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int)` / `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int)` / `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addEnabledActionsChangeListener(java.util.concurrent.Executor,%20java.util.function.Consumer<java.util.Set<java.lang.Integer>>)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#removeEnabledActionsChangeListener(java.util.function.Consumer<java.util.Set<java.lang.Integer>>)`

#### Manage hints for gesture input

The manager provides APIs that enable simplified and consistent hint-showing decisions. The
client can use these APIs to decide whether or not a hint should be shown at a given moment. The
manager also provides APIs for the client to mark events relevant for hint logic management
(example: when a hint has been shown to the user, or when the user uses a gesture event).

The internal hint management logic differs from device to device, but is generally consistent
across multiple applications throughout a given device. Thus, using these APIs allows the
client's application to integrate smoothly with other applications on the user's device that
support gesture input, which in turn provides a smoother gesture input experience to the user.

The hint management APIs are not mandatory to use, but the client is **strongly**
recommended to use them so that they can easily provide meaningful gesture related hints to their
users at reasonable times.

##### Experience Identifier

The term "Experience Identifier" is used across APIs relevant to manage hints.

The Experience Identifier is an identifier that should be chosen by the client to uniquely
identify gesture input experience(s) in a given package for which hints should be managed
together. For example:

- Consider a screen with two buttons, both capable of processing gesture inputs. Let us assume that these buttons look and behave similarly, and that the client is confident that a user who has been hinted to use gesture input on the first button can easily understand the availability of gesture input on the second button. In this case, using the same Experience identifier for both buttons is recommended.
- The same example as the one above applies even if the two UI elements are in different screens. As long as the client is confident that hints shown to one of these elements effectively applies to educate the user about gesture input usage on the other UI element, using the same Experience identifier for both buttons is recommended.

The Experience Identifier should be used consistently (without being changed) for a given set
of gesture input experience(s). Changing this identifier will result in the hint management logic
to be reset, which may result in hints being shown to the user more frequently than desired.

See the following APIs:

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#notifyHintShown(java.lang.String,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#notifyGestureConsumed(java.lang.String,%20int)`

Example usage:

    GestureInputManager gestureInputManager;

     // Assume that this function handles showing hints for the UI element with a given
     // experience identifier, for a given action.
     boolean showHint(String experienceIdentifier, int action) {
       if (gestureInputManager.shouldShowHint(experienceIdentifier, action)) {
         drawHint(experienceIdentifier, action);
         gestureInputManager.notifyHintShown(experienceIdentifier, action);
       }
     }

     // Assume that this function processes GestureEvents that are handled by a UI element with
     // a given experience identifier.
     void onGestureEvent(GestureEvent event, String experienceIdentifier) {
       gestureInputManager.notifyGestureConsumed(event.getAction(), experienceIdentifier);
     }
     
.   
Requires the `https://developer.android.com/reference/com/google/wear/Sdk#FEATURE_WEAR_GESTURE_DETECTION` feature which can be detected using `https://developer.android.com/reference/com/google/wear/Sdk#hasApiFeature(java.lang.String)`.

<br />

Requires the `https://developer.android.com/reference/android/content/pm/PackageManager#hasSystemFeature(java.lang.String)` feature which can be detected using `https://developer.android.com/reference/android/content/pm/PackageManager#hasSystemFeature(java.lang.String)`.
**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureEvent`

## Summary

| ### Constants ||
|---|---|
| `String` | `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#ACTION_GESTURE_INPUT_SETTINGS` Activity Action: On devices that support `https://developer.android.com/reference/com/google/wear/Sdk#FEATURE_WEAR_GESTURE_DETECTION`, this can be used to launch an activity to allow users to configure gesture input. |
| `int` | `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_LOCAL` Represents a subscription for the local device (e.g., the watch itself). |
| `int` | `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_REMOTE` Represents a subscription for a remote device connected to the local device. |

| ### Fields ||
|---|---|
| ` public static final int` | `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#FLAG_HINT_STYLE_OVERLAY` Hint flag indicating that the hint is shown as an overlay that covers a space larger than the specific UI element being hinted. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addEnabledActionsChangeListener(java.util.concurrent.Executor,%20java.util.function.Consumer<java.util.Set<java.lang.Integer>>)(Executor executor, Consumer<Set<Integer>> listener) ` Adds a listener to listen to changes in the set of enabled actions. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.View,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)(int[] actions, View view, Executor executor, Consumer<https://developer.android.com/reference/com/google/wear/input/GestureEvent> listener) ` Adds a listener to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s that happen as the user interacts with the window hosting a given `https://developer.android.com/reference/android/view/View`. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(com.google.wear.input.ForegroundGestureSubscriptionParams,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)(https://developer.android.com/reference/com/google/wear/input/ForegroundGestureSubscriptionParams params, Executor executor, Consumer<https://developer.android.com/reference/com/google/wear/input/GestureEvent> listener) ` Adds a listener to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s while the client is in the foreground (visible to the user), based on {code params}. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.Window,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)(int[] actions, Window window, Executor executor, Consumer<https://developer.android.com/reference/com/google/wear/input/GestureEvent> listener) ` Adds a listener to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s that happen as the user interacts with a given `https://developer.android.com/reference/android/view/Window`. |
| ` int` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getGestureForAction(int,%20int)(int action, int subscriberType) ` Provides the gesture that corresponds to a given `action` for use on a `subscriberType`. |
| ` int` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getGestureForAction(int)(int action) ` Provides the gesture that corresponds to a given `action` for use on the local device. |
| ` int[]` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions()() ` Provides all the gesture actions supported for use by the local device. |
| ` int[]` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions(int)(int subscriberType) ` Provides all the gesture actions supported for use by a `subscriberType`. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)(int action, int subscriberType) ` Whether a given `action` is currently enabled for use by a `subscriberType`. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int)(int action) ` Whether a given `action` is currently enabled for use by the local device. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int)(int action) ` Whether a given `action` is supported for use on the local device. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int,%20int)(int action, int subscriberType) ` Whether a given `action` is supported by the device. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#notifyGestureConsumed(java.lang.String,%20int)(String experienceIdentifier, int action) ` Reports that a `https://developer.android.com/reference/com/google/wear/input/GestureEvent` has been consumed by the user for the provided `experienceIdentifier`. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#notifyHintShown(java.lang.String,%20int)(String experienceIdentifier, int action) ` Reports that a hint has been shown to the user to indicate that the given gesture `action` is available for the provided `experienceIdentifier`. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#removeEnabledActionsChangeListener(java.util.function.Consumer<java.util.Set<java.lang.Integer>>)(Consumer<Set<Integer>> listener) ` Removes a listener that has previously been registered via `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addEnabledActionsChangeListener(java.util.concurrent.Executor,%20java.util.function.Consumer<java.util.Set<java.lang.Integer>>)`. |
| ` void` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#removeGestureEventListener(java.util.function.Consumer<com.google.wear.input.GestureEvent>)(Consumer<https://developer.android.com/reference/com/google/wear/input/GestureEvent> listener) ` Removes a listener that has previously been registered via any of the `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(com.google.wear.input.ForegroundGestureSubscriptionParams,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)` APIs. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int,%20int)(String experienceIdentifier, int action, int hintFlags) ` Whether a hint should be shown to the user to indicate that the given gesture `action` is available for the provided `experienceIdentifier`. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int)(String experienceIdentifier, int action) ` Same as `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int,%20int)`, with the hint flags omitted (set to 0). |

| ### Inherited methods |
|---|---|
| From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||

## Constants

### ACTION_GESTURE_INPUT_SETTINGS

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final String ACTION_GESTURE_INPUT_SETTINGS
```

Activity Action: On devices that support `https://developer.android.com/reference/com/google/wear/Sdk#FEATURE_WEAR_GESTURE_DETECTION`, this can
be used to launch an activity to allow users to configure gesture input.

Input: nothing

Output: nothing

<br />

Constant Value:

"com.google.wear.input.action.GESTURE_INPUT_SETTINGS"


### GESTURE_SUBSCRIBER_TYPE_LOCAL

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GESTURE_SUBSCRIBER_TYPE_LOCAL
```

Represents a subscription for the local device (e.g., the watch itself).

Use this subscription type if you are using gesture events for controlling on-device
features, like silencing a call while a Dialer app is not in the foreground.

<br />

Constant Value:

1
(0x00000001)


### GESTURE_SUBSCRIBER_TYPE_REMOTE

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GESTURE_SUBSCRIBER_TYPE_REMOTE
```

Represents a subscription for a remote device connected to the local device.

Use this subscription type if the end client of the subscribed gesture events is a device
that is not the gesture-producing device. For example: if an app on the watch subscribes to
gesture events and sends the received events to a connected device, like a TV.

<br />

Constant Value:

2
(0x00000002)


## Fields

### FLAG_HINT_STYLE_OVERLAY

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_HINT_STYLE_OVERLAY
```

Hint flag indicating that the hint is shown as an overlay that covers a space larger than the
specific UI element being hinted.

<br />

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int,%20int)`

## Public methods

### addEnabledActionsChangeListener

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void addEnabledActionsChangeListener (Executor executor, 
                Consumer<Set<Integer>> listener)
```

Adds a listener to listen to changes in the set of enabled actions.

The listener will be invoked when the set of actions enabled on ANY subscriber type
changes. The provided `https://developer.android.com/reference/java/util/Set` contains any action that is enabled on at least one
subscriber type. To check the enabled state for a specific subscriber type, use `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)`.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the `https://developer.android.com/reference/java/util/concurrent/Executor` on which the `listener` will be notified. <br /> |
| `listener` | `Consumer`: a `https://developer.android.com/reference/java/util/function/Consumer` that will receive the new set of enabled actions. The `https://developer.android.com/reference/java/util/Set` provided to the listener cannot be modified. <br /> |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#removeEnabledActionsChangeListener(java.util.function.Consumer<java.util.Set<java.lang.Integer>>)`

### addGestureEventListener

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void addGestureEventListener (int[] actions, 
                View view, 
                Executor executor, 
                Consumer<GestureEvent> listener)
```

Adds a listener to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s that happen as the user interacts with the window
hosting a given `https://developer.android.com/reference/android/view/View`.

Similar to `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.Window,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`, but the
event listener follows the Window that the View is attached to. Gesture inputs will be
delivered as long as the window to which the provided `https://developer.android.com/reference/android/view/View` is attached has focus (at
the time of registration, or, if it gains focus after registration). The manager will handle
tracking the window's focus and delivering `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s only while the window
hosting the View is focused. The GestureInputManager will also track if the View is attached
to a different window, and associates the registration to the focus-state of the new window.

Note that, because an action needs to be enabled (`https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int)`) for the
system to detect and emit any `https://developer.android.com/reference/com/google/wear/input/GestureEvent` for it, a listener registered with this
API will get no `https://developer.android.com/reference/com/google/wear/input/GestureEvent` for an action if the action is not enabled.

If a `listener` that has already been added is used again with this API or with
`https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.Window,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`, the previous
registration will be overridden by the new registration. So, if you want to listen to events
on different `https://developer.android.com/reference/android/view/Window`s/`https://developer.android.com/reference/android/view/View`s and/or receive events on different `https://developer.android.com/reference/java/util/concurrent/Executor`s, you should do multiple registrations with different listeners.

<br />

| Parameters ||
|---|---|
| `actions` | `int`: an array of all the actions to subscribe to. This must be NOT empty, and all actions in this array must be supported (see `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int)`). Providing an empty array or a non-empty array that has an unsupported action will result in an `https://developer.android.com/reference/java/lang/IllegalArgumentException` to be thrown. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `view` | `View`: the `https://developer.android.com/reference/android/view/View` on which received `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s will be processed. Events are delivered to the `listener` only while the Window hosting this View has focus. <br /> |
| `executor` | `Executor`: the `https://developer.android.com/reference/java/util/concurrent/Executor` on which the `listener` will be notified. <br /> |
| `listener` | `Consumer`: a `https://developer.android.com/reference/java/util/function/Consumer` that will receive the events. <br /> |

| Throws ||
|---|---|
| `IllegalArgumentException` | if the provided `actions` array is empty or includes an unsupported action. |

### addGestureEventListener

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addGestureEventListener (ForegroundGestureSubscriptionParams params, 
                Executor executor, 
                Consumer<GestureEvent> listener)
```

Adds a listener to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s while the client is in the foreground (visible to
the user), based on {code params}.

If a `listener` that has already been added is used again with this API or any of
the other foreground (`https://developer.android.com/reference/android/view/View` or `https://developer.android.com/reference/android/view/Window` based APIs), the previous registration
will be overridden by the new registration. Each listener can only be registered once
(subsequent registration on the same listener will override the previous one).

<br />

| Parameters ||
|---|---|
| `params` | `ForegroundGestureSubscriptionParams`: parameters for the subscription. <br /> |
| `executor` | `Executor`: the `https://developer.android.com/reference/java/util/concurrent/Executor` on which the `listener` will be notified. <br /> |
| `listener` | `Consumer`: a `https://developer.android.com/reference/java/util/function/Consumer` that will receive the events. <br /> |

### addGestureEventListener

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void addGestureEventListener (int[] actions, 
                Window window, 
                Executor executor, 
                Consumer<GestureEvent> listener)
```

Adds a listener to `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s that happen as the user interacts with a given
`https://developer.android.com/reference/android/view/Window`. The given `https://developer.android.com/reference/android/view/Window` needs to have a decor view (i.e. `https://developer.android.com/reference/android/view/Window#peekDecorView()` should not be `null`) by the time this method is called.

The gesture inputs are delivered as `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s as long as the provided `https://developer.android.com/reference/android/view/Window` has focus (at the time of registration, or, if it gains focus after registration).
The GestureInputManager will handle tracking the window's focus and delivering `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s only while the window is focused.

Note that, because an action needs to be enabled (`https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int)`) for the
system to detect and emit any `https://developer.android.com/reference/com/google/wear/input/GestureEvent` for it, a listener registered with this
API will get no `https://developer.android.com/reference/com/google/wear/input/GestureEvent` for an action if the action is not enabled.

If a `listener` that has already been added is used again with this API or with
`https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.View,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`, the previous registration
will be overridden by the new registration. So, if you want to listen to events on different
`https://developer.android.com/reference/android/view/Window`s/`https://developer.android.com/reference/android/view/View`s and/or receive events on different `https://developer.android.com/reference/java/util/concurrent/Executor`s, you
should do multiple registrations with different listeners.

<br />

| Parameters ||
|---|---|
| `actions` | `int`: an array of all the actions to subscribe to. This must be NOT empty, and all actions in this array must be supported (see `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int)`). Providing an empty array or a non-empty array that has an unsupported action will result in an `https://developer.android.com/reference/java/lang/IllegalArgumentException` to be thrown. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `window` | `Window`: the `https://developer.android.com/reference/android/view/Window` on which received `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s will be processed. This window should have a View attached (i.e. `https://developer.android.com/reference/android/view/Window#peekDecorView()` should not be `null`). Otherwise, the method will throw an `https://developer.android.com/reference/java/lang/IllegalArgumentException`. Events are delivered to the `listener` only while this window has focus. <br /> |
| `executor` | `Executor`: the `https://developer.android.com/reference/java/util/concurrent/Executor` on which the `listener` will be notified. <br /> |
| `listener` | `Consumer`: a `https://developer.android.com/reference/java/util/function/Consumer` that will receive the events. <br /> |

| Throws ||
|---|---|
| `IllegalArgumentException` | if the provided `actions` array is empty or includes an unsupported action, or, if the provided `https://developer.android.com/reference/android/view/Window` does not have a decor view. |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(int[],%20android.view.View,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)`

### getGestureForAction

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getGestureForAction (int action, 
                int subscriberType)
```

Provides the gesture that corresponds to a given `action` for use on a `subscriberType`.

<br />

| Parameters ||
|---|---|
| `action` | `int`: the gesture action for which the corresponding gesture is being queried. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `subscriberType` | `int`: the type of subscription where the gesture events will be used. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_LOCAL` - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_REMOTE` |

| Returns ||
|---|---|
| `int` | the gesture that corresponds to the given action. If the provided action is invalid, or the action is not supported by the devices matching the filter, returns `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN`. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_DOUBLE_PINCH` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_WRIST_TURN` |

### getGestureForAction

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int getGestureForAction (int action)
```

Provides the gesture that corresponds to a given `action` for use on the local device.

<br />

| Parameters ||
|---|---|
| `action` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_DOUBLE_PINCH` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_WRIST_TURN` |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getGestureForAction(int,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int)`

### getSupportedActions

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int[] getSupportedActions ()
```

Provides all the gesture actions supported for use by the local device.

<br />

| Returns ||
|---|---|
| `int[]` | Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions(int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int)`

### getSupportedActions

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int[] getSupportedActions (int subscriberType)
```

Provides all the gesture actions supported for use by a `subscriberType`.

The supported actions for a device are fixed on a given device build and do not change.

<br />

| Parameters ||
|---|---|
| `subscriberType` | `int`: the type of subscription where the gesture events will be used. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_LOCAL` - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_REMOTE` |

| Returns ||
|---|---|
| `int[]` | an array of all supported gesture actions. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions()`

### isActionEnabled

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isActionEnabled (int action, 
                int subscriberType)
```

Whether a given `action` is currently enabled for use by a `subscriberType`.

An action is considered enabled if it is supported and gesture detection is currently
available for it (that is, the system will detect `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s for that action, and
these events will be emitted to listeners registered through the addGestureEventListener
APIs).

Whether an action is enabled could be affected by user preference. It could also be
impacted by internal system states.

If an action is not enabled, no `https://developer.android.com/reference/com/google/wear/input/GestureEvent` will be emitted for the action. Thus,
A `https://developer.android.com/reference/com/google/wear/input/GestureEvent` listener registered through the addGestureEventListener APIs can
receive `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s for an action only if that action is enabled.

A listener will start receiving `https://developer.android.com/reference/com/google/wear/input/GestureEvent`s for the action if the action gets
enabled after the listener was added (as long the listener has not yet been removed).
Similarly, if an action gets disabled after a listener was added for it, the listener will
not get any `https://developer.android.com/reference/com/google/wear/input/GestureEvent` until the action is enabled again.

Use the `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addEnabledActionsChangeListener(java.util.concurrent.Executor,%20java.util.function.Consumer<java.util.Set<java.lang.Integer>>)` API to register listeners that receive
changes to the set of enabled actions.

<br />

| Parameters ||
|---|---|
| `action` | `int`: the action to be checked if it is enabled. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `subscriberType` | `int`: the type of subscription where the gesture events will be used. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_LOCAL` - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_REMOTE` |

| Returns ||
|---|---|
| `boolean` | `true` if the given action is enabled. `false` otherwise. <br /> |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)`

### isActionEnabled

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean isActionEnabled (int action)
```

Whether a given `action` is currently enabled for use by the local device.

<br />

| Parameters ||
|---|---|
| `action` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)`

### isActionSupported

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean isActionSupported (int action)
```

Whether a given `action` is supported for use on the local device.

<br />

| Parameters ||
|---|---|
| `action` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionSupported(int,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getSupportedActions()`

### isActionSupported

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isActionSupported (int action, 
                int subscriberType)
```

Whether a given `action` is supported by the device.

<br />

| Parameters ||
|---|---|
| `action` | `int`: the action to be checked if it is supported by the device. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `subscriberType` | `int`: the type of subscription where the gesture events will be used. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_LOCAL` - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#GESTURE_SUBSCRIBER_TYPE_REMOTE` |

| Returns ||
|---|---|
| `boolean` | `true` if the given action is supported. `false` otherwise. <br /> |

### notifyGestureConsumed

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void notifyGestureConsumed (String experienceIdentifier, 
                int action)
```

Reports that a `https://developer.android.com/reference/com/google/wear/input/GestureEvent` has been consumed by the user for the provided `experienceIdentifier`.

This API should be consistently used by the client to report consumed gesture events so
that the manager can provide a consistent and reasonable decision on whether to shown hints
to the user in the future (`https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int)`).

<br />

| Parameters ||
|---|---|
| `experienceIdentifier` | `String`: the experience identifier for which a gesture has been consumed. Refer to the top-level documentation in this class to learn more about Experience Identifiers. <br /> |
| `action` | `int`: the action of the consumed gesture event (`https://developer.android.com/reference/com/google/wear/input/GestureEvent#getAction()`). Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

### notifyHintShown

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void notifyHintShown (String experienceIdentifier, 
                int action)
```

Reports that a hint has been shown to the user to indicate that the given gesture `action` is available for the provided `experienceIdentifier`.

This API should be consistently used by the client to report when hints are shown so that
the manager can provide a consistent and reasonable decision on whether to shown hints to the
user in the future (`https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int)`).

<br />

| Parameters ||
|---|---|
| `experienceIdentifier` | `String`: the experience identifier for which hint has been shown. Refer to the top-level documentation in this class to learn more about Experience Identifiers. <br /> |
| `action` | `int`: the gesture action for which hint has been shown. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

### removeEnabledActionsChangeListener

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void removeEnabledActionsChangeListener (Consumer<Set<Integer>> listener)
```

Removes a listener that has previously been registered via `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addEnabledActionsChangeListener(java.util.concurrent.Executor,%20java.util.function.Consumer<java.util.Set<java.lang.Integer>>)`. If the provided listener was never registered or has
already been removed, this method will return without doing anything.

<br />

| Parameters ||
|---|---|
| `listener` | `Consumer`: the `https://developer.android.com/reference/java/util/function/Consumer` to remove. <br /> |

**See also:**

- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#isActionEnabled(int,%20int)`
- `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addEnabledActionsChangeListener(java.util.concurrent.Executor,%20java.util.function.Consumer<java.util.Set<java.lang.Integer>>)`

### removeGestureEventListener

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void removeGestureEventListener (Consumer<GestureEvent> listener)
```

Removes a listener that has previously been registered via any of the `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#addGestureEventListener(com.google.wear.input.ForegroundGestureSubscriptionParams,%20java.util.concurrent.Executor,%20java.util.function.Consumer<com.google.wear.input.GestureEvent>)` APIs. If the provided listener was never registered or has already
been removed, this method will return without doing anything.

<br />

| Parameters ||
|---|---|
| `listener` | `Consumer`: the `https://developer.android.com/reference/java/util/function/Consumer` to remove. <br /> |

### shouldShowHint

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean shouldShowHint (String experienceIdentifier, 
                int action, 
                int hintFlags)
```

Whether a hint should be shown to the user to indicate that the given gesture `action`
is available for the provided `experienceIdentifier`.

This API should be used each time when a gesture experience is displayed to the user. For
example, if your gesture experience is in a View, you should use this API when the View
becomes visible. If the experience is in an Activity, you should call it when the Activity is
resumed. If the API returns `true`, you should hint the user (in a way that makes sense
for and is cohesive with the overall UX) about the availability and usage of the gesture
experience.

<br />

| Parameters ||
|---|---|
| `experienceIdentifier` | `String`: the experience identifier to check whether a hint should be shown for. Refer to the top-level documentation in this class to learn more about Experience Identifiers. <br /> |
| `action` | `int`: the gesture action to check whether a hint should be shown for. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `hintFlags` | `int`: a bitmask of flags providing additional information about the hint that is being shown. For example, this can indicate if the hint is an overlay. See `FLAG_HINT_` values. Value is either `0` or - `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#FLAG_HINT_STYLE_OVERLAY` |

| Returns ||
|---|---|
| `boolean` | `true` if the manager suggests showing a hint for the provided `experienceIdentifier` and `action`; `false` otherwise. <br /> |

### shouldShowHint

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean shouldShowHint (String experienceIdentifier, 
                int action)
```

Same as `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#shouldShowHint(java.lang.String,%20int,%20int)`, with the hint flags omitted (set to 0).

<br />

| Parameters ||
|---|---|
| `experienceIdentifier` | `String`: the experience identifier to check whether a hint should be shown for. Refer to the top-level documentation in this class to learn more about Experience Identifiers. <br /> |
| `action` | `int`: the gesture action to check whether a hint should be shown for. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

| Returns ||
|---|---|
| `boolean` | `true` if the manager suggests showing a hint for the provided `experienceIdentifier` and `action`; `false` otherwise. <br /> |