Merge "Provide defaults and annotations for LocationListener"

This commit is contained in:
TreeHugger Robot
2019-12-19 22:15:02 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 18 deletions

View File

@@ -23240,10 +23240,10 @@ package android.location {
}
public interface LocationListener {
method public void onLocationChanged(android.location.Location);
method public void onProviderDisabled(String);
method public void onProviderEnabled(String);
method @Deprecated public void onStatusChanged(String, int, android.os.Bundle);
method public void onLocationChanged(@NonNull android.location.Location);
method public default void onProviderDisabled(@NonNull String);
method public default void onProviderEnabled(@NonNull String);
method @Deprecated public default void onStatusChanged(String, int, android.os.Bundle);
}
public class LocationManager {

View File

@@ -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) {}
}