summaryrefslogtreecommitdiff
path: root/libs/binder/IAppOpsService.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2019-09-05 16:53:28 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-09-05 16:53:28 +0000
commitb653dd0a088f3be9d0fccd3d2099b3f8ab63ca2c (patch)
treea3796f67d19deece6118e60d2faebde9499ce083 /libs/binder/IAppOpsService.cpp
parent0bc2361309d705f8c7f7766f1912fd0f7035d199 (diff)
parent9c724d78b9f2e00a7d4de3bfd2c65f6226fa8529 (diff)
Merge "DO NOT MERGE - Merge Android 10 into master"
Diffstat (limited to 'libs/binder/IAppOpsService.cpp')
-rw-r--r--libs/binder/IAppOpsService.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp
index c839ba5f88..c426f3a31f 100644
--- a/libs/binder/IAppOpsService.cpp
+++ b/libs/binder/IAppOpsService.cpp
@@ -121,6 +121,22 @@ public:
if (reply.readExceptionCode() != 0) return -1;
return reply.readInt32();
}
+
+ virtual int32_t checkAudioOperation(int32_t code, int32_t usage,
+ int32_t uid, const String16& packageName) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor());
+ data.writeInt32(code);
+ data.writeInt32(usage);
+ data.writeInt32(uid);
+ data.writeString16(packageName);
+ remote()->transact(CHECK_AUDIO_OPERATION_TRANSACTION, data, &reply);
+ // fail on exception
+ if (reply.readExceptionCode() != 0) {
+ return MODE_ERRORED;
+ }
+ return reply.readInt32();
+ }
};
IMPLEMENT_META_INTERFACE(AppOpsService, "com.android.internal.app.IAppOpsService");
@@ -207,6 +223,17 @@ status_t BnAppOpsService::onTransact(
reply->writeInt32(opCode);
return NO_ERROR;
} break;
+ case CHECK_AUDIO_OPERATION_TRANSACTION: {
+ CHECK_INTERFACE(IAppOpsService, data, reply);
+ const int32_t code = data.readInt32();
+ const int32_t usage = data.readInt32();
+ const int32_t uid = data.readInt32();
+ const String16 packageName = data.readString16();
+ const int32_t res = checkAudioOperation(code, usage, uid, packageName);
+ reply->writeNoException();
+ reply->writeInt32(res);
+ return NO_ERROR;
+ } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}