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

InteractiveWatchFaceSysUiClient

interface InteractiveWatchFaceSysUiClient : AutoCloseable
androidx.wear.watchface.client.InteractiveWatchFaceSysUiClient

Controls a stateful remote interactive watch face with an interface tailored for SysUI the WearOS launcher app. Typically this will be used for the current active watch face.

Note clients should call close when finished.

Summary

Nested classes

Describes regions of the watch face for use by a screen reader.

Constants
const Int

Indicates that an "up" event on the watch face has occurred that has not been consumed by another activity.

const Int

Indicates a "down" touch event on the watch face.

const Int

Indicates that a previous TAP_TYPE_TOUCH event has been canceled.

Public methods
abstract IBinder

Returns the associated IBinder.

abstract Unit

Triggers watch face rendering into the surface when in ambient mode.

abstract Unit
sendTouchEvent(xPosition: Int, yPosition: Int, tapType: Int)

Sends a tap event to the watch face for processing.

abstract Unit

Updates the watch faces SystemState.

abstract Bitmap
takeWatchFaceScreenshot(renderParameters: RenderParameters, @IntRange(0, 100) compressionQuality: Int, calendarTimeMillis: Long, userStyle: UserStyle?, idAndComplicationData: Map<Int, ComplicationData>?)

Requests for a WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings.

Companion functions
InteractiveWatchFaceSysUiClient

Constructs an InteractiveWatchFaceSysUiClient from the IBinder returned by asBinder.

Properties
abstract List<InteractiveWatchFaceSysUiClient.ContentDescriptionLabel>

Returns the ContentDescriptionLabels describing the watch face, for the use by screen readers.

abstract String

Returns the ID of this watch face instance.

abstract Long

The UTC reference preview time for this watch face in milliseconds since the epoch.

Constants

TAP_TYPE_TAP

const val TAP_TYPE_TAP: Int

Indicates that an "up" event on the watch face has occurred that has not been consumed by another activity. A TAP_TYPE_TOUCH always occur first. This event will not occur if a TAP_TYPE_TOUCH_CANCEL is sent.

Value: IInteractiveWatchFaceSysUI.TAP_TYPE_TAP

TAP_TYPE_TOUCH

const val TAP_TYPE_TOUCH: Int

Indicates a "down" touch event on the watch face.

Value: IInteractiveWatchFaceSysUI.TAP_TYPE_TOUCH

TAP_TYPE_TOUCH_CANCEL

const val TAP_TYPE_TOUCH_CANCEL: Int

Indicates that a previous TAP_TYPE_TOUCH event has been canceled. This generally happens when the watch face is touched but then a move or long press occurs.

Value: IInteractiveWatchFaceSysUI.TAP_TYPE_TOUCH_CANCEL

Public methods

asBinder

abstract fun asBinder(): IBinder

Returns the associated IBinder. Allows this interface to be passed over AIDL.

performAmbientTick

abstract fun performAmbientTick(): Unit

Triggers watch face rendering into the surface when in ambient mode.

sendTouchEvent

abstract fun sendTouchEvent(
    xPosition: Int,
    yPosition: Int,
    tapType: Int
): Unit

Sends a tap event to the watch face for processing.

setSystemState

abstract fun setSystemState(systemState: SystemState): Unit

Updates the watch faces SystemState.

takeWatchFaceScreenshot

@RequiresApi(27) abstract fun takeWatchFaceScreenshot(
    renderParameters: RenderParameters,
    @IntRange(0, 100) compressionQuality: Int,
    calendarTimeMillis: Long,
    userStyle: UserStyle?,
    idAndComplicationData: Map<Int, ComplicationData>?
): Bitmap

Requests for a WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings.

Parameters
renderParameters: RenderParameters The RenderParameters to draw with.
compressionQuality: Int The WebP compression quality, 100 = loss less.
calendarTimeMillis: Long The UTC time in milliseconds since the epoch to render with.
userStyle: UserStyle? Optional UserStyle to render with, if null the current style is used.
idAndComplicationData: Map<Int, ComplicationData>? Map of complication ids to ComplicationData to render with, or if null then the existing complication data if any is used.
Return
A WebP compressed shared memory backed Bitmap containing a screenshot of the watch face with the given settings.

Properties

contentDescriptionLabels

abstract val contentDescriptionLabels: List<InteractiveWatchFaceSysUiClient.ContentDescriptionLabel>

Returns the ContentDescriptionLabels describing the watch face, for the use by screen readers.

instanceId

abstract val instanceId: String

Returns the ID of this watch face instance.

previewReferenceTimeMillis

abstract val previewReferenceTimeMillis: Long

The UTC reference preview time for this watch face in milliseconds since the epoch.

Companion functions

createFromBinder

@JvmStatic fun createFromBinder(binder: IBinder): InteractiveWatchFaceSysUiClient

Constructs an InteractiveWatchFaceSysUiClient from the IBinder returned by asBinder.