summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-10-23 08:38:25 -0400
committerMike Lockwood <lockwood@android.com>2009-10-26 16:18:58 -0400
commit86328a99bd55532e318441d48ee9eb96cdc42403 (patch)
tree0231ed3a165bdc2e25bfc9369e6bf688fafcca1b /services
parent3333fa4f3d2e1bd3842fe7d41d19557ff9a98372 (diff)
downloadframeworks_base-86328a99bd55532e318441d48ee9eb96cdc42403.zip
frameworks_base-86328a99bd55532e318441d48ee9eb96cdc42403.tar.gz
frameworks_base-86328a99bd55532e318441d48ee9eb96cdc42403.tar.bz2
LocationManagerService: clear calling identity in mock provider calls.
Fixes bug b/2198028 (testDirectionsFromScratchByTyping fails because of android.permission.ACCESS_WIFI_STATE) Change-Id: I44e95981d805189ed6d906d388c5189ee788802f Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/LocationManagerService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index d1b3bd0..bbb43d7 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1709,6 +1709,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy) {
checkMockPermissionsSafe();
+ long identity = Binder.clearCallingIdentity();
synchronized (mLock) {
MockProvider provider = new MockProvider(name, this,
requiresNetwork, requiresSatellite,
@@ -1731,6 +1732,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
mLastKnownLocation.put(name, null);
updateProvidersLocked();
}
+ Binder.restoreCallingIdentity(identity);
}
public void removeTestProvider(String provider) {
@@ -1740,6 +1742,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
+ long identity = Binder.clearCallingIdentity();
removeProvider(mProvidersByName.get(provider));
mMockProviders.remove(mockProvider);
// reinstall real provider if we were mocking GPS or network provider
@@ -1752,6 +1755,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
}
mLastKnownLocation.put(provider, null);
updateProvidersLocked();
+ Binder.restoreCallingIdentity(identity);
}
}
@@ -1787,6 +1791,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
+ long identity = Binder.clearCallingIdentity();
if (enabled) {
mockProvider.enable();
mEnabledProviders.add(provider);
@@ -1797,6 +1802,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
mDisabledProviders.add(provider);
}
updateProvidersLocked();
+ Binder.restoreCallingIdentity(identity);
}
}
@@ -1807,9 +1813,11 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
+ long identity = Binder.clearCallingIdentity();
mEnabledProviders.remove(provider);
mDisabledProviders.remove(provider);
updateProvidersLocked();
+ Binder.restoreCallingIdentity(identity);
}
}