Listing permissions of Android application via adb

83,417

Solution 1

I just wanted to combine Jason's and Juuso's answers together and notice that the former lists permissions that were granted, while the latter lists permissions that were requested (including ones that were granted).

To see only permissions that were granted (but omitting ones that were requested but not granted) use

adb shell dumpsys package packagename

and check grantedPermissions section at the bottom of the output.

To list all permissions (requested but not granted + requested and granted):

  1. Notice the APK of a package. You can run the same command

    adb shell dumpsys package packagename
    

    and get the APK path from codePath element of its output.

  2. (if there is no aapt on your device/emulator) You'll need to pull the apk from device/emulator as Juuso Ohtonen has pointed out in his answer. So execute something like this from your desktop:

    adb pull /data/app/com.your.package.apk
    
  3. List all permissions of the package

    If missing from device/emulator aapt can be found under build-tools/<version>/in your Android SDK.

    Then execute

    aapt d permissions /path/to/com.your.package.apk
    

Solution 2

  1. List all applications along with their installation paths (use -3 flag if you're only interested in 3rd party apps). As an example, let's try to find out YouTube app permissions.
    adb shell pm list packages -f

    Output:

    ...
    package:/data/app/com.google.android.youtube-1.apk=com.google.android.youtube
    ...

  2. Pull the selected apk from the device:
    adb pull /data/app/com.google.android.youtube-1.apk

  3. List the permissions with
    aapt d permissions com.google.android.youtube-1.apk

Output:

    uses-permission: android.permission.BROADCAST_STICKY
    uses-permission: android.permission.CALL_PHONE
    uses-permission: android.permission.CALL_PRIVILEGED
    uses-permission: android.permission.WRITE_SETTINGS
    uses-permission: android.permission.WRITE_SECURE_SETTINGS
    uses-permission: android.permission.READ_CONTACTS
    uses-permission: android.permission.READ_CALL_LOG
    uses-permission: android.permission.WRITE_CONTACTS
    uses-permission: android.permission.WRITE_CALL_LOG
    uses-permission: android.permission.SYSTEM_ALERT_WINDOW
    uses-permission: android.permission.INTERNAL_SYSTEM_WINDOW
    uses-permission: android.permission.ADD_SYSTEM_SERVICE
    uses-permission: android.permission.VIBRATE
    uses-permission: android.permission.BLUETOOTH
    uses-permission: android.permission.BLUETOOTH_ADMIN
    uses-permission: android.permission.REORDER_TASKS
    uses-permission: android.permission.CHANGE_CONFIGURATION
    ...

...

Solution 3

The fast way: adb shell dumpsys package packagename | grep permission

Share:
83,417
Juuso Ohtonen
Author by

Juuso Ohtonen

Interests: Android, Python, Continuous integration (Jenkins) Android developer database by their location: http://www.androidtalents.com Some references on Android apps: Word Game http://goo.gl/F86Qnd and the Finnish web site: http://www.sanapeli.net/ Shopping List: https://play.google.com/store/apps/details?id=net.sanapeli.shoppinglist ADB Change Language helper app for developers: https://play.google.com/store/apps/details?id=net.sanapeli.adbchangelanguage Base Converter: https://play.google.com/store/apps/details?id=net.sanapeli.baseconverter Barcode to Price Comparison application (in Finland): https://play.google.com/store/apps/details?id=net.sanapeli.hintavertailu SOreadytohelp

Updated on July 05, 2022

Comments

  • Juuso Ohtonen
    Juuso Ohtonen almost 2 years

    Using adb, how can I find out the which permissions an Android application requires?

    Because I want to display the permissions of multiple applications on different devices, viewing them in Google Play or Settings > Applications manager requires too much manual work.

  • Denys Kniazhev-Support Ukraine
    Denys Kniazhev-Support Ukraine over 9 years
    Nice answer but why do you need step 2? It works fine without it.
  • Denys Kniazhev-Support Ukraine
    Denys Kniazhev-Support Ukraine over 9 years
    This will only list permissions that were granted, see my answer below
  • coco_
    coco_ almost 8 years
    @DenisKniazhev The aapt tool is not provided in the adb shell
  • Denys Kniazhev-Support Ukraine
    Denys Kniazhev-Support Ukraine almost 8 years
    @coco_ You're right, I must have been using an emulator with aapt pre-installed.
  • android developer
    android developer almost 8 years
    Say, I've noticed that "adb shell dumpsys package" command shows many kinds of information about the app. Can it also show all folders that the app officially uses, such as the external storage (on "/storage/emulated/0/Android/data/PACKAGE_NAME" on my device) ?
  • android developer
    android developer almost 8 years
    Doesn't it only include permissions that have the word "pemission" in them?
  • Devlpr
    Devlpr over 3 years
    on a Windows machine use: adb shell "dumpsys package packagename | grep permission"
  • tir38
    tir38 almost 3 years
    Grep highlighting is your friend here adb shell dumpsys package com.example | grep --color -E "granted=true|$"