Loading services/stats/.clang-format 0 → 100644 +17 −0 Original line number Diff line number Diff line BasedOnStyle: Google AllowShortIfStatementsOnASingleLine: true AllowShortFunctionsOnASingleLine: false AllowShortLoopsOnASingleLine: true BinPackArguments: true BinPackParameters: true ColumnLimit: 100 CommentPragmas: NOLINT:.* ContinuationIndentWidth: 8 DerivePointerAlignment: false IndentWidth: 4 PointerAlignment: Left TabWidth: 4 AccessModifierOffset: -4 IncludeCategories: - Regex: '^"Log\.h"' Priority: -1 services/stats/StatsAidl.cpp +19 −22 Original line number Diff line number Diff line Loading @@ -17,17 +17,18 @@ #define DEBUG false // STOPSHIP if true #define LOG_TAG "StatsAidl" #include "StatsAidl.h" #include <log/log.h> #include <statslog.h> #include "StatsAidl.h" namespace aidl { namespace android { namespace frameworks { namespace stats { StatsHal::StatsHal() {} StatsHal::StatsHal() { } ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { if (vendorAtom.atomId < 100000 || vendorAtom.atomId >= 200000) { Loading @@ -47,24 +48,20 @@ ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { for (const auto& atomValue : vendorAtom.values) { switch (atomValue.getTag()) { case VendorAtomValue::intValue: AStatsEvent_writeInt32(event, atomValue.get<VendorAtomValue::intValue>()); AStatsEvent_writeInt32(event, atomValue.get<VendorAtomValue::intValue>()); break; case VendorAtomValue::longValue: AStatsEvent_writeInt64(event, atomValue.get<VendorAtomValue::longValue>()); AStatsEvent_writeInt64(event, atomValue.get<VendorAtomValue::longValue>()); break; case VendorAtomValue::floatValue: AStatsEvent_writeFloat(event, atomValue.get<VendorAtomValue::floatValue>()); AStatsEvent_writeFloat(event, atomValue.get<VendorAtomValue::floatValue>()); break; case VendorAtomValue::stringValue: AStatsEvent_writeString(event, atomValue.get<VendorAtomValue::stringValue>().c_str()); break; case VendorAtomValue::boolValue: AStatsEvent_writeBool(event, atomValue.get<VendorAtomValue::boolValue>()); AStatsEvent_writeBool(event, atomValue.get<VendorAtomValue::boolValue>()); break; case VendorAtomValue::repeatedIntValue: { const std::optional<std::vector<int>>& repeatedIntValue = Loading Loading @@ -152,9 +149,9 @@ ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { const int ret = AStatsEvent_write(event); AStatsEvent_release(event); return ret <= 0 ? ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ret, "report atom failed") : ndk::ScopedAStatus::ok(); return ret <= 0 ? ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ret, "report atom failed") : ndk::ScopedAStatus::ok(); } } // namespace stats Loading services/stats/StatsHal.cpp +25 −24 Original line number Diff line number Diff line Loading @@ -17,21 +17,21 @@ #define DEBUG false // STOPSHIP if true #define LOG_TAG "StatsHal" #include "StatsHal.h" #include <log/log.h> #include <statslog.h> #include "StatsHal.h" namespace android { namespace frameworks { namespace stats { namespace V1_0 { namespace implementation { StatsHal::StatsHal() {} StatsHal::StatsHal() { } hardware::Return<void> StatsHal::reportSpeakerImpedance( const SpeakerImpedance& speakerImpedance) { hardware::Return<void> StatsHal::reportSpeakerImpedance(const SpeakerImpedance& speakerImpedance) { android::util::stats_write(android::util::SPEAKER_IMPEDANCE_REPORTED, speakerImpedance.speakerLocation, speakerImpedance.milliOhms); Loading @@ -47,9 +47,9 @@ hardware::Return<void> StatsHal::reportHardwareFailed(const HardwareFailed& hard hardware::Return<void> StatsHal::reportPhysicalDropDetected( const PhysicalDropDetected& physicalDropDetected) { android::util::stats_write(android::util::PHYSICAL_DROP_DETECTED, int32_t(physicalDropDetected.confidencePctg), physicalDropDetected.accelPeak, physicalDropDetected.freefallDuration); android::util::stats_write( android::util::PHYSICAL_DROP_DETECTED, int32_t(physicalDropDetected.confidencePctg), physicalDropDetected.accelPeak, physicalDropDetected.freefallDuration); return hardware::Void(); } Loading @@ -61,17 +61,18 @@ hardware::Return<void> StatsHal::reportChargeCycles(const ChargeCycles& chargeCy buckets.push_back(0); // Push 0 for buckets that do not exist. } android::util::stats_write(android::util::CHARGE_CYCLES_REPORTED, buckets[0], buckets[1], buckets[2], buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8], buckets[9]); buckets[2], buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8], buckets[9]); return hardware::Void(); } hardware::Return<void> StatsHal::reportBatteryHealthSnapshot( const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) { android::util::stats_write(android::util::BATTERY_HEALTH_SNAPSHOT, int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC, batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA, android::util::stats_write( android::util::BATTERY_HEALTH_SNAPSHOT, int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC, batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA, batteryHealthSnapshotArgs.openCircuitVoltageMicroV, batteryHealthSnapshotArgs.resistanceMicroOhm, batteryHealthSnapshotArgs.levelPercent); Loading @@ -94,7 +95,8 @@ hardware::Return<void> StatsHal::reportBatteryCausedShutdown( hardware::Return<void> StatsHal::reportUsbPortOverheatEvent( const UsbPortOverheatEvent& usbPortOverheatEvent) { android::util::stats_write(android::util::USB_PORT_OVERHEAT_EVENT_REPORTED, android::util::stats_write( android::util::USB_PORT_OVERHEAT_EVENT_REPORTED, usbPortOverheatEvent.plugTemperatureDeciC, usbPortOverheatEvent.maxTemperatureDeciC, usbPortOverheatEvent.timeToOverheat, usbPortOverheatEvent.timeToHysteresis, usbPortOverheatEvent.timeToInactive); Loading @@ -102,8 +104,7 @@ hardware::Return<void> StatsHal::reportUsbPortOverheatEvent( return hardware::Void(); } hardware::Return<void> StatsHal::reportSpeechDspStat( const SpeechDspStat& speechDspStat) { hardware::Return<void> StatsHal::reportSpeechDspStat(const SpeechDspStat& speechDspStat) { android::util::stats_write(android::util::SPEECH_DSP_STAT_REPORTED, speechDspStat.totalUptimeMillis, speechDspStat.totalDowntimeMillis, speechDspStat.totalCrashCount, speechDspStat.totalRecoverCount); Loading services/stats/include/stats/StatsAidl.h +1 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,7 @@ public: /** * Binder call to get vendor atom. */ virtual ndk::ScopedAStatus reportVendorAtom( const VendorAtom& in_vendorAtom) override; virtual ndk::ScopedAStatus reportVendorAtom(const VendorAtom& in_vendorAtom) override; }; } // namespace stats Loading services/stats/include/stats/StatsHal.h +5 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ #include <android/frameworks/stats/1.0/IStats.h> #include <android/frameworks/stats/1.0/types.h> #include <stats_event.h> using namespace android::frameworks::stats::V1_0; Loading Loading @@ -83,8 +82,7 @@ public: /** * Binder call to get Speech DSP state atom. */ virtual Return<void> reportSpeechDspStat( const SpeechDspStat& speechDspStat) override; virtual Return<void> reportSpeechDspStat(const SpeechDspStat& speechDspStat) override; /** * Binder call to get vendor atom. Loading Loading
services/stats/.clang-format 0 → 100644 +17 −0 Original line number Diff line number Diff line BasedOnStyle: Google AllowShortIfStatementsOnASingleLine: true AllowShortFunctionsOnASingleLine: false AllowShortLoopsOnASingleLine: true BinPackArguments: true BinPackParameters: true ColumnLimit: 100 CommentPragmas: NOLINT:.* ContinuationIndentWidth: 8 DerivePointerAlignment: false IndentWidth: 4 PointerAlignment: Left TabWidth: 4 AccessModifierOffset: -4 IncludeCategories: - Regex: '^"Log\.h"' Priority: -1
services/stats/StatsAidl.cpp +19 −22 Original line number Diff line number Diff line Loading @@ -17,17 +17,18 @@ #define DEBUG false // STOPSHIP if true #define LOG_TAG "StatsAidl" #include "StatsAidl.h" #include <log/log.h> #include <statslog.h> #include "StatsAidl.h" namespace aidl { namespace android { namespace frameworks { namespace stats { StatsHal::StatsHal() {} StatsHal::StatsHal() { } ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { if (vendorAtom.atomId < 100000 || vendorAtom.atomId >= 200000) { Loading @@ -47,24 +48,20 @@ ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { for (const auto& atomValue : vendorAtom.values) { switch (atomValue.getTag()) { case VendorAtomValue::intValue: AStatsEvent_writeInt32(event, atomValue.get<VendorAtomValue::intValue>()); AStatsEvent_writeInt32(event, atomValue.get<VendorAtomValue::intValue>()); break; case VendorAtomValue::longValue: AStatsEvent_writeInt64(event, atomValue.get<VendorAtomValue::longValue>()); AStatsEvent_writeInt64(event, atomValue.get<VendorAtomValue::longValue>()); break; case VendorAtomValue::floatValue: AStatsEvent_writeFloat(event, atomValue.get<VendorAtomValue::floatValue>()); AStatsEvent_writeFloat(event, atomValue.get<VendorAtomValue::floatValue>()); break; case VendorAtomValue::stringValue: AStatsEvent_writeString(event, atomValue.get<VendorAtomValue::stringValue>().c_str()); break; case VendorAtomValue::boolValue: AStatsEvent_writeBool(event, atomValue.get<VendorAtomValue::boolValue>()); AStatsEvent_writeBool(event, atomValue.get<VendorAtomValue::boolValue>()); break; case VendorAtomValue::repeatedIntValue: { const std::optional<std::vector<int>>& repeatedIntValue = Loading Loading @@ -152,9 +149,9 @@ ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { const int ret = AStatsEvent_write(event); AStatsEvent_release(event); return ret <= 0 ? ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ret, "report atom failed") : ndk::ScopedAStatus::ok(); return ret <= 0 ? ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ret, "report atom failed") : ndk::ScopedAStatus::ok(); } } // namespace stats Loading
services/stats/StatsHal.cpp +25 −24 Original line number Diff line number Diff line Loading @@ -17,21 +17,21 @@ #define DEBUG false // STOPSHIP if true #define LOG_TAG "StatsHal" #include "StatsHal.h" #include <log/log.h> #include <statslog.h> #include "StatsHal.h" namespace android { namespace frameworks { namespace stats { namespace V1_0 { namespace implementation { StatsHal::StatsHal() {} StatsHal::StatsHal() { } hardware::Return<void> StatsHal::reportSpeakerImpedance( const SpeakerImpedance& speakerImpedance) { hardware::Return<void> StatsHal::reportSpeakerImpedance(const SpeakerImpedance& speakerImpedance) { android::util::stats_write(android::util::SPEAKER_IMPEDANCE_REPORTED, speakerImpedance.speakerLocation, speakerImpedance.milliOhms); Loading @@ -47,9 +47,9 @@ hardware::Return<void> StatsHal::reportHardwareFailed(const HardwareFailed& hard hardware::Return<void> StatsHal::reportPhysicalDropDetected( const PhysicalDropDetected& physicalDropDetected) { android::util::stats_write(android::util::PHYSICAL_DROP_DETECTED, int32_t(physicalDropDetected.confidencePctg), physicalDropDetected.accelPeak, physicalDropDetected.freefallDuration); android::util::stats_write( android::util::PHYSICAL_DROP_DETECTED, int32_t(physicalDropDetected.confidencePctg), physicalDropDetected.accelPeak, physicalDropDetected.freefallDuration); return hardware::Void(); } Loading @@ -61,17 +61,18 @@ hardware::Return<void> StatsHal::reportChargeCycles(const ChargeCycles& chargeCy buckets.push_back(0); // Push 0 for buckets that do not exist. } android::util::stats_write(android::util::CHARGE_CYCLES_REPORTED, buckets[0], buckets[1], buckets[2], buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8], buckets[9]); buckets[2], buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8], buckets[9]); return hardware::Void(); } hardware::Return<void> StatsHal::reportBatteryHealthSnapshot( const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) { android::util::stats_write(android::util::BATTERY_HEALTH_SNAPSHOT, int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC, batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA, android::util::stats_write( android::util::BATTERY_HEALTH_SNAPSHOT, int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC, batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA, batteryHealthSnapshotArgs.openCircuitVoltageMicroV, batteryHealthSnapshotArgs.resistanceMicroOhm, batteryHealthSnapshotArgs.levelPercent); Loading @@ -94,7 +95,8 @@ hardware::Return<void> StatsHal::reportBatteryCausedShutdown( hardware::Return<void> StatsHal::reportUsbPortOverheatEvent( const UsbPortOverheatEvent& usbPortOverheatEvent) { android::util::stats_write(android::util::USB_PORT_OVERHEAT_EVENT_REPORTED, android::util::stats_write( android::util::USB_PORT_OVERHEAT_EVENT_REPORTED, usbPortOverheatEvent.plugTemperatureDeciC, usbPortOverheatEvent.maxTemperatureDeciC, usbPortOverheatEvent.timeToOverheat, usbPortOverheatEvent.timeToHysteresis, usbPortOverheatEvent.timeToInactive); Loading @@ -102,8 +104,7 @@ hardware::Return<void> StatsHal::reportUsbPortOverheatEvent( return hardware::Void(); } hardware::Return<void> StatsHal::reportSpeechDspStat( const SpeechDspStat& speechDspStat) { hardware::Return<void> StatsHal::reportSpeechDspStat(const SpeechDspStat& speechDspStat) { android::util::stats_write(android::util::SPEECH_DSP_STAT_REPORTED, speechDspStat.totalUptimeMillis, speechDspStat.totalDowntimeMillis, speechDspStat.totalCrashCount, speechDspStat.totalRecoverCount); Loading
services/stats/include/stats/StatsAidl.h +1 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,7 @@ public: /** * Binder call to get vendor atom. */ virtual ndk::ScopedAStatus reportVendorAtom( const VendorAtom& in_vendorAtom) override; virtual ndk::ScopedAStatus reportVendorAtom(const VendorAtom& in_vendorAtom) override; }; } // namespace stats Loading
services/stats/include/stats/StatsHal.h +5 −7 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ #include <android/frameworks/stats/1.0/IStats.h> #include <android/frameworks/stats/1.0/types.h> #include <stats_event.h> using namespace android::frameworks::stats::V1_0; Loading Loading @@ -83,8 +82,7 @@ public: /** * Binder call to get Speech DSP state atom. */ virtual Return<void> reportSpeechDspStat( const SpeechDspStat& speechDspStat) override; virtual Return<void> reportSpeechDspStat(const SpeechDspStat& speechDspStat) override; /** * Binder call to get vendor atom. Loading