From e7489fde9ff1529cc0c7a984046918a47b97b40c Mon Sep 17 00:00:00 2001
From: Andrew Solovay "MNC"
.
+ Alternatively, you can use the new methods introduced with revision 23 of the + v4 and v13 support libraries. The support library methods behave + appropriately whether or not the app is running on the M Developer Preview. + For more information, see Support library methods for + handling permissions. +
+When the user tries to do something that requires a permission, the app
@@ -469,10 +477,7 @@ page.image=images/permissions_check.png
android.permission.WRITE_CONTACTS
android.permission.READ_PROFILE
- android.permission.WRITE_PROFILE
+ android.permission.GET_ACCOUNTS
android.permission.BODY_SENSORS
- android.permission.USE_FINGERPRINT
-
- If the user turned down the permission request in the
- past and chose the Don't ask again option in the permission request system
- dialog, this method returns false
. The method also returns
- false
if the device policy prohibits the app from having that
- permission.
+ If the user turned down the permission request in the past and chose the
+ Don't ask again option in the permission request system dialog, this
+ method returns false
. The method also returns false
+ if the device policy prohibits the app from having that permission.
If the app doesn't already have the permission it needs, the app calls the @@ -656,6 +657,16 @@ if (checkSelfPermission(Manifest.permission.READ_CONTACTS) } +
+ Note: When your app calls the framework's
+ requestPermissions()
method, the system shows a standard dialog
+ box to the user. Your app cannot configure or alter that dialog box.
+ If you need to provide any information or explanation to the user, you should
+ do that before you call requestPermissions()
, as
+ described in Explain why the app needs
+ permissions.
+
@@ -875,7 +886,105 @@ $ adb pm revoke <package_name> <permission_name> app's normal operation.
-+ Revision 23 of the v4 and v13 support libraries provide several new methods + for managing permissions. The support library methods work properly on any + device that can use those libraries. Thus, if you use the support library + methods, you do not need to check whether your app is running on a device + with the M Developer Preview. If an app is installed on a device running the + M Preview, the support library methods behave the same as their framework + equivalents. If the device is running an earlier version of Android, the + methods behave appropriately, as described below. +
+ ++ The v4 support library provides the following permissions methods: +
+ +ContextCompat.checkSelfPermission()
+ true
if the app has the specified permission, whether
+ or not the device is using the M Preview.
+ ActivityCompat.requestPermissions()
+ ActivityCompat.OnRequestPermissionsResultCallback
.
+ Passes {@link android.content.pm.PackageManager#PERMISSION_GRANTED
+ PERMISSION_GRANTED} if the app already has the specified permission, or
+ {@link android.content.pm.PackageManager#PERMISSION_DENIED
+ PERMISSION_DENIED} if it does not.
+ ActivityCompat.shouldShowRequestPermissionRationale()
+ false
.
+
+ The v4 support library also contains the PermissionChecker
+ class, which provides several static utility methods for apps that use IPC to
+ provide services for other apps. For example,
+ PermissionChecker.checkCallingPermission()
checks whether an IPC
+ made by a particular package has a specified permission.
+
+ Note: If your app acts on behalf of third-party apps to call
+ platform methods that require runtime permissions on behalf of a third-party
+ app, you should use the appropriate PermissionChecker
methods to
+ ensure that the other app is allowed to perform the operation. The platform
+ has a compatibility mode that allows users to revoke a legacy app's access to
+ permission-protected methods. If the user revokes access in compatibility
+ mode the app's permissions are not actually revoked; instead, access to the
+ APIs is restricted. The PermissionChecker
methods verify app
+ permissions in both normal and legacy modes.
+
+ The v13 support library provides the following permissions methods: +
+ +FragmentCompat.requestPermissions()
+ FragmentCompat.OnRequestPermissionsResultCallback
.
+ Passes {@link android.content.pm.PackageManager#PERMISSION_GRANTED
+ PERMISSION_GRANTED} if the app already has the specified permission, or
+ {@link android.content.pm.PackageManager#PERMISSION_DENIED
+ PERMISSION_DENIED} if it does not.
+ FragmentCompat.shouldShowRequestPermissionRationale()
+ false
.
+ Many permissions are designated as {@link @@ -911,6 +1020,7 @@ $ adb pm revoke <package_name> <permission_name>
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.CHANGE_NETWORK_STATE
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.KILL_BACKGROUND_PROCESSES
android.permission.MODIFY_AUDIO_SETTINGS
android.permission.NFC
android.permission.PERSISTENT_ACTIVITY
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_INSTALL_PACKAGES
android.permission.SET_TIME_ZONE
android.permission.SET_WALLPAPER
android.permission.SET_WALLPAPER_HINTS
android.permission.SUBSCRIBED_FEEDS_READ
android.permission.TRANSMIT_IR
android.permission.USE_FINGERPRINT
android.permission.VIBRATE
android.permission.WAKE_LOCK
android.permission.WRITE_SETTINGS
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