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-05 10:13:19 -0800
commit4c15e0359fda3fa29d21781547fa00a24163bc3c (patch)
treea6baf73fe39bd889dd6490e2ace672abdab8484f
parent05cf3e896c6d3e40c11ca3767bde535433636a6d (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 Merged-In: 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 f68fd5799cfc..43df2e444932 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -233,6 +233,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 079c2652cb17..1da022c11420 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>
@@ -946,7 +947,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()