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
This commit is contained in:
Dana Conrad 2021-04-03 13:54:03 -05:00 committed by Solomon Peachy
parent 962d412917
commit 1aed109fa8
6 changed files with 61 additions and 26 deletions

View file

@ -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;
}
}

View file

@ -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*/

View file

@ -15767,3 +15767,17 @@
*: "Exempt Volume"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_ALWAYSAUTOLOCK
desc: always prime autolock
user: core
<source>
*: "Always Autolock"
</source>
<dest>
*: "Always Autolock"
</dest>
<voice>
*: "Always Autolock"
</voice>
</phrase>

View file

@ -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},

View file

@ -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

View file

@ -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 +.