# Print output for @column tags ?>
public
final
class
Control
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.service.controls.Control |
Represents a physical object that can be represented by a ControlTemplate
and whose
properties may be modified through a ControlAction
.
The information is provided by a ControlsProviderService
and represents static
information (not current status) about the device.
Each control needs a unique (per provider) identifier that is persistent across reboots of the system.
Each Control
will have a name, a subtitle and will optionally belong to a structure
and zone. Some of these values are defined by the user and/or the ControlsProviderService
and will be used to display the control as well as group them for management.
Each object will have an associated DeviceTypes.DeviceType
. This will determine the icons and colors
used to display it.
An Intent
linking to the provider Activity that expands on this Control
and
allows for further actions should be provided.
Nested classes | |
---|---|
class |
Control.StatefulBuilder
Builder class for |
class |
Control.StatelessBuilder
Builder class for |
Constants | |
---|---|
int |
STATUS_DISABLED
The |
int |
STATUS_ERROR
Used to indicate that there was a temporary error while loading the device state. |
int |
STATUS_NOT_FOUND
The device corresponding to the |
int |
STATUS_OK
Used to indicate that the state of the device was successfully retrieved. |
int |
STATUS_UNKNOWN
Reserved for use with the |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<Control> |
CREATOR
|
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
PendingIntent
|
getAppIntent()
|
String
|
getControlId()
|
ControlTemplate
|
getControlTemplate()
|
ColorStateList
|
getCustomColor()
Optional color to be shown with the |
Icon
|
getCustomIcon()
Optional icon to be shown with the |
int
|
getDeviceType()
|
int
|
getStatus()
|
CharSequence
|
getStatusText()
|
CharSequence
|
getStructure()
Optional top-level group to help define the |
CharSequence
|
getSubtitle()
|
CharSequence
|
getTitle()
|
CharSequence
|
getZone()
Optional group name to help define the |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
public static final int STATUS_DISABLED
The Control
is currently disabled. A default error message will be displayed in
place of any custom text that was set through StatefulBuilder#setStatusText
.
Constant Value: 4 (0x00000004)
public static final int STATUS_ERROR
Used to indicate that there was a temporary error while loading the device state. A default
error message will be displayed in place of any custom text that was set through
StatefulBuilder#setStatusText
.
Constant Value: 3 (0x00000003)
public static final int STATUS_NOT_FOUND
The device corresponding to the Control
cannot be found or was removed. The user
will be alerted and directed to the application to resolve.
Constant Value: 2 (0x00000002)
public static final int STATUS_OK
Used to indicate that the state of the device was successfully retrieved. This includes
all scenarios where the device may have a warning for the user, such as "Lock jammed",
or "Vacuum stuck". Any information for the user should be set through
StatefulBuilder#setStatusText
.
Constant Value: 1 (0x00000001)
public static final int STATUS_UNKNOWN
Reserved for use with the StatelessBuilder
, and while loading. When state is
requested via ControlsProviderService#createPublisherFor
, use other status codes
to indicate the proper device state.
Constant Value: 0 (0x00000000)
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
public PendingIntent getAppIntent ()
Returns | |
---|---|
PendingIntent |
a PendingIntent linking to an Activity for the Control
This value cannot be null . |
public String getControlId ()
Returns | |
---|---|
String |
the identifier for the Control
This value cannot be null . |
public ControlTemplate getControlTemplate ()
Returns | |
---|---|
ControlTemplate |
instance of ControlTemplate , that defines how the Control will
behave and what interactions are available to the user
This value cannot be null . |
public ColorStateList getCustomColor ()
Optional color to be shown with the Control
. It is highly recommended
to let the system default the color unless the default is not suitable for the
application.
Returns | |
---|---|
ColorStateList |
background color to use
This value may be null . |
public Icon getCustomIcon ()
Optional icon to be shown with the Control
. It is highly recommended
to let the system default the icon unless the default icon is not suitable.
Returns | |
---|---|
Icon |
icon to show
This value may be null . |
public int getDeviceType ()
public int getStatus ()
Returns | |
---|---|
int |
status of the Control , used to convey information about the attempt to
fetch the current state
Value is STATUS_UNKNOWN , STATUS_OK , STATUS_NOT_FOUND , STATUS_ERROR , or STATUS_DISABLED |
public CharSequence getStatusText ()
Returns | |
---|---|
CharSequence |
user-facing text description of the Control 's status, describing its current
state
This value cannot be null . |
public CharSequence getStructure ()
Optional top-level group to help define the Control
's location, visible to the user.
If not present, the application name will be used as the top-level group. A structure
contains zones which contains controls.
Returns | |
---|---|
CharSequence |
name of the structure containing the control
This value may be null . |
public CharSequence getSubtitle ()
Returns | |
---|---|
CharSequence |
additional information about the Control , to appear underneath the title
This value cannot be null . |
public CharSequence getTitle ()
Returns | |
---|---|
CharSequence |
the user facing name of the Control
This value cannot be null . |
public CharSequence getZone ()
Optional group name to help define the Control
's location within a structure,
visible to the user. A structure contains zones which contains controls.
Returns | |
---|---|
CharSequence |
name of the zone containing the control
This value may be null . |
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
Parcel : This value cannot be null . |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |