5

I work on a project that currently asks for 21 (!) permissions.

I want to clean that up as I believe a lot of them are not necessary (for instance, there is a permission for android.permission.CALL_PHONE which can be removed as pretty much the same thing can be achieved with an Intent with ACTION_DIAL).

What I want to know is a way to, given a permission (say, android.permission.AUTHENTICATE_ACCOUNTS) find all methods which require that permission.

Note that the opposite is easy, i.e., given a method, it is easy to find if that method requires any permission (just go to the documentation and check), but what about the other way around?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
  • i was about to say that :) just go check, after all if you are implementing a function and do not know if there are permissions then hmm .. just saying sir. i don't think there is unless you are willing to use Reflection to check the exceptions they might throw in event of a permission not set and play with it. – Elltz Jun 02 '15 at 03:45
  • Not exactly the Answer to your question, but may be an alternate Approach can be found here: http://stackoverflow.com/questions/8257412/remove-extra-unwanted-permissions-from-manifest-android/8257473#8257473 – AADProgramming Jun 02 '15 at 04:28
  • possible duplicate of [Mapping between Android permissions (that we define in the manisfest file ) to corresponding API calls /methods](http://stackoverflow.com/questions/20740632/mapping-between-android-permissions-that-we-define-in-the-manisfest-file-to-c) – Artjom B. Sep 09 '15 at 09:09

3 Answers3

1

Here you can find all methods that PScout found which require Android permissions. PScout was a tool that did this particular work you need, but the original website is offline.

PScout results- map of Android permissions and methods that require those permissions

Drag0
  • 8,438
  • 9
  • 40
  • 52
0

No way else the compiler would warn you if you haven't set a Permission. No, instead the application just crashes on runtime.

Im sorry but you have to go the long way and search for methods that you think might need permissions and delet them

Ilja KO
  • 1,272
  • 12
  • 26
0

After researching this again, I came across a similar question on SO. Ben Holland explains there are 2 studies done about this problem. None of the solutions proposed are 100% flawless, but it is the best we have so far.

More details at: https://stackoverflow.com/a/24019120/1369016

Community
  • 1
  • 1