OSDN Git Service

Clear cached locations when location providers disabled
authorDavid Christie <dnchrist@google.com>
Wed, 18 Dec 2013 22:33:57 +0000 (14:33 -0800)
committerdcashman <dcashman@google.com>
Mon, 6 Jan 2014 23:30:34 +0000 (15:30 -0800)
Bug: 12118307

(cherry picked from commit b084fef18ee1b5d24d15cff37dc3a053933d361e)

Change-Id: Ief869b9e38858092bfa3f8d6d090a278dee7d86c

services/java/com/android/server/LocationManagerService.java

index f784030..6c97956 100644 (file)
@@ -1019,6 +1019,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);