appops set block not working

819 views
Skip to first unread message

ynu...@gmail.com

unread,
Jul 6, 2021, 11:46:24 AM7/6/21
to Automate
I set ignore to this operation and then use adb shell to check its state, found it not working.
 adb shell appops get com.eg.android.AlipayGphone CAMERA
CAMERA: allow; time=+18d5h44m11s986ms ago; duration=+1s739ms

屏幕截图 2021-07-06 234419.png

ynu...@gmail.com

unread,
Jul 6, 2021, 11:53:49 AM7/6/21
to Automate
some of the operations working, for example, TOAST_WINDOW

Henrik "The Developer" Lindqvist

unread,
Jul 6, 2021, 2:14:54 PM7/6/21
to Automate
A rooted device is required.

Any error message?

ynu...@gmail.com

unread,
Jul 6, 2021, 9:09:58 PM7/6/21
to Automate
My phone is rooted.No error message

Henrik "The Developer" Lindqvist

unread,
Jul 6, 2021, 9:40:42 PM7/6/21
to Automate
Have you tried the other modes, e.g. Deny?

The difference for Camera and Toast Window is that the former also involves the camera permission.

It's likely a system issue, since the block works the same way regardless of Operation, i.e. same for both Camera and Toast window.

ynu...@gmail.com

unread,
Jul 6, 2021, 10:02:34 PM7/6/21
to Automate
I tried mode Error, and still the same 
adb shell appops get com.eg.android.AlipayGphone CAMERA
CAMERA: allow; time=+18d15h55m42s510ms ago; duration=+1s739ms

I also tried another operation "activity_recognition" with mode "Error" and mode "Ignore" 
adb shell appops get com.eg.android.AlipayGphone ACTIVITY_RECOGNITION
ACTIVITY_RECOGNITION: allow; time=+58m45s902ms ago

Henrik "The Developer" Lindqvist

unread,
Jul 6, 2021, 10:19:29 PM7/6/21
to Automate
I sadly no longer have a rooted device to test on.
Does it work if you use ADB to revoke, e.g.:
adb shell appops set com.eg.android.AlipayGphone CAMERA deny
Message has been deleted

ynu...@gmail.com

unread,
Jul 6, 2021, 11:06:23 PM7/6/21
to Automate
PS C:\Users\xxx> adb shell appops set com.eg.android.AlipayGphone CAMERA deny
PS C:\Users\xxx> adb shell appops get com.eg.android.AlipayGphone CAMERA
CAMERA: allow; time=+18d17h5m25s94ms ago; duration=+1s739ms

Then I use another app called "APP OPS" to set this, the output looks like this.
PS C:\Users\xxx> adb shell appops get com.eg.android.AlipayGphone CAMERA
Uid mode: CAMERA: ignore
CAMERA: allow; time=+18d17h5m41s304ms ago; duration=+1s739ms

ynu...@gmail.com

unread,
Jul 6, 2021, 11:06:53 PM7/6/21
to Automate
my device is pixel 4 with android 11

Henrik "The Developer" Lindqvist

unread,
Jul 7, 2021, 12:08:41 AM7/7/21
to Automate
The block does exactly what the appops command does, so if that doesn't work then neither will the block.
The command may not be working because of an lacking --user <USER_ID> argument, how you get that for a particular user i don't know.

I don't know what the "APP OPS" app is doing, but it seems to be using another API call setUidMode, which is not advised, see: https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/AppOps.md

Shari Shark

unread,
Jul 7, 2021, 12:10:50 AM7/7/21
to automa...@googlegroups.com
Anyway I'm going to hijack this thread. It might be worth while to look at appops/shizuku for what you are trying to achieve.

--
You received this message because you are subscribed to the Google Groups "Automate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automate-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automate-user/6e6c2b71-3e67-48ed-9bcf-f0bd2f172280n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages