Added in API level 19

AppOpsManager.OnOpChangedListener


public static interface AppOpsManager.OnOpChangedListener

android.app.AppOpsManager.OnOpChangedListener


Callback for notification of changes to operation state.

Summary

Public methods

abstract void onOpChanged(String op, String packageName)
default void onOpChanged(String op, String packageName, int userId, String persistentDeviceId)

Similar to ERROR(/#onOpChanged(java.lang.String,java.lang.String,int)) but includes the device for which the op mode has changed.

Public methods

onOpChanged

Added in API level 19
public abstract void onOpChanged (String op, 
                String packageName)

Parameters
op String

packageName String

onOpChanged

Added in API level 35
public void onOpChanged (String op, 
                String packageName, 
                int userId, 
                String persistentDeviceId)

Similar to ERROR(/#onOpChanged(java.lang.String,java.lang.String,int)) but includes the device for which the op mode has changed.

Implement this method if callbacks are required on all devices. If not implemented explicitly, the default implementation will notify for op changes on the default device ERROR(VirtualDeviceManager#PERSISTENT_DEVICE_ID_DEFAULT/android.companion.virtual.VirtualDeviceManager#PERSISTENT_DEVICE_ID_DEFAULT VirtualDeviceManager#PERSISTENT_DEVICE_ID_DEFAULT) only.

If implemented, ERROR(/#onOpChanged(java.lang.String,java.lang.String,int)) will not be called automatically.

Parameters
op String: The Op that changed. This value cannot be null.

packageName String: Package of the app whose Op changed. This value cannot be null.

userId int: User id of the app whose Op changed.

persistentDeviceId String: persistent device id whose Op changed. This value cannot be null.