Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5678571d authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Android (Google) Code Review
Browse files

Merge "Add PROVIDERS_CHANGED_ACTION extra for provider"

parents 0718f9d0 3126c907
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22965,6 +22965,7 @@ package android.location {
    method public void unregisterGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
    method public void unregisterGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback);
    method public void unregisterGnssStatusCallback(@NonNull android.location.GnssStatus.Callback);
    field public static final String EXTRA_PROVIDER_NAME = "android.location.extra.PROVIDER_NAME";
    field public static final String GPS_PROVIDER = "gps";
    field public static final String KEY_LOCATION_CHANGED = "location";
    field public static final String KEY_PROVIDER_ENABLED = "providerEnabled";
+11 −1
Original line number Diff line number Diff line
@@ -167,10 +167,20 @@ public class LocationManager {

    /**
     * Broadcast intent action when the set of enabled location providers changes. To check the
     * status of a provider, use {@link #isProviderEnabled(String)}.
     * status of a provider, use {@link #isProviderEnabled(String)}. Depending on API level, may
     * include a string intent extra, {@link #EXTRA_PROVIDER_NAME}, with the name of the provider
     * whose state has changed. See {@link #EXTRA_PROVIDER_NAME} for the supported API level.
     *
     * @see #EXTRA_PROVIDER_NAME
     */
    public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED";

    /**
     * Intent extra included with {@link #PROVIDERS_CHANGED_ACTION} broadcasts, containing the name
     * of the location provider that has changed, to be used with location provider APIs.
     */
    public static final String EXTRA_PROVIDER_NAME = "android.location.extra.PROVIDER_NAME";

    /**
     * Broadcast intent action when the device location mode changes. To check the location mode,
     * use {@link #isLocationEnabled()}.
+9 −4
Original line number Diff line number Diff line
@@ -501,6 +501,8 @@ public class LocationManagerService extends ILocationManager.Stub {
        }

        if (broadcast) {
            // needs to be sent to everyone because we don't know which user may have changed
            // LOCATION_MODE state.
            mContext.sendBroadcastAsUser(
                    new Intent(LocationManager.MODE_CHANGED_ACTION),
                    UserHandle.ALL);
@@ -1212,6 +1214,13 @@ public class LocationManagerService extends ILocationManager.Stub {
                            "-" + mName,
                            mCurrentUserId);
                }

                // needs to be sent to all users because whether or not a provider is enabled for
                // a given user is complicated... we broadcast to everyone and let them figure it
                // out via isProviderEnabled()
                Intent intent = new Intent(LocationManager.PROVIDERS_CHANGED_ACTION);
                intent.putExtra(LocationManager.EXTRA_PROVIDER_NAME, mName);
                mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
            }

            if (useable == mUseable) {
@@ -1232,10 +1241,6 @@ public class LocationManagerService extends ILocationManager.Stub {
            }

            updateProviderUseableLocked(this);

            mContext.sendBroadcastAsUser(
                    new Intent(LocationManager.PROVIDERS_CHANGED_ACTION),
                    UserHandle.ALL);
        }

        @GuardedBy("mLock")