summaryrefslogtreecommitdiff
path: root/libs/permission/IAppOpsService.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2021-10-06 22:53:36 +0000
committer Xin Li <delphij@google.com> 2021-10-06 22:53:36 +0000
commit097d2a50873100486d65a69cb1cbabf37fb3b188 (patch)
treec2f19f92e4503b2de0afeebdd9bf7aeb1bb2e9c1 /libs/permission/IAppOpsService.cpp
parentcbfb18e134845deeace954bbba818acda48cb80f (diff)
parentadcb6a2733c1baf66e5ad72365965ab504f5f959 (diff)
Merge Android 12
Bug: 202323961 Merged-In: Ifb27b3eb12454fa96f07e6797745c697b4f831c4 Change-Id: I2a7f5931477fddb51564c2eabcdc96ce58888ce8
Diffstat (limited to 'libs/permission/IAppOpsService.cpp')
-rw-r--r--libs/permission/IAppOpsService.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/libs/permission/IAppOpsService.cpp b/libs/permission/IAppOpsService.cpp
index 1af5ab8719..d59f44562e 100644
--- a/libs/permission/IAppOpsService.cpp
+++ b/libs/permission/IAppOpsService.cpp
@@ -18,8 +18,8 @@
#include <binder/IAppOpsService.h>
-#include <utils/Log.h>
#include <binder/Parcel.h>
+#include <utils/Log.h>
#include <utils/String8.h>
#include <optional>
@@ -50,24 +50,29 @@ 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;
+ // TODO b/184855056: extract to class
+ reply.readInt32();
+ reply.readByte();
return reply.readInt32();
}
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,12 +80,16 @@ 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;
+ // TODO b/184855056: extract to class
+ reply.readInt32();
+ reply.readByte();
return reply.readInt32();
}
@@ -186,10 +195,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 +212,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;