pstar: touch: GloveMode -> HighTouchPollingRate

This commit is contained in:
SGCMarkus 2022-03-13 15:32:03 +01:00
parent 35b2216ce6
commit 71a1c4bd06
6 changed files with 16 additions and 16 deletions

View File

@ -21,7 +21,7 @@ cc_binary {
relative_install_path: "hw",
proprietary: true,
srcs: [
"GloveMode.cpp",
"HighTouchPollingRate.cpp",
"service.cpp",
],
shared_libs: [

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
#define LOG_TAG "GloveModeService"
#define LOG_TAG "HighTouchPollingRateService"
#include "GloveMode.h"
#include "HighTouchPollingRate.h"
#include <fstream>
@ -28,7 +28,7 @@ namespace implementation {
const std::string kInterpolationPath = "/sys/class/touchscreen/primary/interpolation";
Return<bool> GloveMode::isEnabled() {
Return<bool> HighTouchPollingRate::isEnabled() {
std::ifstream file(kInterpolationPath);
int enabled;
file >> enabled;
@ -39,7 +39,7 @@ Return<bool> GloveMode::isEnabled() {
return false;
}
Return<bool> GloveMode::setEnabled(bool enabled) {
Return<bool> HighTouchPollingRate::setEnabled(bool enabled) {
std::ofstream file(kInterpolationPath);
file << (enabled ? "1" : "0");
return !file.fail();

View File

@ -16,7 +16,7 @@
#pragma once
#include <vendor/lineage/touch/1.0/IGloveMode.h>
#include <vendor/lineage/touch/1.0/IHighTouchPollingRate.h>
namespace vendor {
namespace lineage {
@ -26,9 +26,9 @@ namespace implementation {
using ::android::hardware::Return;
class GloveMode : public IGloveMode {
class HighTouchPollingRate : public IHighTouchPollingRate {
public:
// Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow.
// Methods from ::vendor::lineage::touch::V1_0::IHighTouchPollingRate follow.
Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enabled) override;
};

View File

@ -19,18 +19,18 @@
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "GloveMode.h"
#include "HighTouchPollingRate.h"
using ::vendor::lineage::touch::V1_0::IGloveMode;
using ::vendor::lineage::touch::V1_0::implementation::GloveMode;
using ::vendor::lineage::touch::V1_0::IHighTouchPollingRate;
using ::vendor::lineage::touch::V1_0::implementation::HighTouchPollingRate;
int main() {
android::sp<IGloveMode> gloveMode = new GloveMode();
android::sp<IHighTouchPollingRate> highTouchPollingRate = new HighTouchPollingRate();
android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/);
if (gloveMode->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register touchscreen glove HAL service.";
if (highTouchPollingRate->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register touchscreen high polling rate HAL service.";
return 1;
}

View File

@ -1,5 +1,5 @@
service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.pstar
interface vendor.lineage.touch@1.0::IGloveMode default
interface vendor.lineage.touch@1.0::IHighTouchPollingRate default
class hal
user system
group system

View File

@ -4,7 +4,7 @@
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IGloveMode</name>
<name>IHighTouchPollingRate</name>
<instance>default</instance>
</interface>
</hal>