Added in API level 19

OnOpChangedListener


interface OnOpChangedListener
android.app.AppOpsManager.OnOpChangedListener

Callback for notification of changes to operation state.

Summary

Public methods
abstract Unit
onOpChanged(op: String!, packageName: String!)

open Unit
onOpChanged(op: String, packageName: String, userId: Int, persistentDeviceId: String)

Similar to #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
abstract fun onOpChanged(
    op: String!,
    packageName: String!
): Unit

onOpChanged

Added in API level 35
open fun onOpChanged(
    op: String,
    packageName: String,
    userId: Int,
    persistentDeviceId: String
): Unit

Similar to #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 android.companion.virtual.VirtualDeviceManager#PERSISTENT_DEVICE_ID_DEFAULT only.

If implemented, #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.