AdvancedProtectionManager


class AdvancedProtectionManager
kotlin.Any
   ↳ 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
abstract

A callback class for monitoring changes to Advanced Protection state

Public methods
Boolean

Checks if advanced protection is enabled on the device.

Unit

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

Unit

Unregister an existing Callback.

Public methods

isAdvancedProtectionEnabled

fun isAdvancedProtectionEnabled(): Boolean

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

Return
Boolean true if advanced protection is enabled, false otherwise.

registerAdvancedProtectionCallback

fun registerAdvancedProtectionCallback(
    executor: Executor,
    callback: AdvancedProtectionManager.Callback
): Unit

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 android.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

fun unregisterAdvancedProtectionCallback(callback: AdvancedProtectionManager.Callback): Unit

Unregister an existing Callback.
Requires android.Manifest.permission#QUERY_ADVANCED_PROTECTION_MODE

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