From b412f6e203b38f8047f760261a5e3dc6d0722f08 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Wed, 29 Apr 2015 16:50:41 -0700 Subject: Add body sensors app op - framework native Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f --- libs/binder/IAppOpsService.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libs/binder/IAppOpsService.cpp') diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp index 86abdc0117..9558376dbf 100644 --- a/libs/binder/IAppOpsService.cpp +++ b/libs/binder/IAppOpsService.cpp @@ -111,6 +111,17 @@ public: if (reply.readExceptionCode() != 0) return NULL; return reply.readStrongBinder(); } + + + virtual int32_t permissionToOpCode(const String16& permission) { + Parcel data, reply; + data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); + data.writeString16(permission); + remote()->transact(PERMISSION_TO_OP_CODE_TRANSACTION, data, &reply); + // fail on exception + if (reply.readExceptionCode() != 0) return -1; + return reply.readInt32(); + } }; IMPLEMENT_META_INTERFACE(AppOpsService, "com.android.internal.app.IAppOpsService"); @@ -187,6 +198,14 @@ status_t BnAppOpsService::onTransact( reply->writeStrongBinder(token); return NO_ERROR; } break; + case PERMISSION_TO_OP_CODE_TRANSACTION: { + CHECK_INTERFACE(IAppOpsService, data, reply); + String16 permission = data.readString16(); + const int32_t opCode = permissionToOpCode(permission); + reply->writeNoException(); + reply->writeInt32(opCode); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } -- cgit v1.2.3-59-g8ed1b