public class SystemUpdatePolicy extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<SystemUpdatePolicy> |
CREATOR |
static int |
TYPE_INSTALL_AUTOMATIC
Install system update automatically as soon as one is available.
|
static int |
TYPE_INSTALL_WINDOWED
Install system update automatically within a daily maintenance window, for a maximum of 30
days.
|
static int |
TYPE_POSTPONE
Incoming system update will be blocked for a maximum of 30 days, after which the system
should revert back to its normal behavior as if no policy were set.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
static SystemUpdatePolicy |
createAutomaticInstallPolicy()
Create a policy object and set it to install update automatically as soon as one is
available.
|
static SystemUpdatePolicy |
createPostponeInstallPolicy()
Create a policy object and set it to block installation for a maximum period of 30 days.
|
static SystemUpdatePolicy |
createWindowedInstallPolicy(int startTime,
int endTime)
Create a policy object and set it to: new system update will only be installed automatically
when the system clock is inside a daily maintenance window.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
int |
getInstallWindowEnd()
Get the end of the maintenance window.
|
int |
getInstallWindowStart()
Get the start of the maintenance window.
|
int |
getPolicyType()
Returns the type of system update policy.
|
boolean |
isValid()
Return if this object represents a valid policy.
|
static SystemUpdatePolicy |
restoreFromXml(XmlPullParser parser) |
void |
saveToXml(XmlSerializer out) |
String |
toString()
Returns a string representation of the object.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final int TYPE_INSTALL_AUTOMATIC
public static final int TYPE_INSTALL_WINDOWED
TYPE_INSTALL_AUTOMATIC
which should still take effect to install system update
immediately.public static final int TYPE_POSTPONE
TYPE_INSTALL_AUTOMATIC
which should still take effect to install system update
immediately.public static final Parcelable.Creator<SystemUpdatePolicy> CREATOR
public static SystemUpdatePolicy createAutomaticInstallPolicy()
TYPE_INSTALL_AUTOMATIC
public static SystemUpdatePolicy createWindowedInstallPolicy(int startTime, int endTime)
IllegalArgumentException
will
be thrown. If start time is later than end time, the window is considered spanning midnight,
i.e. end time donates a time on the next day. The maintenance window will last for 30 days,
after which the system should revert back to its normal behavior as if no policy were set.startTime
- the start of the maintenance window, measured as the number of minutes from
midnight in the device's local time. Must be in the range of [0, 1440).endTime
- the end of the maintenance window, measured as the number of minutes from
midnight in the device's local time. Must be in the range of [0, 1440).TYPE_INSTALL_WINDOWED
public static SystemUpdatePolicy createPostponeInstallPolicy()
TYPE_POSTPONE
public int getPolicyType()
TYPE_INSTALL_AUTOMATIC
,
TYPE_INSTALL_WINDOWED
and TYPE_POSTPONE
, or -1 if no policy has been set.public int getInstallWindowStart()
public int getInstallWindowEnd()
public boolean isValid()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public static SystemUpdatePolicy restoreFromXml(XmlPullParser parser)
public void saveToXml(XmlSerializer out) throws IOException
IOException