AdvancedProtectionManager


public final class AdvancedProtectionManager
extends Object

java.lang.Object
   ↳ android.security.advancedprotection.AdvancedProtectionManager


Advanced Protection is a mode that users can enroll their device into, that enhances security by enabling features and restrictions across both the platform and user apps.

This class provides methods to query and control the advanced protection mode for the device.

Summary

Nested classes

interface AdvancedProtectionManager.Callback

A callback class for monitoring changes to Advanced Protection state

To register a callback, implement this interface, and register it with AdvancedProtectionManager.registerAdvancedProtectionCallback(Executor, Callback)

Public methods

boolean isAdvancedProtectionEnabled()

Checks if advanced protection is enabled on the device.

void registerAdvancedProtectionCallback(Executor executor, AdvancedProtectionManager.Callback callback)

Registers a Callback to be notified of changes to the Advanced Protection state.

void unregisterAdvancedProtectionCallback(AdvancedProtectionManager.Callback callback)

Unregister an existing Callback.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

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

void finalize()

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

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

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

final void notifyAll()

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

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

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

final void wait(long timeoutMillis)

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

final void wait()

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

Public methods

isAdvancedProtectionEnabled

public boolean isAdvancedProtectionEnabled ()

Checks if advanced protection is enabled on the device.
Requires Manifest.permission.QUERY_ADVANCED_PROTECTION_MODE

Returns
boolean true if advanced protection is enabled, false otherwise.

registerAdvancedProtectionCallback

public void registerAdvancedProtectionCallback (Executor executor, 
                AdvancedProtectionManager.Callback callback)

Registers a Callback to be notified of changes to the Advanced Protection state.

The provided callback will be called on the specified executor with the updated state. Methods are called when the state changes, as well as once on initial registration.
Requires Manifest.permission.QUERY_ADVANCED_PROTECTION_MODE

Parameters
executor Executor: The executor of where the callback will execute. This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

callback AdvancedProtectionManager.Callback: The Callback object to register.. This value cannot be null.

unregisterAdvancedProtectionCallback

public void unregisterAdvancedProtectionCallback (AdvancedProtectionManager.Callback callback)

Unregister an existing Callback.
Requires Manifest.permission.QUERY_ADVANCED_PROTECTION_MODE

Parameters
callback AdvancedProtectionManager.Callback: The Callback object to unregister. This value cannot be null.