summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/LocationManagerService.java
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-09-13 13:20:59 -0700
committerVictoria Lease <violets@google.com>2012-09-13 14:17:41 -0700
commit4fab68b5324e1f9b6765cdc33e66d1f074623dc2 (patch)
tree96d99f6794718101b1cbb52c72af154d2b0790e9 /services/java/com/android/server/LocationManagerService.java
parentaefd73d2b9f17a06f05346f302db1e393a7ece19 (diff)
downloadframeworks_base-4fab68b5324e1f9b6765cdc33e66d1f074623dc2.zip
frameworks_base-4fab68b5324e1f9b6765cdc33e66d1f074623dc2.tar.gz
frameworks_base-4fab68b5324e1f9b6765cdc33e66d1f074623dc2.tar.bz2
Require ACCESS_FINE_LOCATION for Geofence use.
Bug: 7153226 Change-Id: I49236379e739fcda66bbc9a31cfdca9a87122aec
Diffstat (limited to 'services/java/com/android/server/LocationManagerService.java')
-rw-r--r--services/java/com/android/server/LocationManagerService.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index c26448f..197f6ab 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -588,7 +588,17 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
}
throw new SecurityException("Location requires either ACCESS_COARSE_LOCATION or" +
- "ACCESS_FINE_LOCATION permission");
+ " ACCESS_FINE_LOCATION permission");
+ }
+
+ /**
+ * Throw SecurityException if caller lacks permission to use Geofences.
+ */
+ private void checkGeofencePermission() {
+ if (mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION) !=
+ PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException("Geofence usage requires ACCESS_FINE_LOCATION permission");
+ }
}
/**
@@ -1096,6 +1106,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
public void requestGeofence(LocationRequest request, Geofence geofence, PendingIntent intent,
String packageName) {
if (request == null) request = DEFAULT_LOCATION_REQUEST;
+ checkGeofencePermission();
checkPermissionAndRequest(request);
checkPendingIntent(intent);
checkPackageName(packageName);
@@ -1114,7 +1125,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
@Override
public void removeGeofence(Geofence geofence, PendingIntent intent, String packageName) {
- checkPermission();
+ checkGeofencePermission();
checkPendingIntent(intent);
checkPackageName(packageName);