Reading ActivityManager-logs on a Jelly Bean device?

偶尔善良 提交于 2019-11-30 09:49:26

There is an extensive discussion of this issue going on here. Unfortunately, it's "expected behavior" and as such won't be fixed. The only current solution (for reading the logs from within an application on JB and above) is to manually grant the permission to the app through adb:

adb shell pm grant <pkg> android.permission.READ_LOGS

A such-granted permission:

  • survives reboots
  • survives application updates (i.e. "adb install -r")
  • does not survive if the application was uninstalled and then installed again

It's obvious that this isn't something that a normal user can be expected to do. A GUI-solution (where users can grant this permission from the Settingsmenu of their device) is promised by the Android team, but unfortunately the functionality was removed before the "fix" was implemented.

First of all, ActivityManager isn't an application... it's a class that makes up part of the Android application framework.

Second of all, if the Android team deliberately went out of their way to prevent this from working, then I doubt there is a security loophole around it. The fact is that third party applications should not have to rely on logcat logs in order to work properly. If you give some details about your reason for needing to read these logs, maybe we can help point you to a better solution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!