summaryrefslogtreecommitdiffstats
path: root/core/jni/android_util_Binder.cpp
diff options
context:
space:
mode:
authorBjorn Bringert <bringert@android.com>2011-04-26 19:10:58 +0100
committerBjorn Bringert <bringert@android.com>2011-04-26 19:25:00 +0100
commit9013ccd9fcf3ac317e122aff08cb27cdac2b95fe (patch)
tree768269145896b5bf4dedec4a0ff6b895999e45c4 /core/jni/android_util_Binder.cpp
parent6f026b0fbc776b833566002e1d775c91f33de1ca (diff)
downloadframeworks_base-9013ccd9fcf3ac317e122aff08cb27cdac2b95fe.zip
frameworks_base-9013ccd9fcf3ac317e122aff08cb27cdac2b95fe.tar.gz
frameworks_base-9013ccd9fcf3ac317e122aff08cb27cdac2b95fe.tar.bz2
Check for exceptions before calling back into Java
This fixes a crash when StrictMode is on and a Binder call throws an exception. Bug: 4337406 Change-Id: I5c4d4a8bcd92aa5b0d72b7957578df980cb2a783
Diffstat (limited to 'core/jni/android_util_Binder.cpp')
-rw-r--r--core/jni/android_util_Binder.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 0681195..b432d65 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -282,6 +282,16 @@ protected:
code, (int32_t)&data, (int32_t)reply, flags);
jthrowable excep = env->ExceptionOccurred();
+ if (excep) {
+ report_exception(env, excep,
+ "*** Uncaught remote exception! "
+ "(Exceptions are not yet supported across processes.)");
+ res = JNI_FALSE;
+
+ /* clean up JNI local ref -- we don't return to Java code */
+ env->DeleteLocalRef(excep);
+ }
+
// Restore the Java binder thread's state if it changed while
// processing a call (as it would if the Parcel's header had a
// new policy mask and Parcel.enforceInterface() changed
@@ -294,14 +304,12 @@ protected:
set_dalvik_blockguard_policy(env, strict_policy_before);
}
- if (excep) {
- report_exception(env, excep,
- "*** Uncaught remote exception! "
- "(Exceptions are not yet supported across processes.)");
- res = JNI_FALSE;
-
+ jthrowable excep2 = env->ExceptionOccurred();
+ if (excep2) {
+ report_exception(env, excep2,
+ "*** Uncaught exception in onBinderStrictModePolicyChange");
/* clean up JNI local ref -- we don't return to Java code */
- env->DeleteLocalRef(excep);
+ env->DeleteLocalRef(excep2);
}
//aout << "onTransact to Java code; result=" << res << endl