Creates a dummy pointer for empty messages

Changes to Java HIDL at ContextHubService caused empty messages with
sendMessageToHub to be populated with null pointers. Work around this by
creating a dummy pointer in this case.

Bug: 69065562
Test: Compile on sailfish-userdebug, run CHQTS and verify pass
Change-Id: I763cbf9696f6dc04637add3ed1da01f9c32d458b
This commit is contained in:
Arthur Ishiguro
2017-11-08 17:45:19 -08:00
parent c8145123db
commit 28df640ff4

View File

@@ -155,6 +155,12 @@ Return<Result> Contexthub::sendMessageToHub(uint32_t hubId,
.message = static_cast<const uint8_t *>(msg.msg.data()),
};
// Use a dummy to prevent send_message with empty message from failing prematurely
static uint8_t dummy;
if (txMsg.message_len == 0 && txMsg.message == nullptr) {
txMsg.message = &dummy;
}
ALOGI("Sending msg of type %" PRIu32 ", size %" PRIu32 " to app 0x%" PRIx64,
txMsg.message_type,
txMsg.message_len,