summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brad Fitzpatrick <bradfitz@android.com> 2010-08-27 16:02:21 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-08-27 16:02:21 -0700
commit0c731f99b05630e16dce572ac206ab75c90891cd (patch)
tree6d558d62a2674c0be8d40003f19555f57649b23d
parent1620d118a49dc6df7b0e83d7343f8a8bb6e23b12 (diff)
parent0c5a04014d3833c9a82772a832d3bc6410fc52ac (diff)
Merge "Send broadcast intent when configured location providers change." into gingerbread
-rw-r--r--location/java/android/location/LocationManager.java7
-rw-r--r--services/java/com/android/server/LocationManagerService.java8
2 files changed, 13 insertions, 2 deletions
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 9ceda7ebc88b..9aa84a030dcc 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -127,6 +127,13 @@ public class LocationManager {
"android.location.GPS_ENABLED_CHANGE";
/**
+ * Broadcast intent action when the configured location providers
+ * change.
+ */
+ public static final String PROVIDERS_CHANGED_ACTION =
+ "android.location.PROVIDERS_CHANGED";
+
+ /**
* Broadcast intent action indicating that the GPS has either started or
* stopped receiving GPS fixes. An intent extra provides this state as a
* boolean, where {@code true} means that the GPS is actively receiving fixes.
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 3bcf42782f08..a38970f7ebf4 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -858,18 +858,22 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
}
private void updateProvidersLocked() {
+ boolean changesMade = false;
for (int i = mProviders.size() - 1; i >= 0; i--) {
LocationProviderInterface p = mProviders.get(i);
boolean isEnabled = p.isEnabled();
String name = p.getName();
boolean shouldBeEnabled = isAllowedBySettingsLocked(name);
-
if (isEnabled && !shouldBeEnabled) {
updateProviderListenersLocked(name, false);
+ changesMade = true;
} else if (!isEnabled && shouldBeEnabled) {
updateProviderListenersLocked(name, true);
+ changesMade = true;
}
-
+ }
+ if (changesMade) {
+ mContext.sendBroadcast(new Intent(LocationManager.PROVIDERS_CHANGED_ACTION));
}
}