在將PowerManagerService.java文件DEBUG_SCREEN_ON打開後,在log發現RuntimeException,仔細查看代碼,原來是在setLightBrightness中的debug信息,
特地寫下來,以便以後使用.
1.setLightBrightness 函數:
private void setLightBrightness(int mask, int value) {
int brightnessMode = (mAutoBrightessEnabled
? LightsService.BRIGHTNESS_MODE_SENSOR
: LightsService.BRIGHTNESS_MODE_USER);
if ((mask & SCREEN_BRIGHT_BIT) != 0) {
if (DEBUG_SCREEN_ON) {
RuntimeException e = new RuntimeException("here");
e.fillInStackTrace();
Slog.i(TAG, "Set LCD brightness: " + value, e);
}
mLcdLight.setBrightness(value, brightnessMode);
}
if ((mask & BUTTON_BRIGHT_BIT) != 0) {
mButtonLight.setBrightness(value);
}
if ((mask & KEYBOARD_BRIGHT_BIT) != 0) {
mKeyboardLight.setBrightness(value);
}
}
2.log信息:
I/PowerManagerService( 228): java.lang.RuntimeException: here
I/PowerManagerService( 228): at com.android.server.PowerManagerService.setLightBrightness(PowerManagerService.java:2160)
I/PowerManagerService( 228): at com.android.server.PowerManagerService.access$4600(PowerManagerService.java:77)
I/PowerManagerService( 228): at com.android.server.PowerManagerService$BrightnessState.jumpToTargetLocked(PowerManagerService.java:2265)
I/PowerManagerService( 228): at com.android.server.PowerManagerService.setBacklightBrightness(PowerManagerService.java:3049)
I/PowerManagerService( 228): at android.os.IPowerManager$Stub.onTransact(IPowerManager.java:227)
I/PowerManagerService( 228): at android.os.Binder.execTransact(Binder.java:338)
I/PowerManagerService( 228): at dalvik.system.NativeStart.run(Native Method)