WatchState

public final class WatchState


Describes the current state of the wearable including some hardware details such as whether or not it supports burn in prevention and low-bit ambient.

Summary

Public fields

final long

UTC reference time for previews of analog watch faces in milliseconds since the epoch.

final int

the size, in pixels, of the chin or zero if the device does not have a chin.

final long

UTC reference time for previews of digital watch faces in milliseconds since the epoch.

final boolean

Whether or not the watch hardware supports burn in protection.

final boolean

Whether or not the watch hardware supports low bit ambient support.

final @NonNull StateFlow<@NonNull Integer>

The current user interruption settings.

final @NonNull StateFlow<@NonNull Boolean>

Whether or not the watch is in ambient mode.

final boolean

Whether or not this is a headless watchface.

final @NonNull StateFlow<@NonNull Boolean>

Whether or not the watch face is visible.

Public constructors

WatchState(
    @NonNull StateFlow<@NonNull Integer> interruptionFilter,
    @NonNull StateFlow<@NonNull Boolean> isAmbient,
    @NonNull StateFlow<@NonNull Boolean> isBatteryLowAndNotCharging,
    @NonNull StateFlow<@NonNull Boolean> isVisible,
    boolean hasLowBitAmbient,
    boolean hasBurnInProtection,
    long analogPreviewReferenceTimeMillis,
    long digitalPreviewReferenceTimeMillis,
    @Px int chinHeight,
    boolean isHeadless
)

Public fields

analogPreviewReferenceTimeMillis

@NonNull
public final long analogPreviewReferenceTimeMillis

UTC reference time for previews of analog watch faces in milliseconds since the epoch.

chinHeight

@NonNull
public final int chinHeight

the size, in pixels, of the chin or zero if the device does not have a chin. A chin is a section at the bottom of a circular display that is visible due to hardware limitations.

digitalPreviewReferenceTimeMillis

@NonNull
public final long digitalPreviewReferenceTimeMillis

UTC reference time for previews of digital watch faces in milliseconds since the epoch.

hasBurnInProtection

@NonNull
public final boolean hasBurnInProtection

Whether or not the watch hardware supports burn in protection.

hasLowBitAmbient

@NonNull
public final boolean hasLowBitAmbient

Whether or not the watch hardware supports low bit ambient support.

interruptionFilter

@NonNull
public final @NonNull StateFlow<@NonNull IntegerinterruptionFilter

The current user interruption settings. See NotificationManager. Based on the value the watch face should adjust the amount of information it displays. For example, if it displays the number of pending emails, it should hide it if interruptionFilter is equal to NotificationManager.INTERRUPTION_FILTER_NONE. interruptionFilter can be NotificationManager.INTERRUPTION_FILTER_NONE, NotificationManager.INTERRUPTION_FILTER_PRIORITY, NotificationManager.INTERRUPTION_FILTER_ALL, NotificationManager.INTERRUPTION_FILTER_ALARMS, or NotificationManager.INTERRUPTION_FILTER_UNKNOWN.

isAmbient

@NonNull
public final @NonNull StateFlow<@NonNull BooleanisAmbient

Whether or not the watch is in ambient mode. The order in which ambient vs style changes are reported is not guaranteed. Likewise the order of isAmbient flow callbacks and Renderer.CanvasRenderer.render or Renderer.GlesRenderer.render calls is not defined. For rendering please refer to RenderParameters.drawMode instead of isAmbient because you might receive requests for rendering non-ambient frames while the watch is ambient (e.g. editing from the companion phone).

isHeadless

@NonNull
public final boolean isHeadless

Whether or not this is a headless watchface.

isVisible

@NonNull
public final @NonNull StateFlow<@NonNull BooleanisVisible

Whether or not the watch face is visible.

Public constructors

WatchState

public final WatchState(
    @NonNull StateFlow<@NonNull Integer> interruptionFilter,
    @NonNull StateFlow<@NonNull Boolean> isAmbient,
    @NonNull StateFlow<@NonNull Boolean> isBatteryLowAndNotCharging,
    @NonNull StateFlow<@NonNull Boolean> isVisible,
    boolean hasLowBitAmbient,
    boolean hasBurnInProtection,
    long analogPreviewReferenceTimeMillis,
    long digitalPreviewReferenceTimeMillis,
    @Px int chinHeight,
    boolean isHeadless
)
Parameters
@NonNull StateFlow<@NonNull Integer> interruptionFilter

The current user interruption settings. See NotificationManager. Based on the value the watch face should adjust the amount of information it displays. For example, if it displays the number of pending emails, it should hide it if interruptionFilter is equal to NotificationManager.INTERRUPTION_FILTER_NONE. interruptionFilter can be