am bf6cecc2: am 5716e4bf: am 776b3956: am 7f4d8293: am 6826387e: DO NOT MERGE: Clear cached locations when location providers disabled Bug: 12118307
* commit 'bf6cecc21f50d1bc98e0d2dec41bef3ce259a23f':
DO NOT MERGE: Clear cached locations when location providers disabled Bug: 12118307
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 0f08c56..260890b 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -918,6 +918,10 @@
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);