From 0003f594ef610b50c22b5a1c5236abba50687314 Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Sat, 20 Jul 2019 01:01:03 +0200 Subject: [PATCH] lineagehw: hidl: livedisplay: run clang-format Change-Id: I2abd96bb87321c8cfb86aa155b5423665dfb5c2e --- lineagehw/hidl/livedisplay/.clang-format | 11 +++++++++ .../hidl/livedisplay/AdaptiveBacklight.cpp | 2 +- .../hidl/livedisplay/AdaptiveBacklight.h | 3 +-- .../livedisplay/DisplayColorCalibration.h | 2 +- .../DisplayColorCalibrationExynos.cpp | 2 +- .../DisplayColorCalibrationExynos.h | 3 +-- lineagehw/hidl/livedisplay/DisplayModes.cpp | 7 +++--- lineagehw/hidl/livedisplay/DisplayModes.h | 2 +- .../hidl/livedisplay/ReadingEnhancement.cpp | 3 +-- .../hidl/livedisplay/ReadingEnhancement.h | 3 +-- .../hidl/livedisplay/SunlightEnhancement.cpp | 7 +++--- .../hidl/livedisplay/SunlightEnhancement.h | 2 +- .../livedisplay/SunlightEnhancementExynos.cpp | 3 +-- .../livedisplay/SunlightEnhancementExynos.h | 3 +-- lineagehw/hidl/livedisplay/service.cpp | 24 ++++++++++--------- lineagehw/hidl/livedisplay/serviceExynos.cpp | 24 ++++++++++--------- 16 files changed, 54 insertions(+), 47 deletions(-) create mode 100644 lineagehw/hidl/livedisplay/.clang-format diff --git a/lineagehw/hidl/livedisplay/.clang-format b/lineagehw/hidl/livedisplay/.clang-format new file mode 100644 index 00000000..ae4a4513 --- /dev/null +++ b/lineagehw/hidl/livedisplay/.clang-format @@ -0,0 +1,11 @@ +BasedOnStyle: Google +AccessModifierOffset: -2 +AllowShortFunctionsOnASingleLine: Inline +ColumnLimit: 100 +CommentPragmas: NOLINT:.* +DerivePointerAlignment: false +IndentWidth: 4 +PointerAlignment: Left +TabWidth: 4 +UseTab: Never +PenaltyExcessCharacter: 32 diff --git a/lineagehw/hidl/livedisplay/AdaptiveBacklight.cpp b/lineagehw/hidl/livedisplay/AdaptiveBacklight.cpp index aacfa231..986ab125 100644 --- a/lineagehw/hidl/livedisplay/AdaptiveBacklight.cpp +++ b/lineagehw/hidl/livedisplay/AdaptiveBacklight.cpp @@ -31,7 +31,7 @@ namespace livedisplay { namespace V2_0 { namespace samsung { -static constexpr const char *kBacklightPath = "/sys/class/lcd/panel/power_reduce"; +static constexpr const char* kBacklightPath = "/sys/class/lcd/panel/power_reduce"; bool AdaptiveBacklight::isSupported() { std::fstream backlight(kBacklightPath, backlight.in | backlight.out); diff --git a/lineagehw/hidl/livedisplay/AdaptiveBacklight.h b/lineagehw/hidl/livedisplay/AdaptiveBacklight.h index 35502baf..793f101d 100644 --- a/lineagehw/hidl/livedisplay/AdaptiveBacklight.h +++ b/lineagehw/hidl/livedisplay/AdaptiveBacklight.h @@ -17,9 +17,9 @@ #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_ADAPTIVEBACKLIGHT_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_ADAPTIVEBACKLIGHT_H -#include #include #include +#include namespace vendor { namespace lineage { @@ -44,7 +44,6 @@ class AdaptiveBacklight : public IAdaptiveBacklight { Return setEnabled(bool enabled) override; // Methods from ::android::hidl::base::V1_0::IBase follow. - }; } // namespace samsung diff --git a/lineagehw/hidl/livedisplay/DisplayColorCalibration.h b/lineagehw/hidl/livedisplay/DisplayColorCalibration.h index 6753a349..b22f988b 100644 --- a/lineagehw/hidl/livedisplay/DisplayColorCalibration.h +++ b/lineagehw/hidl/livedisplay/DisplayColorCalibration.h @@ -32,7 +32,7 @@ using ::android::hardware::Void; #define FILE_RGB "/sys/class/graphics/fb0/rgb" class DisplayColorCalibration : public IDisplayColorCalibration { - public: + public: bool isSupported(); // Methods from ::vendor::lineage::livedisplay::V2_0::IDisplayColorCalibration follow. diff --git a/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.cpp b/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.cpp index a44ab241..d791ed73 100644 --- a/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.cpp +++ b/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.cpp @@ -32,7 +32,7 @@ namespace livedisplay { namespace V2_0 { namespace samsung { -static constexpr const char *kColorPath = "/sys/class/mdnie/mdnie/sensorRGB"; +static constexpr const char* kColorPath = "/sys/class/mdnie/mdnie/sensorRGB"; bool DisplayColorCalibrationExynos::isSupported() { std::fstream rgb(kColorPath, rgb.in | rgb.out); diff --git a/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.h b/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.h index c00e5770..81c18273 100644 --- a/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.h +++ b/lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.h @@ -17,9 +17,9 @@ #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYCOLORCALIBRATIONEXYNOS_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYCOLORCALIBRATIONEXYNOS_H -#include #include #include +#include namespace vendor { namespace lineage { @@ -46,7 +46,6 @@ class DisplayColorCalibrationExynos : public IDisplayColorCalibration { Return setCalibration(const hidl_vec& rgb) override; // Methods from ::android::hidl::base::V1_0::IBase follow. - }; } // namespace samsung diff --git a/lineagehw/hidl/livedisplay/DisplayModes.cpp b/lineagehw/hidl/livedisplay/DisplayModes.cpp index 03d713ea..3a2b9021 100644 --- a/lineagehw/hidl/livedisplay/DisplayModes.cpp +++ b/lineagehw/hidl/livedisplay/DisplayModes.cpp @@ -26,18 +26,19 @@ namespace livedisplay { namespace V2_0 { namespace samsung { - static constexpr const char* kModePath = "/sys/class/mdnie/mdnie/mode"; static constexpr const char* kModeMaxPath = "/sys/class/mdnie/mdnie/mode_max"; static constexpr const char* kDefaultPath = "/data/vendor/display/.displaymodedefault"; const std::map DisplayModes::kModeMap = { + // clang-format off {0, "Dynamic"}, {1, "Standard"}, {2, "Natural"}, {3, "Cinema"}, {4, "Adaptive"}, {5, "Reading"}, + // clang-format on }; DisplayModes::DisplayModes() : mDefaultModeId(0) { @@ -76,8 +77,7 @@ Return DisplayModes::getDisplayModes(getDisplayModes_cb resultCb) { value = kModeMap.size(); } for (const auto& entry : kModeMap) { - if (entry.first < value) - modes.push_back({entry.first, entry.second}); + if (entry.first < value) modes.push_back({entry.first, entry.second}); } resultCb(modes); return Void(); @@ -127,7 +127,6 @@ Return DisplayModes::setDisplayMode(int32_t modeID, bool makeDefault) { return true; } - // Methods from ::android::hidl::base::V1_0::IBase follow. } // namespace samsung diff --git a/lineagehw/hidl/livedisplay/DisplayModes.h b/lineagehw/hidl/livedisplay/DisplayModes.h index ef539fc0..149edf3d 100644 --- a/lineagehw/hidl/livedisplay/DisplayModes.h +++ b/lineagehw/hidl/livedisplay/DisplayModes.h @@ -17,9 +17,9 @@ #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYMODES_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYMODES_H -#include #include #include +#include namespace vendor { namespace lineage { diff --git a/lineagehw/hidl/livedisplay/ReadingEnhancement.cpp b/lineagehw/hidl/livedisplay/ReadingEnhancement.cpp index 4c2c31b9..3880c43c 100644 --- a/lineagehw/hidl/livedisplay/ReadingEnhancement.cpp +++ b/lineagehw/hidl/livedisplay/ReadingEnhancement.cpp @@ -31,7 +31,7 @@ namespace livedisplay { namespace V2_0 { namespace samsung { -static constexpr const char *kREPath = "/sys/class/mdnie/mdnie/accessibility"; +static constexpr const char* kREPath = "/sys/class/mdnie/mdnie/accessibility"; // Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow. bool ReadingEnhancement::isSupported() { @@ -54,7 +54,6 @@ Return ReadingEnhancement::setEnabled(bool enabled) { return WriteStringToFile(enabled ? "4" : "0", kREPath, true); } - // Methods from ::android::hidl::base::V1_0::IBase follow. } // namespace samsung diff --git a/lineagehw/hidl/livedisplay/ReadingEnhancement.h b/lineagehw/hidl/livedisplay/ReadingEnhancement.h index 6fa7084d..5b716697 100644 --- a/lineagehw/hidl/livedisplay/ReadingEnhancement.h +++ b/lineagehw/hidl/livedisplay/ReadingEnhancement.h @@ -17,9 +17,9 @@ #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_READINGENHANCEMENT_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_READINGENHANCEMENT_H -#include #include #include +#include namespace vendor { namespace lineage { @@ -44,7 +44,6 @@ class ReadingEnhancement : public IReadingEnhancement { Return setEnabled(bool) override; // Methods from ::android::hidl::base::V1_0::IBase follow. - }; } // namespace samsung diff --git a/lineagehw/hidl/livedisplay/SunlightEnhancement.cpp b/lineagehw/hidl/livedisplay/SunlightEnhancement.cpp index 5c3ca51e..077672ec 100644 --- a/lineagehw/hidl/livedisplay/SunlightEnhancement.cpp +++ b/lineagehw/hidl/livedisplay/SunlightEnhancement.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ - #include #include @@ -32,8 +31,8 @@ namespace livedisplay { namespace V2_0 { namespace samsung { -static constexpr const char *kHBMPath = "/sys/class/lcd/panel/panel/auto_brightness"; -static constexpr const char *kSREPath = "/sys/class/mdnie/mdnie/outdoor"; +static constexpr const char* kHBMPath = "/sys/class/lcd/panel/panel/auto_brightness"; +static constexpr const char* kSREPath = "/sys/class/mdnie/mdnie/outdoor"; // Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow. bool SunlightEnhancement::isSupported() { @@ -59,7 +58,7 @@ Return SunlightEnhancement::isEnabled() { if (mHasHBM && ReadFileToString(kHBMPath, &tmp)) { statusHBM = std::stoi(Trim(tmp)); } - + return ((statusSRE == 1 && statusHBM == 6) || statusSRE == 1); } diff --git a/lineagehw/hidl/livedisplay/SunlightEnhancement.h b/lineagehw/hidl/livedisplay/SunlightEnhancement.h index a1a627fa..44b34b99 100644 --- a/lineagehw/hidl/livedisplay/SunlightEnhancement.h +++ b/lineagehw/hidl/livedisplay/SunlightEnhancement.h @@ -17,9 +17,9 @@ #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENT_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENT_H -#include #include #include +#include namespace vendor { namespace lineage { diff --git a/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.cpp b/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.cpp index a0a330cb..950342ad 100644 --- a/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.cpp +++ b/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.cpp @@ -21,7 +21,6 @@ #include "SunlightEnhancementExynos.h" - using android::base::ReadFileToString; using android::base::Trim; using android::base::WriteStringToFile; @@ -32,7 +31,7 @@ namespace livedisplay { namespace V2_0 { namespace samsung { -static constexpr const char *kLUXPath = "/sys/class/mdnie/mdnie/lux"; +static constexpr const char* kLUXPath = "/sys/class/mdnie/mdnie/lux"; // Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow. bool SunlightEnhancementExynos::isSupported() { diff --git a/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.h b/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.h index 5bf9798c..4b348618 100644 --- a/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.h +++ b/lineagehw/hidl/livedisplay/SunlightEnhancementExynos.h @@ -17,9 +17,9 @@ #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENTEXYNOS_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENTEXYNOS_H -#include #include #include +#include namespace vendor { namespace lineage { @@ -44,7 +44,6 @@ class SunlightEnhancementExynos : public ISunlightEnhancement { Return setEnabled(bool enabled) override; // Methods from ::android::hidl::base::V1_0::IBase follow. - }; } // namespace samsung diff --git a/lineagehw/hidl/livedisplay/service.cpp b/lineagehw/hidl/livedisplay/service.cpp index b59eab1c..1e97aee0 100644 --- a/lineagehw/hidl/livedisplay/service.cpp +++ b/lineagehw/hidl/livedisplay/service.cpp @@ -54,13 +54,15 @@ int main() { adaptiveBacklight = new AdaptiveBacklight(); if (adaptiveBacklight == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, exiting."; + LOG(ERROR) + << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, exiting."; goto shutdown; } displayColorCalibration = new DisplayColorCalibration(); if (displayColorCalibration == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration Iface, exiting."; + LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration " + "Iface, exiting."; goto shutdown; } @@ -72,13 +74,15 @@ int main() { readingEnhancement = new ReadingEnhancement(); if (readingEnhancement == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, exiting."; + LOG(ERROR) + << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, exiting."; goto shutdown; } sunlightEnhancement = new SunlightEnhancement(); if (sunlightEnhancement == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, exiting."; + LOG(ERROR) + << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, exiting."; goto shutdown; } @@ -87,9 +91,8 @@ int main() { if (adaptiveBacklight->isSupported()) { status = adaptiveBacklight->registerAsService(); if (status != OK) { - LOG(ERROR) - << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" - << status << ")"; + LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" + << status << ")"; goto shutdown; } } @@ -107,9 +110,8 @@ int main() { if (displayModes->isSupported()) { status = displayModes->registerAsService(); if (status != OK) { - LOG(ERROR) - << "Could not register service for LiveDisplay HAL DisplayModes Iface (" - << status << ")"; + LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface (" + << status << ")"; goto shutdown; } } @@ -136,7 +138,7 @@ int main() { LOG(INFO) << "LiveDisplay HAL service is ready."; joinRpcThreadpool(); - // Should not pass this line +// Should not pass this line shutdown: // In normal operation, we don't expect the thread pool to shutdown diff --git a/lineagehw/hidl/livedisplay/serviceExynos.cpp b/lineagehw/hidl/livedisplay/serviceExynos.cpp index e1f67b5d..c7395b8d 100644 --- a/lineagehw/hidl/livedisplay/serviceExynos.cpp +++ b/lineagehw/hidl/livedisplay/serviceExynos.cpp @@ -54,13 +54,15 @@ int main() { adaptiveBacklight = new AdaptiveBacklight(); if (adaptiveBacklight == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, exiting."; + LOG(ERROR) + << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, exiting."; goto shutdown; } displayColorCalibrationExynos = new DisplayColorCalibrationExynos(); if (displayColorCalibrationExynos == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration Iface, exiting."; + LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration " + "Iface, exiting."; goto shutdown; } @@ -72,13 +74,15 @@ int main() { readingEnhancement = new ReadingEnhancement(); if (readingEnhancement == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, exiting."; + LOG(ERROR) + << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, exiting."; goto shutdown; } sunlightEnhancementExynos = new SunlightEnhancementExynos(); if (sunlightEnhancementExynos == nullptr) { - LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, exiting."; + LOG(ERROR) + << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, exiting."; goto shutdown; } @@ -87,9 +91,8 @@ int main() { if (adaptiveBacklight->isSupported()) { status = adaptiveBacklight->registerAsService(); if (status != OK) { - LOG(ERROR) - << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" - << status << ")"; + LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" + << status << ")"; goto shutdown; } } @@ -107,9 +110,8 @@ int main() { if (displayModes->isSupported()) { status = displayModes->registerAsService(); if (status != OK) { - LOG(ERROR) - << "Could not register service for LiveDisplay HAL DisplayModes Iface (" - << status << ")"; + LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface (" + << status << ")"; goto shutdown; } } @@ -136,7 +138,7 @@ int main() { LOG(INFO) << "LiveDisplay HAL service is ready."; joinRpcThreadpool(); - // Should not pass this line +// Should not pass this line shutdown: // In normal operation, we don't expect the thread pool to shutdown