diff options
author | Soonil Nagarkar <sooniln@google.com> | 2019-12-04 16:05:08 -0800 |
---|---|---|
committer | Soonil Nagarkar <sooniln@google.com> | 2019-12-05 12:22:57 -0800 |
commit | 06e37f67de54ea047039ef9a98eb37861ece89c7 (patch) | |
tree | 2db3714a89202e62b7104902a8d7b445353bffab /location | |
parent | 4d4e91db5e61aa5765b28a4afdaae7ee915cabc6 (diff) |
Update location broadcast behavior
Updates location broadcast behavior in preparation for future changes
that will remove writes to LOCATION_PROVIDERS_ALLOWED. These changes
ensure that clients can properly listen for changes to provider enabled
status without being reliant on the deprecated
LOCATION_PROVIDERS_ALLOWED.
Bug: 145752928
Test: presubmits
Change-Id: I073749a895a6a206023290d83ea815a361353460
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/LocationManager.java | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index c0041722c475..1f8c1d5352b0 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -164,25 +164,52 @@ 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)}. From Android Q and above, will * include a string intent extra, {@link #EXTRA_PROVIDER_NAME}, with the name of the provider - * whose state has changed. + * whose state has changed. From Android R and above, will include a boolean intent extra, + * {@link #EXTRA_PROVIDER_ENABLED}, with the enabled state of the provider. * * @see #EXTRA_PROVIDER_NAME + * @see #EXTRA_PROVIDER_ENABLED + * @see #isProviderEnabled(String) */ 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. + * of the location provider that has changed. + * + * @see #PROVIDERS_CHANGED_ACTION + * @see #EXTRA_PROVIDER_ENABLED */ 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()}. + * Intent extra included with {@link #PROVIDERS_CHANGED_ACTION} broadcasts, containing the + * boolean enabled state of the location provider that has changed. + * + * @see #PROVIDERS_CHANGED_ACTION + * @see #EXTRA_PROVIDER_NAME + */ + public static final String EXTRA_PROVIDER_ENABLED = "android.location.extra.PROVIDER_ENABLED"; + + /** + * Broadcast intent action when the device location enabled state changes. From Android R and + * above, will include a boolean intent extra, {@link #EXTRA_LOCATION_ENABLED}, with the enabled + * state of location. + * + * @see #EXTRA_LOCATION_ENABLED + * @see #isLocationEnabled() */ public static final String MODE_CHANGED_ACTION = "android.location.MODE_CHANGED"; /** + * Intent extra included with {@link #MODE_CHANGED_ACTION} broadcasts, containing the boolean + * enabled state of location. + * + * @see #MODE_CHANGED_ACTION + */ + public static final String EXTRA_LOCATION_ENABLED = "android.location.extra.LOCATION_ENABLED"; + + /** * Broadcast intent action indicating that a high power location requests * has either started or stopped being active. The current state of * active location requests should be read from AppOpsManager using |