summaryrefslogtreecommitdiffstats
path: root/services/core/java/com
diff options
context:
space:
mode:
authorFyodor Kupolov <fkupolov@google.com>2015-07-23 18:38:10 -0700
committerFyodor Kupolov <fkupolov@google.com>2015-07-24 16:54:15 -0700
commitce09a024f8478a21b1f4b8e8ddaf247b0fc9f616 (patch)
tree7fdf8fbf475c20fe089b2b318fd7d4bfcacfccac /services/core/java/com
parentc174de0ab353e2ecaf6e1728e6899bffcfefe48e (diff)
downloadframeworks_base-ce09a024f8478a21b1f4b8e8ddaf247b0fc9f616.zip
frameworks_base-ce09a024f8478a21b1f4b8e8ddaf247b0fc9f616.tar.gz
frameworks_base-ce09a024f8478a21b1f4b8e8ddaf247b0fc9f616.tar.bz2
Check for ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION
Call to checkPermission(ACCESS_COARSE_LOCATION) should return PERMISSION_GRANTED, when package only has ACCESS_FINE_LOCATION permission Bug: 21852542 Change-Id: I53fe2945784213693f59e7bfccc524276ea8c189
Diffstat (limited to 'services/core/java/com')
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java26
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;
+ }
}
}
}