Android 12修改usb tp触摸唤醒

简介: Android 12修改usb tp触摸唤醒
前言

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();

 


目录
相关文章
|
安全 API Android开发
Android打开USB调试命令
【6月更文挑战第20天】
473 1
|
Android开发
Android监听USB设备插拔
Android监听USB设备插拔
1354 7
|
Java Android开发
Android 触摸音的播放
Android 触摸音的播放
146 5
|
Java Android开发
修改Android 触摸提示音及音量大小
修改Android 触摸提示音及音量大小
567 4
|
Android开发
Android 获取 USB设备列表
Android 获取 USB设备列表 【5月更文挑战第6天】
444 4
|
Java API Android开发
安卓开发app 调用usb 摄像头 需要用到哪个库
在安卓开发中,调用USB摄像头常常使用libuvc库,这是一个跨平台处理USB视频设备的库。有多个基于libuvc的开源项目简化了在安卓上的使用,如UVCCamera和Android EasyCap UVC。例如,UVCCamera提供了一个更简单的接口来访问USB摄像头,并且可以在Jetpack Compose中显示预览。开发者可以参考官方文档、开源项目以及相关教程和资源来学习和实现这一功能。
|
13天前
|
开发工具 Android开发
X Android SDK file not found: adb.安卓开发常见问题-Android SDK 缺少 `adb`(Android Debug Bridge)-优雅草卓伊凡
X Android SDK file not found: adb.安卓开发常见问题-Android SDK 缺少 `adb`(Android Debug Bridge)-优雅草卓伊凡
182 11
X Android SDK file not found: adb.安卓开发常见问题-Android SDK 缺少 `adb`(Android Debug Bridge)-优雅草卓伊凡
|
23天前
|
Java 开发工具 Maven
【01】完整的安卓二次商业实战-详细的初级步骤同步项目和gradle配置以及开发思路-优雅草伊凡
【01】完整的安卓二次商业实战-详细的初级步骤同步项目和gradle配置以及开发思路-优雅草伊凡
87 6
|
3月前
|
安全 数据库 Android开发
在Android开发中实现两个Intent跳转及数据交换的方法
总结上述内容,在Android开发中,Intent不仅是活动跳转的桥梁,也是两个活动之间进行数据交换的媒介。运用Intent传递数据时需注意数据类型、传输大小限制以及安全性问题的处理,以确保应用的健壯性和安全性。
172 11

热门文章

最新文章