summaryrefslogtreecommitdiff
path: root/libs/binder/AppOpsManager.cpp
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2013-07-17 17:26:15 -0700
committer Dianne Hackborn <hackbod@google.com> 2013-07-17 17:26:15 -0700
commit913b63d235a982174b66acad95ca2f87ac8a1982 (patch)
tree971b3386461f6a6aaefb01134967900c5dc9c805 /libs/binder/AppOpsManager.cpp
parentba3ed90b095dfd397aa252fb0234647d7cc5c8f9 (diff)
Follow framework change to track started ops by proc.
Change-Id: Ibbce3bf6556f45751c74bab045b46377e56bff9b
Diffstat (limited to 'libs/binder/AppOpsManager.cpp')
-rw-r--r--libs/binder/AppOpsManager.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp
index 7ac1b11d56..99c27476c7 100644
--- a/libs/binder/AppOpsManager.cpp
+++ b/libs/binder/AppOpsManager.cpp
@@ -15,6 +15,7 @@
*/
#include <binder/AppOpsManager.h>
+#include <binder/Binder.h>
#include <binder/IServiceManager.h>
#include <utils/SystemClock.h>
@@ -22,6 +23,16 @@
namespace android {
static String16 _appops("appops");
+static pthread_mutex_t gTokenMutex = PTHREAD_MUTEX_INITIALIZER;
+static sp<IBinder> gToken;
+
+static const sp<IBinder>& getToken(const sp<IAppOpsService>& service) {
+ pthread_mutex_lock(&gTokenMutex);
+ if (gToken == NULL) {
+ gToken = service->getToken(new BBinder());
+ }
+ return gToken;
+}
AppOpsManager::AppOpsManager()
{
@@ -66,13 +77,14 @@ int32_t AppOpsManager::noteOp(int32_t op, int32_t uid, const String16& callingPa
int32_t AppOpsManager::startOp(int32_t op, int32_t uid, const String16& callingPackage) {
sp<IAppOpsService> service = getService();
- return service != NULL ? service->startOperation(op, uid, callingPackage) : MODE_IGNORED;
+ return service != NULL ? service->startOperation(getToken(service), op, uid, callingPackage)
+ : MODE_IGNORED;
}
void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPackage) {
sp<IAppOpsService> service = getService();
if (service != NULL) {
- service->finishOperation(op, uid, callingPackage);
+ service->finishOperation(getToken(service), op, uid, callingPackage);
}
}