通话距离感应实现源码

展讯平台:android 7.0代码。

packages/apps/Dialer/InCallUI/src/com/android/incallui/ProximitySensor.java

frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java


PowerManager.WakeLock mProximityWakeLock; 

private PowerManager mPowerManager; 

mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); 
mProximityWakeLock=pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, LOG_TAG); 


然后用mProximityWakeLock.acquire();  打开屏幕 
用 mProximityWakeLock.release(flags);  关闭屏幕。 

但是当我在我的应用里面写 
mProximityWakeLock=pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, LOG_TAG); 

的时候,会提示PROXIMITY_SCREEN_OFF_WAKE_LOCK不存在。 


获取kmsg消息:

adb shell dmesg | tee 123.log
adb shell cat proc/kmsg > 123.log


TP距离感应的值:

vendor/sprd/modules/sensors/pls/tp/Pls_TP.cpp

adb shell cat sys/board_properties/facemode



你可能感兴趣的:(android)