Skip to content

Instantly share code, notes, and snippets.

@andhie
Last active October 23, 2017 17:04
Show Gist options
  • Save andhie/70098e17ded91eee19e9 to your computer and use it in GitHub Desktop.
Save andhie/70098e17ded91eee19e9 to your computer and use it in GitHub Desktop.
Marshmallow Permission Level
normal
--------------------------------------------------
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_NOTIFICATION_POLICY
android.permission.ACCESS_WIFI_STATE
android.permission.ACCESS_WIMAX_STATE
android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN
android.permission.BROADCAST_STICKY
android.permission.CHANGE_WIFI_MULTICAST_STATE
android.permission.CHANGE_WIFI_STATE
android.permission.CHANGE_WIMAX_STATE
android.permission.DISABLE_KEYGUARD
android.permission.EXPAND_STATUS_BAR
android.permission.FLASHLIGHT
android.permission.GET_PACKAGE_SIZE
android.permission.GET_TASKS
android.permission.INTERNET
android.permission.KILL_BACKGROUND_PROCESSES
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.NFC
android.permission.PERSISTENT_ACTIVITY
android.permission.READ_INSTALL_SESSIONS
android.permission.READ_PROFILE
android.permission.READ_SOCIAL_STREAM
android.permission.READ_SYNC_SETTINGS
android.permission.READ_SYNC_STATS
android.permission.READ_USER_DICTIONARY
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.REORDER_TASKS
android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
android.permission.REQUEST_INSTALL_PACKAGES
android.permission.RESTART_PACKAGES
android.permission.SET_TIME_ZONE
android.permission.SET_WALLPAPER
android.permission.SET_WALLPAPER_HINTS
android.permission.TRANSMIT_IR
android.permission.USE_FINGERPRINT
android.permission.VIBRATE
android.permission.WAKE_LOCK
android.permission.WRITE_PROFILE
android.permission.WRITE_SOCIAL_STREAM
android.permission.WRITE_SYNC_SETTINGS
android.permission.WRITE_USER_DICTIONARY
com.android.alarm.permission.SET_ALARM
com.android.launcher.permission.INSTALL_SHORTCUT
com.android.launcher.permission.UNINSTALL_SHORTCUT
dangerous
--------------------------------------------------
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.BODY_SENSORS
android.permission.CALL_PHONE
android.permission.CAMERA
android.permission.GET_ACCOUNTS
android.permission.PROCESS_OUTGOING_CALLS
android.permission.READ_CALENDAR
android.permission.READ_CALL_LOG
android.permission.READ_CELL_BROADCASTS
android.permission.READ_CONTACTS
android.permission.READ_EXTERNAL_STORAGE
android.permission.READ_PHONE_STATE
android.permission.READ_SMS
android.permission.RECEIVE_MMS
android.permission.RECEIVE_SMS
android.permission.RECEIVE_WAP_PUSH
android.permission.RECORD_AUDIO
android.permission.SEND_SMS
android.permission.USE_SIP
android.permission.WRITE_CALENDAR
android.permission.WRITE_CALL_LOG
android.permission.WRITE_CONTACTS
android.permission.WRITE_EXTERNAL_STORAGE
com.android.voicemail.permission.ADD_VOICEMAIL
signature
--------------------------------------------------
android.intent.category.MASTER_CLEAR.permission.C2D_MESSAGE
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_INPUT_FLINGER
android.permission.ACCESS_KEYGUARD_SECURE_STORAGE
android.permission.ACCESS_MOCK_LOCATION
android.permission.ACCESS_PDB_STATE
android.permission.ACCESS_SURFACE_FLINGER
android.permission.ACCESS_VOICE_INTERACTION_SERVICE
android.permission.ACCOUNT_MANAGER
android.permission.ASEC_ACCESS
android.permission.ASEC_CREATE
android.permission.ASEC_DESTROY
android.permission.ASEC_MOUNT_UNMOUNT
android.permission.ASEC_RENAME
android.permission.BIND_ACCESSIBILITY_SERVICE
android.permission.BIND_CHOOSER_TARGET_SERVICE
android.permission.BIND_CONDITION_PROVIDER_SERVICE
android.permission.BIND_DEVICE_ADMIN
android.permission.BIND_DREAM_SERVICE
android.permission.BIND_INPUT_METHOD
android.permission.BIND_INTENT_FILTER_VERIFIER
android.permission.BIND_JOB_SERVICE
android.permission.BIND_MIDI_DEVICE_SERVICE
android.permission.BIND_NFC_SERVICE
android.permission.BIND_NOTIFICATION_LISTENER_SERVICE
android.permission.BIND_PACKAGE_VERIFIER
android.permission.BIND_PRINT_SERVICE
android.permission.BIND_PRINT_SPOOLER_SERVICE
android.permission.BIND_REMOTE_DISPLAY
android.permission.BIND_ROUTE_PROVIDER
android.permission.BIND_TEXT_SERVICE
android.permission.BIND_TRUST_AGENT
android.permission.BIND_VOICE_INTERACTION
android.permission.BIND_VPN_SERVICE
android.permission.BLUETOOTH_MAP
android.permission.BLUETOOTH_STACK
android.permission.BRICK
android.permission.BROADCAST_PACKAGE_REMOVED
android.permission.BROADCAST_SMS
android.permission.BROADCAST_WAP_PUSH
android.permission.CHANGE_APP_IDLE_STATE
android.permission.CHANGE_BACKGROUND_DATA_SETTING
android.permission.CONFIGURE_WIFI_DISPLAY
android.permission.CONFIRM_FULL_BACKUP
android.permission.CONTROL_KEYGUARD
android.permission.CONTROL_WIFI_DISPLAY
android.permission.COPY_PROTECTED_DATA
android.permission.DEVICE_POWER
android.permission.DIAGNOSTIC
android.permission.FACTORY_TEST
android.permission.FILTER_EVENTS
android.permission.FORCE_BACK
android.permission.FRAME_STATS
android.permission.FREEZE_SCREEN
android.permission.GET_DETAILED_TASKS
android.permission.GET_TOP_ACTIVITY_INFO
android.permission.GLOBAL_SEARCH_CONTROL
android.permission.HARDWARE_TEST
android.permission.INJECT_EVENTS
android.permission.INTERNAL_SYSTEM_WINDOW
android.permission.MANAGE_APP_TOKENS
android.permission.MANAGE_DOCUMENTS
android.permission.MANAGE_MEDIA_PROJECTION
android.permission.MANAGE_NETWORK_POLICY
android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS
android.permission.NET_ADMIN
android.permission.NET_TUNNELING
android.permission.OEM_UNLOCK_STATE
android.permission.PEERS_MAC_ADDRESS
android.permission.QUERY_DO_NOT_ASK_CREDENTIALS_ON_BOOT
android.permission.READ_INPUT_STATE
android.permission.REMOTE_AUDIO_PLAYBACK
android.permission.REMOVE_TASKS
android.permission.RETRIEVE_WINDOW_TOKEN
android.permission.SET_ACTIVITY_WATCHER
android.permission.SET_INPUT_CALIBRATION
android.permission.SET_KEYBOARD_LAYOUT
android.permission.SET_ORIENTATION
android.permission.SET_POINTER_SPEED
android.permission.SET_PREFERRED_APPLICATIONS
android.permission.SET_SCREEN_COMPATIBILITY
android.permission.START_ANY_ACTIVITY
android.permission.STATUS_BAR_SERVICE
android.permission.TEMPORARY_ENABLE_ACCESSIBILITY
android.permission.TRUST_LISTENER
signature|privileged
--------------------------------------------------
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_FM_RADIO
android.permission.ACCESS_IMS_CALL_SERVICE
android.permission.ACCESS_MTP
android.permission.ACCESS_NETWORK_CONDITIONS
android.permission.ACCESS_NOTIFICATIONS
android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK
android.permission.BACKUP
android.permission.BIND_APPWIDGET
android.permission.BIND_CARRIER_MESSAGING_SERVICE
android.permission.BIND_CARRIER_SERVICES
android.permission.BIND_CONNECTION_SERVICE
android.permission.BIND_DIRECTORY_SEARCH
android.permission.BIND_INCALL_SERVICE
android.permission.BIND_KEYGUARD_APPWIDGET
android.permission.BIND_REMOTEVIEWS
android.permission.BIND_TELECOM_CONNECTION_SERVICE
android.permission.BIND_TV_INPUT
android.permission.BIND_WALLPAPER
android.permission.BLUETOOTH_PRIVILEGED
android.permission.BROADCAST_NETWORK_PRIVILEGED
android.permission.CALL_PRIVILEGED
android.permission.CAMERA_DISABLE_TRANSMIT_LED
android.permission.CAMERA_SEND_SYSTEM_EVENTS
android.permission.CAPTURE_AUDIO_HOTWORD
android.permission.CAPTURE_AUDIO_OUTPUT
android.permission.CAPTURE_SECURE_VIDEO_OUTPUT
android.permission.CAPTURE_TV_INPUT
android.permission.CAPTURE_VIDEO_OUTPUT
android.permission.CARRIER_FILTER_SMS
android.permission.CHANGE_COMPONENT_ENABLED_STATE
android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST
android.permission.CLEAR_APP_CACHE
android.permission.CONNECTIVITY_INTERNAL
android.permission.CONTROL_INCALL_EXPERIENCE
android.permission.CONTROL_LOCATION_UPDATES
android.permission.CONTROL_VPN
android.permission.CRYPT_KEEPER
android.permission.DELETE_CACHE_FILES
android.permission.DELETE_PACKAGES
android.permission.DISPATCH_NFC_MESSAGE
android.permission.DVB_DEVICE
android.permission.FORCE_STOP_PACKAGES
android.permission.GET_ACCOUNTS_PRIVILEGED
android.permission.GET_PACKAGE_IMPORTANCE
android.permission.GLOBAL_SEARCH
android.permission.HDMI_CEC
android.permission.INSTALL_LOCATION_PROVIDER
android.permission.INSTALL_PACKAGES
android.permission.INTENT_FILTER_VERIFICATION_AGENT
android.permission.INVOKE_CARRIER_SETUP
android.permission.LAUNCH_TRUST_AGENT_SETTINGS
android.permission.LOCAL_MAC_ADDRESS
android.permission.LOCATION_HARDWARE
android.permission.LOOP_RADIO
android.permission.MANAGE_ACTIVITY_STACKS
android.permission.MANAGE_CA_CERTIFICATES
android.permission.MANAGE_DEVICE_ADMINS
android.permission.MANAGE_FINGERPRINT
android.permission.MANAGE_USB
android.permission.MANAGE_USERS
android.permission.MANAGE_VOICE_KEYPHRASES
android.permission.MASTER_CLEAR
android.permission.MEDIA_CONTENT_CONTROL
android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS
android.permission.MODIFY_AUDIO_ROUTING
android.permission.MODIFY_NETWORK_ACCOUNTING
android.permission.MODIFY_PARENTAL_CONTROLS
android.permission.MODIFY_PHONE_STATE
android.permission.MOUNT_FORMAT_FILESYSTEMS
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
android.permission.MOVE_PACKAGE
android.permission.NFC_HANDOVER_STATUS
android.permission.NOTIFY_PENDING_SYSTEM_UPDATE
android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS
android.permission.OVERRIDE_WIFI_CONFIG
android.permission.PACKAGE_VERIFICATION_AGENT
android.permission.PERFORM_CDMA_PROVISIONING
android.permission.PERFORM_SIM_ACTIVATION
android.permission.PROVIDE_TRUST_AGENT
android.permission.READ_DREAM_STATE
android.permission.READ_FRAME_BUFFER
android.permission.READ_NETWORK_USAGE_HISTORY
android.permission.READ_PRECISE_PHONE_STATE
android.permission.READ_PRIVILEGED_PHONE_STATE
android.permission.READ_SEARCH_INDEXABLES
android.permission.READ_WIFI_CREDENTIAL
android.permission.REAL_GET_TASKS
android.permission.REBOOT
android.permission.RECEIVE_BLUETOOTH_MAP
android.permission.RECEIVE_DATA_ACTIVITY_CHANGE
android.permission.RECEIVE_EMERGENCY_BROADCAST
android.permission.RECEIVE_STK_COMMANDS
android.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE
android.permission.RECOVERY
android.permission.REGISTER_CALL_PROVIDER
android.permission.REGISTER_CONNECTION_MANAGER
android.permission.REGISTER_SIM_SUBSCRIPTION
android.permission.REMOVE_DRM_CERTIFICATES
android.permission.RETRIEVE_WINDOW_CONTENT
android.permission.SCORE_NETWORKS
android.permission.SEND_RESPOND_VIA_MESSAGE
android.permission.SERIAL_PORT
android.permission.SET_TIME
android.permission.SET_WALLPAPER_COMPONENT
android.permission.SHUTDOWN
android.permission.START_TASKS_FROM_RECENTS
android.permission.STATUS_BAR
android.permission.STOP_APP_SWITCHES
android.permission.TV_INPUT_HARDWARE
android.permission.UPDATE_CONFIG
android.permission.UPDATE_DEVICE_STATS
android.permission.UPDATE_LOCK
android.permission.USER_ACTIVITY
android.permission.WRITE_APN_SETTINGS
android.permission.WRITE_DREAM_STATE
android.permission.WRITE_GSERVICES
android.permission.WRITE_MEDIA_STORAGE
com.android.voicemail.permission.READ_VOICEMAIL
com.android.voicemail.permission.WRITE_VOICEMAIL
signature|privileged|development
--------------------------------------------------
android.permission.BATTERY_STATS
android.permission.CHANGE_CONFIGURATION
android.permission.DUMP
android.permission.GET_APP_OPS_STATS
android.permission.INTERACT_ACROSS_USERS
android.permission.READ_LOGS
android.permission.SET_ALWAYS_FINISH
android.permission.SET_ANIMATION_SCALE
android.permission.SET_DEBUG_APP
android.permission.SET_PROCESS_LIMIT
android.permission.SIGNAL_PERSISTENT_PROCESSES
android.permission.WRITE_SECURE_SETTINGS
signature|privileged|development|appop
--------------------------------------------------
android.permission.PACKAGE_USAGE_STATS
signature|installer
--------------------------------------------------
android.permission.CLEAR_APP_USER_DATA
android.permission.GRANT_RUNTIME_PERMISSIONS
android.permission.INTERACT_ACROSS_USERS_FULL
android.permission.KILL_UID
signature|privileged|installer
--------------------------------------------------
android.permission.UPDATE_APP_OPS_STATS
signature|installer|verifier
--------------------------------------------------
android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS
android.permission.REVOKE_RUNTIME_PERMISSIONS
signature|appop|pre23|preinstalled
--------------------------------------------------
android.permission.CHANGE_NETWORK_STATE
android.permission.SYSTEM_ALERT_WINDOW
android.permission.WRITE_SETTINGS
public static void printPermissions(Context context) {
PackageInfo android;
try {
android = context.getPackageManager().getPackageInfo("android", PackageManager.GET_PERMISSIONS);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return;
}
PermissionInfo[] permissions = android.permissions;
SparseArrayCompat<List<String>> sparseArray = new SparseArrayCompat<>();
PermissionInfo permissionInfo;
int size = permissions.length;
for (int i = 0; i < size; i++) {
permissionInfo = permissions[i];
List<String> list = sparseArray.get(permissionInfo.protectionLevel);
if (list == null) {
list = new ArrayList<>(30);
sparseArray.put(permissionInfo.protectionLevel, list);
}
list.add(permissionInfo.name);
}
size = sparseArray.size();
for (int i = 0; i < size; i++) {
int level = sparseArray.keyAt(i);
List<String> list = sparseArray.get(level);
Collections.sort(list);
Log.i("tag", protectionToString(level));
for (int j = 0; j < list.size(); j++) {
Log.i("tag", list.get(j));
}
}
}
/**
* Lifted from {@link PermissionInfo}
*/
public static String protectionToString(int level) {
String protLevel = "????";
switch (level & PermissionInfo.PROTECTION_MASK_BASE) {
case PermissionInfo.PROTECTION_DANGEROUS:
protLevel = "dangerous";
break;
case PermissionInfo.PROTECTION_NORMAL:
protLevel = "normal";
break;
case PermissionInfo.PROTECTION_SIGNATURE:
protLevel = "signature";
break;
case PermissionInfo.PROTECTION_SIGNATURE_OR_SYSTEM:
protLevel = "signatureOrSystem";
break;
}
if ((level & PermissionInfo.PROTECTION_FLAG_PRIVILEGED) != 0) {
protLevel += "|privileged";
}
if ((level & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
protLevel += "|development";
}
if ((level & PermissionInfo.PROTECTION_FLAG_APPOP) != 0) {
protLevel += "|appop";
}
if ((level & PermissionInfo.PROTECTION_FLAG_PRE23) != 0) {
protLevel += "|pre23";
}
if ((level & PermissionInfo.PROTECTION_FLAG_INSTALLER) != 0) {
protLevel += "|installer";
}
if ((level & PermissionInfo.PROTECTION_FLAG_VERIFIER) != 0) {
protLevel += "|verifier";
}
if ((level & PermissionInfo.PROTECTION_FLAG_PREINSTALLED) != 0) {
protLevel += "|preinstalled";
}
return protLevel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment