diff options
author | Soonil Nagarkar <sooniln@google.com> | 2019-12-16 11:47:59 -0800 |
---|---|---|
committer | Soonil Nagarkar <sooniln@google.com> | 2019-12-16 11:47:59 -0800 |
commit | 13cde9694d660c925480b1648955ac32f036a5bf (patch) | |
tree | d10e836f80931deaf37970292fb6bca48d895aa1 /location | |
parent | 46fab815a75b6c96047cdf7209702ebef38b87ea (diff) |
Provide defaults and annotations for LocationListener
Providing defaults allows lambdas to be used with LocationListener.
Bug: 146355527
Test: presubmits
Change-Id: Ic7b9575c2788b7fcfef91293aa2371a32621f761
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/LocationListener.java | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/location/java/android/location/LocationListener.java b/location/java/android/location/LocationListener.java index aa9dddc03515..8df08345c79b 100644 --- a/location/java/android/location/LocationListener.java +++ b/location/java/android/location/LocationListener.java @@ -16,6 +16,7 @@ package android.location; +import android.annotation.NonNull; import android.os.Bundle; /** @@ -37,36 +38,32 @@ public interface LocationListener { /** * Called when the location has changed. * - * <p> There are no restrictions on the use of the supplied Location object. - * - * @param location The new location, as a Location object. + * @param location the updated location */ - void onLocationChanged(Location location); + void onLocationChanged(@NonNull Location location); /** - * This callback will never be invoked and providers can be considers as always in the - * {@link LocationProvider#AVAILABLE} state. + * This callback will never be invoked on Android Q and above, and providers can be considered + * as always in the {@link LocationProvider#AVAILABLE} state. * - * @deprecated This callback will never be invoked. + * @deprecated This callback will never be invoked on Android Q and above. */ @Deprecated - void onStatusChanged(String provider, int status, Bundle extras); + default void onStatusChanged(String provider, int status, Bundle extras) {} /** * Called when the provider is enabled by the user. * - * @param provider the name of the location provider associated with this - * update. + * @param provider the name of the location provider that has become enabled */ - void onProviderEnabled(String provider); + default void onProviderEnabled(@NonNull String provider) {} /** * Called when the provider is disabled by the user. If requestLocationUpdates * is called on an already disabled provider, this method is called * immediately. * - * @param provider the name of the location provider associated with this - * update. + * @param provider the name of the location provider that has become disabled */ - void onProviderDisabled(String provider); + default void onProviderDisabled(@NonNull String provider) {} } |