diff options
| author | 2022-12-12 23:02:31 +0000 | |
|---|---|---|
| committer | 2022-12-12 23:02:31 +0000 | |
| commit | cd98f5dd102a5f5cb2ccbf1873f95c9d84df0787 (patch) | |
| tree | 468a8e5ef20ec3edb265a3cbbe09f48b62ddd4b8 | |
| parent | 8f2e1ef9b2038b3f5a8583f4f617b9a0f1231dd7 (diff) | |
| parent | 8d2b4331e2f1d426305d18c05ffad7293df15350 (diff) | |
Merge changes from topic "istats_repeated" am: 73dcda7ead am: 8d2b4331e2
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2337147
Change-Id: I2a4b2bac58549d3301082f33fe20fe6248c51486
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/stats/StatsAidl.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/services/stats/StatsAidl.cpp b/services/stats/StatsAidl.cpp index d4b9a883f0..fe2845449f 100644 --- a/services/stats/StatsAidl.cpp +++ b/services/stats/StatsAidl.cpp @@ -66,6 +66,61 @@ ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { AStatsEvent_writeBool(event, atomValue.get<VendorAtomValue::boolValue>()); break; + case VendorAtomValue::repeatedIntValue: { + const std::optional<std::vector<int>>& repeatedIntValue = + atomValue.get<VendorAtomValue::repeatedIntValue>(); + AStatsEvent_writeInt32Array(event, repeatedIntValue->data(), + repeatedIntValue->size()); + break; + } + case VendorAtomValue::repeatedLongValue: { + const std::optional<std::vector<int64_t>>& repeatedLongValue = + atomValue.get<VendorAtomValue::repeatedLongValue>(); + AStatsEvent_writeInt64Array(event, repeatedLongValue->data(), + repeatedLongValue->size()); + break; + } + case VendorAtomValue::repeatedFloatValue: { + const std::optional<std::vector<float>>& repeatedFloatValue = + atomValue.get<VendorAtomValue::repeatedFloatValue>(); + AStatsEvent_writeFloatArray(event, repeatedFloatValue->data(), + repeatedFloatValue->size()); + break; + } + case VendorAtomValue::repeatedStringValue: { + const std::optional<std::vector<std::optional<std::string>>>& repeatedStringValue = + atomValue.get<VendorAtomValue::repeatedStringValue>(); + const std::vector<std::optional<std::string>>& repeatedStringVector = + *repeatedStringValue; + const char* cStringArray[repeatedStringVector.size()]; + + for (int i = 0; i < repeatedStringVector.size(); ++i) { + cStringArray[i] = repeatedStringVector[i]->c_str(); + } + + AStatsEvent_writeStringArray(event, cStringArray, repeatedStringVector.size()); + break; + } + case VendorAtomValue::repeatedBoolValue: { + const std::optional<std::vector<bool>>& repeatedBoolValue = + atomValue.get<VendorAtomValue::repeatedBoolValue>(); + const std::vector<bool>& repeatedBoolVector = *repeatedBoolValue; + bool boolArray[repeatedBoolValue->size()]; + + for (int i = 0; i < repeatedBoolVector.size(); ++i) { + boolArray[i] = repeatedBoolVector[i]; + } + + AStatsEvent_writeBoolArray(event, boolArray, repeatedBoolVector.size()); + break; + } + case VendorAtomValue::byteArrayValue: { + const std::optional<std::vector<uint8_t>>& byteArrayValue = + atomValue.get<VendorAtomValue::byteArrayValue>(); + + AStatsEvent_writeByteArray(event, byteArrayValue->data(), byteArrayValue->size()); + break; + } } } AStatsEvent_build(event); |