summaryrefslogtreecommitdiff
path: root/libs/binder/AppOpsManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/binder/AppOpsManager.cpp')
-rw-r--r--libs/binder/AppOpsManager.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp
index 4f0b7d31a2..ca9c6087c9 100644
--- a/libs/binder/AppOpsManager.cpp
+++ b/libs/binder/AppOpsManager.cpp
@@ -44,16 +44,16 @@ const int APP_OPS_MANAGER_UNAVAILABLE_MODE = AppOpsManager::MODE_IGNORED;
} // namespace
static String16 _appops("appops");
-static pthread_mutex_t gTokenMutex = PTHREAD_MUTEX_INITIALIZER;
-static sp<IBinder> gToken;
+static pthread_mutex_t gClientIdMutex = PTHREAD_MUTEX_INITIALIZER;
+static sp<IBinder> gClientId;
-static const sp<IBinder>& getToken(const sp<IAppOpsService>& service) {
- pthread_mutex_lock(&gTokenMutex);
- if (gToken == nullptr || gToken->pingBinder() != NO_ERROR) {
- gToken = service->getToken(new BBinder());
+static const sp<IBinder>& getClientId() {
+ pthread_mutex_lock(&gClientIdMutex);
+ if (gClientId == nullptr) {
+ gClientId = new BBinder();
}
- pthread_mutex_unlock(&gTokenMutex);
- return gToken;
+ pthread_mutex_unlock(&gClientIdMutex);
+ return gClientId;
}
thread_local uint64_t notedAppOpsInThisBinderTransaction[2];
@@ -144,7 +144,7 @@ int32_t AppOpsManager::startOpNoThrow(int32_t op, int32_t uid, const String16& c
const String16& message) {
sp<IAppOpsService> service = getService();
int32_t mode = service != nullptr
- ? service->startOperation(getToken(service), op, uid, callingPackage,
+ ? service->startOperation(getClientId(), op, uid, callingPackage,
featureId, startIfModeDefault) : APP_OPS_MANAGER_UNAVAILABLE_MODE;
if (mode == AppOpsManager::MODE_ALLOWED) {
@@ -162,7 +162,7 @@ void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPac
const std::unique_ptr<String16>& callingFeatureId) {
sp<IAppOpsService> service = getService();
if (service != nullptr) {
- service->finishOperation(getToken(service), op, uid, callingPackage, callingFeatureId);
+ service->finishOperation(getClientId(), op, uid, callingPackage, callingFeatureId);
}
}