Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

shell - android dumpsys permission denial

I have an application where I create a process and call the dumpsys telephony.registry command to get information about the mobile network status.

String[] cmds={"dumpsys telephony.registry"};
Process p = Runtime.getRuntime().exec(cmds [0]+"
");

and then after that I parse the result of the command. For "ls" or other commands it works fine. For dupmsys I get Permission Denial: can't dump telephony.registry from pid-953, uid=10090. I get the same error results for dumpsys power or other dumpsys commands.

I have set DUMP permissions android.permission.DUMP in the android Manifest like suggested here

I think that I am doing this right since Android offers this feature here

I have also done the step described here to force eclipse to allow me to give my application DUMP permission in the manifest.

When I execute the dumpsys command I always get the same result

Permission Denial: can't dump telephony.registry from pid-953, uid=10090

Am I doing something wrong? Why does android OS still deny me access to the dump service ?

PS I have set min API 8 and I am testing the application on device running (ICS) API 15

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...