mirror of
https://github.com/PixelExperience-Devices/device_xiaomi_sm6250-common.git
synced 2025-05-07 22:37:17 +09:00
Revert "sm6250-common: power: Add support for DT2W feature"
This reverts commit a587e4ebb8e87c3eb5e41e9eafcca0511d4b76b6.
This commit is contained in:
parent
4a00c3e9af
commit
db8339d7a2
@ -22,9 +22,6 @@ cc_binary {
|
|||||||
"Power.cpp",
|
"Power.cpp",
|
||||||
"service.cpp",
|
"service.cpp",
|
||||||
],
|
],
|
||||||
header_libs: [
|
|
||||||
"generated_kernel_headers",
|
|
||||||
],
|
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"liblog",
|
"liblog",
|
||||||
"libhidlbase",
|
"libhidlbase",
|
||||||
|
@ -16,14 +16,8 @@
|
|||||||
|
|
||||||
#define LOG_TAG "android.hardware.power@1.3-service.xiaomi_sm6250"
|
#define LOG_TAG "android.hardware.power@1.3-service.xiaomi_sm6250"
|
||||||
|
|
||||||
#include <linux/input.h>
|
|
||||||
|
|
||||||
#include "Power.h"
|
#include "Power.h"
|
||||||
|
|
||||||
constexpr static char const* inputDevicesDirectory = "/dev/input/";
|
|
||||||
constexpr static int wakeupModeOn = 5;
|
|
||||||
constexpr static int wakeupModeOff = 4;
|
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
namespace power {
|
namespace power {
|
||||||
@ -39,66 +33,7 @@ Return<void> Power::powerHint(PowerHint_1_0, int32_t) {
|
|||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSupportedInputName(char* name) {
|
Return<void> Power::setFeature(Feature, bool) {
|
||||||
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();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
service vendor.power-hal-1-0 /vendor/bin/hw/android.hardware.power@1.3-service.xiaomi_sm6250
|
service vendor.power-hal-1-0 /vendor/bin/hw/android.hardware.power@1.3-service.xiaomi_sm6250
|
||||||
class hal
|
class hal
|
||||||
user system
|
user system
|
||||||
group system input
|
group system
|
||||||
|
3
sepolicy/vendor/hal_power_default.te
vendored
3
sepolicy/vendor/hal_power_default.te
vendored
@ -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;
|
|
Loading…
x
Reference in New Issue
Block a user