2

Can Sensors Off (developer options) introduced in Android 10 be controlled via ADB?

Sensors Off tile | System UI

Haven't got it from AOSP sources yet: Sensors Off | Android Open Source Project

4
  • Try calling setSensorPrivacy. Read here how to do this. Apr 16, 2022 at 1:23
  • Ohh, I barely got there, @irfan-latif. I used the service list command to get the existing list. Then when I call it with the command service call sensor_privacy 4 i32 1, it outputs the parcel result, as in the link below. It seems, there is also something that must be given a value for it to run. However, I don't know how. Photos: - !service list. - !service call sensor_privacy 4 i32 1. Btw, specifically my device is running Android 12L, and I'm new to this. My B Markdown. Apr 16, 2022 at 7:42
  • You are calling the wrong method. For Android 12 the code should be 7, not 4. Apr 16, 2022 at 11:59
  • One number left below.. It's on 8th method. Now, it works! Photos: service call sensor_privacy 8. Take your point by answering. Thanks. Apr 17, 2022 at 9:07

1 Answer 1

1

First of all, thanks to @irfan-latif for providing the right answer to this question in the comments column. But apparently, this will be allowed. So, I will help complete the answer.

On Android 10:

service call sensor_privacy 4 i32 1

service call sensor_privacy 4 i32 0

On Android 11:

service call sensor_privacy 4 i32 1

service call sensor_privacy 4 i32 0

On Android 12:

service call sensor_privacy 8 i32 1

service call sensor_privacy 8 i32 0

On Android 12L:

service call sensor_privacy 8 i32 1

service call sensor_privacy 8 i32 0

On Android 13:

service call sensor_privacy 9 i32 1

service call sensor_privacy 9 i32 0

Else, the above command does not produce anything, you can search for ISensorPrivacyManager Interface in Android Code Search according to the revised version of your Android device[2] (Hint: the number on the back is the revision number.). Then, change the sequence number of the Method in which setSensorPrivacy() resides.

[2]: getprop | grep ro.vendor_dlkm.build.id

2
  • The specific error I get is Result: Parcel(00000000 '....') Oneplus 5T, LineageOS 18.1 / Android 11. Both service call sensor_privacy 4 i32 1 and [...] 0 of course.
    – user598527
    Jun 20, 2022 at 6:50
  • Yeah.. indeed the output of the both commands is Result: Parcel(00000000 '....'), and check the Sensors Off icon on the notification bar. Else, you need to check the ISensorPrivacyManager Interface on your phone's Android version/revision to Android Code Search, or you can contact the developer of the ROM concerned for help. Because, this command is the basis of AOSP. Jun 25, 2022 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .