diff options
author | Bruno Martins <bgcngm@gmail.com> | 2021-01-06 17:12:16 +0000 |
---|---|---|
committer | Davide Garberi <dade.garberi@gmail.com> | 2021-10-28 22:38:40 +0200 |
commit | 8af90b16090b54cba6da59c94f84f6a36c83d731 (patch) | |
tree | ff7c127e066c1f0a279923e4b9c651806d7ee75a | |
parent | 9327d74d955a2329e4475bf003d4cab2b00be88b (diff) |
msm8996-common: touch: Fix code style issues
Change-Id: Ide58643d2718f36792a212ea87426e3548a922c0
-rw-r--r-- | touch/KeyDisabler.cpp | 18 | ||||
-rw-r--r-- | touch/KeyDisabler.h | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/touch/KeyDisabler.cpp b/touch/KeyDisabler.cpp index c5acdef..4f02f9f 100644 --- a/touch/KeyDisabler.cpp +++ b/touch/KeyDisabler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The LineageOS Project + * Copyright (C) 2019,2021 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ #include "KeyDisabler.h" +using ::android::base::ReadFileToString; +using ::android::base::Trim; +using ::android::base::WriteStringToFile; + namespace vendor { namespace lineage { namespace touch { @@ -29,27 +33,27 @@ namespace implementation { constexpr const char kControlPath[] = "/sys/devices/soc/soc:fpc1020/utouch_disable"; KeyDisabler::KeyDisabler() { - mHasKeyDisabler = !access(kControlPath, F_OK); + has_key_disabler_ = !access(kControlPath, F_OK); } // Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow. Return<bool> KeyDisabler::isEnabled() { std::string buf; - if (!mHasKeyDisabler) return false; + if (!has_key_disabler_) return false; - if (!android::base::ReadFileToString(kControlPath, &buf, true)) { + if (!ReadFileToString(kControlPath, &buf, true)) { LOG(ERROR) << "Failed to read " << kControlPath; return false; } - return std::stoi(android::base::Trim(buf)) == 1; + return Trim(buf) == "1"; } Return<bool> KeyDisabler::setEnabled(bool enabled) { - if (!mHasKeyDisabler) return false; + if (!has_key_disabler_) return false; - if (!android::base::WriteStringToFile((enabled ? "1" : "0"), kControlPath, true)) { + if (!WriteStringToFile(enabled ? "1" : "0", kControlPath, true)) { LOG(ERROR) << "Failed to write " << kControlPath; return false; } diff --git a/touch/KeyDisabler.h b/touch/KeyDisabler.h index f7a18fa..8aba763 100644 --- a/touch/KeyDisabler.h +++ b/touch/KeyDisabler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The LineageOS Project + * Copyright (C) 2019,2021 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ class KeyDisabler : public IKeyDisabler { Return<bool> setEnabled(bool enabled) override; private: - bool mHasKeyDisabler; + bool has_key_disabler_; }; } // namespace implementation |