diff options
author | Fyodor Kupolov <fkupolov@google.com> | 2015-07-27 17:27:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-27 17:27:02 +0000 |
commit | b83b5fa641847ee1d533253ba5e1a3e13913b9d9 (patch) | |
tree | 5dc731ca5eb2a71bd3c9ee531f86dc78d8a15193 /services/core/java/com | |
parent | 4604c1dc67f634e1fac37f623f5b093615d49f0f (diff) | |
parent | ce09a024f8478a21b1f4b8e8ddaf247b0fc9f616 (diff) | |
download | frameworks_base-b83b5fa641847ee1d533253ba5e1a3e13913b9d9.zip frameworks_base-b83b5fa641847ee1d533253ba5e1a3e13913b9d9.tar.gz frameworks_base-b83b5fa641847ee1d533253ba5e1a3e13913b9d9.tar.bz2 |
Merge "Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION" into mnc-dev
Diffstat (limited to 'services/core/java/com')
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 61ed1a7..b719b16 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3119,7 +3119,13 @@ public class PackageManagerService extends IPackageManager.Stub { final PackageParser.Package p = mPackages.get(pkgName); if (p != null && p.mExtras != null) { final PackageSetting ps = (PackageSetting) p.mExtras; - if (ps.getPermissionsState().hasPermission(permName, userId)) { + final PermissionsState permissionsState = ps.getPermissionsState(); + if (permissionsState.hasPermission(permName, userId)) { + return PackageManager.PERMISSION_GRANTED; + } + // Special case: ACCESS_FINE_LOCATION permission includes ACCESS_COARSE_LOCATION + if (Manifest.permission.ACCESS_COARSE_LOCATION.equals(permName) && permissionsState + .hasPermission(Manifest.permission.ACCESS_FINE_LOCATION, userId)) { return PackageManager.PERMISSION_GRANTED; } } @@ -3140,13 +3146,25 @@ public class PackageManagerService extends IPackageManager.Stub { Object obj = mSettings.getUserIdLPr(UserHandle.getAppId(uid)); if (obj != null) { final SettingBase ps = (SettingBase) obj; - if (ps.getPermissionsState().hasPermission(permName, userId)) { + final PermissionsState permissionsState = ps.getPermissionsState(); + if (permissionsState.hasPermission(permName, userId)) { + return PackageManager.PERMISSION_GRANTED; + } + // Special case: ACCESS_FINE_LOCATION permission includes ACCESS_COARSE_LOCATION + if (Manifest.permission.ACCESS_COARSE_LOCATION.equals(permName) && permissionsState + .hasPermission(Manifest.permission.ACCESS_FINE_LOCATION, userId)) { return PackageManager.PERMISSION_GRANTED; } } else { ArraySet<String> perms = mSystemPermissions.get(uid); - if (perms != null && perms.contains(permName)) { - return PackageManager.PERMISSION_GRANTED; + if (perms != null) { + if (perms.contains(permName)) { + return PackageManager.PERMISSION_GRANTED; + } + if (Manifest.permission.ACCESS_COARSE_LOCATION.equals(permName) && perms + .contains(Manifest.permission.ACCESS_FINE_LOCATION)) { + return PackageManager.PERMISSION_GRANTED; + } } } } |