From 8f4122ad5d9323d476641d29392e2a3f985e8b9f Mon Sep 17 00:00:00 2001 From: dshivangi Date: Mon, 26 Jun 2023 11:09:17 +0000 Subject: [PATCH] Add 'Stay unlocked on fold' toogle to settings Added 'Stay unlocked on fold' toogle to display settings. Enabling this setting will allow user to keep their device awake after the fold the device. Test: atest StayAwakeOnFoldPreferenceControllerTest LogicalDisplayMapperTest Test: manual Built and flashed foldable device and manually tested by 1. unfolded device -> enable setting -> folded device 2. unfolded device -> disabled setting -> folded devices Built and flashed non-foldable device and manually tested by 1. Went to Settings -> display -> the toogle setting is not visible Bug: 274447767 Change-Id: I35fbd0f5d1297ee6e14896e8f3be8301cda6622f --- res/values/config.xml | 3 + res/values/strings.xml | 7 ++ res/xml/display_settings.xml | 7 ++ .../StayAwakeOnFoldPreferenceController.java | 75 +++++++++++ ...ayAwakeOnFoldPreferenceControllerTest.java | 119 ++++++++++++++++++ 5 files changed, 211 insertions(+) create mode 100644 src/com/android/settings/display/StayAwakeOnFoldPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/display/StayAwakeOnFoldPreferenceControllerTest.java diff --git a/res/values/config.xml b/res/values/config.xml index 0c5c7a05edf..5968d3c21a3 100755 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -545,6 +545,9 @@ false + + false + true diff --git a/res/values/strings.xml b/res/values/strings.xml index 04d9f17de4b..81150c8398c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2363,6 +2363,10 @@ Display white balance + + Stay unlocked on fold + + Keep front display unlocked when folded until screen timeout Smooth Display @@ -7034,6 +7038,9 @@ screen pinning work challenge, work, profile work profile, managed profile, unify, unification, work, profile + + awake, sleep, do not lock, stay unlocked on fold, folding, closing, fold, close, screen off + gestures wallet pay, tap, payments diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml index ad5236ecbd3..f94ba70a701 100644 --- a/res/xml/display_settings.xml +++ b/res/xml/display_settings.xml @@ -48,6 +48,13 @@ settings:keywords="@string/keywords_ambient_display_screen" settings:controller="com.android.settings.security.screenlock.LockScreenPreferenceController"/> + +