Revert "sm6250-common: power: Add support for DT2W feature"

This reverts commit a587e4ebb8e87c3eb5e41e9eafcca0511d4b76b6.
This commit is contained in:
Subhajeet Muhuri 2020-08-25 23:25:10 +05:30 committed by Volodymyr Zhdanov
parent 4a00c3e9af
commit db8339d7a2
4 changed files with 2 additions and 73 deletions

View File

@ -22,9 +22,6 @@ cc_binary {
"Power.cpp",
"service.cpp",
],
header_libs: [
"generated_kernel_headers",
],
shared_libs: [
"liblog",
"libhidlbase",

View File

@ -16,14 +16,8 @@
#define LOG_TAG "android.hardware.power@1.3-service.xiaomi_sm6250"
#include <linux/input.h>
#include "Power.h"
constexpr static char const* inputDevicesDirectory = "/dev/input/";
constexpr static int wakeupModeOn = 5;
constexpr static int wakeupModeOff = 4;
namespace android {
namespace hardware {
namespace power {
@ -39,66 +33,7 @@ Return<void> Power::powerHint(PowerHint_1_0, int32_t) {
return Void();
}
bool isSupportedInputName(char* name) {
return false;
}
int openInputFd() {
DIR *dir = opendir(inputDevicesDirectory);
if (dir == NULL) {
return -1;
}
struct dirent *ent;
int fd;
int rc;
while ((ent = readdir(dir)) != NULL) {
if (ent->d_type != DT_CHR)
continue;
char absolute_path[PATH_MAX] = {0};
char name[80] = {0};
strcpy(absolute_path, inputDevicesDirectory);
strcat(absolute_path, ent->d_name);
fd = open(absolute_path, O_RDWR);
if (fd < 0)
continue;
rc = ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name);
if (rc > 0 && isSupportedInputName(name))
break;
close(fd);
fd = -1;
}
closedir(dir);
return fd;
}
Return<void> Power::setFeature(Feature feature, bool activate) {
switch (feature) {
case Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE: {
int fd = openInputFd();
if (fd < 0) {
ALOGW("No touchscreen input devices that support DT2W were found");
return Void();
}
struct input_event ev;
ev.type = EV_SYN;
ev.code = SYN_CONFIG;
ev.value = activate ? wakeupModeOn : wakeupModeOff;
write(fd, &ev, sizeof(ev));
close(fd);
} break;
default:
break;
}
Return<void> Power::setFeature(Feature, bool) {
return Void();
}

View File

@ -1,4 +1,4 @@
service vendor.power-hal-1-0 /vendor/bin/hw/android.hardware.power@1.3-service.xiaomi_sm6250
class hal
user system
group system input
group system

View File

@ -1,3 +0,0 @@
# Allow hal_power_default to write to dt2w nodes
allow hal_power_default input_device:dir r_dir_perms;
allow hal_power_default input_device:chr_file rw_file_perms;