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 constructors

No default complication data source.

This method is deprecated. Use a constructor that sets the DefaultTypes

DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName dataSource,
    int systemDataSourceFallback
)

This method is deprecated. Use a constructor that sets the DefaultTypes

DefaultComplicationDataSourcePolicy(
    int systemDataSource,
    @NonNull ComplicationType systemDataSourceDefaultType
)

Uses a system data source as the default complication data source.

DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComponentName secondaryDataSource,
    int systemDataSourceFallback
)

This method is deprecated. Use a constructor that sets the DefaultTypes

DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComplicationType primaryDataSourceDefaultType,
    int systemDataSourceFallback,
    @NonNull ComplicationType systemDataSourceFallbackDefaultType
)

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

DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComplicationType primaryDataSourceDefaultType,
    @NonNull ComponentName secondaryDataSource,
    @NonNull ComplicationType secondaryDataSourceDefaultType,
    int systemDataSourceFallback,
    @NonNull ComplicationType systemDataSourceFallbackDefaultType
)

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
equals(Object other)
final ComponentName

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

final ComplicationType

The default ComplicationType for primaryDataSource.

final ComponentName

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

final ComplicationType

The default ComplicationType for secondaryDataSource.

final int

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

final @NonNull ComplicationType

The default ComplicationType for systemDataSourceFallback.

int
final boolean

Whether or not this DefaultComplicationDataSourcePolicy contains a default data source.

@NonNull String

Public constructors

DefaultComplicationDataSourcePolicy

Added in 1.0.0
public DefaultComplicationDataSourcePolicy()

No default complication data source.

DefaultComplicationDataSourcePolicy

Added in 1.0.0
Deprecated in 1.1.0
public DefaultComplicationDataSourcePolicy(int systemProvider)

Uses systemProvider as the default complication data source.

DefaultComplicationDataSourcePolicy

Added in 1.0.0
Deprecated in 1.1.0
public DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName dataSource,
    int systemDataSourceFallback
)

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

DefaultComplicationDataSourcePolicy

Added in 1.1.0
public DefaultComplicationDataSourcePolicy(
    int systemDataSource,
    @NonNull ComplicationType systemDataSourceDefaultType
)

Uses a system data source as the default complication data source.

Parameters
int systemDataSource

The system DataSourceId data source to use.

@NonNull ComplicationType systemDataSourceDefaultType

The initial default ComplicationType.

DefaultComplicationDataSourcePolicy

Added in 1.0.0
Deprecated in 1.1.0
public DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComponentName secondaryDataSource,
    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.

DefaultComplicationDataSourcePolicy

Added in 1.1.0
public DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComplicationType primaryDataSourceDefaultType,
    int systemDataSourceFallback,
    @NonNull ComplicationType systemDataSourceFallbackDefaultType
)

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

Parameters
@NonNull ComponentName primaryDataSource

The data source to try.

@NonNull ComplicationType primaryDataSourceDefaultType

The default ComplicationType if primaryDataSource is selected. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

int systemDataSourceFallback

The system data source to fall back on if neither provider is available.

@NonNull ComplicationType systemDataSourceFallbackDefaultType

The default ComplicationType if systemDataSourceFallback is selected.

DefaultComplicationDataSourcePolicy

Added in 1.1.0
public DefaultComplicationDataSourcePolicy(
    @NonNull ComponentName primaryDataSource,
    @NonNull ComplicationType primaryDataSourceDefaultType,
    @NonNull ComponentName secondaryDataSource,
    @NonNull ComplicationType secondaryDataSourceDefaultType,
    int systemDataSourceFallback,
    @NonNull ComplicationType systemDataSourceFallbackDefaultType
)

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.

Parameters
@NonNull ComponentName primaryDataSource

The first data source to try.

@NonNull ComplicationType primaryDataSourceDefaultType

The default ComplicationType if primaryDataSource is selected. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

@NonNull ComponentName secondaryDataSource

The second data source to try.

@NonNull ComplicationType secondaryDataSourceDefaultType

The default ComplicationType if secondaryDataSource is selected. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

int systemDataSourceFallback

The system data source to fall back on if neither provider is available.

@NonNull ComplicationType systemDataSourceFallbackDefaultType

The default ComplicationType if systemDataSourceFallback is selected.

Public methods

equals

public boolean equals(Object other)

getPrimaryDataSource

Added in 1.0.0
public final ComponentName getPrimaryDataSource()

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

getPrimaryDataSourceDefaultType

Added in 1.1.0
public final ComplicationType getPrimaryDataSourceDefaultType()

The default ComplicationType for primaryDataSource. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

getSecondaryDataSource

Added in 1.0.0
public final ComponentName getSecondaryDataSource()

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

getSecondaryDataSourceDefaultType

Added in 1.1.0
public final ComplicationType getSecondaryDataSourceDefaultType()

The default ComplicationType for secondaryDataSource. Note Pre-R this will be ignored in favour of systemDataSourceFallbackDefaultType.

getSystemDataSourceFallback

Added in 1.0.0
public final int getSystemDataSourceFallback()

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

getSystemDataSourceFallbackDefaultType

Added in 1.1.0
public final @NonNull ComplicationType getSystemDataSourceFallbackDefaultType()

The default ComplicationType for systemDataSourceFallback.

hashCode

public int hashCode()

isEmpty

Added in 1.0.0
public final boolean isEmpty()

Whether or not this DefaultComplicationDataSourcePolicy contains a default data source.

toString

public @NonNull String toString()