手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android4.0与2.3版本的TP代码区别解析
android4.0与2.3版本的TP代码区别解析
摘要:通常来说在android2.3上调试TP时,只需要把linux驱动调通,android就可以正常使用了。但是到了android4.0上又有些...

通常来说在android2.3上调试TP时,只需要把linux驱动调通,android就可以正常使用了。但是到了android4.0上又有些不同了,针对linux驱动,需添加如下一些内容:

1、在手指按下时需调用如下函数上报Key Down:

input_report_key(struct input_dev *input, BTN_TOUCH, 1);

2、在手指释放时需调用如下函数上报Key Up:

input_report_key(struct input_dev *input, BTN_TOUCH, 0);

这样通过的话,可以在android4.0上看到有鼠标指针(圆圈)可以移动,把触摸屏做成了笔记本电脑上的鼠标触摸屏了,后来再查了下,原来需要添加一个idc文件,具体识别优先级参考:http://source.android.com/tech/input/input-device-configuration-files.html这篇文档,会按下面的顺序识别配置文件:

/system/usr/idc/Vendor_XXXX_Product_XXXX_Version_XXXX.idc /system/usr/idc/Vendor_XXXX_Product_XXXX.idc /system/usr/idc/DEVICE_NAME.idc /data/system/devices/idc/Vendor_XXXX_Product_XXXX_Version_XXXX.idc /data/system/devices/idc/Vendor_XXXX_Product_XXXX.idc /data/system/devices/idc/DEVICE_NAME.idc

为了方便,我直接创建一个“设备名.idc”的文件,直接放到/system/usr/idc/目录下,相应的内容参考如下:

# Basic Parameters touch.deviceType = touchScreen touch.orientationAware = 1 # Size touch.size.calibration = diameter touch.size.scale = 10 touch.size.bias = 0 touch.size.isSummed = 0 # Pressure # Driver reports signal strength as pressure. # # A normal thumb touch typically registers about 200 signal strength # units although we don't expect these values to be accurate. touch.pressure.calibration = amplitude touch.pressure.scale = 0.005 # Orientation touch.orientation.calibration = none

这样配置好后,在android4.0上的TP就可以正常使用了,而不会成为滑鼠触屏了。

【android4.0与2.3版本的TP代码区别解析】相关文章:

Android三种菜单实例分析

Android获取版本号等信息

Android 使用XML做动画UI的深入解析

基于Android本地代码生成器详解

刷新android中的媒体库

Android 混淆代码详解及实例

Android键盘显示与隐藏代码

android notification 的总结分析

android上的缓存、缓存算法和缓存框架详解

Android中手机号码归属地查询实现

精品推荐
分类导航