Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何用adb禁用传感器 #116

Open
zhengqwe opened this issue Jul 15, 2024 · 3 comments
Open

如何用adb禁用传感器 #116

zhengqwe opened this issue Jul 15, 2024 · 3 comments

Comments

@zhengqwe
Copy link

App Ops可以实现,但不知道执行了什么命令

@mzlogin
Copy link
Owner

mzlogin commented Jul 16, 2024

这个 APP 好像没有开源,没法直接看到实现细节。

@zhengqwe
Copy link
Author

主要是关于用adb禁用传感器全网都搜不到具体的实现方法

这个 APP 好像没有开源

没法直接看到实现细节。

那只能在修改传感器权限的时候抓log研究了

@mzlogin
Copy link
Owner

mzlogin commented Jul 16, 2024

反编译它的 APK 大致看了下,它应该是向 sensorservice 发送指令来实现的。

关键片段:

image image

sensorservice 底层源码 https://android.googlesource.com/platform/frameworks/native/+/master/services/sensorservice/SensorService.cpp 里有两个方法 handleSetUidStatehandleResetUidState,推测是跟以上两个指令相对应,你可以继续研究一下看看。

status_t SensorService::printHelp(int out) {
  return dprintf(out, "Sensor service commands:\n"
  "  get-uid-state <PACKAGE> [--user USER_ID] gets the uid state\n"
  "  set-uid-state <PACKAGE> <active\|idle> [--user USER_ID] overrides the uid state\n"
  "  reset-uid-state <PACKAGE> [--user USER_ID] clears the uid state override\n"
  "  help print this message\n");
}

APK 有混淆,我只能根据一些关键字来进行推测,有可能不准确。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants