SettingsPreferenceMetadata


public final class SettingsPreferenceMetadata
extends Object implements Parcelable

java.lang.Object
   ↳ android.service.settings.preferences.SettingsPreferenceMetadata


Data object representation of a Settings Preference definition and state.

Summary

Nested classes

class SettingsPreferenceMetadata.Builder

Builder to construct SettingsPreferenceMetadata

Constants

int DEEPLINK_ONLY

Indicates preference is write-sensitive.

int EXPECT_POST_CONFIRMATION

Indicates preference is mildly write-sensitive.

int NO_DIRECT_ACCESS

Indicates preference is highly write-sensitivity and carries significant user-risk.

int NO_SENSITIVITY

Indicates preference is not write-sensitive.

Inherited constants

Fields

public static final Creator<SettingsPreferenceMetadata> CREATOR

Parcelable Creator for SettingsPreferenceMetadata.

Public methods

Bundle getExtras()

Returns any additional fields specific to this preference.

String getKey()

Returns the key of Preference.

Intent getLaunchIntent()

Returns the intent to launch the host app page for this Preference.

List<String> getReadPermissions()

Returns the permissions required to read this Preference's value.

String getScreenKey()

Returns the screen key of Preference.

String getSummary()

Returns the summary of Preference.

String getTitle()

Returns the title of Preference.

List<String> getWritePermissions()

Returns the permissions required to write this Preference's value.

int getWriteSensitivity()

Returns the write-level sensitivity of Preference.

boolean isAvailable()

Returns whether Preference is available.

boolean isEnabled()

Returns whether Preference is enabled.

boolean isRestricted()

Returns whether Preference is restricted.

boolean isWritable()

Returns whether Preference is writable.

Inherited methods

Constants

public static final int DEEPLINK_ONLY

Indicates preference is write-sensitive.

This preference cannot be changed through this API; instead a deeplink to the Preference's page should be used instead, accessible via getLaunchIntent().

Constant Value: 2 (0x00000002)

EXPECT_POST_CONFIRMATION

public static final int EXPECT_POST_CONFIRMATION

Indicates preference is mildly write-sensitive.

In addition to necessary permissions, after writing its value the user should be given the option to revert back.

Constant Value: 1 (0x00000001)

NO_DIRECT_ACCESS

public static final int NO_DIRECT_ACCESS

Indicates preference is highly write-sensitivity and carries significant user-risk.

This Preference cannot be changed through this API and no direct deeplink is available. Other Metadata is still available.

Constant Value: 3 (0x00000003)

NO_SENSITIVITY

public static final int NO_SENSITIVITY

Indicates preference is not write-sensitive.

Its value is writable without explicit consent, assuming all necessary permissions are granted.

Constant Value: 0 (0x00000000)

Fields

CREATOR

public static final Creator<SettingsPreferenceMetadata> CREATOR

Parcelable Creator for SettingsPreferenceMetadata.

Public methods

getExtras

public Bundle getExtras ()

Returns any additional fields specific to this preference.

Treat all data as optional. This may contain unstructured data for a given preference, where the type and format of this data may only known by inspecting the source code of that preference. As such, any access of this data must handle failures gracefully to account for changing or missing data.

Returns
Bundle

getKey

public String getKey ()

Returns the key of Preference.

Returns
String

getLaunchIntent

public Intent getLaunchIntent ()

Returns the intent to launch the host app page for this Preference.

Returns
Intent

getReadPermissions

public List<String> getReadPermissions ()

Returns the permissions required to read this Preference's value.

May be empty.

Returns
List<String>

getScreenKey

public String getScreenKey ()

Returns the screen key of Preference.

Returns
String

getSummary

public String getSummary ()

Returns the summary of Preference.

Returns
String

getTitle

public String getTitle ()

Returns the title of Preference.

Returns
String

getWritePermissions

public List<String> getWritePermissions ()

Returns the permissions required to write this Preference's value.

May be empty.

Returns
List<String>

getWriteSensitivity

public int getWriteSensitivity ()

Returns the write-level sensitivity of Preference.

Returns
int Value is NO_SENSITIVITY, EXPECT_POST_CONFIRMATION, DEEPLINK_ONLY, or NO_DIRECT_ACCESS

isAvailable

public boolean isAvailable ()

Returns whether Preference is available.

Returns
boolean

isEnabled

public boolean isEnabled ()

Returns whether Preference is enabled.

Returns
boolean

isRestricted

public boolean isRestricted ()

Returns whether Preference is restricted.

If true, this means the Preference is treated as a Restricted Preference which indicates that it could be conditionally disabled/unavailable due to admin settings.

Returns
boolean

isWritable

public boolean isWritable ()

Returns whether Preference is writable.

Returns
boolean