summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2012-08-17 15:09:44 -0700
committerNick Pelly <npelly@google.com>2012-08-17 15:25:21 -0700
commit2b7a0d00426218523629e4e8dd2e9197d445c09b (patch)
tree337da69dba57f48b5c6e96fb6c382f658cf765ad /services
parent4035f5a7c191a68bc9a5912ce44c43c82e9e5dbf (diff)
downloadframeworks_base-2b7a0d00426218523629e4e8dd2e9197d445c09b.zip
frameworks_base-2b7a0d00426218523629e4e8dd2e9197d445c09b.tar.gz
frameworks_base-2b7a0d00426218523629e4e8dd2e9197d445c09b.tar.bz2
Fix addGeofence() and addProximityAlert().
Need to clear the callers identity before calling into geofence manager because it in turn calls fused location API's. Change-Id: I7993b0b8b2a947ff93c37a7c9d29ca0e7c95f9a8
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/LocationManagerService.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 69ae833..8a564f7 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -968,7 +968,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Obs
final int uid = Binder.getCallingUid();
Receiver recevier = checkListenerOrIntent(listener, intent, pid, uid, packageName);
- // so wakelock calls will succeed (not totally sure this is still needed)
+ // providers may use public location API's, need to clear identity
long identity = Binder.clearCallingIdentity();
try {
synchronized (mLock) {
@@ -1018,7 +1018,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Obs
final int uid = Binder.getCallingUid();
Receiver receiver = checkListenerOrIntent(listener, intent, pid, uid, packageName);
- // so wakelock calls will succeed (not totally sure this is still needed)
+ // providers may use public location API's, need to clear identity
long identity = Binder.clearCallingIdentity();
try {
synchronized (mLock) {
@@ -1107,7 +1107,14 @@ public class LocationManagerService extends ILocationManager.Stub implements Obs
if (D) Log.d(TAG, "requestGeofence: " + request + " " + geofence + " " + intent);
- mGeofenceManager.addFence(request, geofence, intent, Binder.getCallingUid(), packageName);
+ // geo-fence manager uses the public location API, need to clear identity
+ int uid = Binder.getCallingUid();
+ long identity = Binder.clearCallingIdentity();
+ try {
+ mGeofenceManager.addFence(request, geofence, intent, uid, packageName);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
}
@Override
@@ -1118,7 +1125,13 @@ public class LocationManagerService extends ILocationManager.Stub implements Obs
if (D) Log.d(TAG, "removeGeofence: " + geofence + " " + intent);
- mGeofenceManager.removeFence(geofence, intent);
+ // geo-fence manager uses the public location API, need to clear identity
+ long identity = Binder.clearCallingIdentity();
+ try {
+ mGeofenceManager.removeFence(geofence, intent);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
}