AndroidPermissionsUsage


Source link: https://github.com/RomainPiel/AndroidPermissionsUsage

AndroidPermissionsUsage

Note: this is an experiment and it doesn't do perfectly what it's supposed to do

AndroidPermissionsUsage is an IntelliJ IDEA (and Android Studio) plugin designed to find the usage of the permissions defined in an Android application.

It happens often that a lot of permissions get defined in the AndroidManifest.xml and never get actually used anywhere in the app. Sometimes a functionality gets modified or removed and the initially required permission stays there because everyone forgot about it.

As a result you might enter the permissions nightmare and your users would start to freak out about their rights. (Although I'm pretty sure these were declared on purpose)

There is currently no way to check which permissions are used or not by your app. Hopefully Google might integrate a solution in Lint in the future. But for now, let's try something else...

How does this plugin work?

AndroidPermissionsUsage is based on a simple mechanism: the "Find usage..." functionality. When asked for it, this plugin will:

  1. Grab the permissions declared in the AndroidManifest.xml
  2. For each permission, look through the Android SDK and find the methods/classes/fields that contain a reference to the permission in its javadoc
  3. Look through your project modules and libraries (if the sources are available) and count the references for each method/class/field requiring a permission
  4. Finally display a window listing all permission and the methods/classes/fields that you use in your project (as well as the number of times you use each of them

But does it actually work?!

As you may imagine, I was quite excited when I originally got this idea. At the end the plugin kinda work and it's not too slow (~4s for a big project). But it's mainly limited by the Android documentation. Some permissions are not specified as required in the javadoc even if they if they need to be declared in the manifest. For example the permission android.permission.INTERNET is not mentioned a lot and it can show as not used even though your app will need it. Another example is the permission android.permission.READ_CALENDAR which is not even mentioned in the Android SDK javadoc for any classes requiring it. Another limitation is that the javadoc is showing references to permissions on the build versions ( DONUT, ICE_CREAM_SANDWICH...) because they have somehow been changed at that point. As a result, the references will show in the final summary.

So, well, it doesn't really work but at least it was interesting. I'm leaving this as a note for those who might be interested in the problem.

How to install it?

I'm glad you asked. Download the latest archive. In IntelliJ or Android Studio, open the preferences.

  • Go to Plugins > Install plugin from disk
  • Pick the downloaded archive
  • Restart the IDE as requested
  • Right click on your AndroidManifest.xml
  • Click on Find Permissions Usage...
  • After a few seconds, you should see a popup with the results

Resources

Usb serial controller for Android.

HTML Content (Article) Extractor for Android - fork of Goose by Gravity Labs.

Adapter between RxJava V1 and V2.

Sketch can help developers to read images from local storage or network.

A simple comparison chart for rankings.

A view to show radar chart.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes