In AppOpsManager.noteOp, it said SecurityException
will be thrown
if the app has been configured to crash on this op
I can't find any information about how to do that. Is it something app developer can configure in the source code?
My bad. It's already explained in the document of AppOpsManager
To control access the app-op can be set to a mode to:
MODE_ERRORED Throw a SecurityException on access. This can be suppressed by using a ...noThrow method to check the mode
To set MODE_ERRORED, you can use adb shell command: cmd appops set <package> <OP> deny