Search code examples
androidandroid-permissionsandroid-6.0-marshmallowandroid-firmware

Android Marshmallow, "dangerous" protection level and system components/apps


I'm developing an application that going to be pr-installed (as a system app) on the firmware.

from the documentation so far about the relation between system apps, new permissions model, and the protection levels - I don't understand exactly when system app needs (if at all) to request user permission.

My problems starts when I try to use the WRITE_EXTERNAL_STORAGE permission. from the documentation I can see that it marked as "dangerous" permission.

- does "dangerous" permissions grant automatically to system apps?

when I use WRITE_EXTERNAL_STORAGE permission (as a system app) I'm getting security exception, and I don't know if it's mean that even tough my app installed as a system app - "dangerous" permissions must be requested by the user..

another point to mention:
to check the app behavior as a system app, I'm installing my application APK on the sys-priv directory (the device is rooted) of a nexus 5 running SDK preview 3. this is when I'm getting the security exception when attep to use methods requires the external storage permission..


Solution

  • Quoting the release notes for the 2nd M preview:

    Apps included in the system image are no longer granted dangerous permissions automatically. All apps should check for and request permissions at runtime.

    That fits with what I recall seeing when I first used the stock Camera app on a Nexus 5 with the final(?) 6.0 preview firmware — it too asked for the runtime permission.

    So, AFAIK, system apps have to ask for runtime permissions, as do non-system apps.