On Jun 15, 5:11 pm, "Richard C. Cox" <conard...@gmail.com> wrote: > I'm not sure if I completely grasp the Android permissions model. I recently > started working on a simple widget to put the phone to sleep. Of course, it > always gets a security exception because an ordinary user app isn't allowed to > call the PowerManager method 'goToSleep' because it's requires the 'signature' > level permission DEVICE_POWER. But I could find nowhere in the docs or on > Google that officially says that.
You're right, and IMHO you've spotted a deficiency in the SDK documentation. The required permissions are usually documented alongside the API call - for example in the documentation of the PowerManager reboot() method it states that the REBOOT permission is required. However, in both of these cases (DEVICE_POWER and REBOOT) the permissions have protectionLevel of 'signature' so the only way to call those APIs from an APK signed by the the device manufacturer. I'm not sure why these APIs aren't hidden from the API documentation - as they can't be used by most developers. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en