Android 12修改usb tp触摸唤醒

本文介绍了如何在Android12系统中调整USBTP设备的设置,以便在休眠状态下通过触摸唤醒。关键在于修改`TouchInputMapper.cpp`中的`mParameters.wake`值,使其始终为真,以确保所有USBTP设备支持触控唤醒功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

 Android 12系统休眠时,需要不管接什么型号usb tp都能够触摸唤醒。

Android12系统中,usb tp要能够触摸唤醒,需要在frameworks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp中将mParameters.wake赋值为true,才能够在系统休眠的时候,触摸usb tp唤醒系统。(在TouchInputMapper.cpp中mParameters.wake的值是由getDeviceContext().isExternal();决定的,getDeviceContext().isExternal();是通过EventHub.cpp中的bool EventHub::Device::isExternalDeviceLocked()获得的。这个函数是通过读取对应tp idc文件中的device.internal属性来决定的。)我们现在要求所有的usb tp的能够触摸唤醒,只需按如下修改即可:

Index: reader/mapper/TouchInputMapper.cpp
===================================================================
--- reader/mapper/TouchInputMapper.cpp  (revision 2066)
+++ reader/mapper/TouchInputMapper.cpp  (working copy)
@@ -508,7 +508,7 @@
     // Initial downs on external touch devices should wake the device.
     // Normally we don't do this for internal touch screens to prevent them from waking
     // up in your pocket but you can enable it using the input device configuration.
-    mParameters.wake = getDeviceContext().isExternal();
+    mParameters.wake = true;
     getDeviceContext().getConfiguration().tryGetProperty(String8("touch.wake"), mParameters.wake);
 }

 

09-20 21:45:13.715   664   818 I InputReader: Disabling eGalax Inc. eGalaxTouch P80H84 2331 v00_T1 k4.10.143 (device 3) because the associated viewport is not active

 修改方法

@@ -664,12 +664,12 @@
         return;
     }

-    if (!newViewport->isActive) {
-        ALOGI("Disabling %s (device %i) because the associated viewport is not active",
-              getDeviceName().c_str(), getDeviceId());
-        mDeviceMode = DeviceMode::DISABLED;
-        return;
-    }
+    // if (!newViewport->isActive) {
+        // ALOGI("Disabling %s (device %i) because the associated viewport is not active",
+              // getDeviceName().c_str(), getDeviceId());
+        // mDeviceMode = DeviceMode::DISABLED;
+        // return;
+    // }

     // Raw width and height in the natural orientation.
     int32_t rawWidth = mRawPointerAxes.getRawWidth();

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiaowang_lj

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值