androidandroid-manifestandroid-permissionsandroid-7.0-nougat

What is the most accurate way to count the number of Android permissions for version 7.0?


According to my research on the net, I found that to count the number of permission of the recent version of Android (Android 7), we can refer to the official documentation proposed in this link (https://developer.android.com/reference/android/Manifest.permission.html).

The proposed table contains 138 permissions, which is what I thought my count is correct until the AndroidManifest.xml (https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r29/core/res/AndroidManifest.xml) file analysis of the Android OS that I scan with this little parsing program found on github (https://github.com/benjholla/AndroidPermissionAttributeMapper).

The resulting output files are:

android.permission-group.CONTACTS:
3 Permissions
android.permission.READ_CONTACTS
android.permission.GET_ACCOUNTS
android.permission.WRITE_CONTACTS
NO PERMISSION GROUP FOUND:
320 Permissions
android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK
android.permission.DIAGNOSTIC
android.permission.INTERACT_ACROSS_USERS
android.permission.SIGNAL_PERSISTENT_PROCESSES
android.permission.START_TASKS_FROM_RECENTS
android.permission.BIND_SCREENING_SERVICE
android.permission.SET_TIME_ZONE
com.android.browser.permission.WRITE_HISTORY_BOOKMARKS
android.permission.REGISTER_SIM_SUBSCRIPTION
android.permission.USER_ACTIVITY
android.permission.RECEIVE_MEDIA_RESOURCE_USAGE
android.permission.TABLET_MODE
android.permission.SUBSCRIBED_FEEDS_READ
android.permission.BIND_TV_REMOTE_SERVICE
android.permission.CONTROL_INCALL_EXPERIENCE
android.permission.MASTER_CLEAR
android.permission.WAKE_LOCK
android.permission.HDMI_CEC
android.permission.MODIFY_CELL_BROADCASTS
android.permission.MANAGE_USERS
android.permission.BIND_VOICE_INTERACTION
android.permission.GRANT_RUNTIME_PERMISSIONS
android.permission.BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE
android.permission.PACKAGE_USAGE_STATS
android.permission.BLUETOOTH_MAP
android.permission.GET_PACKAGE_SIZE
android.permission.BIND_TELECOM_CONNECTION_SERVICE
android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST
com.android.alarm.permission.SET_ALARM
android.permission.SET_WALLPAPER_HINTS
android.permission.DEVICE_POWER
android.permission.UPDATE_CONFIG
android.permission.INTERNET
android.permission.INJECT_EVENTS
android.permission.UPDATE_LOCK_TASK_PACKAGES
android.permission.RECEIVE_EMERGENCY_BROADCAST
android.permission.RETRIEVE_WINDOW_TOKEN
android.permission.CAMERA_DISABLE_TRANSMIT_LED
android.permission.SET_WALLPAPER
android.permission.BIND_PRINT_SERVICE
android.permission.READ_LOGS
android.permission.REMOVE_TASKS
android.permission.READ_SYNC_SETTINGS
android.permission.ACCESS_MTP
android.permission.AUTHENTICATE_ACCOUNTS
android.permission.CONTROL_LOCATION_UPDATES
android.permission.READ_PROFILE
android.permission.CRYPT_KEEPER
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.READ_FRAME_BUFFER
com.android.launcher.permission.UNINSTALL_SHORTCUT
android.permission.CONTROL_VPN
android.permission.BIND_DIRECTORY_SEARCH
android.permission.SCORE_NETWORKS
android.permission.BIND_MIDI_DEVICE_SERVICE
android.permission.GET_APP_OPS_STATS
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.GET_APP_GRANTED_URI_PERMISSIONS
android.permission.SEND_RESPOND_VIA_MESSAGE
android.permission.MANAGE_ACTIVITY_STACKS
android.permission.CHANGE_CONFIGURATION
android.permission.VIBRATE
android.permission.GET_TOP_ACTIVITY_INFO
android.permission.GET_PROCESS_STATE_AND_OOM_SCORE
android.permission.WRITE_SYNC_SETTINGS
android.permission.RESTART_PACKAGES
android.permission.KILL_BACKGROUND_PROCESSES
android.permission.HARDWARE_TEST
android.permission.BIND_TRUST_AGENT
android.permission.FORCE_STOP_PACKAGES
android.permission.READ_NETWORK_USAGE_HISTORY
android.permission.READ_PRECISE_PHONE_STATE
android.permission.READ_BLOCKED_NUMBERS
android.permission.READ_WIFI_CREDENTIAL
android.permission.RESET_SHORTCUT_MANAGER_THROTTLING
android.permission.MOVE_PACKAGE
android.permission.BLUETOOTH
android.permission.SERIAL_PORT
com.android.voicemail.permission.WRITE_VOICEMAIL
android.permission.WRITE_USER_DICTIONARY
android.permission.ACCESS_WIMAX_STATE
android.permission.SET_SCREEN_COMPATIBILITY
android.permission.ACCESS_VR_MANAGER
android.permission.BLUETOOTH_STACK
android.permission.BIND_INCALL_SERVICE
android.permission.BIND_PRINT_RECOMMENDATION_SERVICE
android.permission.INSTALL_PACKAGES
android.permission.BIND_VR_LISTENER_SERVICE
android.permission.SET_PREFERRED_APPLICATIONS
android.permission.BIND_TV_INPUT
android.permission.GET_DETAILED_TASKS
android.permission.SET_PROCESS_LIMIT
android.permission.WRITE_PROFILE
android.permission.RECEIVE_BLUETOOTH_MAP
android.permission.ACCESS_WIFI_STATE
android.permission.LAUNCH_TRUST_AGENT_SETTINGS
android.permission.BIND_ROUTE_PROVIDER
android.permission.REGISTER_WINDOW_MANAGER_LISTENERS
com.android.voicemail.permission.READ_VOICEMAIL
android.permission.INTERNAL_SYSTEM_WINDOW
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
android.permission.SET_POINTER_SPEED
android.permission.READ_OEM_UNLOCK_STATE
android.permission.OEM_UNLOCK_STATE
android.permission.NOTIFY_PENDING_SYSTEM_UPDATE
android.permission.WRITE_DREAM_STATE
android.permission.CONTROL_KEYGUARD
android.permission.RETRIEVE_WINDOW_CONTENT
android.permission.BIND_DREAM_SERVICE
android.permission.LOCAL_MAC_ADDRESS
android.permission.PACKET_KEEPALIVE_OFFLOAD
android.permission.ACCESS_INPUT_FLINGER
android.permission.FLASHLIGHT
android.permission.CAPTURE_TV_INPUT
android.permission.EXPAND_STATUS_BAR
android.permission.ACCESS_SURFACE_FLINGER
android.permission.ASEC_CREATE
android.permission.READ_DREAM_STATE
android.permission.BIND_INPUT_METHOD
android.permission.RECEIVE_DATA_ACTIVITY_CHANGE
android.permission.BIND_NFC_SERVICE
android.permission.GLOBAL_SEARCH_CONTROL
android.permission.ACCESS_PDB_STATE
android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS
android.permission.UPDATE_LOCK
android.permission.DUMP
android.permission.MANAGE_NETWORK_POLICY
android.permission.ACCESS_NOTIFICATIONS
android.permission.ACCESS_FM_RADIO
android.permission.CARRIER_FILTER_SMS
android.permission.BIND_TEXT_SERVICE
android.permission.CONFIRM_FULL_BACKUP
android.permission.ASEC_MOUNT_UNMOUNT
android.permission.BACKUP
android.permission.TRUST_LISTENER
android.permission.SET_ACTIVITY_WATCHER
android.permission.BIND_REMOTE_DISPLAY
android.permission.PERFORM_SIM_ACTIVATION
android.permission.CAPTURE_AUDIO_HOTWORD
android.permission.READ_SEARCH_INDEXABLES
android.permission.ASEC_ACCESS
android.permission.SET_ORIENTATION
android.permission.BIND_CONDITION_PROVIDER_SERVICE
android.permission.USE_CREDENTIALS
android.permission.STATUS_BAR_SERVICE
android.permission.FACTORY_TEST
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.CHANGE_NETWORK_STATE
android.intent.category.MASTER_CLEAR.permission.C2D_MESSAGE
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.DVB_DEVICE
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
android.permission.BIND_DEVICE_ADMIN
android.permission.SEND_SMS_NO_CONFIRMATION
android.permission.BLUETOOTH_PRIVILEGED
android.permission.MODIFY_PHONE_STATE
android.permission.CAPTURE_AUDIO_OUTPUT
android.permission.CONFIGURE_DISPLAY_COLOR_TRANSFORM
android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS
android.permission.SHUTDOWN
android.permission.NET_ADMIN
android.permission.DELETE_CACHE_FILES
android.permission.READ_USER_DICTIONARY
android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS
android.permission.BROADCAST_NETWORK_PRIVILEGED
android.permission.CAMERA_SEND_SYSTEM_EVENTS
android.permission.INTERACT_ACROSS_USERS_FULL
android.permission.MANAGE_NOTIFICATIONS
android.permission.MODIFY_PARENTAL_CONTROLS
android.permission.OVERRIDE_WIFI_CONFIG
android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS
android.permission.DISABLE_KEYGUARD
android.permission.CHANGE_APP_IDLE_STATE
android.permission.BIND_NOTIFICATION_LISTENER_SERVICE
android.permission.ACCESS_NETWORK_CONDITIONS
android.permission.BIND_NOTIFICATION_RANKER_SERVICE
android.permission.CALL_PRIVILEGED
android.permission.BIND_INTENT_FILTER_VERIFIER
android.permission.RECEIVE_STK_COMMANDS
android.permission.MANAGE_USB
android.permission.CAPTURE_VIDEO_OUTPUT
android.permission.MODIFY_AUDIO_ROUTING
android.permission.MANAGE_SOUND_TRIGGER
android.permission.CHANGE_WIFI_STATE
android.permission.GET_TASKS
android.permission.TV_INPUT_HARDWARE
android.permission.SET_WALLPAPER_COMPONENT
android.permission.SET_TIME
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.MANAGE_MEDIA_PROJECTION
android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME
android.permission.TV_VIRTUAL_REMOTE_CONTROLLER
android.permission.DISPATCH_PROVISIONING_MESSAGE
android.permission.CAPTURE_SECURE_VIDEO_OUTPUT
android.permission.UPDATE_APP_OPS_STATS
android.permission.BROADCAST_SMS
android.permission.CHANGE_BACKGROUND_DATA_SETTING
android.permission.REMOVE_DRM_CERTIFICATES
android.permission.BLUETOOTH_ADMIN
android.permission.WRITE_GSERVICES
android.permission.MANAGE_CA_CERTIFICATES
android.permission.NFC
android.permission.START_ANY_ACTIVITY
android.permission.CHANGE_COMPONENT_ENABLED_STATE
android.permission.TETHER_PRIVILEGED
android.permission.CHANGE_WIMAX_STATE
android.permission.PEERS_MAC_ADDRESS
android.permission.DISPATCH_NFC_MESSAGE
android.permission.ACCESS_NOTIFICATION_POLICY
android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
android.permission.LOCATION_HARDWARE
android.permission.REMOTE_AUDIO_PLAYBACK
com.android.launcher.permission.INSTALL_SHORTCUT
android.permission.MOUNT_FORMAT_FILESYSTEMS
android.permission.RESET_FINGERPRINT_LOCKOUT
android.permission.WRITE_SMS
android.permission.NET_TUNNELING
android.permission.STATUS_BAR
android.permission.COPY_PROTECTED_DATA
android.permission.QUERY_DO_NOT_ASK_CREDENTIALS_ON_BOOT
android.permission.REORDER_TASKS
android.permission.BIND_PACKAGE_VERIFIER
android.permission.BIND_KEYGUARD_APPWIDGET
android.permission.TEMPORARY_ENABLE_ACCESSIBILITY
android.permission.MANAGE_FINGERPRINT
android.permission.READ_PRIVILEGED_PHONE_STATE
android.permission.ASEC_DESTROY
android.permission.REVOKE_RUNTIME_PERMISSIONS
android.permission.REAL_GET_TASKS
android.permission.BIND_ACCESSIBILITY_SERVICE
android.permission.FRAME_STATS
android.permission.MANAGE_VOICE_KEYPHRASES
android.permission.ACCOUNT_MANAGER
android.permission.STORAGE_INTERNAL
android.permission.READ_INSTALL_SESSIONS
android.permission.GET_ACCOUNTS_PRIVILEGED
android.permission.MANAGE_APP_OPS_RESTRICTIONS
android.permission.ACCESS_MOCK_LOCATION
android.permission.GET_PASSWORD
android.permission.GLOBAL_SEARCH
android.permission.TRANSMIT_IR
android.permission.MANAGE_DEVICE_ADMINS
android.permission.BROADCAST_WAP_PUSH
android.permission.INTENT_FILTER_VERIFICATION_AGENT
android.permission.MEDIA_CONTENT_CONTROL
android.permission.MANAGE_DOCUMENTS
android.permission.PROVIDE_TRUST_AGENT
android.permission.BIND_CARRIER_MESSAGING_SERVICE
android.permission.WRITE_MEDIA_STORAGE
com.android.browser.permission.READ_HISTORY_BOOKMARKS
android.permission.SET_ALWAYS_FINISH
android.permission.REBOOT
android.permission.CONNECTIVITY_INTERNAL
android.permission.BIND_CARRIER_SERVICES
android.permission.CONTROL_WIFI_DISPLAY
android.permission.GET_INTENT_SENDER_INTENT
android.permission.LOOP_RADIO
android.permission.BIND_CONNECTION_SERVICE
android.permission.CACHE_CONTENT
android.permission.WRITE_SECURE_SETTINGS
android.permission.MANAGE_APP_TOKENS
android.permission.SUBSCRIBED_FEEDS_WRITE
android.permission.MANAGE_ACCOUNTS
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.WRITE_APN_SETTINGS
android.permission.CLEAR_APP_CACHE
android.permission.BRICK
android.permission.WRITE_SOCIAL_STREAM
android.permission.BIND_PRINT_SPOOLER_SERVICE
android.permission.WRITE_BLOCKED_NUMBERS
android.permission.PACKAGE_VERIFICATION_AGENT
android.permission.MODIFY_DAY_NIGHT_MODE
android.permission.CHANGE_WIFI_MULTICAST_STATE
android.permission.BIND_VPN_SERVICE
android.permission.CONFIGURE_WIFI_DISPLAY
android.permission.MODIFY_NETWORK_ACCOUNTING
android.permission.REQUEST_INSTALL_PACKAGES
android.permission.BROADCAST_PACKAGE_REMOVED
android.permission.REGISTER_CONNECTION_MANAGER
android.permission.READ_SYNC_STATS
android.permission.BROADCAST_STICKY
android.permission.INSTALL_LOCATION_PROVIDER
android.permission.REGISTER_CALL_PROVIDER
android.permission.KILL_UID
android.permission.INVOKE_CARRIER_SETUP
android.permission.BIND_JOB_SERVICE
android.permission.SET_INPUT_CALIBRATION
android.permission.READ_SOCIAL_STREAM
android.permission.UPDATE_DEVICE_STATS
android.permission.READ_INPUT_STATE
android.permission.SET_DEBUG_APP
android.permission.BIND_WALLPAPER
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.RECOVERY
android.permission.SYSTEM_ALERT_WINDOW
android.permission.CREATE_USERS
android.permission.SET_KEYBOARD_LAYOUT
android.permission.CLEAR_APP_USER_DATA
android.permission.FILTER_EVENTS
android.permission.BIND_REMOTEVIEWS
android.permission.BIND_QUICK_SETTINGS_TILE
android.permission.STOP_APP_SWITCHES
android.permission.BIND_CHOOSER_TARGET_SERVICE
android.permission.ACCESS_VOICE_INTERACTION_SERVICE
android.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE
android.permission.SET_ANIMATION_SCALE
android.permission.PERSISTENT_ACTIVITY
android.permission.ACCESS_NETWORK_STATE
android.permission.BATTERY_STATS
android.permission.FREEZE_SCREEN
android.permission.DELETE_PACKAGES
android.permission.CLEAR_APP_GRANTED_URI_PERMISSIONS
android.permission.PERFORM_CDMA_PROVISIONING
android.permission.ASEC_RENAME
android.permission.GET_PACKAGE_IMPORTANCE
android.permission.FORCE_BACK
android.permission.BIND_APPWIDGET
android.permission.NFC_HANDOVER_STATUS
android.permission.WRITE_SETTINGS
android.permission.ACCESS_KEYGUARD_SECURE_STORAGE
android.permission-group.STORAGE:
2 Permissions
android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_EXTERNAL_STORAGE
android.permission-group.PHONE:
10 Permissions
android.permission.USE_SIP
android.permission.ACCESS_UCE_PRESENCE_SERVICE
android.permission.CALL_PHONE
com.android.voicemail.permission.ADD_VOICEMAIL
android.permission.ACCESS_UCE_OPTIONS_SERVICE
android.permission.READ_CALL_LOG
android.permission.WRITE_CALL_LOG
android.permission.PROCESS_OUTGOING_CALLS
android.permission.ACCESS_IMS_CALL_SERVICE
android.permission.READ_PHONE_STATE
android.permission-group.LOCATION:
2 Permissions
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_COARSE_LOCATION
android.permission-group.MICROPHONE:
1 Permissions
android.permission.RECORD_AUDIO
android.permission-group.SENSORS:
2 Permissions
android.permission.BODY_SENSORS
android.permission.USE_FINGERPRINT
android.permission-group.SMS:
6 Permissions
android.permission.SEND_SMS
android.permission.RECEIVE_SMS
android.permission.READ_SMS
android.permission.RECEIVE_WAP_PUSH
android.permission.READ_CELL_BROADCASTS
android.permission.RECEIVE_MMS
android.permission-group.CAMERA:
1 Permissions
android.permission.CAMERA
android.permission-group.CALENDAR:
2 Permissions
android.permission.WRITE_CALENDAR
android.permission.READ_CALENDAR

As you can see, the number of permissions detected far exceeds the number quoted in the documentation, there are permissions listed in AndroidManifest.xml and does not exist in the documentation, for example: android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK, android.permission .ACCESS_FM_RADIO!

What is the error in my analysis? What I want in the end is the number of permissions proposed to developers in Android 7, is that 138 permissions or more? If it's more how can I count them if I based on the AndroidManifest.xml file?

Thank you for your help.


Solution

  • What I want in the end is the number of permissions proposed to developers in Android 7, is that 138 permissions or more?

    It is unclear what you mean by "the number of permissions proposed to developers".

    If you mean "the number of permissions defined on an Android 7.0 device", the answer is ¯\_(ツ)_/¯, as apps can define their own permissions.

    If you mean "the number of permissions defined on an Android 7.0 device, as shipped from the factory", the answer is ¯\_(ツ)_/¯, as a manufacturer's pre-installed apps can define their own permissions.

    If you mean "the number of permissions defined on an Android 7.0 device, as shipped from the factory, not including those from pre-installed apps", the answer is ¯\_(ツ)_/¯, as a manufacturer (or custom ROM developer) can modify the platform AndroidManifest.xml file.

    If you mean "the number of permissions defined in the Android 7.0 edition of the Android Open Source Project, and not counting any AOSP apps like Settings", that will be the number of <permission> elements in the platform AndroidManifest.xml file at minimum. Right now, that's 300+ (my count is 353 based on the master branch).

    If you mean "the number of permissions that ordinary app developers working on Android 7.0 will deal with", that would be the permissions documented in the Manifest.permission JavaDocs, which will be a small subset of those defined in the platform AndroidManifest.xml file. For example, ACCESS_FM_RADIO is one that you cited as being in the manifest but not in the documentation — that is because it has the @hide annotation:

    <!-- @SystemApi Allows access to FM
         @hide This is not a third-party API (intended for system apps).-->
    <permission android:name="android.permission.ACCESS_FM_RADIO"
        android:protectionLevel="signature|privileged" />
    

    In the platform Java classes, @hide-annotated elements get removed from the SDK as part of building android.jar. Similarly, @hide-annotated manifest elements get removed as well from the SDK, even though they should exist on the device.

    FWIW, my PermissionReporter sample app uses PackageManager to find all of the defined permissions on an Android device and list them in tabs based on protection level. So, for example, ACCESS_FM_RADIO shows up there on an Android 7.1.1 device.