am d71021cb: am 0c731f99: Merge "Send broadcast intent when configured location providers change." into gingerbread

Merge commit 'd71021cb30bd20dabd6783f4235d5f245a7bd1a3'

* commit 'd71021cb30bd20dabd6783f4235d5f245a7bd1a3':
  Send broadcast intent when configured location providers change.
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 9ceda7e..9aa84a03 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -127,6 +127,13 @@
         "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 5697181..a343c59 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -859,18 +859,22 @@
     }
 
     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));
         }
     }