Most visited

Recently visited

Added in API level 23

SystemUpdatePolicy

public class SystemUpdatePolicy
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.admin.SystemUpdatePolicy


A class that represents a local system update policy set by the device owner.

See also:

Summary

Constants

int TYPE_INSTALL_AUTOMATIC

Install system update automatically as soon as one is available.

int TYPE_INSTALL_WINDOWED

Install system update automatically within a daily maintenance window, for a maximum of 30 days.

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.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<SystemUpdatePolicy> CREATOR

Public methods

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.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

TYPE_INSTALL_AUTOMATIC

Added in API level 23
int TYPE_INSTALL_AUTOMATIC

Install system update automatically as soon as one is available.

Constant Value: 1 (0x00000001)

TYPE_INSTALL_WINDOWED

Added in API level 23
int TYPE_INSTALL_WINDOWED

Install system update automatically within a daily maintenance window, for a maximum of 30 days. After the expiration the policy will no longer be effective and the system should revert back to its normal behavior as if no policy were set. The only exception is TYPE_INSTALL_AUTOMATIC which should still take effect to install system update immediately.

Constant Value: 2 (0x00000002)

TYPE_POSTPONE

Added in API level 23
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. The only exception is TYPE_INSTALL_AUTOMATIC which should still take effect to install system update immediately.

Constant Value: 3 (0x00000003)

Fields

CREATOR

Added in API level 23
Creator<SystemUpdatePolicy> CREATOR

Public methods

createAutomaticInstallPolicy

Added in API level 23
SystemUpdatePolicy createAutomaticInstallPolicy ()

Create a policy object and set it to install update automatically as soon as one is available.

Returns
SystemUpdatePolicy

See also:

createPostponeInstallPolicy

Added in API level 23
SystemUpdatePolicy createPostponeInstallPolicy ()

Create a policy object and set it to block installation for a maximum period of 30 days. After expiration the system should revert back to its normal behavior as if no policy were set.

Returns
SystemUpdatePolicy

See also:

createWindowedInstallPolicy

Added in API level 23
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. If the start and end times are the same, the window is considered to include the WHOLE 24 hours, that is, updates can install at any time. If the given window in invalid, a 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.

Parameters
startTime int: 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 int: 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).
Returns
SystemUpdatePolicy

See also:

describeContents

Added in API level 23
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(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.

getInstallWindowEnd

Added in API level 23
int getInstallWindowEnd ()

Get the end of the maintenance window.

Returns
int the end of the maintenance window measured as the number of minutes from midnight, or -1 if the policy does not have a maintenance window.

getInstallWindowStart

Added in API level 23
int getInstallWindowStart ()

Get the start of the maintenance window.

Returns
int the start of the maintenance window measured as the number of minutes from midnight, or -1 if the policy does not have a maintenance window.

getPolicyType

Added in API level 23
int getPolicyType ()

Returns the type of system update policy.

Returns
int an integer, either one of TYPE_INSTALL_AUTOMATIC, TYPE_INSTALL_WINDOWED and TYPE_POSTPONE, or -1 if no policy has been set.

toString

Added in API level 23
String toString ()

Returns a string representation of the object. In general, the 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())
 

Returns
String a string representation of the object.

writeToParcel

Added in API level 23
void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

Hooray!