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
This commit is contained in:
Dianne Hackborn
2011-03-14 14:24:04 -07:00
parent 68f66b945e
commit cf3004a46e

View File

@@ -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);
}