Allow Throwable to represent errors

Previously used Exception, but there's no good reason not to allow any
Throwable instead which allows for slightly more client flexibility.

Bug: 229872126
Test: atest GeocodeProviderBaseTest
Change-Id: Ie81f00dd2c082c331c10045e93fbeb8f2a393354
diff --git a/location/api/system-current.txt b/location/api/system-current.txt
index 2e7a541..254d74a 100644
--- a/location/api/system-current.txt
+++ b/location/api/system-current.txt
@@ -616,8 +616,8 @@
   @FlaggedApi(Flags.FLAG_NEW_GEOCODER) public abstract class GeocodeProviderBase {
     ctor public GeocodeProviderBase(@NonNull android.content.Context, @NonNull String);
     method @NonNull public final android.os.IBinder getBinder();
-    method public abstract void onForwardGeocode(@NonNull android.location.provider.ForwardGeocodeRequest, @NonNull android.os.OutcomeReceiver<java.util.List<android.location.Address>,java.lang.Exception>);
-    method public abstract void onReverseGeocode(@NonNull android.location.provider.ReverseGeocodeRequest, @NonNull android.os.OutcomeReceiver<java.util.List<android.location.Address>,java.lang.Exception>);
+    method public abstract void onForwardGeocode(@NonNull android.location.provider.ForwardGeocodeRequest, @NonNull android.os.OutcomeReceiver<java.util.List<android.location.Address>,java.lang.Throwable>);
+    method public abstract void onReverseGeocode(@NonNull android.location.provider.ReverseGeocodeRequest, @NonNull android.os.OutcomeReceiver<java.util.List<android.location.Address>,java.lang.Throwable>);
     field public static final String ACTION_GEOCODE_PROVIDER = "com.android.location.service.GeocodeProvider";
   }
 
diff --git a/location/java/android/location/provider/GeocodeProviderBase.java b/location/java/android/location/provider/GeocodeProviderBase.java
index e2c48b9..71644d07 100644
--- a/location/java/android/location/provider/GeocodeProviderBase.java
+++ b/location/java/android/location/provider/GeocodeProviderBase.java
@@ -104,14 +104,14 @@
      */
     public abstract void onForwardGeocode(
             @NonNull ForwardGeocodeRequest request,
-            @NonNull OutcomeReceiver<List<Address>, Exception> callback);
+            @NonNull OutcomeReceiver<List<Address>, Throwable> callback);
 
     /**
      * Requests reverse geocoding of the given arguments. The given callback must be invoked once.
      */
     public abstract void onReverseGeocode(
             @NonNull ReverseGeocodeRequest request,
-            @NonNull OutcomeReceiver<List<Address>, Exception> callback);
+            @NonNull OutcomeReceiver<List<Address>, Throwable> callback);
 
     private class Service extends IGeocodeProvider.Stub {
         @Override
@@ -145,7 +145,7 @@
         }
     }
 
-    private static class SingleUseCallback implements OutcomeReceiver<List<Address>, Exception> {
+    private static class SingleUseCallback implements OutcomeReceiver<List<Address>, Throwable> {
 
         private final AtomicReference<IGeocodeCallback> mCallback;
 
@@ -154,7 +154,7 @@
         }
 
         @Override
-        public void onError(Exception e) {
+        public void onError(Throwable e) {
             try {
                 Objects.requireNonNull(mCallback.getAndSet(null)).onError(e.toString());
             } catch (RemoteException r) {