Clear cached locations when location providers disabled

Bug: 12118307

(cherry picked from commit b084fef18e)

Change-Id: I49eff73f89633052a2587112cdc381ae6d254bfe
This commit is contained in:
David Christie
2013-12-18 14:33:57 -08:00
committed by dcashman
parent 76e5ca81b3
commit 75c55f92f5

View File

@@ -1148,6 +1148,11 @@ public class LocationManagerService extends ILocationManager.Stub {
boolean shouldBeEnabled = isAllowedByCurrentUserSettingsLocked(name);
if (isEnabled && !shouldBeEnabled) {
updateProviderListenersLocked(name, false, mCurrentUserId);
// If any provider has been disabled, clear all last locations for all providers.
// This is to be on the safe side in case a provider has location derived from
// this disabled provider.
mLastLocation.clear();
mLastLocationCoarseInterval.clear();
changesMade = true;
} else if (!isEnabled && shouldBeEnabled) {
updateProviderListenersLocked(name, true, mCurrentUserId);