From d605096898cadafad574be0ea328ef05a4c8ea46 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 31 Jan 2020 14:59:06 -0800 Subject: [PATCH] Use libbinderthreadstateutils. Clients needing to differentiate between system/vendor used to be able to use isServingCall. However, this was expensive to implement. This alternative approach instead requires users of this API to use libbinderthreadstateutils which does a slighty different operation. Bug: 148692216 Test: boot Change-Id: I2c926107e43a47bd4e20e08f16a293e707ab03f7 --- core/jni/Android.bp | 1 + core/jni/android_util_Binder.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/jni/Android.bp b/core/jni/Android.bp index c04efa3be5966..d80c1b2307fd0 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -207,6 +207,7 @@ cc_library_shared { static_libs: [ "libasync_safe", + "libbinderthreadstateutils", "libdmabufinfo", "libgif", "libseccomp_policy", diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index e77c25efb1d4e..af53244c63599 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -927,7 +928,7 @@ static jint android_os_Binder_getCallingUid() static jboolean android_os_Binder_isHandlingTransaction() { - return IPCThreadState::self()->isServingCall(); + return getCurrentServingCall() == BinderCallType::BINDER; } static jlong android_os_Binder_clearCallingIdentity()