diff options
author | 2020-07-15 02:29:01 +0100 | |
---|---|---|
committer | 2020-08-03 17:06:23 +0000 | |
commit | fce9ccce5f68b35832869233d0fcdaea17b7c992 (patch) | |
tree | a17c9b9fd71fb749c759106660e01183644cd4ed /libs/binder/IAppOpsService.cpp | |
parent | 98da25e58d33e7dadc2dc473b7563afcb232e3de (diff) |
Add shouldCollectMessage parameter to AppOpsManager calls from native code.
Bug: 161362515
Test: manually verified
Change-Id: I05894dee10ba2cab587aea5d02773feae1085e34
Diffstat (limited to 'libs/binder/IAppOpsService.cpp')
-rw-r--r-- | libs/binder/IAppOpsService.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp index cd78866624..ee0cd6206e 100644 --- a/libs/binder/IAppOpsService.cpp +++ b/libs/binder/IAppOpsService.cpp @@ -50,15 +50,16 @@ public: virtual int32_t noteOperation(int32_t code, int32_t uid, const String16& packageName, const std::optional<String16>& attributionTag, bool shouldCollectAsyncNotedOp, - const String16& message) { + const String16& message, bool shouldCollectMessage) { Parcel data, reply; data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); data.writeInt32(code); data.writeInt32(uid); data.writeString16(packageName); data.writeString16(attributionTag); - data.writeInt32(shouldCollectAsyncNotedOp ? 1 : 0); + data.writeBool(shouldCollectAsyncNotedOp); data.writeString16(message); + data.writeBool(shouldCollectMessage); remote()->transact(NOTE_OPERATION_TRANSACTION, data, &reply); // fail on exception if (reply.readExceptionCode() != 0) return MODE_ERRORED; @@ -67,7 +68,8 @@ public: virtual int32_t startOperation(const sp<IBinder>& token, int32_t code, int32_t uid, const String16& packageName, const std::optional<String16>& attributionTag, - bool startIfModeDefault, bool shouldCollectAsyncNotedOp, const String16& message) { + bool startIfModeDefault, bool shouldCollectAsyncNotedOp, const String16& message, + bool shouldCollectMessage) { Parcel data, reply; data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); data.writeStrongBinder(token); @@ -75,9 +77,10 @@ public: data.writeInt32(uid); data.writeString16(packageName); data.writeString16(attributionTag); - data.writeInt32(startIfModeDefault ? 1 : 0); - data.writeInt32(shouldCollectAsyncNotedOp ? 1 : 0); + data.writeBool(startIfModeDefault); + data.writeBool(shouldCollectAsyncNotedOp); data.writeString16(message); + data.writeBool(shouldCollectMessage); remote()->transact(START_OPERATION_TRANSACTION, data, &reply); // fail on exception if (reply.readExceptionCode() != 0) return MODE_ERRORED; @@ -186,10 +189,11 @@ status_t BnAppOpsService::onTransact( String16 packageName = data.readString16(); std::optional<String16> attributionTag; data.readString16(&attributionTag); - bool shouldCollectAsyncNotedOp = data.readInt32() == 1; + bool shouldCollectAsyncNotedOp = data.readBool(); String16 message = data.readString16(); + bool shouldCollectMessage = data.readBool(); int32_t res = noteOperation(code, uid, packageName, attributionTag, - shouldCollectAsyncNotedOp, message); + shouldCollectAsyncNotedOp, message, shouldCollectMessage); reply->writeNoException(); reply->writeInt32(res); return NO_ERROR; @@ -202,11 +206,12 @@ status_t BnAppOpsService::onTransact( String16 packageName = data.readString16(); std::optional<String16> attributionTag; data.readString16(&attributionTag); - bool startIfModeDefault = data.readInt32() == 1; - bool shouldCollectAsyncNotedOp = data.readInt32() == 1; + bool startIfModeDefault = data.readBool(); + bool shouldCollectAsyncNotedOp = data.readBool(); String16 message = data.readString16(); + bool shouldCollectMessage = data.readBool(); int32_t res = startOperation(token, code, uid, packageName, attributionTag, - startIfModeDefault, shouldCollectAsyncNotedOp, message); + startIfModeDefault, shouldCollectAsyncNotedOp, message, shouldCollectMessage); reply->writeNoException(); reply->writeInt32(res); return NO_ERROR; |