Update binder interfaces for AIDL change in byte[] type
byte[] is now uint8_t in AIDL. We need to accomodate this.
Change-Id: I15ed5948c99bba0783802ca607a2420b5b05aa57
Test: Build succeeds against new AIDL
Bug: 27078230
(cherry picked from commit 8805184cdaef79c997db25aff527042606e98abe)
diff --git a/trunks/trunks_binder_proxy.cc b/trunks/trunks_binder_proxy.cc
index 772afc7..ed1052a 100644
--- a/trunks/trunks_binder_proxy.cc
+++ b/trunks/trunks_binder_proxy.cc
@@ -38,7 +38,7 @@
// ITrunksClient interface.
android::binder::Status OnCommandResponse(
- const std::vector<int8_t>& response_proto_data) override {
+ const std::vector<uint8_t>& response_proto_data) override {
trunks::SendCommandResponse response_proto;
if (!response_proto.ParseFromArray(response_proto_data.data(),
response_proto_data.size())) {
@@ -74,7 +74,7 @@
const ResponseCallback& callback) {
SendCommandRequest command_proto;
command_proto.set_command(command);
- std::vector<int8_t> command_proto_data;
+ std::vector<uint8_t> command_proto_data;
command_proto_data.resize(command_proto.ByteSize());
if (!command_proto.SerializeToArray(command_proto_data.data(),
command_proto_data.size())) {
@@ -95,14 +95,14 @@
std::string TrunksBinderProxy::SendCommandAndWait(const std::string& command) {
SendCommandRequest command_proto;
command_proto.set_command(command);
- std::vector<int8_t> command_proto_data;
+ std::vector<uint8_t> command_proto_data;
command_proto_data.resize(command_proto.ByteSize());
if (!command_proto.SerializeToArray(command_proto_data.data(),
command_proto_data.size())) {
LOG(ERROR) << "TrunksBinderProxy: Failed to serialize protobuf.";
return CreateErrorResponse(TRUNKS_RC_IPC_ERROR);
}
- std::vector<int8_t> response_proto_data;
+ std::vector<uint8_t> response_proto_data;
android::binder::Status status = trunks_service_->SendCommandAndWait(
command_proto_data, &response_proto_data);
if (!status.isOk()) {
diff --git a/trunks/trunks_binder_service.cc b/trunks/trunks_binder_service.cc
index 028aa3c..b8b72b5 100644
--- a/trunks/trunks_binder_service.cc
+++ b/trunks/trunks_binder_service.cc
@@ -30,7 +30,7 @@
// If |command| is a valid command protobuf, provides the |command_data| and
// returns true. Otherwise, returns false.
-bool ParseCommandProto(const std::vector<int8_t>& command,
+bool ParseCommandProto(const std::vector<uint8_t>& command,
std::string* command_data) {
trunks::SendCommandRequest request_proto;
if (!request_proto.ParseFromArray(command.data(), command.size()) ||
@@ -42,7 +42,7 @@
}
void CreateResponseProto(const std::string& data,
- std::vector<int8_t>* response) {
+ std::vector<uint8_t>* response) {
trunks::SendCommandResponse response_proto;
response_proto.set_response(data);
response->resize(response_proto.ByteSize());
@@ -75,7 +75,7 @@
: service_(service) {}
android::binder::Status TrunksBinderService::BinderServiceInternal::SendCommand(
- const std::vector<int8_t>& command,
+ const std::vector<uint8_t>& command,
const android::sp<android::trunks::ITrunksClient>& client) {
auto callback =
base::Bind(&TrunksBinderService::BinderServiceInternal::OnResponse,
@@ -93,7 +93,7 @@
void TrunksBinderService::BinderServiceInternal::OnResponse(
const android::sp<android::trunks::ITrunksClient>& client,
const std::string& response) {
- std::vector<int8_t> binder_response;
+ std::vector<uint8_t> binder_response;
CreateResponseProto(response, &binder_response);
android::binder::Status status = client->OnCommandResponse(binder_response);
if (!status.isOk()) {
@@ -104,8 +104,8 @@
android::binder::Status
TrunksBinderService::BinderServiceInternal::SendCommandAndWait(
- const std::vector<int8_t>& command,
- std::vector<int8_t>* response) {
+ const std::vector<uint8_t>& command,
+ std::vector<uint8_t>* response) {
std::string command_data;
if (!ParseCommandProto(command, &command_data)) {
LOG(ERROR) << "TrunksBinderService: Bad command data.";
diff --git a/trunks/trunks_binder_service.h b/trunks/trunks_binder_service.h
index 7f809ac..0352b74 100644
--- a/trunks/trunks_binder_service.h
+++ b/trunks/trunks_binder_service.h
@@ -57,11 +57,11 @@
// ITrunks interface.
android::binder::Status SendCommand(
- const std::vector<int8_t>& command,
+ const std::vector<uint8_t>& command,
const android::sp<android::trunks::ITrunksClient>& client) override;
android::binder::Status SendCommandAndWait(
- const std::vector<int8_t>& command,
- std::vector<int8_t>* response) override;
+ const std::vector<uint8_t>& command,
+ std::vector<uint8_t>* response) override;
private:
void OnResponse(const android::sp<android::trunks::ITrunksClient>& client,