AppOpsManager.noteOp: How can I configure my app to crash on specific op

217 Views Asked by At

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?

1

There are 1 best solutions below

0
Chalermpong Satayavibul On BEST ANSWER

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