Udostępnij za pośrednictwem


SystemUpdatePolicy Class

Definition

Determines when over-the-air system updates are installed on a device.

[Android.Runtime.Register("android/app/admin/SystemUpdatePolicy", ApiSince=23, DoNotGenerateAcw=true)]
public class SystemUpdatePolicy : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/admin/SystemUpdatePolicy", ApiSince=23, DoNotGenerateAcw=true)>]
type SystemUpdatePolicy = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
SystemUpdatePolicy
Attributes
Implements

Remarks

Determines when over-the-air system updates are installed on a device. Only a device policy controller (DPC) running in device owner mode or in profile owner mode for an organization-owned device can set an update policy for the device—by calling the DevicePolicyManager method DevicePolicyManager#setSystemUpdatePolicy setSystemUpdatePolicy(). An update policy affects the pending system update (if there is one) and any future updates for the device.

If a policy is set on a device, the system doesn't notify the user about updates.

<h3>Example</h3>

The example below shows how a DPC might set a maintenance window for system updates:

<code>
            private final MAINTENANCE_WINDOW_START = 1380; // 11pm
            private final MAINTENANCE_WINDOW_END = 120; // 2am

            // ...

            // Create the system update policy
            SystemUpdatePolicy policy = SystemUpdatePolicy.createWindowedInstallPolicy(
                MAINTENANCE_WINDOW_START, MAINTENANCE_WINDOW_END);

            // Get a DevicePolicyManager instance to set the policy on the device
            DevicePolicyManager dpm =
                (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
            ComponentName adminComponent = getComponentName(context);
            dpm.setSystemUpdatePolicy(adminComponent, policy);
</code>

<h3>Developer guide</h3> To learn more, read Manage system updates.

Java documentation for android.app.admin.SystemUpdatePolicy.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

SystemUpdatePolicy(IntPtr, JniHandleOwnership)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
FreezePeriods

Returns the list of freeze periods previously set on this system update policy object.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
InstallWindowEnd

Get the end of the maintenance window.

InstallWindowStart

Get the start of the maintenance window.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
PolicyType

Returns the type of system update policy, or -1 if no policy has been set.

ThresholdClass
ThresholdType

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CreateAutomaticInstallPolicy()

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

CreatePostponeInstallPolicy()

Create a policy object and set it to block installation for a maximum period of 30 days.

CreateWindowedInstallPolicy(Int32, Int32)

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.

DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetFreezePeriods(IList<FreezePeriod>)

Configure a list of freeze periods on top of the current policy.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to