android dumpsys permission denial

心不动则不痛 提交于 2019-11-29 05:20:05

Why does android OS still deny me access to the dump service ?

Because that permission is flagged as android:protectionLevel="signature|system|development" (or signatureOrSystem using the old syntax) on Android 2.3+, and therefore cannot be held by ordinary Android SDK applications.

There's another (hacky) way to access dumpsys without rooting your device - through adb shell.

This will require allowing USB debugging, and finding the port of the adb service.

  1. Enable USB debugging on your device. This option is found under Settings -> Developer Options.

  2. Connect your device to a PC, and run the following command from the PC's shell/command line: adb tcpip 12345. Then, from your devices shell, issue the command adb connect localhost:12345 from your application. You can now disconnect the device from USB. Alternatively, you can scan the ports on your device one by one without USB connection, using adb connect localhost:<portnum> and find the port adb service is listening to.

  3. Authorize USB debugging from the pop up confirmation dialog, if prompted. Check the "always" checkbox to do not require this step again.

  4. Now, when you have access to the adb service, use adb shell dumpsys ... from your application code to get whatever service dump you need.

NOTE: You don't need the DUMP permission for that to work.

The android dev team decided to stop granting these permissions to third-party apps. Only system apps can now get them.

more details:https://code.google.com/p/acra/issues/detail?id=100

It reports private values of core Android services that you would never be able to typically obtain. Official document says "Not for use by third-party applications".

Pixeldroid Modding

Add permission on your manifest "android.permission.DUMP". I have not tried it yet but it shows on adb shell that it is missing that permission

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