Loading core/java/com/android/internal/listeners/ListenerExecutor.java +10 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ public interface ListenerExecutor { /** * Called before this operation is to be run. Some operations may be canceled before they * are run, in which case this method may not be called. {@link #onPostExecute(boolean)} * will only be run if this method was run. * will only be run if this method was run. This callback is invoked on the calling thread. */ default void onPreExecute() {} Loading @@ -49,7 +49,7 @@ public interface ListenerExecutor { * RuntimeException, which will propagate normally. Implementations of * {@link ListenerExecutor} have the option to override * {@link ListenerExecutor#onOperationFailure(ListenerOperation, Exception)} instead to * intercept failures at the class level. * intercept failures at the class level. This callback is invoked on the executor thread. */ default void onFailure(Exception e) { // implementations should handle any exceptions that may be thrown Loading @@ -59,21 +59,24 @@ public interface ListenerExecutor { /** * Called after the operation is run. This method will always be called if * {@link #onPreExecute()} is called. Success implies that the operation was run to * completion with no failures. * completion with no failures. This callback may be invoked on the calling thread or * executor thread. */ default void onPostExecute(boolean success) {} /** * Called after this operation is complete (which does not imply that it was necessarily * run). Will always be called once per operation, no matter if the operation was run or * not. Success implies that the operation was run to completion with no failures. * not. Success implies that the operation was run to completion with no failures. This * callback may be invoked on the calling thread or executor thread. */ default void onComplete(boolean success) {} } /** * May be override to handle operation failures at a class level. Will not be invoked in the * event of a RuntimeException, which will propagate normally. * event of a RuntimeException, which will propagate normally. This callback is invoked on the * executor thread. */ default <TListener> void onOperationFailure(ListenerOperation<TListener> operation, Exception exception) { Loading @@ -83,7 +86,8 @@ public interface ListenerExecutor { /** * Executes the given listener operation on the given executor, using the provided listener * supplier. If the supplier returns a null value, or a value during the operation that does not * match the value prior to the operation, then the operation is considered canceled. * match the value prior to the operation, then the operation is considered canceled. If a null * operation is supplied, nothing happens. */ default <TListener> void executeSafely(Executor executor, Supplier<TListener> listenerSupplier, @Nullable ListenerOperation<TListener> operation) { Loading location/java/android/location/GpsStatus.java +10 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,16 @@ public final class GpsStatus { return status; } /** * Builds an empty GpsStatus. Should only be used for legacy reasons. * * @hide */ @NonNull static GpsStatus createEmpty() { return new GpsStatus(); } private GpsStatus() { } Loading location/java/android/location/ILocationListener.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,6 @@ import android.os.IRemoteCallback; */ oneway interface ILocationListener { void onLocationChanged(in Location location, in IRemoteCallback onCompleteCallback); void onLocationChanged(in Location location, in @nullable IRemoteCallback onCompleteCallback); void onProviderEnabledChanged(String provider, boolean enabled); } location/java/android/location/ILocationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ interface ILocationManager List<LocationRequest> getTestProviderCurrentRequests(String provider); LocationTime getGnssTimeMillis(); boolean sendExtraCommand(String provider, String command, inout Bundle extras); void sendExtraCommand(String provider, String command, inout Bundle extras); // used by gts tests to verify whitelists String[] getBackgroundThrottlingWhitelist(); Loading location/java/android/location/LocationListener.java +8 −7 Original line number Diff line number Diff line Loading @@ -36,7 +36,9 @@ import android.os.Bundle; public interface LocationListener { /** * Called when the location has changed. * Called when the location has changed. A wakelock is held on behalf on the listener for some * brief amount of time as this callback executes. If this callback performs long running * operations, it is the client's responsibility to obtain their own wakelock. * * @param location the updated location */ Loading @@ -52,18 +54,17 @@ public interface LocationListener { default void onStatusChanged(String provider, int status, Bundle extras) {} /** * Called when the provider is enabled by the user. * Called when a provider this listener is registered with becomes enabled. * * @param provider the name of the location provider that has become enabled * @param provider the name of the location 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. * Called when the provider this listener is registered with becomes disabled. If a provider is * disabled when this listener is registered, this callback will be invoked immediately. * * @param provider the name of the location provider that has become disabled * @param provider the name of the location provider */ default void onProviderDisabled(@NonNull String provider) {} } Loading
core/java/com/android/internal/listeners/ListenerExecutor.java +10 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ public interface ListenerExecutor { /** * Called before this operation is to be run. Some operations may be canceled before they * are run, in which case this method may not be called. {@link #onPostExecute(boolean)} * will only be run if this method was run. * will only be run if this method was run. This callback is invoked on the calling thread. */ default void onPreExecute() {} Loading @@ -49,7 +49,7 @@ public interface ListenerExecutor { * RuntimeException, which will propagate normally. Implementations of * {@link ListenerExecutor} have the option to override * {@link ListenerExecutor#onOperationFailure(ListenerOperation, Exception)} instead to * intercept failures at the class level. * intercept failures at the class level. This callback is invoked on the executor thread. */ default void onFailure(Exception e) { // implementations should handle any exceptions that may be thrown Loading @@ -59,21 +59,24 @@ public interface ListenerExecutor { /** * Called after the operation is run. This method will always be called if * {@link #onPreExecute()} is called. Success implies that the operation was run to * completion with no failures. * completion with no failures. This callback may be invoked on the calling thread or * executor thread. */ default void onPostExecute(boolean success) {} /** * Called after this operation is complete (which does not imply that it was necessarily * run). Will always be called once per operation, no matter if the operation was run or * not. Success implies that the operation was run to completion with no failures. * not. Success implies that the operation was run to completion with no failures. This * callback may be invoked on the calling thread or executor thread. */ default void onComplete(boolean success) {} } /** * May be override to handle operation failures at a class level. Will not be invoked in the * event of a RuntimeException, which will propagate normally. * event of a RuntimeException, which will propagate normally. This callback is invoked on the * executor thread. */ default <TListener> void onOperationFailure(ListenerOperation<TListener> operation, Exception exception) { Loading @@ -83,7 +86,8 @@ public interface ListenerExecutor { /** * Executes the given listener operation on the given executor, using the provided listener * supplier. If the supplier returns a null value, or a value during the operation that does not * match the value prior to the operation, then the operation is considered canceled. * match the value prior to the operation, then the operation is considered canceled. If a null * operation is supplied, nothing happens. */ default <TListener> void executeSafely(Executor executor, Supplier<TListener> listenerSupplier, @Nullable ListenerOperation<TListener> operation) { Loading
location/java/android/location/GpsStatus.java +10 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,16 @@ public final class GpsStatus { return status; } /** * Builds an empty GpsStatus. Should only be used for legacy reasons. * * @hide */ @NonNull static GpsStatus createEmpty() { return new GpsStatus(); } private GpsStatus() { } Loading
location/java/android/location/ILocationListener.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,6 @@ import android.os.IRemoteCallback; */ oneway interface ILocationListener { void onLocationChanged(in Location location, in IRemoteCallback onCompleteCallback); void onLocationChanged(in Location location, in @nullable IRemoteCallback onCompleteCallback); void onProviderEnabledChanged(String provider, boolean enabled); }
location/java/android/location/ILocationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ interface ILocationManager List<LocationRequest> getTestProviderCurrentRequests(String provider); LocationTime getGnssTimeMillis(); boolean sendExtraCommand(String provider, String command, inout Bundle extras); void sendExtraCommand(String provider, String command, inout Bundle extras); // used by gts tests to verify whitelists String[] getBackgroundThrottlingWhitelist(); Loading
location/java/android/location/LocationListener.java +8 −7 Original line number Diff line number Diff line Loading @@ -36,7 +36,9 @@ import android.os.Bundle; public interface LocationListener { /** * Called when the location has changed. * Called when the location has changed. A wakelock is held on behalf on the listener for some * brief amount of time as this callback executes. If this callback performs long running * operations, it is the client's responsibility to obtain their own wakelock. * * @param location the updated location */ Loading @@ -52,18 +54,17 @@ public interface LocationListener { default void onStatusChanged(String provider, int status, Bundle extras) {} /** * Called when the provider is enabled by the user. * Called when a provider this listener is registered with becomes enabled. * * @param provider the name of the location provider that has become enabled * @param provider the name of the location 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. * Called when the provider this listener is registered with becomes disabled. If a provider is * disabled when this listener is registered, this callback will be invoked immediately. * * @param provider the name of the location provider that has become disabled * @param provider the name of the location provider */ default void onProviderDisabled(@NonNull String provider) {} }