summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Makoto Onuki <omakoto@google.com> 2016-03-11 22:52:34 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-03-11 22:52:35 +0000
commit4b19f4a702b9da07c91d093b922b30163ddd1471 (patch)
tree5541257f7392da744a4581ae376626b21b08788a
parent89db9dbedbb250e012d5853a7c3ae2b8fa070ecc (diff)
parentf9b941f528e28f4afa7c6e09b9dff6f65d72f26c (diff)
Merge "Add a flag to log service side runtime exception" into nyc-dev
-rw-r--r--core/java/android/os/Binder.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index d73deb6678eb..ea8ba2f1e6df 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -70,6 +70,9 @@ public class Binder implements IBinder {
private static final boolean CHECK_PARCEL_SIZE = false;
static final String TAG = "Binder";
+ /** @hide */
+ public static boolean LOG_RUNTIME_EXCEPTION = false; // DO NOT SUBMIT WITH TRUE
+
/**
* Control whether dump() calls are allowed.
*/
@@ -560,17 +563,16 @@ public class Binder implements IBinder {
// If the call was FLAG_ONEWAY then these exceptions disappear into the ether.
try {
res = onTransact(code, data, reply, flags);
- } catch (RemoteException e) {
- if ((flags & FLAG_ONEWAY) != 0) {
- Log.w(TAG, "Binder call failed.", e);
- } else {
- reply.setDataPosition(0);
- reply.writeException(e);
+ } catch (RemoteException|RuntimeException e) {
+ if (LOG_RUNTIME_EXCEPTION) {
+ Log.w(TAG, "Caught a RuntimeException from the binder stub implementation.", e);
}
- res = true;
- } catch (RuntimeException e) {
if ((flags & FLAG_ONEWAY) != 0) {
- Log.w(TAG, "Caught a RuntimeException from the binder stub implementation.", e);
+ if (e instanceof RemoteException) {
+ Log.w(TAG, "Binder call failed.", e);
+ } else {
+ Log.w(TAG, "Caught a RuntimeException from the binder stub implementation.", e);
+ }
} else {
reply.setDataPosition(0);
reply.writeException(e);