diff options
-rw-r--r-- | libs/binder/Android.bp | 8 | ||||
-rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 4 | ||||
-rw-r--r-- | services/stats/.clang-format | 17 | ||||
-rw-r--r-- | services/stats/StatsAidl.cpp | 41 | ||||
-rw-r--r-- | services/stats/StatsHal.cpp | 49 | ||||
-rw-r--r-- | services/stats/include/stats/StatsAidl.h | 3 | ||||
-rw-r--r-- | services/stats/include/stats/StatsHal.h | 12 |
7 files changed, 77 insertions, 57 deletions
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp index cebaf17937..eb130de8ab 100644 --- a/libs/binder/Android.bp +++ b/libs/binder/Android.bp @@ -287,6 +287,14 @@ cc_defaults { cflags: [ "-DBINDER_WITH_KERNEL_IPC", ], + arch: { + // TODO(b/254713216): undefined symbol in BufferedTextOutput::getBuffer + riscv64: { + lto: { + thin: false, + }, + }, + }, } cc_library { diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index a51bbb1553..1242ac83e3 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -426,8 +426,8 @@ void BLASTBufferQueue::releaseBufferCallbackLocked(const ReleaseCallbackId& id, mCurrentMaxAcquiredBufferCount = *currentMaxAcquiredBufferCount; } - const auto numPendingBuffersToHold = - isEGL ? std::max(0u, mMaxAcquiredBuffers - mCurrentMaxAcquiredBufferCount) : 0; + const uint32_t numPendingBuffersToHold = + isEGL ? std::max(0, mMaxAcquiredBuffers - (int32_t)mCurrentMaxAcquiredBufferCount) : 0; auto rb = ReleasedBuffer{id, releaseFence}; if (std::find(mPendingRelease.begin(), mPendingRelease.end(), rb) == mPendingRelease.end()) { diff --git a/services/stats/.clang-format b/services/stats/.clang-format new file mode 100644 index 0000000000..cead3a0794 --- /dev/null +++ b/services/stats/.clang-format @@ -0,0 +1,17 @@ +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 diff --git a/services/stats/StatsAidl.cpp b/services/stats/StatsAidl.cpp index 410a5af421..13485481a5 100644 --- a/services/stats/StatsAidl.cpp +++ b/services/stats/StatsAidl.cpp @@ -14,32 +14,33 @@ * limitations under the License. */ -#define DEBUG false // STOPSHIP if true +#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) { - ALOGE("Atom ID %ld is not a valid vendor atom ID", (long) vendorAtom.atomId); + ALOGE("Atom ID %ld is not a valid vendor atom ID", (long)vendorAtom.atomId); return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage( - -1, "Not a valid vendor atom ID"); + -1, "Not a valid vendor atom ID"); } if (vendorAtom.reverseDomainName.length() > 50) { ALOGE("Vendor atom reverse domain name %s is too long.", - vendorAtom.reverseDomainName.c_str()); + vendorAtom.reverseDomainName.c_str()); return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage( - -1, "Vendor atom reverse domain name is too long"); + -1, "Vendor atom reverse domain name is too long"); } AStatsEvent* event = AStatsEvent_obtain(); AStatsEvent_setAtomId(event, vendorAtom.atomId); @@ -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()); + 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 = @@ -112,8 +109,8 @@ ndk::ScopedAStatus StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { for (int i = 0; i < repeatedStringVector.size(); ++i) { cStringArray[i] = repeatedStringVector[i].has_value() - ? repeatedStringVector[i]->c_str() - : ""; + ? repeatedStringVector[i]->c_str() + : ""; } AStatsEvent_writeStringArray(event, cStringArray, repeatedStringVector.size()); @@ -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 diff --git a/services/stats/StatsHal.cpp b/services/stats/StatsHal.cpp index d27d989c81..19176d9aaf 100644 --- a/services/stats/StatsHal.cpp +++ b/services/stats/StatsHal.cpp @@ -14,42 +14,42 @@ * limitations under the License. */ -#define DEBUG false // STOPSHIP if true +#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); + speakerImpedance.speakerLocation, speakerImpedance.milliOhms); return hardware::Void(); } hardware::Return<void> StatsHal::reportHardwareFailed(const HardwareFailed& hardwareFailed) { android::util::stats_write(android::util::HARDWARE_FAILED, int32_t(hardwareFailed.hardwareType), - hardwareFailed.hardwareLocation, int32_t(hardwareFailed.errorCode)); + hardwareFailed.hardwareLocation, int32_t(hardwareFailed.errorCode)); return hardware::Void(); } 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(); } @@ -58,20 +58,21 @@ hardware::Return<void> StatsHal::reportChargeCycles(const ChargeCycles& chargeCy std::vector<int32_t> buckets = chargeCycles.cycleBucket; int initialSize = buckets.size(); for (int i = 0; i < 10 - initialSize; i++) { - buckets.push_back(0); // Push 0 for buckets that do not exist. + 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); @@ -87,14 +88,15 @@ hardware::Return<void> StatsHal::reportSlowIo(const SlowIo& slowIo) { hardware::Return<void> StatsHal::reportBatteryCausedShutdown( const BatteryCausedShutdown& batteryCausedShutdown) { android::util::stats_write(android::util::BATTERY_CAUSED_SHUTDOWN, - batteryCausedShutdown.voltageMicroV); + batteryCausedShutdown.voltageMicroV); return hardware::Void(); } 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); @@ -102,18 +104,17 @@ 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); + speechDspStat.totalUptimeMillis, speechDspStat.totalDowntimeMillis, + speechDspStat.totalCrashCount, speechDspStat.totalRecoverCount); return hardware::Void(); } hardware::Return<void> StatsHal::reportVendorAtom(const VendorAtom& vendorAtom) { if (vendorAtom.atomId < 100000 || vendorAtom.atomId >= 200000) { - ALOGE("Atom ID %ld is not a valid vendor atom ID", (long) vendorAtom.atomId); + ALOGE("Atom ID %ld is not a valid vendor atom ID", (long)vendorAtom.atomId); return hardware::Void(); } if (vendorAtom.reverseDomainName.size() > 50) { diff --git a/services/stats/include/stats/StatsAidl.h b/services/stats/include/stats/StatsAidl.h index 219e71e7b0..340b53955d 100644 --- a/services/stats/include/stats/StatsAidl.h +++ b/services/stats/include/stats/StatsAidl.h @@ -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 diff --git a/services/stats/include/stats/StatsHal.h b/services/stats/include/stats/StatsHal.h index 071e54f07c..864ad1457f 100644 --- a/services/stats/include/stats/StatsHal.h +++ b/services/stats/include/stats/StatsHal.h @@ -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; @@ -30,8 +29,8 @@ namespace implementation { using android::hardware::Return; /** -* Implements the Stats HAL -*/ + * Implements the Stats HAL + */ class StatsHal : public IStats { public: StatsHal(); @@ -50,12 +49,12 @@ public: * Binder call to get PhysicalDropDetected atom. */ virtual Return<void> reportPhysicalDropDetected( - const PhysicalDropDetected& physicalDropDetected) override; + const PhysicalDropDetected& physicalDropDetected) override; /** * Binder call to get ChargeCyclesReported atom. */ - virtual Return<void> reportChargeCycles(const ChargeCycles& chargeCycles) override; + virtual Return<void> reportChargeCycles(const ChargeCycles& chargeCycles) override; /** * Binder call to get BatteryHealthSnapshot atom. @@ -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. |