MTK6515光感如何把单向调节改成双向调节
我做的实验是,拿手电筒去照射,发现背光变亮,拿开手电筒,背光不会变暗,但是光感的值是正常下降了的。
感觉像是算法有问题,可能是比前一次的值要小的话就丢弃,在驱动的代码中没看到类似的处理,只是返回values[0]。
各位大哥,求指教!
frameworks/base/services/java/com/android/server路径下的PowerManagerService.java
private void lightSensorChangedLocked(int value)方法中
// do not allow light sensor value to decrease
if (mHighestLightSensorValue < value) {
mHighestLightSensorValue = value;
}
/*屏蔽这段
if (mLightSensorValue != value) {
mLightSensorValue = value;
*/
if ((mPowerState & BATTERY_LOW_BIT) == 0) {
// use maximum light sensor value seen since screen went on for LCD to avoid flicker
// we only do this if we are undocked, since lighting should be stable when
// stationary in a dock.
把下面
/*
int lcdValue = getAutoBrightnessValue(
(mIsDocked ? value : mHighestLightSensorValue),
mLcdBacklightValues);
*/
改为
int lcdValue = getAutoBrightnessValue(value,mLcdBacklightValues);
谷歌的源码就是单向调节的。
写错了。
// do not allow light sensor value to decrease
应该
/*屏蔽这段
if (mHighestLightSensorValue < value) {
mHighestLightSensorValue = value;
}
*/
if (mLightSensorValue != value) {
mLightSensorValue = value;
不错,支持小编!