27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main yerine android-latest-release kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Android 11'de dikkatsiz uyku, FLAG_KEEP_SCREEN_ON ile başlayan pencereler görünür durumdayken veya FULL_WAKE_LOCK, SCREEN_BRIGHT_WAKE_LOCK ya da SCREEN_DIM_WAKE_LOCK düzeyinde uyanık kalma kilitleri tutulsa bile kullanıcının etkin olmaması durumunda ekranın kapanacağı bir zaman aşımı süresinin ayarlanmasına olanak tanıyan bir güç tasarrufu özelliğidir.
PARTIAL_WAKE_LOCK düzeyinde wakelock'lar bu özellikten etkilenmez.
Zaman aşımı sona ermeden kısa bir süre önce, kullanıcıyı cihazla etkileşime geçmezse cihazın uykuya geçeceği konusunda uyaran bir mesaj gösterilebilir.
Bu bağlamda kullanıcı etkinliği, aşağıdakiler dahil ancak bunlarla sınırlı olmamak üzere PowerManager#userActivity (USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS işareti olmadan) çağrısını tetikleyen her şeyi ifade eder:
Dokunmatik ekranla etkileşimde bulunma
Fiziksel bir düğmeye basma
Harici bir aksesuardan (ör. bağlı klavye, Bluetooth uzaktan kumanda, kızılötesi uzaktan kumanda) giriş etkinlikleri
Sesli etkileşim
One Touch Play gibi belirli HDMI CEC mesajları alma
Yeni bir yayınlama oturumu başlatma
Özelleştirme
Bu özellik etkinleştirildiğinde, kullanıcı belirli bir süre boyunca işlem yapmazsa cihazda ekranda bir uyarı gösterilir. Hiçbir işlem yapılmazsa ekran kapanır. Bu yapılandırma seçeneklerini kullanarak özelliği özelleştirebilirsiniz.
Zaman aşımını yapılandırma
Zaman aşımını yapılandırmak için frameworks/base/core/res/res/values/config.xml'te aşağıdaki öğeyi güncelleyin:
config_attentiveTimeout
Kullanıcının etkin olmaması durumunda ekranın kapanacağı varsayılan süreyi milisaniye cinsinden belirtir (ekran uyandırıcı kilitleri etkin olsa bile).
Derleme sırasında ayarlanır.
Değer 0 ile config_minimumScreenOffTimeout arasındaysa cihazın uyanıştan kısa bir süre sonra ekranını kapatmasını önlemek için zaman aşımı config_minimumScreenOffTimeout olarak ayarlanır.
Varsayılan: -1. Bu değer, bu özelliği devre dışı bırakır.
Varsayılan zaman aşımını geçersiz kılma
Varsayılan zaman aşımı ayarını geçersiz kılmak için aşağıdaki öğeyi güncelleyin.
Settings.Secure.ATTENTIVE_TIMEOUT
Ayarlanırsa config_attentiveTimeout tarafından belirlenen varsayılan dikkatsiz uyku zaman aşımını geçersiz kılar.
Çalışma zamanında ayarlanabilir.
Uyarının gösterileceği süreyi yapılandırma
Süreyi yapılandırmak için frameworks/base/core/res/res/values/config.xml dosyasında aşağıdaki öğeyi güncelleyin:
config_attentiveWarningDuration
Kullanıcı uzun süre etkin olmadığında ekran kapanmadan önce kullanıcıya uyarı mesajı gösterilecek süre.
Değer, ayarlanan dikkatsiz uyku zaman aşımının çok altında olmalıdır. Aksi takdirde uyarı iletişim kutusu sürekli gösterilir ve kapatılamaz.
Varsayılan: 30000 (30 saniye).
TvSettings'te zaman aşımı tercihlerini gösterme
Zaman aşımı tercihlerini göstermek için packages/apps/TvSettings/Settings/res/values/config.xml'te aşağıdaki öğeyi güncelleyin:
config_show_standby_timeout
Medya oynatma sırasında ekranın kapatılmasına izin veren bir tercih öğesinin gösterilip gösterilmeyeceği.
Varsayılan: false.
Uyarı kullanıcı arayüzüyle ilgili kaynaklar
Uyarı iletişim kutusunun düzeni frameworks/base/packages/SystemUI/res/layout/inattentive_sleep_warning.xml adresinde tanımlanır.
İletişim için aşağıdaki dizeler frameworks/base/packages/SystemUI/res/values/strings.xml ve frameworks/base/packages/SystemUI/res-product/values/strings.xml içinde tanımlanır.
inattentive_sleep_warning_title
inattentive_sleep_warning_message
Derleme zamanı yapılandırmaları ve kaynakları, kaynak yer paylaşımlarıyla değiştirilebilir.
frameworks/base/packages/SystemUI/src/com/android/systemui/power/InattentiveSleepWarningView.java, varsayılan uyarı kullanıcı arayüzü uygulamasını içerir.
packages/apps/TvSettings, özelliğin ayarlarda nasıl gösterileceğine dair bir örnek sağlar.
Manuel test örneği
Cihazın sağlık HAL'i cihazda pil olduğunu bildirirse (battery_present = true) stay_on_while_plugged_in geliştirici ayarının kapalı olduğundan emin olun. Bu, özelliğin ekranı kapatmasını engelleyebilir. adb shell settings put global stay_on_while_plugged_in 0
Dikkatsiz kullanım nedeniyle uyku moduna geçme zaman aşımını, uyarı iletişim kutusunun süresinden birkaç saniye daha uzun olacak şekilde ayarlayın. adb shell settings put secure attentive_timeout 32000
Bir videoyu oynatmaya başlayın (ekranı uyandırın).
Birkaç saniye sonra uyku uyarısı iletişim kutusunun gösterildiğini doğrulayın.
Ayarlanan zaman aşımı süresi dolduktan sonra ekranın kapandığını doğrulayın.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# TV standby\n\nIn Android 11, inattentive sleep is a power-saving feature\nthat allows a user inactivity timeout to be set after which the screen turns off, even\nif windows with [FLAG_KEEP_SCREEN_ON](https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_KEEP_SCREEN_ON)\nare visible or wakelocks of level\n[FULL_WAKE_LOCK](https://developer.android.com/reference/android/os/PowerManager#FULL_WAKE_LOCK),\n[SCREEN_BRIGHT_WAKE_LOCK](https://developer.android.com/reference/android/os/PowerManager#SCREEN_BRIGHT_WAKE_LOCK) or\n[SCREEN_DIM_WAKE_LOCK](https://developer.android.com/reference/android/os/PowerManager#SCREEN_DIM_WAKE_LOCK)\nare held.\nWakelocks with level [PARTIAL_WAKE_LOCK](https://developer.android.com/reference/android/os/PowerManager#PARTIAL_WAKE_LOCK) aren't affected by this feature.\nShortly before the timeout expires, a message can be shown that warns\nthe user that the device will go to sleep if they don't interact with the device.\n\nIn this context, user activity refers to anything that triggers a call to\n`PowerManager#userActivity` (without the `USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS`\nflag), including but not limited to:\n\n- Interacting with the touchscreen\n- Pressing a physical button\n- Input events from an external accessory (for example, connected keyboard, bluetooth remote, IR remote)\n- Voice interaction\n- Receiving certain HDMI CEC messages, such as One Touch Play\n- Starting a new cast session\n\nCustomization\n-------------\n\nIf the feature is enabled, the device shows an onscreen warning after a specified time of\nuser inactivity. If no action is taken, the screen turns off. You can customize the feature\nusing these configuration options.\n| **Caution:** If a similar power-saving feature is already implemented, enabling this feature might lead to unintended consequences, such as duplicate warning UI.\n\n### Configure the timeout\n\nTo configure the timeout, update the following element in\n`frameworks/base/core/res/res/values/config.xml`:\n\n- `config_attentiveTimeout`\n - Specifies the default time in milliseconds of user inactivity after which the screen turns off (even if screen wakelocks are in place).\n - Set at build time.\n - If the value is between `0` and `config_minimumScreenOffTimeout`, the timeout is set to `config_minimumScreenOffTimeout` to prevent the device from turning off its screen shortly after waking up.\n - Default: `-1`, which disables this feature.\n\n### Override the default timeout\n\nTo override the default timeout setting, update the following element.\n\n- `Settings.Secure.ATTENTIVE_TIMEOUT`\n - If set, overrides the default inattentive sleep timeout set by `config_attentiveTimeout`.\n - Can be set at runtime.\n\n### Configure the duration before warning appears\n\nTo configure the duration, update the following element in\n`frameworks/base/core/res/res/values/config.xml`:\n\n- `config_attentiveWarningDuration`\n - How long to show a warning message to the user before the screen turns off after prolonged user inactivity.\n - The value should be well below the set inattentive sleep timeout, otherwise the warning dialog shows constantly and can't be dismissed.\n - Default: `30000` (30s).\n\n### Show the timeout preferences in TvSettings\n\nTo show the timeout preferences, update the following element in\n`packages/apps/TvSettings/Settings/res/values/config.xml`:\n\n- `config_show_standby_timeout`\n - Whether to show a preference item for allowing turning the screen off during media playback.\n - Default: `false`.\n\n### Resources for the warning UI\n\n- The layout of the warning dialog is defined in `frameworks/base/packages/SystemUI/res/layout/inattentive_sleep_warning.xml`.\n- The following strings for the dialog are defined in `frameworks/base/packages/SystemUI/res/values/strings.xml` and `frameworks/base/packages/SystemUI/res-product/values/strings.xml`.\n - `inattentive_sleep_warning_title`\n - `inattentive_sleep_warning_message`\n\nThe build time configurations and resources can be changed by resource overlays.\n\nImplementation\n--------------\n\nEnable the feature using the following.\n\n1. Override the default `config_attentiveTimeout`.\n2. If using the AOSP `TvSettings`:\n - Disable the feature in settings by overriding `config_show_standby_timeout`.\n - Implement your own settings that set `Settings.Secure.ATTENTIVE_TIMEOUT`.\n\nValidation\n----------\n\nThe CTS tests for the feature are at\n`cts/hostsidetests/os/src/android/os/cts/InattentiveSleepTests.java`.\n\nExamples and source\n-------------------\n\n- `frameworks/base/packages/SystemUI/src/com/android/systemui/power/InattentiveSleepWarningView.java` contains the default warning UI implementation.\n- `packages/apps/TvSettings` provides an example of how to expose the feature in settings.\n\nManual test case example\n------------------------\n\n1. Make sure the `stay_on_while_plugged_in`\n developer setting is off if the device's health HAL reports that the device has a\n battery (`battery_present` is `true`) as this might prevent the\n feature from turning off the screen. \n\n `adb shell settings put global stay_on_while_plugged_in 0`\n\n2. Set an inattentive sleep timeout to be a few seconds more than the warning dialog duration. \n `adb shell settings put secure attentive_timeout 32000`\n3. Start playing back a video (to acquire a screen wakelock).\n4. Verify that the sleep warning dialog appears after a few seconds.\n5. Verify that the screen turns off after the set timeout expires."]]