lineagehw: hidl: touch: run clang-format

Change-Id: If7126936fc4e0804c29061c7ecc706228654af15
tirimbino
Jan Altensen 5 years ago committed by Paul Keith
parent 53afa33078
commit 6f3af5aed8
  1. 11
      lineagehw/hidl/touch/.clang-format
  2. 6
      lineagehw/hidl/touch/GloveMode.cpp
  3. 3
      lineagehw/hidl/touch/GloveMode.h
  4. 3
      lineagehw/hidl/touch/KeyDisabler.h
  5. 6
      lineagehw/hidl/touch/StylusMode.cpp
  6. 3
      lineagehw/hidl/touch/StylusMode.h
  7. 4
      lineagehw/hidl/touch/TouchscreenGesture.cpp
  8. 3
      lineagehw/hidl/touch/TouchscreenGesture.h
  9. 20
      lineagehw/hidl/touch/service.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

@ -29,8 +29,7 @@ bool GloveMode::isSupported() {
if (file.is_open()) { if (file.is_open()) {
std::string line; std::string line;
while (getline(file, line)) { while (getline(file, line)) {
if (!line.compare("glove_mode")) if (!line.compare("glove_mode")) return true;
return true;
} }
file.close(); file.close();
} }
@ -43,8 +42,7 @@ Return<bool> GloveMode::isEnabled() {
if (file.is_open()) { if (file.is_open()) {
std::string line; std::string line;
getline(file, line); getline(file, line);
if (!line.compare("glove_mode,1:OK")) if (!line.compare("glove_mode,1:OK")) return true;
return true;
file.close(); file.close();
} }
return false; return false;

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H #ifndef VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H
#define VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H #define VENDOR_LINEAGE_TOUCH_V1_0_GLOVEMODE_H
#include <vendor/lineage/touch/1.0/IGloveMode.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/touch/1.0/IGloveMode.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -46,7 +46,6 @@ class GloveMode : public IGloveMode {
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

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H #ifndef VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H
#define VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H #define VENDOR_LINEAGE_TOUCH_V1_0_KEYDISABLER_H
#include <vendor/lineage/touch/1.0/IKeyDisabler.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/touch/1.0/IKeyDisabler.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -46,7 +46,6 @@ class KeyDisabler : public IKeyDisabler {
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

@ -29,8 +29,7 @@ bool StylusMode::isSupported() {
if (file.is_open()) { if (file.is_open()) {
std::string line; std::string line;
while (getline(file, line)) { while (getline(file, line)) {
if (!line.compare("hover_enable")) if (!line.compare("hover_enable")) return true;
return true;
} }
file.close(); file.close();
} }
@ -43,8 +42,7 @@ Return<bool> StylusMode::isEnabled() {
if (file.is_open()) { if (file.is_open()) {
std::string line; std::string line;
getline(file, line); getline(file, line);
if (!line.compare("hover_enable,1:OK")) if (!line.compare("hover_enable,1:OK")) return true;
return true;
file.close(); file.close();
} }
return false; return false;

@ -17,9 +17,9 @@
#ifndef VENDOR_LINEAGE_TOUCH_V1_0_STYLUSMODE_H #ifndef VENDOR_LINEAGE_TOUCH_V1_0_STYLUSMODE_H
#define VENDOR_LINEAGE_TOUCH_V1_0_STYLUSMODE_H #define VENDOR_LINEAGE_TOUCH_V1_0_STYLUSMODE_H
#include <vendor/lineage/touch/1.0/IStylusMode.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/touch/1.0/IStylusMode.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -46,7 +46,6 @@ class StylusMode : public IStylusMode {
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

@ -27,14 +27,15 @@ namespace samsung {
static constexpr const char* kGeasturePath = "/sys/class/sec/sec_epen/epen_gestures"; static constexpr const char* kGeasturePath = "/sys/class/sec/sec_epen/epen_gestures";
const std::map<int32_t, TouchscreenGesture::GestureInfo> TouchscreenGesture::kGestureInfoMap = { const std::map<int32_t, TouchscreenGesture::GestureInfo> TouchscreenGesture::kGestureInfoMap = {
// clang-format off
{0, {0x2f1, "Swipe up stylus"}}, {0, {0x2f1, "Swipe up stylus"}},
{1, {0x2f2, "Swipe down stylus"}}, {1, {0x2f2, "Swipe down stylus"}},
{2, {0x2f3, "Swipe left stylus"}}, {2, {0x2f3, "Swipe left stylus"}},
{3, {0x2f4, "Swipe right stylus"}}, {3, {0x2f4, "Swipe right stylus"}},
{4, {0x2f5, "Long press stylus"}}, {4, {0x2f5, "Long press stylus"}},
// clang-format on
}; };
bool TouchscreenGesture::isSupported() { bool TouchscreenGesture::isSupported() {
std::ifstream file(kGeasturePath); std::ifstream file(kGeasturePath);
return file.good(); return file.good();
@ -70,7 +71,6 @@ Return<bool> TouchscreenGesture::setGestureEnabled(
return !file.fail(); return !file.fail();
} }
// 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_TOUCH_V1_0_TOUCHSCREENGESTURE_H #ifndef VENDOR_LINEAGE_TOUCH_V1_0_TOUCHSCREENGESTURE_H
#define VENDOR_LINEAGE_TOUCH_V1_0_TOUCHSCREENGESTURE_H #define VENDOR_LINEAGE_TOUCH_V1_0_TOUCHSCREENGESTURE_H
#include <vendor/lineage/touch/1.0/ITouchscreenGesture.h>
#include <hidl/MQDescriptor.h> #include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <vendor/lineage/touch/1.0/ITouchscreenGesture.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -50,7 +50,6 @@ class TouchscreenGesture : public ITouchscreenGesture {
const char* name; const char* name;
} GestureInfo; } GestureInfo;
static const std::map<int32_t, GestureInfo> kGestureInfoMap; // id -> info static const std::map<int32_t, GestureInfo> kGestureInfoMap; // id -> info
}; };
// FIXME: most likely delete, this is only for passthrough implementations // FIXME: most likely delete, this is only for passthrough implementations

@ -74,9 +74,8 @@ int main() {
if (gloveMode->isSupported()) { if (gloveMode->isSupported()) {
status = gloveMode->registerAsService(); status = gloveMode->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for Touch HAL GloveMode Iface (" << status
<< "Could not register service for Touch HAL GloveMode Iface (" << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -84,9 +83,8 @@ int main() {
if (keyDisabler->isSupported()) { if (keyDisabler->isSupported()) {
status = keyDisabler->registerAsService(); status = keyDisabler->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for Touch HAL KeyDisabler Iface (" << status
<< "Could not register service for Touch HAL KeyDisabler Iface (" << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -94,9 +92,8 @@ int main() {
if (stylusMode->isSupported()) { if (stylusMode->isSupported()) {
status = stylusMode->registerAsService(); status = stylusMode->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for Touch HAL StylusMode Iface (" << status
<< "Could not register service for Touch HAL StylusMode Iface (" << ")";
<< status << ")";
goto shutdown; goto shutdown;
} }
} }
@ -104,8 +101,7 @@ int main() {
if (touchscreenGesture->isSupported()) { if (touchscreenGesture->isSupported()) {
status = touchscreenGesture->registerAsService(); status = touchscreenGesture->registerAsService();
if (status != OK) { if (status != OK) {
LOG(ERROR) LOG(ERROR) << "Could not register service for Touch HAL TouchscreenGesture Iface ("
<< "Could not register service for Touch HAL TouchscreenGesture Iface ("
<< status << ")"; << status << ")";
goto shutdown; goto shutdown;
} }
@ -113,7 +109,7 @@ int main() {
LOG(INFO) << "Touch HAL service is ready."; LOG(INFO) << "Touch 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