LCD在打电话时不灭屏的解决方法
来源:互联网 发布:淘宝充流量要验证码 编辑:程序博客网 时间:2024/05/02 05:41
环境:MSM8909+Android6.0.1+STK3310
1.打开QSensorTest app,用手靠近和远离P-sensor,sensor均能正常上报数据。
2.打电话时查看kernel日志,发现enable函数没有被调用。
P-sensor采用的轮训的方式上报数据,说明上层没有调用sensor的enable函数,在frameworks/base/core/java/android/hardware/SensorManager.java文件中:
1.打开QSensorTest app,用手靠近和远离P-sensor,sensor均能正常上报数据。
2.打电话时查看kernel日志,发现enable函数没有被调用。
P-sensor采用的轮训的方式上报数据,说明上层没有调用sensor的enable函数,在frameworks/base/core/java/android/hardware/SensorManager.java文件中:
/** * Use this method to get the default sensor for a given type. Note that the * returned sensor could be a composite sensor, and its data could be * averaged or filtered. If you need to access the raw sensors use * {@link SensorManager#getSensorList(int) getSensorList}. * * @param type * of sensors requested * * @return the default sensor matching the requested type if one exists and the application * has the necessary permissions, or null otherwise. * * @see #getSensorList(int) * @see Sensor */public Sensor getDefaultSensor(int type) { // TODO: need to be smarter, for now, just return the 1st sensor List<Sensor> l = getSensorList(type); boolean wakeUpSensor = false; // For the following sensor types, return a wake-up sensor. These types are by default // defined as wake-up sensors. For the rest of the SDK defined sensor types return a // non_wake-up version. if (type == Sensor.TYPE_PROXIMITY || type == Sensor.TYPE_SIGNIFICANT_MOTION || type == Sensor.TYPE_TILT_DETECTOR || type == Sensor.TYPE_WAKE_GESTURE || type == Sensor.TYPE_GLANCE_GESTURE || type == Sensor.TYPE_PICK_UP_GESTURE || type == Sensor.TYPE_WRIST_TILT_GESTURE) { wakeUpSensor = true; } for (Sensor sensor : l) { if (sensor.isWakeUpSensor() == wakeUpSensor) return sensor; } return null;}如果是wakeUpSensor,则正常返回。调用到这的时候,返回的是NULL。在hardware/libhardware/include/hardware/sensors.h中有对wake_up_sensor的详细说明:
/* * Availability: SENSORS_DEVICE_API_VERSION_1_3 * Sensor flags used in sensor_t.flags. */enum { /* * Whether this sensor wakes up the AP from suspend mode when data is available. Whenever * sensor events are delivered from a wake_up sensor, the driver needs to hold a wake_lock till * the events are read by the SensorService i.e till sensors_poll_device_t.poll() is called the * next time. Once poll is called again it means events have been read by the SensorService, the * driver can safely release the wake_lock. SensorService will continue to hold a wake_lock till * the app actually reads the events. */ SENSOR_FLAG_WAKE_UP = 1U << 0, /* * Reporting modes for various sensors. Each sensor will have exactly one of these modes set. * The least significant 2nd, 3rd and 4th bits are used to represent four possible reporting * modes. */ SENSOR_FLAG_CONTINUOUS_MODE = 0, // 0000 SENSOR_FLAG_ON_CHANGE_MODE = 0x2, // 0010 SENSOR_FLAG_ONE_SHOT_MODE = 0x4, // 0100 SENSOR_FLAG_SPECIAL_REPORTING_MODE = 0x6, // 0110 /* * Set this flag if the sensor supports data_injection mode and allows data to be injected * from the SensorService. When in data_injection ONLY sensors with this flag set are injected * sensor data and only sensors with this flag set are activated. Eg: Accelerometer and Step * Counter sensors can be set with this flag and SensorService will inject accelerometer data * and read the corresponding step counts. */ SENSOR_FLAG_SUPPORTS_DATA_INJECTION = 0x10 // 1 0000};如果是wake_up_sensor的话,需要设置SENSOR_FLAG_WAKE_UP标志,在hardware/qcom/sensors/NativeSensorManager.cpp的int NativeSensorManager::getDataInfo函数中:
case SENSOR_TYPE_PROXIMITY:has_proximity = 1;#if defined(SENSORS_DEVICE_API_VERSION_1_3)/* reporting mode fix up */list->sensor->flags |= SENSOR_FLAG_ON_CHANGE_MODE;#endiflist->driver = new ProximitySensor(list);sensor_proximity = *(list->sensor);break;SENSOR_FLAG_ON_CHANGE_MODE等于2,或上SENSOR_FLAG_WAKE_UP之后就是3,因此,driver中的flags配置成3即可。
static struct sensors_classdev sensors_proximity_cdev = {.name = "stk3x1x-proximity",.vendor = "Sensortek",.version = 1,.handle = SENSORS_PROXIMITY_HANDLE,.type = SENSOR_TYPE_PROXIMITY,.max_range = "5.0",.resolution = "5.0",.sensor_power = "0.1",.min_delay = 0,.fifo_reserved_event_count = 0,.fifo_max_event_count = 0,.flags = 3,.enabled = 0,.delay_msec = 200,.sensors_enable = NULL,.sensors_poll_delay = NULL,};
0 0
- LCD在打电话时不灭屏的解决方法
- 成为了在我心中一盏不灭的明灯
- 做一只不灭的火炬
- [PowerManagerService]经验总结, 手机不灭屏以及手机无法点亮的常见原因
- 在虚拟机里虚拟打电话的代码
- Linux下LCD自动熄屏解决方法
- 手机某些时候无法接打电话的解决方法
- 微软Windows XP——不灭的传说
- 经典不灭:细数十大史上造型最经典的显卡
- 在MT6735平台下驱动LCD屏Sitronix-ST7701-LCD
- s3c6410 LCD在uboot下的驱动
- 模拟时钟在LCD上的显示
- 模拟时钟在LCD上的显示
- 美国人打电话时最常用的句子
- 打电话的运行时权限获得方法
- 制作uboot LCD开机logo以及lcd字符显示错误的解决方法
- LCD屏的调试注意事项
- LCD屏DPI的计算方法
- AsyncTask解析
- Java基本语法-----java关键字
- node.js下mongoose简单操作实例
- 今天遇到一个错误,使用spring上传失败,找不到临时文件
- Ngrok 内网穿透利器
- LCD在打电话时不灭屏的解决方法
- linux学习10:工作管理与进程管理
- python3使用sax操作xml
- pat 1110. Complete Binary Tree (25)
- 链表之逆序建表
- javascript实现获取指定精度的上传文件的大小
- [概率dp] hdu 4336 Card Collector
- python 集合操作符和关系符号
- Telegram 之 MTProtoKit 架构分析