Just ran a quick test on my Galaxy Nexus with stock OTA 4.1.1

1) Added the permission to the manifest:

<uses-permission android:name="android.permission.READ_LOGS"/>

2) Pushed an update from Eclipse, this appeared in the adb logcat:

07-18 22:43:20.265 W/PackageManager(  306): Not granting permission
android.permission.READ_LOGS to package org.kman.AquaMail
(protectionLevel=50 flags=0x8be46)

3) Tried to grant the permission:

~$adb shell
shell@android:/ $ pm grant org.kman.AquaMail android.permission.READ_LOGS

Operation not allowed: java.lang.SecurityException: Neither user 2000 nor
current process has android.permission.GRANT_REVOKE_PERMISSIONS.

4) Who is user 2000?

shell@android:/ $ id
uid=2000(shell) gid=2000(shell)
groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)

Aha, it's the uid used by "adb shell".

-- K

2012/7/18 Ievgenii Nazaruk <[email protected]>

> I guess that's because I tried it on emulator. I don't have a device with
> JB to verify that same procedure works for real devices.
>
>
> On Wednesday, July 18, 2012 7:58:10 PM UTC+3, vt wrote:
>>
>> On Friday, July 13, 2012 1:54:45 AM UTC-7, Ievgenii Nazaruk wrote:
>>
>> I've tested the "adb shell pm grant <pkg> android.permission.READ_LOGS"
>>> and can confirm that it enables READ_LOGS permission for my application.
>>
>>
>> How did you dodge "Operation not allowed: java.lang.SecurityException:
>> Neither user 2000 nor current process has android.permission.GRANT_**
>> REVOKE_PERMISSIONS"?
>>
>> --vt
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to