use of com.android.server.location.MockProvider in project android_frameworks_base by ParanoidAndroid.
the class LocationManagerService method clearTestProviderStatus.
@Override
public void clearTestProviderStatus(String provider) {
checkMockPermissionsSafe();
synchronized (mLock) {
MockProvider mockProvider = mMockProviders.get(provider);
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
mockProvider.clearStatus();
}
}
use of com.android.server.location.MockProvider in project android_frameworks_base by ParanoidAndroid.
the class LocationManagerService method setTestProviderLocation.
@Override
public void setTestProviderLocation(String provider, Location loc) {
checkMockPermissionsSafe();
synchronized (mLock) {
MockProvider mockProvider = mMockProviders.get(provider);
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
// clear calling identity so INSTALL_LOCATION_PROVIDER permission is not required
long identity = Binder.clearCallingIdentity();
mockProvider.setLocation(loc);
Binder.restoreCallingIdentity(identity);
}
}
use of com.android.server.location.MockProvider in project android_frameworks_base by ParanoidAndroid.
the class LocationManagerService method clearTestProviderEnabled.
@Override
public void clearTestProviderEnabled(String provider) {
checkMockPermissionsSafe();
synchronized (mLock) {
MockProvider mockProvider = mMockProviders.get(provider);
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
long identity = Binder.clearCallingIdentity();
mEnabledProviders.remove(provider);
mDisabledProviders.remove(provider);
updateProvidersLocked();
Binder.restoreCallingIdentity(identity);
}
}
use of com.android.server.location.MockProvider in project android_frameworks_base by ParanoidAndroid.
the class LocationManagerService method removeTestProvider.
@Override
public void removeTestProvider(String provider) {
checkMockPermissionsSafe();
synchronized (mLock) {
MockProvider mockProvider = mMockProviders.remove(provider);
if (mockProvider == null) {
throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
}
long identity = Binder.clearCallingIdentity();
removeProviderLocked(mProvidersByName.get(provider));
if (mGeoFencer != null) {
mGeoFencerEnabled = true;
}
// reinstate real provider if available
LocationProviderInterface realProvider = mRealProviders.get(provider);
if (realProvider != null) {
addProviderLocked(realProvider);
}
mLastLocation.put(provider, null);
mLastLocationCoarseInterval.put(provider, null);
updateProvidersLocked();
Binder.restoreCallingIdentity(identity);
}
}
use of com.android.server.location.MockProvider in project android_frameworks_base by DirtyUnicorns.
the class LocationManagerService method addTestProviderLocked.
private void addTestProviderLocked(String name, ProviderProperties properties) {
if (mProvidersByName.get(name) != null) {
throw new IllegalArgumentException("Provider \"" + name + "\" already exists");
}
MockProvider provider = new MockProvider(name, this, properties);
addProviderLocked(provider);
mMockProviders.put(name, provider);
mLastLocation.put(name, null);
mLastLocationCoarseInterval.put(name, null);
}
Aggregations