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
|
Public methods | |
---|---|
boolean
|
isAdvancedProtectionEnabled()
Checks if advanced protection is enabled on the device. |
void
|
registerAdvancedProtectionCallback(Executor executor, AdvancedProtectionManager.Callback callback)
Registers a |
void
|
unregisterAdvancedProtectionCallback(AdvancedProtectionManager.Callback callback)
Unregister an existing |
Inherited methods | |
---|---|
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 . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-13 UTC.