From 1aed109fa8c2a9e5a788295f523642bc71269351 Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Sat, 3 Apr 2021 13:54:03 -0500 Subject: [PATCH] Add ability to always have autolock on Tested on ErosQ Added a setting in the Advanced Softlock menu to always have autolock on, rather than having to "arm" it with the softlock button. Lock/Unlock still works the same with this on, but when the screen turns off, the device always ends up in the locked state. Requires Autolock On to be set as well, and the normal Autolock functionality is unchanged with this off. Caveat: the power/softlock button must be pressed at least once after powering on the device or enabling the feature. After that, it should consistently always "arm" the autolock. Added feature to manual in manual/configure_rockbox/system_options.tex. Also updated some labels I had changed in the Advanced Key Lock menu and added information for Disable All Lock Notifications in a previous commit. Shared items also updated in manual/configure_rockbox/display_options.tex for selective backlight. Change-Id: I09dc6814bee803e40c7088157e1fe9d01d5f3474 --- apps/action.c | 37 ++++++++++++-------- apps/action.h | 2 +- apps/lang/english.lang | 14 ++++++++ apps/menus/settings_menu.c | 1 + manual/configure_rockbox/display_options.tex | 8 ++--- manual/configure_rockbox/system_options.tex | 25 +++++++++---- 6 files changed, 61 insertions(+), 26 deletions(-) diff --git a/apps/action.c b/apps/action.c index f9602b967f..34897b938c 100644 --- a/apps/action.c +++ b/apps/action.c @@ -675,24 +675,31 @@ static inline int do_auto_softlock(action_last_t *last, action_cur_t *cur) } else if (action == ACTION_STD_KEYLOCK) { - last->unlock_combo = cur->button;/* set unlock combo to allow unlock */ - last->softlock_mask ^= SEL_ACTION_ALOCK_OK; - action_handle_backlight(true, false); - /* If we don't wait for a moment for the backlight queue - * to process, the user will never see the message */ - if (!is_backlight_on(false)) + if (!has_flag(last->softlock_mask, SEL_ACTION_ALWAYSAUTOLOCK)) // normal operation, clear/arm autolock { - sleep(HZ/2); - } + last->unlock_combo = cur->button;/* set unlock combo to allow unlock */ + last->softlock_mask ^= SEL_ACTION_ALOCK_OK; + action_handle_backlight(true, false); + /* If we don't wait for a moment for the backlight queue + * to process, the user will never see the message */ + if (!is_backlight_on(false)) + { + sleep(HZ/2); + } - if (has_flag(last->softlock_mask, SEL_ACTION_ALOCK_OK)) + if (has_flag(last->softlock_mask, SEL_ACTION_ALOCK_OK)) + { + splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_ON)); + action = ACTION_REDRAW; + } + else + { + splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_OFF)); + } + } else if (!has_flag(last->softlock_mask, SEL_ACTION_ALOCK_OK)) // always autolock, but not currently armed { - splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_ON)); - action = ACTION_REDRAW; - } - else - { - splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_OFF)); + last->unlock_combo = cur->button;/* set unlock combo to allow unlock */ + last->softlock_mask ^= SEL_ACTION_ALOCK_OK; } } diff --git a/apps/action.h b/apps/action.h index da4565c28b..e4ad29504b 100644 --- a/apps/action.h +++ b/apps/action.h @@ -51,7 +51,7 @@ #define SEL_ACTION_SKIP 0x008U #define SEL_ACTION_NOUNMAPPED 0x010U/* disable backlight on unmapped buttons */ #define SEL_ACTION_ALLNONOTIFY 0x020U/* disable switch for all softlock notifications */ - /* Available 0x040U*/ +#define SEL_ACTION_ALWAYSAUTOLOCK 0x040U/* always prime autolock, requires autolock enabled */ #define SEL_ACTION_NOTOUCH 0x080U/* disable touch screen/pad on screen lock */ #define SEL_ACTION_AUTOLOCK 0x100U/* autolock on backlight off */ #define SEL_ACTION_NOEXT 0x200U/* disable selective backlight while charge*/ diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 327584c4f6..9ca4c84430 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -15767,3 +15767,17 @@ *: "Exempt Volume" + + id: LANG_ACTION_ALWAYSAUTOLOCK + desc: always prime autolock + user: core + + *: "Always Autolock" + + + *: "Always Autolock" + + + *: "Always Autolock" + + diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index a5daad01ce..0b7516f749 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -89,6 +89,7 @@ int mask = global_settings.bt_selective_softlock_actions_mask; {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP}, #ifdef HAVE_BACKLIGHT {ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK}, + {ID2P(LANG_ACTION_ALWAYSAUTOLOCK), SEL_ACTION_ALWAYSAUTOLOCK}, #endif #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN) {ID2P(LANG_ACTION_DISABLE_TOUCH), SEL_ACTION_NOTOUCH}, diff --git a/manual/configure_rockbox/display_options.tex b/manual/configure_rockbox/display_options.tex index f00b0a2da9..d64734aec4 100755 --- a/manual/configure_rockbox/display_options.tex +++ b/manual/configure_rockbox/display_options.tex @@ -67,13 +67,13 @@ \item[Settings.] Allows to select actions that will \emph{not} activate backlight. \begin{itemize} - \item[Volume.] + \item[Exempt Volume] Volume up/down. - \item[Play.] + \item[Exempt Play] Toggling Play/Pause. - \item[Seek.] + \item[Exempt Seek] Seeking in a track. - \item[Skip.] + \item[Exempt Skip] Skipping of a track. \item[Disable Unmapped Keys.] Buttons that have no action assigned and accidental button diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex index bf82b8c074..59acdaa5f9 100755 --- a/manual/configure_rockbox/system_options.tex +++ b/manual/configure_rockbox/system_options.tex @@ -262,16 +262,16 @@ therefore result in better runtime. \item[Settings.] Allows to select actions that will \emph{not} be blocked by the key lock. \begin{itemize} - \item[Volume.] + \item[Exempt Volume] Volume up/down. - \item[Play.] + \item[Exempt Play] Toggling Play/Pause. - \item[Seek.] + \item[Exempt Seek] Seeking in a track. - \item[Skip.] + \item[Exempt Skip] Skipping of a track. \opt{HAVE_BACKLIGHT}{ - \item[Autolock On.] + \item[Autolock On] When the backlight turns off, softlock will lock the screen, activates when you press the lock key and if you manually lock again, while active it then disables autolock. @@ -284,16 +284,29 @@ therefore result in better runtime. \item (Lock Button Pressed \#3) >(device unlocked). \end{itemize} + \item[Always Autolock] + Force Autolock to always be active rather than cycling through the + list above. The device can be locked and unlocked manually, but + the lock will always engage when the backlight turns off. Requires + Autolock On to be enabled. + \note{The lock button must be pressed at least once after enabling + this setting and at least once every time the device is powered up.} } %\opt{HAVE_BACKLIGHT} \opt{touchpad}{ \item[Disable Touch.] Blocks touch screen buttons like the original. } - \item[Disable Notify.] + \item[Disable Locked Reminders] Suppresses the notification 'Buttons Locked' (still will if power button is pressed). \note{This is a pre-requisite for \setting{selectivebacklight} \reference{ref:selectivebacklight} to work also during key lock.} + \item[Disable All Lock Notifications] + Disable all softlock notifications, including when power button + is pressed. + \note{When this is enabled, Disable Locked Reminders is still required to + be enabled for \setting{selectivebacklight} \reference{ref:selectivebacklight} + to work during key lock.} \end{itemize} Selected actions are indicated by a leading +.