fogos: Handle dt2w through power HAL extension

Co-authored-by: Anand S <anandzzz360@gmail.com>
Change-Id: I9f6b6300b2595b0cae76f7d2d805c0ea15495936
This commit is contained in:
Arian 2025-05-07 20:58:04 +05:30 committed by Anand S
parent a76305f888
commit 5e393e1bcb
No known key found for this signature in database
GPG key ID: 5BCAC037A93D36F0
5 changed files with 66 additions and 3 deletions

View file

@ -26,6 +26,9 @@ BOOT_KERNEL_MODULES := $(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD)
BOARD_MOT_DP_GROUP_SIZE := 5901385728 # (BOARD_SUPER_PARTITION_SIZE - 4MB)
BOARD_SUPER_PARTITION_SIZE := 5905580032
# Power
TARGET_POWER_LIBPERFMGR_MODE_EXTENSION_LIB := //$(DEVICE_PATH):libperfmgr-ext-fogos
# Properties
TARGET_PRODUCT_PROP += $(DEVICE_PATH)/product.prop
TARGET_SYSTEM_PROP += $(DEVICE_PATH)/system.prop

11
power/Android.bp Normal file
View file

@ -0,0 +1,11 @@
cc_library_static {
name: "libperfmgr-ext-fogos",
vendor: true,
srcs: [
"power-mode.cpp",
],
shared_libs: [
"android.hardware.power-V5-ndk",
"libbase",
],
}

49
power/power-mode.cpp Normal file
View file

@ -0,0 +1,49 @@
/*
* Copyright (C) 2021 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <aidl/android/hardware/power/BnPower.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <sys/ioctl.h>
namespace aidl {
namespace google {
namespace hardware {
namespace power {
namespace impl {
namespace pixel {
using ::aidl::android::hardware::power::Mode;
const std::string TAP_TO_WAKE_NODE = "/sys/class/touchscreen/primary/gesture";
bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) {
switch (type) {
case Mode::DOUBLE_TAP_TO_WAKE:
*_aidl_return = true;
return true;
default:
return false;
}
}
bool setDeviceSpecificMode(Mode type, bool enabled) {
switch (type) {
case Mode::DOUBLE_TAP_TO_WAKE: {
::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true);
return true;
}
default:
return false;
}
}
} // namespace pixel
} // namespace impl
} // namespace power
} // namespace hardware
} // namespace google
} // namespace aidl

View file

@ -348,4 +348,7 @@
<!-- Whether the device enable the non-standalone (NSA) mode of 5G NR.-->
<bool name="config_telephony5gNonStandalone">true</bool>
<!-- Whether device supports double tap to wake -->
<bool name="config_supportDoubleTapWake">true</bool>
</resources>

View file

@ -77,9 +77,6 @@ on boot
chown root input /sys/class/sensors/Moto\ CapSense\ Ch3/poll_delay
chown root input /sys/class/sensors/Moto\ CapSense\ Ch4/enable
chown root input /sys/class/sensors/Moto\ CapSense\ Ch4/poll_delay
# Change ownership for touch gesture
chown root input /sys/class/sensors/dt-gesture/enable
chown root input /sys/class/sensors/dt-gesture/poll_delay
# touch
chown system system /sys/class/touchscreen/primary/interpolation
chmod 0660 /sys/class/touchscreen/primary/interpolation