summaryrefslogtreecommitdiffstats
path: root/core/jni/android_util_Binder.cpp
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-03-14 14:24:04 -0700
committerDianne Hackborn <hackbod@google.com>2011-03-14 14:24:04 -0700
commitcf3004a46eabb49f3eee483067e75aef7b0a69e7 (patch)
tree547f02030e25e37c49f9f8c6351dc4a252ef1d2d /core/jni/android_util_Binder.cpp
parent68f66b945e7a69549689becd2e656d9056f1e7f5 (diff)
downloadframeworks_base-cf3004a46eabb49f3eee483067e75aef7b0a69e7.zip
frameworks_base-cf3004a46eabb49f3eee483067e75aef7b0a69e7.tar.gz
frameworks_base-cf3004a46eabb49f3eee483067e75aef7b0a69e7.tar.bz2
Add some debug code to try to track down issue 3183612
java.lang.SecurityException: Neither user 1209 nor current process has android.permission.WAKE_LOCK. Change-Id: I3e84f8795941744e697824a5e5b2e651f565b253
Diffstat (limited to 'core/jni/android_util_Binder.cpp')
-rw-r--r--core/jni/android_util_Binder.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 7a53874..8db2553 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -603,6 +603,15 @@ static jlong android_os_Binder_clearCallingIdentity(JNIEnv* env, jobject clazz)
static void android_os_Binder_restoreCallingIdentity(JNIEnv* env, jobject clazz, jlong token)
{
+ // XXX temporary sanity check to debug crashes.
+ int uid = (int)(token>>32);
+ if (uid > 0 && uid < 999) {
+ // In Android currently there are no uids in this range.
+ char buf[128];
+ sprintf(buf, "Restoring bad calling ident: 0x%Lx", token);
+ jniThrowException(env, "java/lang/IllegalStateException", buf);
+ return;
+ }
IPCThreadState::self()->restoreCallingIdentity(token);
}