diff options
author | 2019-02-25 12:16:02 -0800 | |
---|---|---|
committer | 2019-03-12 15:05:39 -0700 | |
commit | 94a566d4ce418e756d60b855efe66f067fca53e6 (patch) | |
tree | b0fb8ed65cfc679accf8a322d9d53198af7f20d7 /libs/binder/IAppOpsService.cpp | |
parent | dd50a3cf4c9f41bf0e4952246cd559da5cfb503a (diff) |
Native impl for ApOpManager.checkAudioOperation
Bug: 112339570
Test: enter DnD, play notifications, verify not heard
Change-Id: I645121cbf2c5d99a727f82b8fbf4226d104a5ae3
Diffstat (limited to 'libs/binder/IAppOpsService.cpp')
-rw-r--r-- | libs/binder/IAppOpsService.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp index fb0d521cac..66d6e31902 100644 --- a/libs/binder/IAppOpsService.cpp +++ b/libs/binder/IAppOpsService.cpp @@ -123,6 +123,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"); @@ -209,6 +225,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); } |