summaryrefslogtreecommitdiff
path: root/libs/binder/IAppOpsService.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/IAppOpsService.cpp
parentba3ed90b095dfd397aa252fb0234647d7cc5c8f9 (diff)
Follow framework change to track started ops by proc.
Change-Id: Ibbce3bf6556f45751c74bab045b46377e56bff9b
Diffstat (limited to 'libs/binder/IAppOpsService.cpp')
-rw-r--r--libs/binder/IAppOpsService.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp
index 282b30fedd..471e3e993e 100644
--- a/libs/binder/IAppOpsService.cpp
+++ b/libs/binder/IAppOpsService.cpp
@@ -61,9 +61,11 @@ public:
return reply.readInt32();
}
- virtual int32_t startOperation(int32_t code, int32_t uid, const String16& packageName) {
+ virtual int32_t startOperation(const sp<IBinder>& token, int32_t code, int32_t uid,
+ const String16& packageName) {
Parcel data, reply;
data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor());
+ data.writeStrongBinder(token);
data.writeInt32(code);
data.writeInt32(uid);
data.writeString16(packageName);
@@ -73,9 +75,11 @@ public:
return reply.readInt32();
}
- virtual void finishOperation(int32_t code, int32_t uid, const String16& packageName) {
+ virtual void finishOperation(const sp<IBinder>& token, int32_t code, int32_t uid,
+ const String16& packageName) {
Parcel data, reply;
data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor());
+ data.writeStrongBinder(token);
data.writeInt32(code);
data.writeInt32(uid);
data.writeString16(packageName);
@@ -98,6 +102,16 @@ public:
data.writeStrongBinder(callback->asBinder());
remote()->transact(STOP_WATCHING_MODE_TRANSACTION, data, &reply);
}
+
+ virtual sp<IBinder> getToken(const sp<IBinder>& clientToken) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor());
+ data.writeStrongBinder(clientToken);
+ remote()->transact(GET_TOKEN_TRANSACTION, data, &reply);
+ // fail on exception
+ if (reply.readExceptionCode() != 0) return NULL;
+ return reply.readStrongBinder();
+ }
};
IMPLEMENT_META_INTERFACE(AppOpsService, "com.android.internal.app.IAppOpsService");
@@ -131,20 +145,22 @@ status_t BnAppOpsService::onTransact(
} break;
case START_OPERATION_TRANSACTION: {
CHECK_INTERFACE(IAppOpsService, data, reply);
+ sp<IBinder> token = data.readStrongBinder();
int32_t code = data.readInt32();
int32_t uid = data.readInt32();
String16 packageName = data.readString16();
- int32_t res = startOperation(code, uid, packageName);
+ int32_t res = startOperation(token, code, uid, packageName);
reply->writeNoException();
reply->writeInt32(res);
return NO_ERROR;
} break;
case FINISH_OPERATION_TRANSACTION: {
CHECK_INTERFACE(IAppOpsService, data, reply);
+ sp<IBinder> token = data.readStrongBinder();
int32_t code = data.readInt32();
int32_t uid = data.readInt32();
String16 packageName = data.readString16();
- finishOperation(code, uid, packageName);
+ finishOperation(token, code, uid, packageName);
reply->writeNoException();
return NO_ERROR;
} break;
@@ -164,6 +180,14 @@ status_t BnAppOpsService::onTransact(
reply->writeNoException();
return NO_ERROR;
} break;
+ case GET_TOKEN_TRANSACTION: {
+ CHECK_INTERFACE(IAppOpsService, data, reply);
+ sp<IBinder> clientToken = data.readStrongBinder();
+ sp<IBinder> token = getToken(clientToken);
+ reply->writeNoException();
+ reply->writeStrongBinder(token);
+ return NO_ERROR;
+ } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}