在工模测试中有一项测试为LCD屏幕亮度测试,可以通过写值的方式来实现。
// bright 为0~255之间的常量值
private void setBrightness(int bright) {
Window localWindow = getWindow();
WindowManager.LayoutParams localLayoutParams = localWindow
.getAttributes();
//调节屏幕亮度
localLayoutParams.screenBrightness = (bright / 255.0F);
localLayoutParams.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF;
localWindow.setAttributes(localLayoutParams);
}