134 points · by Arinerron · 10y ago · 95 comments
Oh how what a mess the intro of this one was.
Over night Android went from a potential production platform to a straight media consumption platform, as now only system apps could write to removable storage.
Your camera app used to be able to access your WhatsApp backup folder and your documents. It was just a flat file system. Developers would request the permission even though all they needed was a caching folder or something, but they could read and upload all of your documents, too.
This change, while breaking a bunch of applications until they migrate to the new fine-grained API, was a necessary one.
(many storage media are formatted using FAT, so the media API is probably not implemented using Unix permissions)
http://developer.android.com/guide/topics/providers/document...
They also made a video explaining how it works:
https://www.youtube.com/watch?v=C28pvd2plBA
Info about scoped directory access in Android 7.0:
https://developer.android.com/training/articles/scoped-direc...
Incidentally I didn't see READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE in the list.
Thing is that SAF only arrived with 4.4, and didn't properly handle anything more than single file access until 5.0. The the write_media_storage permission was introduced in 3.1. Thats some 5 releases and 2 years of goofing around before they sorted their own mess.
Oh and the external_storage permissions where there initially, but they seem to have edited it since in an effort to clear out some non-Android stuff.
This is why I absolutely won't consider any Android devices in future. The hardware's been admirable, particularly with a folio-style case and bluetooth keyboard. Great battery life. The display is limited, but the best as can be hoped for.
But the limitations on what I as a user can do drive me bloody bananas.
It's a very short drive, and an entirely uninteresting challenge.
Google, Samsung, and Logitech specifically have fucked this up hard and irretrievably.
This is not a hostile limitation - it's a backwards-incompatible API change that the ecosystem hasn't fully adapted to.
A laptop running Linux. The mobile world isn't ready for non-trivial use. May never be, though I'm watching Ubuntu's progress.
As you point out, the benefit of Android was never quite taken advantage of.
However, Google's upcoming Android laptops will hopefully push the issue to the fore. It would be amazing to have a more powerful alternative to iOS on the iPad Pro, more powerful in ways we notice everyday, rather than just being more powerful on paper.
If we observe Windows tablets, with the MS Surface at the forefront, many of them come with a easily accessible USB-A port (I recall Gigabyte tried to sell a tablet that came complete with a ethernet port even, but i think that series has since been discontinued).
What worries me is that Google introduced this change to placate big media. Because around the same time they made the big announcement that people could now buy movies and music via the Android Marketplace (later renamed Google Play).
You can access your media if you use a file explorer and media player which support the new API.
> If we observe Windows tablets, with the MS Surface at the forefront, many of them come with a easily accessible USB-A port
And all of the applications running on it can access all of your media. Life is easy when there's only one single flat security domain.
But the bigger point is that I don't think it's just the USB port that limited Android's flexibility. Android was supposed to be a more flexible, more powerful iOS. That didn't play out in ways the average end user cares about.
And that was its big issue. They used the firmware model for a general purpose OS. This keeps Android from having the simple install models we've come to expect with Windows/some Linux distros/MacOS. I wrote a thing on this a while back:
BTW, event thought Chromebooks gets updates all the time the kernel and drivers are the same one as when they originally shipped. This means that older Chromebooks will not be able to run Android apps, as it is done using kernel provided containerization.
On a related note, there's some research[0] into parsing the Android OS source code and coming up with a mapping of "API call => required permission", and by apply this mapping to the source code of your own app the list of required permissions can be generated automatically. What do you guys think of this approach?
This should be less relevant for apps using post-marshmallow-style permissions which don't need to be granted on install.
Surely that must be part of the documentation of each API call, right? Like, "You must enable android.permission.X or this call will fail"? If it is, why not just scrape the documentation, and if it's not, how does anyone develop for Android?
Disclaimer: I only read the abstract.
But some of the permissions listed can't even be used without system permission, meaning your app has to be signed with the same keys the OS was (iirc more recently I've seen a device that didn't need this) and installed in a special system directory. Permissions like getting the users local MAC address...
https://source.android.com/devices/tech/config/runtime_perms...
So starting with Android 6, the user can say "no way" to granting a permission when asked, or at any time after installation (via the app settings menu), and the app has to gracefully notice and/or handle the lack of permission without crashing or otherwise screwing up. This means the app must be designed where the permissions-related stuff can be called asynchronously. I wrote a bit about this in my question here:
https://stackoverflow.com/questions/32134299/can-you-request...
If just you start writing the app with every permission granted you're potentially going to have a huge headache when you go back to pin down the permissions you'll actually need-- now you need to go back and revise the logic so it can handle possible denials. Probably wiser to do that as you go, no?
And that's just the base functionality-- there's a UI question too that would benefit some advance-thinking. Do you want to hit the user with a huge list of permissions the first time they launch the app? Or maybe only in groups when they do key operations. Or perhaps individually. This is a question that may be informed by an early understanding of what permissions will be needed, so you know when to ask and what to do if denied.
Here's the most popular permissions we've identified:
permission | apps | pct_apps
------------------------------------------------------------+---------+----------
android.permission.INTERNET | 2607544 | 92.90
android.permission.ACCESS_NETWORK_STATE | 2332429 | 83.10
android.permission.READ_EXTERNAL_STORAGE | 1707550 | 60.83
android.permission.WRITE_EXTERNAL_STORAGE | 1696178 | 60.43
android.permission.READ_PHONE_STATE | 1154963 | 41.15
android.permission.WAKE_LOCK | 989176 | 35.24
android.permission.ACCESS_WIFI_STATE | 944675 | 33.65
android.permission.ACCESS_FINE_LOCATION | 798122 | 28.43
android.permission.ACCESS_COARSE_LOCATION | 770878 | 27.46
android.permission.VIBRATE | 734366 | 26.16
com.google.android.c2dm.permission.RECEIVE | 687083 | 24.48
android.permission.GET_ACCOUNTS | 676143 | 24.09
android.permission.CAMERA | 436581 | 15.55
android.permission.RECEIVE_BOOT_COMPLETED | 429658 | 15.30
android.permission.RECORD_AUDIO | 243793 | 8.68
android.permission.GET_TASKS | 235717 | 8.39
android.permission.CALL_PHONE | 218079 | 7.76
com.android.vending.BILLING | 200927 | 7.15
android.permission.READ_CONTACTS | 190848 | 6.79
com.google.android.providers.gsf.permission.READ_GSERVICES | 188162 | 6.70
android.permission.SYSTEM_ALERT_WINDOW | 176363 | 6.28
com.android.launcher.permission.INSTALL_SHORTCUT | 164649 | 5.86
android.permission.SET_WALLPAPER | 156845 | 5.58
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS | 131898 | 4.69
android.permission.WRITE_SETTINGS | 122783 | 4.37
android.permission.USE_CREDENTIALS | 110675 | 3.94
android.permission.BLUETOOTH | 106272 | 3.78
android.permission.MODIFY_AUDIO_SETTINGS | 102882 | 3.66
android.permission.SEND_SMS | 97892 | 3.48
android.permission.WRITE_CONTACTS | 97585 | 3.47
com.android.browser.permission.READ_HISTORY_BOOKMARKS | 97147 | 3.46
android.permission.CHANGE_WIFI_STATE | 97074 | 3.45
android.permission.READ_CALL_LOG | 90001 | 3.20
com.android.vending.CHECK_LICENSE | 79279 | 2.82
android.permission.BLUETOOTH_ADMIN | 78199 | 2.78
android.permission.FLASHLIGHT | 74952 | 2.67
android.permission.RECEIVE_SMS | 73898 | 2.63
android.permission.BROADCAST_STICKY | 67092 | 2.39
android.permission.DISABLE_KEYGUARD | 66887 | 2.38
com.android.browser.permission.WRITE_HISTORY_BOOKMARKS | 65765 | 2.34
android.permission.READ_CALENDAR | 61989 | 2.20
android.permission.WRITE_CALENDAR | 61327 | 2.18
android.permission.READ_LOGS | 60059 | 2.13This because Google switched to putting different permissions into bins, and the networking bin is accepted by default. Note also that these days a user is only notified if a update introduces a new bin requirement, not on every permission change.
Here's the top 250:
https://mixrank.com/playstore/apps?expiration=2016-11-03&pag...
android.permission.ACCESS_FINE_LOCATION | 798122 | 28.43
android.permission.ACCESS_COARSE_LOCATION | 770878 | 27.46
There might be a legitimate reason that 1 app in 8 needs access to the camera, but that also seems a high. android.permission.CAMERA | 436581 | 15.55* Banking apps/shopping want access to the camera to scan your debit/credit/gift cards, instead of having to type it out.
* messaging apps/email etc want access to the camera so you can msg/email photos
* games that are vaguely 'social' and want to have a real photo of you as an in-game avatar etc.
I forgot about that type of use, which makes the camera usage rate a lot more reasonable.
https://mixrank.com/appstore/apps?expiration=2016-11-03&sdk_...
We've found 49k+ android apps with Crashlytics. Here's the top 10:
https://mixrank.com/playstore/apps?expiration=2016-11-03&sdk...
for reference : https://developer.android.com/guide/topics/security/permissi...
The others ones are still there but pretty much an implementation detail now for Marshmallow apps (I know M+ is a tiny market share at the moment, but it will only increase).
Therefore, from a security perspective, there are far fewer coarser permissions.
https://stuff.mit.edu/afs/sipb/project/android/docs/referenc...
You can list all the permissions in the system, or just those an app uses or see all the "dangerous" groups from adb. For example:
adb shell pm list permissions -g -d
Enjoy.