From 75c55f92f5ca00ced05b6778389454ae50beed61 Mon Sep 17 00:00:00 2001 From: David Christie Date: Wed, 18 Dec 2013 14:33:57 -0800 Subject: Clear cached locations when location providers disabled Bug: 12118307 (cherry picked from commit b084fef18ee1b5d24d15cff37dc3a053933d361e) Change-Id: I49eff73f89633052a2587112cdc381ae6d254bfe --- services/java/com/android/server/LocationManagerService.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'services') diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index 8f480dd..eebd1c5 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -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); -- cgit v1.1