HeadlessWatchFaceClient
public interface HeadlessWatchFaceClient extends AutoCloseable
Controls a stateless remote headless watch face. This is mostly intended for use by watch face editor UIs which need to generate screenshots for various styling configurations without affecting the current watchface.
Note clients should call close when finished.
use Watch Face Format instead
Summary
Nested types |
|---|
public interface HeadlessWatchFaceClient.ClientDisconnectListenerThis interface is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods |
|
|---|---|
abstract void |
@AnyThreadThis method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
default static final @NonNull HeadlessWatchFaceClient |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract @NonNull Map<@NonNull Integer, @NonNull ComplicationSlotState> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract @NonNull Instant |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
default @NonNull UserStyleFlavors |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract @NonNull UserStyleSchema |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
default @NonNull byte[] |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
default boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract void |
@AnyThreadThis method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract Bitmap |
@RequiresApi(value = 27)This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract @NonNull Bitmap |
@RequiresApi(value = 27)This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
abstract @NonNull Bundle |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Inherited methods |
||
|---|---|---|
|
Public methods
addClientDisconnectListener
@AnyThread
abstract voidaddClientDisconnectListener(
@NonNull HeadlessWatchFaceClient.ClientDisconnectListener listener,
@NonNull Executor executor
)
Registers a ClientDisconnectListener.
createFromBundle
default static final @NonNull HeadlessWatchFaceClientcreateFromBundle(@NonNull Bundle bundle)
getComplicationSlotsState
abstract @NonNull Map<@NonNull Integer, @NonNull ComplicationSlotState>getComplicationSlotsState()
Map of androidx.wear.watchface.ComplicationSlot ids to ComplicationSlotState for each ComplicationSlot registered with the watch face's ComplicationSlotsManager. The ComplicationSlotState is based on the initial state of each androidx.wear.watchface.ComplicationSlot plus any overrides from the default style's ComplicationSlotsUserStyleSetting. Because the style can't change, ComplicationSlotState is immutable for a headless watch face.
getPreviewReferenceInstant
abstract @NonNull InstantgetPreviewReferenceInstant()
The Instant to use when rendering previews.
getUserStyleFlavors
default @NonNull UserStyleFlavorsgetUserStyleFlavors()
Returns the watch face's UserStyleFlavors if any.
| Throws | |
|---|---|
kotlin.RuntimeException |
if the watch face threw an exception while trying to service the request or there was a communication problem with watch face process. |
getUserStyleSchema
abstract @NonNull UserStyleSchemagetUserStyleSchema()
The watch face's UserStyleSchema.
getUserStyleSchemaDigestHash
default @NonNull byte[]getUserStyleSchemaDigestHash()
A SHA-1 MessageDigest hash of the UserStyleSchema. Note that for performance reasons where possible the resource id or url for Icons in the schema are used rather than the image bytes. This means that this hash should be considered insensitive to changes to the contents of icons between APK versions, which the user should account for accordingly.
This gives the same result as calling UserStyleSchema.computeDigestHash on userStyleSchema but is slightly faster since less data is passed over AIDL.
isConnectionAlive
@AnyThread
abstract booleanisConnectionAlive()
Returns true if the connection to the server side is alive.
isRenderWatchFaceToSurfaceSupported
default boolean isRenderWatchFaceToSurfaceSupported()Whether or not the watch face supports renderWatchFaceToSurface.
removeClientDisconnectListener
@AnyThread
abstract voidremoveClientDisconnectListener(
@NonNull HeadlessWatchFaceClient.ClientDisconnectListener listener
)
Removes a ClientDisconnectListener previously registered by addClientDisconnectListener.
renderComplicationToBitmap
@RequiresApi(value = 27)
abstract BitmaprenderComplicationToBitmap(
int complicationSlotId,
@NonNull RenderParameters renderParameters,
@NonNull Instant instant,
@NonNull ComplicationData complicationData,
UserStyle userStyle
)
Renders the androidx.wear.watchface.ComplicationSlot to a shared memory backed Bitmap with the given settings. The complication will be rendered at the same scale as it would be when the watch face is full screen.
| Parameters | |
|---|---|
int complicationSlotId |
The id of the complication to render |
@NonNull RenderParameters renderParameters |
The |
@NonNull Instant instant |
The |
@NonNull ComplicationData complicationData |
the |
UserStyle userStyle |
Optional |
| Returns | |
|---|---|
Bitmap |
A shared memory backed |
renderWatchFaceToBitmap
@RequiresApi(value = 27)
abstract @NonNull BitmaprenderWatchFaceToBitmap(
@NonNull RenderParameters renderParameters,
@NonNull Instant instant,
UserStyle userStyle,
Map<@NonNull Integer, @NonNull ComplicationData> slotIdToComplicationData
)
Renders the watchface to a shared memory backed Bitmap with the given settings.
| Parameters | |
|---|---|
@NonNull RenderParameters renderParameters |
The |
@NonNull Instant instant |
The |
UserStyle userStyle |
Optional |
Map<@NonNull Integer, @NonNull ComplicationData> slotIdToComplicationData |
Map of |