summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-10-20 06:20:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-10-20 06:20:57 +0000
commit4af480c6c10b916fd702c8c4b1812437d12d146c (patch)
tree84b0bbd7a56f3b9b32785b4c544cf5f12bb65689
parentab8c0dde6f57b35dd1b254660ffb3f8dd84e9424 (diff)
parent4c4ca9a50c43e56d6c448c18b06b7b3a3744c123 (diff)
Merge "Make restoreCallingIdentity() @CriticalNative."
-rw-r--r--core/java/android/os/Binder.java1
-rw-r--r--core/jni/android_util_Binder.cpp12
2 files changed, 3 insertions, 10 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index d492e0870b2e..fce3437db049 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -379,6 +379,7 @@ public class Binder implements IBinder {
*
* @see #clearCallingIdentity
*/
+ @CriticalNative
public static final native void restoreCallingIdentity(long token);
/**
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index e1180384fcc9..32b8fa61c8a0 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -960,17 +960,8 @@ static jlong android_os_Binder_clearCallingIdentity()
return IPCThreadState::self()->clearCallingIdentity();
}
-static void android_os_Binder_restoreCallingIdentity(JNIEnv* env, jobject clazz, jlong token)
+static void android_os_Binder_restoreCallingIdentity(jlong token)
{
- // XXX temporary validation 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%" PRIx64, token);
- jniThrowException(env, "java/lang/IllegalStateException", buf);
- return;
- }
IPCThreadState::self()->restoreCallingIdentity(token);
}
@@ -1064,6 +1055,7 @@ static const JNINativeMethod gBinderMethods[] = {
{ "isHandlingTransaction", "()Z", (void*)android_os_Binder_isHandlingTransaction },
// @CriticalNative
{ "clearCallingIdentity", "()J", (void*)android_os_Binder_clearCallingIdentity },
+ // @CriticalNative
{ "restoreCallingIdentity", "(J)V", (void*)android_os_Binder_restoreCallingIdentity },
// @CriticalNative
{ "setThreadStrictModePolicy", "(I)V", (void*)android_os_Binder_setThreadStrictModePolicy },