[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Ambient Mode is a screensaver built into Google TV and Android TV. Its purpose\nis to avoid displaying static images for extended periods. This is important\nfor display technologies, such as OLED, which may be susceptible to screen burn.\n\nThe OS will put the device into Ambient Mode after 10 minutes of user\ninactivity. After a further period of user inactivity (defined by the device\nEnergy Saver setting) the OS will enter Energy Saver mode,\npowering the display off. Media playback apps may prevent the device\nfrom entering Ambient Mode, despite the user not interacting with it, for\nexample, while watching a movie.\n\nIf the user interacts with the device within 30 minutes of entering Ambient\nMode, the app that was active when Ambient Mode was entered will be restored.\nIf the user interacts with the device more than 30 minutes after entering\nAmbient Mode, they will be returned to the Home screen.\nWhen the user starts the device using the power button while it's in Energy\nSaver mode, they will be taken to the Home screen. Alternatively, if the user\nstarts the device while it's in Energy Saver mode using specific app buttons\n(for example, YouTube) they will be taken directly to that app.\n| **Note:** It is important to ensure that your app meets [the Ambient Mode requirements](/docs/quality-guidelines/tv-app-quality#ambient-mode) when submitting it to Google Play.\n\nVideo playback\n--------------\n\nFor video playback, it's important to [prevent the device entering Ambient Mode\nduring user-initiated playback](/docs/quality-guidelines/tv-app-quality#TV-BU)\nto provide an uninterrupted viewing experience. However, apps should *not*\nprevent devices from entering Ambient Mode when playback is stopped or paused.\n\nAudio playback\n--------------\n\nFor audio playback, apps\n[should not prevent Ambient Mode during playback](/docs/quality-guidelines/tv-app-quality#TV-BA)\nunless they implement their own screensaver with non-static imagery.\nAudio playback will continue while Ambient Mode is active.\n\nAudio playback on Android will implicitly hold a\n[partial wake lock](/reference/android/os/PowerManager#PARTIAL_WAKE_LOCK).\nThis will *not* prevent the device from entering Ambient Mode, but *will*\nprevent the subsequent transition to Energy Saver mode. Playback will therefore\ncontinue even after the device enters Ambient Mode, but the device will be\nprevented from going to sleep to allow uninterrupted playback.\n\nPreventing Ambient Mode\n-----------------------\n\nIt is possible to prevent the OS from putting the device into Ambient Mode, but\nthis must be used in accordance with\n[Ambient Mode requirements](/docs/quality-guidelines/tv-app-quality#ambient-mode).\nApp developers cannot prevent the device from entering\nEnergy Saver mode.\n\nApps can prevent the screen from turning off by setting a flag on the\n[`Window`](/reference/android/view/Window): \n\n### Kotlin\n\n```kotlin\nrequireActivity().window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)\n```\n\n### Java\n\n```java\nrequireActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\n```\n\nAmbient Mode will be disabled while this flag is set. To re-enable it you must\nclear the flag: \n\n### Kotlin\n\n```kotlin\nrequireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)\n```\n\n### Java\n\n```java\nrequireActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\n```\n| **Note:** You must only prevent the device from entering Ambient Mode for user-initiated playback sessions. If your app is [automatically playing video or animations](/docs/quality-guidelines/tv-app-quality#TV-BY), you must *not* set the [`FLAG_KEEP_SCREEN_ON`](/reference/android/view/WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON) flag."]]