summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Roshan Pius <rpius@google.com> 2019-11-14 18:37:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-11-14 18:37:26 +0000
commit97191d8c50ca3b5296199fdc0d689b8e4bba2bf9 (patch)
tree09d5aa805fed0dff40771c90ada50e0b2c2a09d2
parentd34013b779baad1b847ff4a19b11799c03e526a1 (diff)
parent148e86e5a563eedb710a71c97eced91310aa195d (diff)
Merge "RemoteException: Mark rethrow* APIs public"
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/os/RemoteException.java16
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());