RestrictionEntry
open class RestrictionEntry : Parcelable
kotlin.Any | |
↳ | android.content.RestrictionEntry |
Applications can expose restrictions for a restricted user on a multiuser device. The administrator can configure these restrictions that will then be applied to the restricted user. Each RestrictionsEntry is one configurable restriction.
Any application that chooses to expose such restrictions does so by implementing a receiver that handles theIntent.ACTION_GET_RESTRICTION_ENTRIES
action. The receiver then returns a result bundle that contains an entry called "restrictions", whose value is an ArrayList.
Summary
Constants | |
---|---|
static Int |
Restriction of type "bool". |
static Int |
Restriction of type "bundle". |
static Int |
Restriction of type "bundle_array". |
static Int |
Restriction of type "choice". |
static Int |
Restriction of type "integer". |
static Int |
Restriction of type "multi-select". |
static Int |
Hidden restriction type. |
static Int |
Restriction of type "string". |
Inherited constants | |
---|---|
Public constructors | |
---|---|
RestrictionEntry(in: Parcel!) |
|
RestrictionEntry(type: Int, key: String!) Constructor for specifying the type and key, with no initial value; |
|
RestrictionEntry(key: String!, selectedState: Boolean) Constructor for |
|
RestrictionEntry(key: String!, selectedInt: Int) Constructor for |
|
RestrictionEntry(key: String!, selectedString: String!) Constructor for |
|
RestrictionEntry(key: String!, selectedStrings: Array<String!>!) Constructor for |
Public methods | |
---|---|
open static RestrictionEntry! |
createBundleArrayEntry(key: String!, restrictionEntries: Array<RestrictionEntry!>!) Creates an entry of type |
open static RestrictionEntry! |
createBundleEntry(key: String!, restrictionEntries: Array<RestrictionEntry!>!) Creates an entry of type |
open Int | |
open Boolean |
Indicates whether some other object is "equal to" this one. |
open Array<String!>! |
Returns the list of currently selected values. |
open Array<String!>! |
Returns the list of strings, set earlier, that will be presented as choices to the user. |
open Array<String!>! |
Returns the list of possible string values set earlier. |
open String! |
Returns the provided user-visible description of the entry, if any. |
open Int |
Returns the value of the entry as an integer when the type is |
open String! |
getKey() This is the unique key for the restriction entry. |
open Array<RestrictionEntry!>! |
Returns array of possible restriction entries that this entry may contain. |
open Boolean |
Returns the current selected state for an entry of type |
open String! |
Returns the currently selected string value. |
open String! |
getTitle() Returns the user-visible title for the entry, if any. |
open Int |
getType() Returns the type for this restriction. |
open Int |
hashCode() |
open Unit |
setAllSelectedStrings(allSelectedStrings: Array<String!>!) Sets the current list of selected values for an entry of type |
open Unit |
setChoiceEntries(context: Context!, stringArrayResId: Int) Sets a list of strings that will be presented as choices to the user. |
open Unit |
setChoiceEntries(choiceEntries: Array<String!>!) Sets a list of strings that will be presented as choices to the user. |
open Unit |
setChoiceValues(context: Context!, stringArrayResId: Int) Sets a list of string values that can be selected by the user, similar to |
open Unit |
setChoiceValues(choiceValues: Array<String!>!) Sets a list of string values that can be selected by the user. |
open Unit |
setDescription(description: String!) Sets the user-visible description of the entry, as a possible sub-text for the title. |
open Unit |
setIntValue(value: Int) Sets the integer value of the entry when the type is |
open Unit |
setRestrictions(restrictions: Array<RestrictionEntry!>!) Sets an array of possible restriction entries, that this entry may contain. |
open Unit |
setSelectedState(state: Boolean) Sets the current selected state for an entry of type |
open Unit |
setSelectedString(selectedString: String!) Sets the string value to use as the selected value for this restriction. |
open Unit |
Sets the user-visible title for the entry. |
open Unit |
Sets the type for this restriction. |
open String |
toString() |
open Unit |
writeToParcel(dest: Parcel, flags: Int) |
Properties | |
---|---|
static Parcelable.Creator<RestrictionEntry!> |
Constants
TYPE_BOOLEAN
static val TYPE_BOOLEAN: Int
Restriction of type "bool". Use this for storing a boolean value, typically presented as a checkbox in the UI.
Value: 1
TYPE_BUNDLE
static val TYPE_BUNDLE: Int
Restriction of type "bundle". Use this for storing bundles
of restrictions
Value: 7
TYPE_BUNDLE_ARRAY
static val TYPE_BUNDLE_ARRAY: Int
Restriction of type "bundle_array". Use this for storing arrays of bundles
of restrictions
Value: 8
TYPE_CHOICE
static val TYPE_CHOICE: Int
Restriction of type "choice". Use this for storing a string value, typically presented as a single-select list. Call setChoiceEntries(java.lang.String[])
and setChoiceValues(java.lang.String[])
to set the localized list entries to present to the user and the corresponding values, respectively.
Value: 2
TYPE_INTEGER
static val TYPE_INTEGER: Int
Restriction of type "integer". Use this for storing an integer value. The range of values is from Integer.MIN_VALUE
to Integer.MAX_VALUE
.
Value: 5
TYPE_MULTI_SELECT
static val TYPE_MULTI_SELECT: Int
Restriction of type "multi-select". Use this for presenting a multi-select list where more than one entry can be selected, such as for choosing specific titles to allowlist. Call setChoiceEntries(java.lang.String[])
and setChoiceValues(java.lang.String[])
to set the localized list entries to present to the user and the corresponding values, respectively. Use getAllSelectedStrings()
and setAllSelectedStrings(java.lang.String[])
to manipulate the selections.
Value: 4
TYPE_NULL
static val TYPE_NULL: Int
Hidden restriction type. Use this type for information that needs to be transferred across but shouldn't be presented to the user in the UI. Stores a single String value.
Value: 0
TYPE_STRING
static val TYPE_STRING: Int
Restriction of type "string". Use this for storing a string value.
Value: 6
See Also
Public constructors
RestrictionEntry
RestrictionEntry(
type: Int,
key: String!)
Constructor for specifying the type and key, with no initial value;
Parameters | |
---|---|
type |
Int: the restriction type. |
key |
String!: the unique key for this restriction |
RestrictionEntry
RestrictionEntry(
key: String!,
selectedState: Boolean)
Constructor for TYPE_BOOLEAN
type.
Parameters | |
---|---|
key |
String!: the unique key for this restriction |
selectedState |
Boolean: whether this restriction is selected or not |
RestrictionEntry
RestrictionEntry(
key: String!,
selectedInt: Int)
Constructor for TYPE_INTEGER
type.
Parameters | |
---|---|
key |
String!: the unique key for this restriction |
selectedInt |
Int: the integer value of the restriction |
RestrictionEntry
RestrictionEntry(
key: String!,
selectedString: String!)
Constructor for TYPE_CHOICE
type.
Parameters | |
---|---|
key |
String!: the unique key for this restriction |
selectedString |
String!: the current value |
RestrictionEntry
RestrictionEntry(
key: String!,
selectedStrings: Array<String!>!)
Constructor for TYPE_MULTI_SELECT
type.
Parameters | |
---|---|
key |
String!: the unique key for this restriction |
selectedStrings |
Array<String!>!: the list of values that are currently selected |
Public methods
createBundleArrayEntry
open static fun createBundleArrayEntry(
key: String!,
restrictionEntries: Array<RestrictionEntry!>!
): RestrictionEntry!
Creates an entry of type TYPE_BUNDLE_ARRAY
.
Parameters | |
---|---|
key |
String!: the unique key for this restriction |
restrictionEntries |
Array<RestrictionEntry!>!: array of nested restriction entries. The array may only contain elements of type bundle . |
Return | |
---|---|
RestrictionEntry! |
the newly created restriction |
createBundleEntry
open static fun createBundleEntry(
key: String!,
restrictionEntries: Array<RestrictionEntry!>!
): RestrictionEntry!
Creates an entry of type TYPE_BUNDLE
.
Parameters | |
---|---|
key |
String!: the unique key for this restriction |
restrictionEntries |
Array<RestrictionEntry!>!: array of nested restriction entries. |
Return | |
---|---|
RestrictionEntry! |
the newly created restriction |
describeContents
open fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
open fun equals(other: Any?): Boolean
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
obj |
the reference object with which to compare. |
o |
This value may be null . |
Return | |
---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getAllSelectedStrings
open fun getAllSelectedStrings(): Array<String!>!
Returns the list of currently selected values.
Return | |
---|---|
Array<String!>! |
the list of current selections, if type is TYPE_MULTI_SELECT , null otherwise. |
getChoiceEntries
open fun getChoiceEntries(): Array<String!>!
Returns the list of strings, set earlier, that will be presented as choices to the user.
Return | |
---|---|
Array<String!>! |
the list of choices presented to the user. |
getChoiceValues
open fun getChoiceValues(): Array<String!>!
Returns the list of possible string values set earlier.
Return | |
---|---|
Array<String!>! |
the list of possible values. |
getDescription
open fun getDescription(): String!
Returns the provided user-visible description of the entry, if any.
Return | |
---|---|
String! |
the user-visible description, null if none was set earlier. |
getIntValue
open fun getIntValue(): Int
Returns the value of the entry as an integer when the type is TYPE_INTEGER
.
Return | |
---|---|
Int |
the integer value of the entry. |
getKey
open fun getKey(): String!
This is the unique key for the restriction entry.
Return | |
---|---|
String! |
the key for the restriction. |
getRestrictions
open fun getRestrictions(): Array<RestrictionEntry!>!
Returns array of possible restriction entries that this entry may contain.
getSelectedState
open fun getSelectedState(): Boolean
Returns the current selected state for an entry of type TYPE_BOOLEAN
.
Return | |
---|---|
Boolean |
the current selected state of the entry. |
getSelectedString
open fun getSelectedString(): String!
Returns the currently selected string value.
Return | |
---|---|
String! |
the currently selected value, which can be null for types that aren't for holding single string values. |
getTitle
open fun getTitle(): String!
Returns the user-visible title for the entry, if any.
Return | |
---|---|
String! |
the user-visible title for the entry, null if none was set earlier. |
getType
open fun getType(): Int
Returns the type for this restriction.
Return | |
---|---|
Int |
the type for this restriction |
hashCode
open fun hashCode(): Int
Return | |
---|---|
Int |
a hash code value for this object. |
setAllSelectedStrings
open fun setAllSelectedStrings(allSelectedStrings: Array<String!>!): Unit
Sets the current list of selected values for an entry of type TYPE_MULTI_SELECT
. These values will be persisted by the system for later use by the application.
Parameters | |
---|---|
allSelectedStrings |
Array<String!>!: the current list of selected values. |
setChoiceEntries
open fun setChoiceEntries(
context: Context!,
stringArrayResId: Int
): Unit
Sets a list of strings that will be presented as choices to the user. This is similar to setChoiceEntries(java.lang.String[])
.
Parameters | |
---|---|
context |
Context!: the application context, used for retrieving the resources. |
stringArrayResId |
Int: the resource id of a string array containing the possible entries. |
setChoiceEntries
open fun setChoiceEntries(choiceEntries: Array<String!>!): Unit
Sets a list of strings that will be presented as choices to the user. When the user selects one or more of these choices, the corresponding value from the possible values are stored as the selected strings. The size of this array must match the size of the array set in setChoiceValues(java.lang.String[])
. This method is not relevant for types other than TYPE_CHOICE
, and TYPE_MULTI_SELECT
.
Parameters | |
---|---|
choiceEntries |
Array<String!>!: the list of user-visible choices. |
See Also
setChoiceValues
open fun setChoiceValues(
context: Context!,
stringArrayResId: Int
): Unit
Sets a list of string values that can be selected by the user, similar to setChoiceValues(java.lang.String[])
.
Parameters | |
---|---|
context |
Context!: the application context for retrieving the resources. |
stringArrayResId |
Int: the resource id for a string array containing the possible values. |
See Also
setChoiceValues
open fun setChoiceValues(choiceValues: Array<String!>!): Unit
Sets a list of string values that can be selected by the user. If no user-visible entries are set by a call to setChoiceEntries(java.lang.String[])
, these values will be the ones shown to the user. Values will be chosen from this list as the user's selection and the selected values can be retrieved by a call to getAllSelectedStrings()
, or getSelectedString()
, depending on whether it is a multi-select type or choice type. This method is not relevant for types other than TYPE_CHOICE
, and TYPE_MULTI_SELECT
.
Parameters | |
---|---|
choiceValues |
Array<String!>!: an array of Strings which will be the selected values for the user's selections. |
setDescription
open fun setDescription(description: String!): Unit
Sets the user-visible description of the entry, as a possible sub-text for the title. You can use this to describe the entry in more detail or to display the current state of the restriction.
Parameters | |
---|---|
description |
String!: the user-visible description string. |
setIntValue
open fun setIntValue(value: Int): Unit
Sets the integer value of the entry when the type is TYPE_INTEGER
.
Parameters | |
---|---|
value |
Int: the integer value to set. |
setRestrictions
open fun setRestrictions(restrictions: Array<RestrictionEntry!>!): Unit
Sets an array of possible restriction entries, that this entry may contain.
This method is only relevant for types TYPE_BUNDLE
and TYPE_BUNDLE_ARRAY
setSelectedState
open fun setSelectedState(state: Boolean): Unit
Sets the current selected state for an entry of type TYPE_BOOLEAN
. This value will be persisted by the system for later use by the application.
Parameters | |
---|---|
state |
Boolean: the current selected state |
setSelectedString
open fun setSelectedString(selectedString: String!): Unit
Sets the string value to use as the selected value for this restriction. This value will be persisted by the system for later use by the application.
Parameters | |
---|---|
selectedString |
String!: the string value to select. |
setTitle
open fun setTitle(title: String!): Unit
Sets the user-visible title for the entry.
Parameters | |
---|---|
title |
String!: the user-visible title for the entry. |
setType
open fun setType(type: Int): Unit
Sets the type for this restriction.
Parameters | |
---|---|
type |
Int: the type for this restriction. |
toString
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |