Google is committed to advancing racial equity for Black communities. See how.


open class TestWearableButtonsProvider : WearableButtonsProvider
   ↳ androidx.wear.input.testing.TestWearableButtonsProvider

A WearableButtonsProvider suitable for use in tests.

This allows for explicitly specifying which buttons are available for testing, and their coordinates. It is intended to be used by passing in a map, mapping between the button keycode (typically in the set android.view.KeyEvent#KEYCODE_STEM_PRIMARY, , android.view.KeyEvent#KEYCODE_STEM_2, or ) and the location of the button. Take the following example:

Map<integer, testwearablebuttonlocation>
  buttons = new HashMap&lt;&gt;();
      buttons.put(KEYCODE_STEM_1, new TestWearableButtonLocation(100, 100);
      TestWearableButtonsProvider provider = new TestWearableButtonsProvider(buttons);


Nested classes

Class describing the location of a button on a wearable device.

Public constructors

Build a button provider, which will respond with the provided set of buttons.

Public methods
open IntArray?

open Bundle
getButtonInfo(@NonNull context: Context, keycode: Int)

Public constructors


TestWearableButtonsProvider(@NonNull buttons: MutableMap<Int!, TestWearableButtonsProvider.TestWearableButtonLocation!>)

Build a button provider, which will respond with the provided set of buttons.

buttons MutableMap<Int!, TestWearableButtonsProvider.TestWearableButtonLocation!>: The buttons returned by this provider.

Public methods


@Nullable open fun getAvailableButtonKeyCodes(@NonNull context: Context): IntArray?


@NonNull open fun getButtonInfo(
    @NonNull context: Context,
    keycode: Int
): Bundle