How to dim screen to zero without conflicting with FLAG_KEEP_SCREEN_ON

爱⌒轻易说出口 提交于 2019-12-04 03:40:55

问题


I found several methods to dim the screen but I am unsure how they work in concert with FLAG_KEEP_SCREEN_ON:

  • Settings.System.SCREEN_BRIGHTNESS
  • IHardwareService.setScreenBacklight()
  • WindowManager.LayoutParams.screenBrightness

Which of the above methods will keep the screen on, even if I set brightness to 0.0?


回答1:


Nothing will work reliably. If you set the brightness to 0 on some devices it will turn off the screen (but the device will be in a funny state for about 5 seconds or so before really realizing it's off and acting as such). Some devices it will be on but black.

IIRC LayoutParams.screenBrightness with a value less than 30 is unreliable in that it might turn off the display.

On an AMOLED device a full screen that's all black will not have backlight. But SLCD definitely will. Also on Android 3.0 you can't have a full screen as the system bar is always visible.



来源:https://stackoverflow.com/questions/6876471/how-to-dim-screen-to-zero-without-conflicting-with-flag-keep-screen-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!