相關檔案:
frameworks/base/services/java/com/android/server/PowerManagerService.java
frameworks/base/services/java/com/android/server/NotificationManagerService.java
private void updateLightsLocked()
對于mBatteryLow是mBatteryLow和mBatteryCharging的時候電池的訓示是要顯示的,否則關閉。android做成平闆機,netbook的時候,一般是有電池訓示燈的。 另外: // we only flash if screen is off and persistent pulsing is enabled // and we are not currently in a call if (mLedNotification == null || mScreenOn || mInCall) { mNotificationLight.turnOff(); }
在電源管理的manager代碼中,在函數中可見,燈在LCD關閉的時候是要關的。
private int setScreenStateLocked(boolean on) {
int err = Power.setScreenState(on);
if (err == 0) {
mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0);
if (mUseSoftwareAutoBrightness) {
enableLightSensor(on);
if (!on) {
// make sure button and key backlights are off too
mButtonLight.turnOff();
mKeyboardLight.turnOff();
// clear current value so we will update based on the new conditions
// when the sensor is reenabled.
mLightSensorValue = -1;
// reset our highest light sensor value when the screen turns off
mHighestLightSensorValue = -1;
}
}
}
return err;
注意 mUseSoftwareAutoBrightness 很多光現象都與之相關,代碼查查就好了。SCREEN_BRIGHTNESS也相關的。