diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/os/RemoteException.java | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/api/current.txt b/api/current.txt index 0ddc42a38122..8a235b19046b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -35360,6 +35360,8 @@ package android.os { public class RemoteException extends android.util.AndroidException { ctor public RemoteException(); ctor public RemoteException(String); + method @NonNull public RuntimeException rethrowAsRuntimeException(); + method @NonNull public RuntimeException rethrowFromSystemServer(); } public class ResultReceiver implements android.os.Parcelable { diff --git a/core/java/android/os/RemoteException.java b/core/java/android/os/RemoteException.java index 2e673a857a93..10ef27952df4 100644 --- a/core/java/android/os/RemoteException.java +++ b/core/java/android/os/RemoteException.java @@ -16,7 +16,7 @@ package android.os; -import android.annotation.UnsupportedAppUsage; +import android.annotation.NonNull; import android.util.AndroidException; /** @@ -37,7 +37,15 @@ public class RemoteException extends AndroidException { super(message, cause, enableSuppression, writableStackTrace); } - /** {@hide} */ + /** + * Rethrow this as an unchecked runtime exception. + * <p> + * Apps making calls into other processes may end up persisting internal + * state or making security decisions based on the perceived success or + * failure of a call, or any default values returned. For this reason, we + * want to strongly throw when there was trouble with the transaction. + */ + @NonNull public RuntimeException rethrowAsRuntimeException() { throw new RuntimeException(this); } @@ -52,10 +60,8 @@ public class RemoteException extends AndroidException { * state or making security decisions based on the perceived success or * failure of a call, or any default values returned. For this reason, we * want to strongly throw when there was trouble with the transaction. - * - * @hide */ - @UnsupportedAppUsage + @NonNull public RuntimeException rethrowFromSystemServer() { if (this instanceof DeadObjectException) { throw new RuntimeException(new DeadSystemException()); |