Loading core/java/android/content/pm/PackageManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -3291,7 +3291,8 @@ public abstract class PackageManager { * Grant a runtime permission to an application which the application does not * already have. The permission must have been requested by the application. * If the application is not allowed to hold the permission, a {@link * java.lang.SecurityException} is thrown. * java.lang.SecurityException} is thrown. If the package or permission is * invalid, a {@link java.lang.IllegalArgumentException} is thrown. * <p> * <strong>Note: </strong>Using this API requires holding * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is Loading @@ -3316,7 +3317,8 @@ public abstract class PackageManager { * #grantRuntimePermission(String, String, android.os.UserHandle)}. The * permission must have been requested by and granted to the application. * If the application is not allowed to hold the permission, a {@link * java.lang.SecurityException} is thrown. * java.lang.SecurityException} is thrown. If the package or permission is * invalid, a {@link java.lang.IllegalArgumentException} is thrown. * <p> * <strong>Note: </strong>Using this API requires holding * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is Loading services/core/java/com/android/server/vr/VrManagerService.java +16 −4 Original line number Diff line number Diff line Loading @@ -663,16 +663,28 @@ public class VrManagerService extends SystemService implements EnabledComponentC private void grantCoarseLocationPermissionIfNeeded(String pkg, int userId) { // Don't clobber the user if permission set in current state explicitly if (!isPermissionUserUpdated(Manifest.permission.ACCESS_COARSE_LOCATION, pkg, userId)) { try { mContext.getPackageManager().grantRuntimePermission(pkg, Manifest.permission.ACCESS_COARSE_LOCATION, new UserHandle(userId)); } catch (IllegalArgumentException e) { // Package was removed during update. Slog.w(TAG, "Could not grant coarse location permission, package " + pkg + " was removed."); } } } private void revokeCoarseLocationPermissionIfNeeded(String pkg, int userId) { // Don't clobber the user if permission set in current state explicitly if (!isPermissionUserUpdated(Manifest.permission.ACCESS_COARSE_LOCATION, pkg, userId)) { try { mContext.getPackageManager().revokeRuntimePermission(pkg, Manifest.permission.ACCESS_COARSE_LOCATION, new UserHandle(userId)); } catch (IllegalArgumentException e) { // Package was removed during update. Slog.w(TAG, "Could not revoke coarse location permission, package " + pkg + " was removed."); } } } Loading Loading
core/java/android/content/pm/PackageManager.java +4 −2 Original line number Diff line number Diff line Loading @@ -3291,7 +3291,8 @@ public abstract class PackageManager { * Grant a runtime permission to an application which the application does not * already have. The permission must have been requested by the application. * If the application is not allowed to hold the permission, a {@link * java.lang.SecurityException} is thrown. * java.lang.SecurityException} is thrown. If the package or permission is * invalid, a {@link java.lang.IllegalArgumentException} is thrown. * <p> * <strong>Note: </strong>Using this API requires holding * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is Loading @@ -3316,7 +3317,8 @@ public abstract class PackageManager { * #grantRuntimePermission(String, String, android.os.UserHandle)}. The * permission must have been requested by and granted to the application. * If the application is not allowed to hold the permission, a {@link * java.lang.SecurityException} is thrown. * java.lang.SecurityException} is thrown. If the package or permission is * invalid, a {@link java.lang.IllegalArgumentException} is thrown. * <p> * <strong>Note: </strong>Using this API requires holding * android.permission.GRANT_REVOKE_PERMISSIONS and if the user id is Loading
services/core/java/com/android/server/vr/VrManagerService.java +16 −4 Original line number Diff line number Diff line Loading @@ -663,16 +663,28 @@ public class VrManagerService extends SystemService implements EnabledComponentC private void grantCoarseLocationPermissionIfNeeded(String pkg, int userId) { // Don't clobber the user if permission set in current state explicitly if (!isPermissionUserUpdated(Manifest.permission.ACCESS_COARSE_LOCATION, pkg, userId)) { try { mContext.getPackageManager().grantRuntimePermission(pkg, Manifest.permission.ACCESS_COARSE_LOCATION, new UserHandle(userId)); } catch (IllegalArgumentException e) { // Package was removed during update. Slog.w(TAG, "Could not grant coarse location permission, package " + pkg + " was removed."); } } } private void revokeCoarseLocationPermissionIfNeeded(String pkg, int userId) { // Don't clobber the user if permission set in current state explicitly if (!isPermissionUserUpdated(Manifest.permission.ACCESS_COARSE_LOCATION, pkg, userId)) { try { mContext.getPackageManager().revokeRuntimePermission(pkg, Manifest.permission.ACCESS_COARSE_LOCATION, new UserHandle(userId)); } catch (IllegalArgumentException e) { // Package was removed during update. Slog.w(TAG, "Could not revoke coarse location permission, package " + pkg + " was removed."); } } } Loading