diff options
-rw-r--r-- | core/jni/android_os_HwParcel.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp index a88f8919ed08..ff336ee64b54 100644 --- a/core/jni/android_os_HwParcel.cpp +++ b/core/jni/android_os_HwParcel.cpp @@ -122,10 +122,18 @@ void signalExceptionForError(JNIEnv *env, status_t err, bool canThrowRemoteExcep std::stringstream ss; ss << "HwBinder Error: (" << err << ")"; - jniThrowException( - env, - canThrowRemoteException ? "android/os/RemoteException" : "java/lang/RuntimeException", - ss.str().c_str()); + const char* exception = nullptr; + if (canThrowRemoteException) { + if (err == DEAD_OBJECT) { + exception = "android/os/DeadObjectException"; + } else { + exception = "android/os/RemoteException"; + } + } else { + exception = "java/lang/RuntimeException"; + } + + jniThrowException(env, exception, ss.str().c_str()); break; } |