lineagehw: hidl: livedisplay: run clang-format

Change-Id: I2abd96bb87321c8cfb86aa155b5423665dfb5c2e
tirimbino
Jan Altensen 6 years ago committed by Paul Keith
parent 6f3af5aed8
commit 0003f594ef
  1. 11
      lineagehw/hidl/livedisplay/.clang-format
  2. 2
      lineagehw/hidl/livedisplay/AdaptiveBacklight.cpp
  3. 3
      lineagehw/hidl/livedisplay/AdaptiveBacklight.h
  4. 2
      lineagehw/hidl/livedisplay/DisplayColorCalibration.h
  5. 2
      lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.cpp
  6. 3
      lineagehw/hidl/livedisplay/DisplayColorCalibrationExynos.h
  7. 7
      lineagehw/hidl/livedisplay/DisplayModes.cpp
  8. 2
      lineagehw/hidl/livedisplay/DisplayModes.h
  9. 3
      lineagehw/hidl/livedisplay/ReadingEnhancement.cpp
  10. 3
      lineagehw/hidl/livedisplay/ReadingEnhancement.h
  11. 7
      lineagehw/hidl/livedisplay/SunlightEnhancement.cpp
  12. 2
      lineagehw/hidl/livedisplay/SunlightEnhancement.h
  13. 3
      lineagehw/hidl/livedisplay/SunlightEnhancementExynos.cpp
  14. 3
      lineagehw/hidl/livedisplay/SunlightEnhancementExynos.h
  15. 24
      lineagehw/hidl/livedisplay/service.cpp
  16. 24
      lineagehw/hidl/livedisplay/serviceExynos.cpp

@ -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

@ -31,7 +31,7 @@ namespace livedisplay {
namespace V2_0 { namespace V2_0 {
namespace samsung { 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() { bool AdaptiveBacklight::isSupported() {
std::fstream backlight(kBacklightPath, backlight.in | backlight.out); std::fstream backlight(kBacklightPath, backlight.in | backlight.out);

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_ADAPTIVEBACKLIGHT_H #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_ADAPTIVEBACKLIGHT_H
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_ADAPTIVEBACKLIGHT_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_ADAPTIVEBACKLIGHT_H
#include <vendor/lineage/livedisplay/2.0/IAdaptiveBacklight.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/livedisplay/2.0/IAdaptiveBacklight.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -44,7 +44,6 @@ class AdaptiveBacklight : public IAdaptiveBacklight {
Return<bool> setEnabled(bool enabled) override; Return<bool> setEnabled(bool enabled) override;
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
}; };
} // namespace samsung } // namespace samsung

@ -32,7 +32,7 @@ using ::android::hardware::Void;
#define FILE_RGB "/sys/class/graphics/fb0/rgb" #define FILE_RGB "/sys/class/graphics/fb0/rgb"
class DisplayColorCalibration : public IDisplayColorCalibration { class DisplayColorCalibration : public IDisplayColorCalibration {
public: public:
bool isSupported(); bool isSupported();
// Methods from ::vendor::lineage::livedisplay::V2_0::IDisplayColorCalibration follow. // Methods from ::vendor::lineage::livedisplay::V2_0::IDisplayColorCalibration follow.

@ -32,7 +32,7 @@ namespace livedisplay {
namespace V2_0 { namespace V2_0 {
namespace samsung { 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() { bool DisplayColorCalibrationExynos::isSupported() {
std::fstream rgb(kColorPath, rgb.in | rgb.out); std::fstream rgb(kColorPath, rgb.in | rgb.out);

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYCOLORCALIBRATIONEXYNOS_H #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYCOLORCALIBRATIONEXYNOS_H
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYCOLORCALIBRATIONEXYNOS_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYCOLORCALIBRATIONEXYNOS_H
#include <vendor/lineage/livedisplay/2.0/IDisplayColorCalibration.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/livedisplay/2.0/IDisplayColorCalibration.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -46,7 +46,6 @@ class DisplayColorCalibrationExynos : public IDisplayColorCalibration {
Return<bool> setCalibration(const hidl_vec<int32_t>& rgb) override; Return<bool> setCalibration(const hidl_vec<int32_t>& rgb) override;
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
}; };
} // namespace samsung } // namespace samsung

@ -26,18 +26,19 @@ namespace livedisplay {
namespace V2_0 { namespace V2_0 {
namespace samsung { namespace samsung {
static constexpr const char* kModePath = "/sys/class/mdnie/mdnie/mode"; 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* kModeMaxPath = "/sys/class/mdnie/mdnie/mode_max";
static constexpr const char* kDefaultPath = "/data/vendor/display/.displaymodedefault"; static constexpr const char* kDefaultPath = "/data/vendor/display/.displaymodedefault";
const std::map<int32_t, std::string> DisplayModes::kModeMap = { const std::map<int32_t, std::string> DisplayModes::kModeMap = {
// clang-format off
{0, "Dynamic"}, {0, "Dynamic"},
{1, "Standard"}, {1, "Standard"},
{2, "Natural"}, {2, "Natural"},
{3, "Cinema"}, {3, "Cinema"},
{4, "Adaptive"}, {4, "Adaptive"},
{5, "Reading"}, {5, "Reading"},
// clang-format on
}; };
DisplayModes::DisplayModes() : mDefaultModeId(0) { DisplayModes::DisplayModes() : mDefaultModeId(0) {
@ -76,8 +77,7 @@ Return<void> DisplayModes::getDisplayModes(getDisplayModes_cb resultCb) {
value = kModeMap.size(); value = kModeMap.size();
} }
for (const auto& entry : kModeMap) { for (const auto& entry : kModeMap) {
if (entry.first < value) if (entry.first < value) modes.push_back({entry.first, entry.second});
modes.push_back({entry.first, entry.second});
} }
resultCb(modes); resultCb(modes);
return Void(); return Void();
@ -127,7 +127,6 @@ Return<bool> DisplayModes::setDisplayMode(int32_t modeID, bool makeDefault) {
return true; return true;
} }
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
} // namespace samsung } // namespace samsung

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYMODES_H #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYMODES_H
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYMODES_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_DISPLAYMODES_H
#include <vendor/lineage/livedisplay/2.0/IDisplayModes.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/livedisplay/2.0/IDisplayModes.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {

@ -31,7 +31,7 @@ namespace livedisplay {
namespace V2_0 { namespace V2_0 {
namespace samsung { 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. // Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow.
bool ReadingEnhancement::isSupported() { bool ReadingEnhancement::isSupported() {
@ -54,7 +54,6 @@ Return<bool> ReadingEnhancement::setEnabled(bool enabled) {
return WriteStringToFile(enabled ? "4" : "0", kREPath, true); return WriteStringToFile(enabled ? "4" : "0", kREPath, true);
} }
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
} // namespace samsung } // namespace samsung

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_READINGENHANCEMENT_H #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_READINGENHANCEMENT_H
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_READINGENHANCEMENT_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_READINGENHANCEMENT_H
#include <vendor/lineage/livedisplay/2.0/IReadingEnhancement.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/livedisplay/2.0/IReadingEnhancement.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -44,7 +44,6 @@ class ReadingEnhancement : public IReadingEnhancement {
Return<bool> setEnabled(bool) override; Return<bool> setEnabled(bool) override;
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
}; };
} // namespace samsung } // namespace samsung

@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/strings.h> #include <android-base/strings.h>
@ -32,8 +31,8 @@ namespace livedisplay {
namespace V2_0 { namespace V2_0 {
namespace samsung { namespace samsung {
static constexpr const char *kHBMPath = "/sys/class/lcd/panel/panel/auto_brightness"; 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* kSREPath = "/sys/class/mdnie/mdnie/outdoor";
// Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow. // Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow.
bool SunlightEnhancement::isSupported() { bool SunlightEnhancement::isSupported() {
@ -59,7 +58,7 @@ Return<bool> SunlightEnhancement::isEnabled() {
if (mHasHBM && ReadFileToString(kHBMPath, &tmp)) { if (mHasHBM && ReadFileToString(kHBMPath, &tmp)) {
statusHBM = std::stoi(Trim(tmp)); statusHBM = std::stoi(Trim(tmp));
} }
return ((statusSRE == 1 && statusHBM == 6) || statusSRE == 1); return ((statusSRE == 1 && statusHBM == 6) || statusSRE == 1);
} }

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENT_H #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENT_H
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENT_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENT_H
#include <vendor/lineage/livedisplay/2.0/ISunlightEnhancement.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/livedisplay/2.0/ISunlightEnhancement.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {

@ -21,7 +21,6 @@
#include "SunlightEnhancementExynos.h" #include "SunlightEnhancementExynos.h"
using android::base::ReadFileToString; using android::base::ReadFileToString;
using android::base::Trim; using android::base::Trim;
using android::base::WriteStringToFile; using android::base::WriteStringToFile;
@ -32,7 +31,7 @@ namespace livedisplay {
namespace V2_0 { namespace V2_0 {
namespace samsung { 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. // Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow.
bool SunlightEnhancementExynos::isSupported() { bool SunlightEnhancementExynos::isSupported() {

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENTEXYNOS_H #ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENTEXYNOS_H
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENTEXYNOS_H #define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_SUNLIGHTENHANCEMENTEXYNOS_H
#include <vendor/lineage/livedisplay/2.0/ISunlightEnhancement.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/livedisplay/2.0/ISunlightEnhancement.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -44,7 +44,6 @@ class SunlightEnhancementExynos : public ISunlightEnhancement {
Return<bool> setEnabled(bool enabled) override; Return<bool> setEnabled(bool enabled) override;
// Methods from ::android::hidl::base::V1_0::IBase follow. // Methods from ::android::hidl::base::V1_0::IBase follow.
}; };
} // namespace samsung } // namespace samsung

@ -54,13 +54,15 @@ int main() {
adaptiveBacklight = new AdaptiveBacklight(); adaptiveBacklight = new AdaptiveBacklight();
if (adaptiveBacklight == nullptr) { 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; goto shutdown;
} }
displayColorCalibration = new DisplayColorCalibration(); displayColorCalibration = new DisplayColorCalibration();
if (displayColorCalibration == nullptr) { 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; goto shutdown;
} }
@ -72,13 +74,15 @@ int main() {
readingEnhancement = new ReadingEnhancement(); readingEnhancement = new ReadingEnhancement();
if (readingEnhancement == nullptr) { 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; goto shutdown;
} }
sunlightEnhancement = new SunlightEnhancement(); sunlightEnhancement = new SunlightEnhancement();
if (sunlightEnhancement == nullptr) { 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; goto shutdown;
} }
@ -87,9 +91,8 @@ int main() {
if (adaptiveBacklight->isSupported()) { if (adaptiveBacklight->isSupported()) {
status = adaptiveBacklight->registerAsService(); status = adaptiveBacklight->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface ("
<< "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" << status << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -107,9 +110,8 @@ int main() {
if (displayModes->isSupported()) { if (displayModes->isSupported()) {
status = displayModes->registerAsService(); status = displayModes->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface ("
<< "Could not register service for LiveDisplay HAL DisplayModes Iface (" << status << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -136,7 +138,7 @@ int main() {
LOG(INFO) << "LiveDisplay HAL service is ready."; LOG(INFO) << "LiveDisplay HAL service is ready.";
joinRpcThreadpool(); joinRpcThreadpool();
// Should not pass this line // Should not pass this line
shutdown: shutdown:
// In normal operation, we don't expect the thread pool to shutdown // In normal operation, we don't expect the thread pool to shutdown

@ -54,13 +54,15 @@ int main() {
adaptiveBacklight = new AdaptiveBacklight(); adaptiveBacklight = new AdaptiveBacklight();
if (adaptiveBacklight == nullptr) { 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; goto shutdown;
} }
displayColorCalibrationExynos = new DisplayColorCalibrationExynos(); displayColorCalibrationExynos = new DisplayColorCalibrationExynos();
if (displayColorCalibrationExynos == nullptr) { 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; goto shutdown;
} }
@ -72,13 +74,15 @@ int main() {
readingEnhancement = new ReadingEnhancement(); readingEnhancement = new ReadingEnhancement();
if (readingEnhancement == nullptr) { 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; goto shutdown;
} }
sunlightEnhancementExynos = new SunlightEnhancementExynos(); sunlightEnhancementExynos = new SunlightEnhancementExynos();
if (sunlightEnhancementExynos == nullptr) { 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; goto shutdown;
} }
@ -87,9 +91,8 @@ int main() {
if (adaptiveBacklight->isSupported()) { if (adaptiveBacklight->isSupported()) {
status = adaptiveBacklight->registerAsService(); status = adaptiveBacklight->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface ("
<< "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" << status << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -107,9 +110,8 @@ int main() {
if (displayModes->isSupported()) { if (displayModes->isSupported()) {
status = displayModes->registerAsService(); status = displayModes->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface ("
<< "Could not register service for LiveDisplay HAL DisplayModes Iface (" << status << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -136,7 +138,7 @@ int main() {
LOG(INFO) << "LiveDisplay HAL service is ready."; LOG(INFO) << "LiveDisplay HAL service is ready.";
joinRpcThreadpool(); joinRpcThreadpool();
// Should not pass this line // Should not pass this line
shutdown: shutdown:
// In normal operation, we don't expect the thread pool to shutdown // In normal operation, we don't expect the thread pool to shutdown

Loading…
Cancel
Save