/* Window flag: as long as this window is visible to the user, keep the device’s screen turned on and bright. /
public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
WindowManager提供了FLAG_KEEP_SCREEN_ON,让开发者更方便实现屏幕常亮。
用法也很简单:
让屏幕常亮
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
释放屏幕
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);