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

Commit 13cde969 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Provide defaults and annotations for LocationListener

Providing defaults allows lambdas to be used with LocationListener.

Bug: 146355527
Test: presubmits
Change-Id: Ic7b9575c2788b7fcfef91293aa2371a32621f761
parent 46fab815
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -23219,10 +23219,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 {
+11 −14
Original line number Diff line number Diff line
@@ -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) {}
}