summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2020-01-31 14:59:06 -0800
committer Steven Moreland <smoreland@google.com> 2020-02-03 14:51:30 -0800
commitd605096898cadafad574be0ea328ef05a4c8ea46 (patch)
tree852fcd5f327e13754fe5cae6bf8c42b0390aca39
parente0fb3e2dcd6c4a54e8cf1696fbeb174b0985c22d (diff)
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
-rw-r--r--core/jni/Android.bp1
-rw-r--r--core/jni/android_util_Binder.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index c04efa3be596..d80c1b2307fd 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 e77c25efb1d4..af53244c6359 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -37,6 +37,7 @@
#include <binder/Parcel.h>
#include <binder/ProcessState.h>
#include <binder/Stability.h>
+#include <binderthreadstate/CallerUtils.h>
#include <cutils/atomic.h>
#include <log/log.h>
#include <utils/KeyedVector.h>
@@ -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()