MuntashirAkon / AppManager

A full-featured package manager and viewer for Android
https://muntashirakon.github.io/AppManager/
Other
4.29k stars 252 forks source link

How to use adb to revoke WRITE_SMS 'App Op' from an application? #1371

Open Drugoy opened 1 week ago

Drugoy commented 1 week ago

Describe the existing feature/documentation

I see that App Manager lists '15 - WRITE_SMS' on 'App Ops' (which feel like permissions, but for some reason are called differently) tab for some applications. I would like to programmatically disable that 'App Op' for selected applications.

Describe your problem(s)

As it turns out, there is no such a permission in Android that corresponds to WRITE_SMS operation that could be revoked by adb via adb shell pm revoke ${pkg} ${permission}! There are android.permission.RECEIVE_SMS and android.permission.READ_SMS, but nothing related to WRITE_SMS. (Please, correct me if I'm wrong.)

Thus, I have a guess: your application could probably be (ab)used with the help of adb by starting an activity specified by some INTENT, that'd switch off WRITE_SMS 'App Op' for a particular application. Or maybe there's even a better way and maybe your application has a CLI util we could execute directly to reach the goal.

Could you, please, tell? Is my guess correct? Could you provide a command that would turn off WRITE_SMS 'App Op' for, say, com.google.android.cellbroadcastreceiver (that's an app that seems to be built-in into any Android and that has that 'App Op').

Additional context

No response