Merge "Update libstatssocket_lazy to support StringArray" into main

This commit is contained in:
Kenn Frankel 2024-02-05 19:16:33 +00:00 committed by Gerrit Code Review
commit 7833f27c25
2 changed files with 10 additions and 2 deletions

View file

@ -45,6 +45,7 @@ enum MethodIndex {
k_AStatsEvent_writeBool,
k_AStatsEvent_writeByteArray,
k_AStatsEvent_writeString,
k_AStatsEvent_writeStringArray,
k_AStatsEvent_writeAttributionChain,
k_AStatsEvent_addBoolAnnotation,
k_AStatsEvent_addInt32Annotation,
@ -104,6 +105,7 @@ static void InitializeOnce() {
BIND_SYMBOL(AStatsEvent_writeBool);
BIND_SYMBOL(AStatsEvent_writeByteArray);
BIND_SYMBOL(AStatsEvent_writeString);
BIND_SYMBOL(AStatsEvent_writeStringArray);
BIND_SYMBOL(AStatsEvent_writeAttributionChain);
BIND_SYMBOL(AStatsEvent_addBoolAnnotation);
BIND_SYMBOL(AStatsEvent_addInt32Annotation);
@ -179,6 +181,11 @@ void AStatsEvent_writeString(AStatsEvent* event, const char* value) {
INVOKE_METHOD(AStatsEvent_writeString, event, value);
}
void AStatsEvent_writeStringArray(AStatsEvent* event, const char* const* elements,
size_t numElements) {
INVOKE_METHOD(AStatsEvent_writeStringArray, event, elements, numElements);
}
void AStatsEvent_writeAttributionChain(AStatsEvent* event, const uint32_t* uids,
const char* const* tags, uint8_t numNodes) {
INVOKE_METHOD(AStatsEvent_writeAttributionChain, event, uids, tags, numNodes);
@ -198,4 +205,4 @@ void AStatsEvent_addInt32Annotation(AStatsEvent* event, uint8_t annotationId, in
void AStatsSocket_close() {
INVOKE_METHOD(AStatsSocket_close);
}
}

View file

@ -47,6 +47,7 @@ TEST_F(LibstatssocketLazyTest, NoLibstatssocketForStatsEvent) {
EXPECT_DEATH(AStatsEvent_writeBool(event, false), kLoadFailed);
EXPECT_DEATH(AStatsEvent_writeByteArray(event, NULL, 0), kLoadFailed);
EXPECT_DEATH(AStatsEvent_writeString(event, NULL), kLoadFailed);
EXPECT_DEATH(AStatsEvent_writeStringArray(event, NULL, 0), kLoadFailed);
EXPECT_DEATH(AStatsEvent_writeAttributionChain(event, NULL, NULL, 0), kLoadFailed);
EXPECT_DEATH(AStatsEvent_addBoolAnnotation(event, 0, false), kLoadFailed);
@ -55,4 +56,4 @@ TEST_F(LibstatssocketLazyTest, NoLibstatssocketForStatsEvent) {
TEST_F(LibstatssocketLazyTest, NoLibstatssocketForStatsSocket) {
EXPECT_DEATH(AStatsSocket_close(), kLoadFailed);
}
}