diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index f21f826d9fd8f..90a42090ab7d4 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -918,6 +918,10 @@ public class LocationManagerService extends ILocationManager.Stub implements Run boolean shouldBeEnabled = isAllowedBySettingsLocked(name, mCurrentUserId); 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(); changesMade = true; } else if (!isEnabled && shouldBeEnabled) { updateProviderListenersLocked(name, true, mCurrentUserId);