DefaultComplicationDataSourcePolicy

public final class DefaultComplicationDataSourcePolicy


A watch face may wish to try and set one or more non-system data sources as the default data source for a complication. If a complication data source can't be used for some reason (e.g. it isn't installed or it doesn't support the requested type, or the watch face lacks the necessary permission) then the next one will be tried. A system complication data source acts as a final fallback in case no non-system data sources can be used.

If the DefaultComplicationDataSourcePolicy is empty then no default is set.

Summary

Public fields

final @Nullable ComponentName

First of two non-system data sources to be tried in turn.

final @Nullable ComponentName

Second of two non-system data sources to be tried in turn.

final @SystemDataSources.DataSourceId int

Fallback in case none of the non-system data sources could be used.

Public constructors

No default complication data source.

Uses systemProvider as the default complication data source.

DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName dataSource,
    @SystemDataSources.DataSourceId int systemDataSourceFallback
)

Attempts to use dataSource as the default complication complication data source, if not present then systemDataSourceFallback will be used instead.

DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComponentName secondaryDataSource,
    @SystemDataSources.DataSourceId int systemDataSourceFallback
)

Attempts to use primaryDataSource as the default complication data source, if not present then secondaryDataSource will be tried and if that's not present then systemDataSourceFallback will be used instead.

Public methods

boolean
int
final boolean

Whether or not this DefaultComplicationDataSourcePolicy contains a default data source.

Public fields

primaryDataSource

@Nullable
public final @Nullable ComponentName primaryDataSource

First of two non-system data sources to be tried in turn. Set to null if not required.

secondaryDataSource

@Nullable
public final @Nullable ComponentName secondaryDataSource

Second of two non-system data sources to be tried in turn. Set to null if not required.

systemDataSourceFallback

@SystemDataSources.DataSourceId
@NonNull
public final @SystemDataSources.DataSourceId int systemDataSourceFallback

Fallback in case none of the non-system data sources could be used.

Public constructors

DefaultComplicationDataSourcePolicy

public final DefaultComplicationDataSourcePolicy()

No default complication data source.

DefaultComplicationDataSourcePolicy

public final DefaultComplicationDataSourcePolicy(
    @SystemDataSources.DataSourceId int systemProvider
)

Uses systemProvider as the default complication data source.

DefaultComplicationDataSourcePolicy

public final DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName dataSource,
    @SystemDataSources.DataSourceId int systemDataSourceFallback
)

Attempts to use dataSource as the default complication complication data source, if not present then systemDataSourceFallback will be used instead.

DefaultComplicationDataSourcePolicy

public final DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComponentName secondaryDataSource,
    @SystemDataSources.DataSourceId int systemDataSourceFallback
)

Attempts to use primaryDataSource as the default complication data source, if not present then secondaryDataSource will be tried and if that's not present then systemDataSourceFallback will be used instead.

Public methods

equals

@NonNull
public boolean equals(@Nullable Object other)

hashCode

@NonNull
public int hashCode()

isEmpty

@NonNull
public final boolean isEmpty()

Whether or not this DefaultComplicationDataSourcePolicy contains a default data source.