diff options
| -rw-r--r-- | core/java/android/os/Binder.java | 5 | ||||
| -rw-r--r-- | core/jni/android_util_Binder.cpp | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index 8b6194c29707..6a4c78c9e353 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -249,6 +249,7 @@ public class Binder implements IBinder { * If the current thread is not currently executing an incoming transaction, * then its own pid is returned. */ + @CriticalNative public static final native int getCallingPid(); /** @@ -258,6 +259,7 @@ public class Binder implements IBinder { * permissions. If the current thread is not currently executing an * incoming transaction, then its own uid is returned. */ + @CriticalNative public static final native int getCallingUid(); /** @@ -288,6 +290,7 @@ public class Binder implements IBinder { * @see #getCallingUid() * @see #restoreCallingIdentity(long) */ + @CriticalNative public static final native long clearCallingIdentity(); /** @@ -364,6 +367,7 @@ public class Binder implements IBinder { * @see StrictMode * @hide */ + @CriticalNative public static final native void setThreadStrictModePolicy(int policyMask); /** @@ -372,6 +376,7 @@ public class Binder implements IBinder { * @see #setThreadStrictModePolicy * @hide */ + @CriticalNative public static final native int getThreadStrictModePolicy(); /** diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index ec980800c410..fd042b39f7c2 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -865,17 +865,17 @@ void signalExceptionForError(JNIEnv* env, jobject obj, status_t err, // ---------------------------------------------------------------------------- -static jint android_os_Binder_getCallingPid(JNIEnv* env, jobject clazz) +static jint android_os_Binder_getCallingPid() { return IPCThreadState::self()->getCallingPid(); } -static jint android_os_Binder_getCallingUid(JNIEnv* env, jobject clazz) +static jint android_os_Binder_getCallingUid() { return IPCThreadState::self()->getCallingUid(); } -static jlong android_os_Binder_clearCallingIdentity(JNIEnv* env, jobject clazz) +static jlong android_os_Binder_clearCallingIdentity() { return IPCThreadState::self()->clearCallingIdentity(); } @@ -894,12 +894,12 @@ static void android_os_Binder_restoreCallingIdentity(JNIEnv* env, jobject clazz, IPCThreadState::self()->restoreCallingIdentity(token); } -static void android_os_Binder_setThreadStrictModePolicy(JNIEnv* env, jobject clazz, jint policyMask) +static void android_os_Binder_setThreadStrictModePolicy(jint policyMask) { IPCThreadState::self()->setStrictModePolicy(policyMask); } -static jint android_os_Binder_getThreadStrictModePolicy(JNIEnv* env, jobject clazz) +static jint android_os_Binder_getThreadStrictModePolicy() { return IPCThreadState::self()->getStrictModePolicy(); } @@ -950,11 +950,16 @@ static void android_os_Binder_blockUntilThreadAvailable(JNIEnv* env, jobject cla static const JNINativeMethod gBinderMethods[] = { /* name, signature, funcPtr */ + // @CriticalNative { "getCallingPid", "()I", (void*)android_os_Binder_getCallingPid }, + // @CriticalNative { "getCallingUid", "()I", (void*)android_os_Binder_getCallingUid }, + // @CriticalNative { "clearCallingIdentity", "()J", (void*)android_os_Binder_clearCallingIdentity }, { "restoreCallingIdentity", "(J)V", (void*)android_os_Binder_restoreCallingIdentity }, + // @CriticalNative { "setThreadStrictModePolicy", "(I)V", (void*)android_os_Binder_setThreadStrictModePolicy }, + // @CriticalNative { "getThreadStrictModePolicy", "()I", (void*)android_os_Binder_getThreadStrictModePolicy }, // @CriticalNative { "setThreadWorkSource", "(I)I", (void*)android_os_Binder_setThreadWorkSource }, |