Is https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON specific to a window or a display?
Apr 12, 10:56pm

The FLAG_KEEP_SCREEN_ON flag in Android's WindowManager.LayoutParams is specific to a window, not the entire display.

Key Points:

  • Scope: When you set this flag on a window's layout parameters (e.g., via window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)), it ensures that the screen stays on while that specific window is visible.
  • Implementation: This flag is applied to the window itself, not globally to the device display.

So, if you want to keep the screen on for a particular activity or dialog, you set this flag on its window. For other windows (e.g., another activity), you would need to set the flag separately.

Would you like an example of how to use this flag in code?

Apr 12, 10:56pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.