Custom timeouts for automatic device lock (or at least more options)

The “automatic lock” functionality is very useful however currently you can only choose between disabled, instant and timeouts with 5 minutes or longer.

For me this feature really only makes sense in one situation: you have your phone open to view some website/data and also work on something else (for example following a recipe). From time to time you miss the moment where the screen turns off and locks the device. Usually you notice this within 5-30 seconds. In that moment you want to be able to quickly reopen whatever you are viewing without the need to enter the pin code.

The current shortest setting of 5 minutes is way to long for this use case and (at least I) usually don’t want my phone to be unlocked for 5 minutes or longer.

My Request is to either allow custom timeout settings (like the timer dialog in the clock app) or more options in the current combo box to allow shorter durations like 5, 10, 30 & 60 seconds

8 Likes

Anyone an idea for this request? A patch location would help for now.

2 Likes

It is enough a check box: quick autolock [0/1]

  • 0 means 5/10/30/60 minutes
  • 1 means 5/10/30/60 seconds

That’s all. Curious that nobody implemented it.

I have not checked, but pretty sure you can set arbitrary timeouts with mcetool.

1 Like

Very powerful tool that I discovered 2 days ago.

These values should be changed in a more useful default values:

  • Adaptive dimming threshold: 10000 (milliseconds) → 1000, at least
  • Led breathing battery limit: 101 (%) → at the threshold set by user
  • Charging enable limit: 87 (%) → 85 when the top is set to 90%

I think that I found the value for the device lock.

  • –set-devicelock-in-lockscreen=<READ THE LONG HELP`>

The long help does not help but scare! :slight_smile:

"DO NOT TOUCH THIS UNLESS YOU KNOWN WHAT YOU ARE DOING\n"
"\n"
"Enabling the toggle on devices where device unlocking\n"
"is not included in the lockscreen makes it impossible to\n"
"unlock the device via touch screen.\n"
"\n"
"Valid modes are: 'enabled' and 'disabled'\n"

Also, these options are interesting:

  • –disable-radio master
  • –set-forced-psm enable

The patch is very simple. The file to patch is /usr/share/jolla-settings/pages/devicelock/devicelock.qml

Example. The following patch adds two new device lock timeout options: 1 minute and 2 hours

--- a/usr/share/jolla-settings/pages/devicelock/devicelock.qml	Sat Jun 17 04:08:28 2023
+++ b/usr/share/jolla-settings/pages/devicelock/devicelock.qml	Sat Jun 17 04:33:14 2023
@@ -155,6 +155,13 @@
                         onClicked: lockingCombobox.setAutomaticLocking(0)
                     }
                     MenuItem {
+                        //% "1 minute"
+                        text: "1 minute"
+                        visible: deviceLockSettings.maximumAutomaticLocking === -1
+                                    || deviceLockSettings.maximumAutomaticLocking >= 1
+                        onClicked: lockingCombobox.setAutomaticLocking(1)
+                    }
+                    MenuItem {
                         //% "5 minutes"
                         text: qsTrId("settings_devicelock-me-on5")
                         visible: deviceLockSettings.maximumAutomaticLocking === -1
@@ -182,6 +189,13 @@
                                     || deviceLockSettings.maximumAutomaticLocking >= 60
                         onClicked: lockingCombobox.setAutomaticLocking(60)
                     }
+                    MenuItem {
+                        //% "2 hours"
+                        text: "120 minutes"
+                        visible: deviceLockSettings.maximumAutomaticLocking === -1
+                                    || deviceLockSettings.maximumAutomaticLocking >= 120
+                        onClicked: lockingCombobox.setAutomaticLocking(120)
+                    }
                 }
 
                 function setAutomaticLocking(minutes) {
@@ -205,14 +219,18 @@
                         return 0
                     } else if (value === 0) {
                         return 1
-                    } else if (value === 5) {
+                    } else if (value === 1) {
                         return 2
-                    } else if (value === 10) {
+                    } else if (value === 5) {
                         return 3
-                    } else if (value === 30) {
+                    } else if (value === 10) {
                         return 4
-                    } else if (value === 60) {
+                    } else if (value === 30) {
                         return 5
+                    } else if (value === 60) {
+                        return 6
+                    } else if (value === 120) {
+                        return 7
                     }
                 }
             }

Note: those two new options are not localized. They’re shown in English on the Settings page (i.e. “1 minute” and “120 minutes”). If you want them localized to your language, edit it in the patch.

The same way as above, you can add any further timeout options you want. It takes values in minutes, so I haven’t tested and do not know if timeouts shorter than 1 minute would work. Please try it yourself…

1 Like

Thanks, I appreciated your suggestion. :slight_smile:

I suppose that there is a way to automatically localise that text/label when the UI language is changed. Usually there is also a standard vocabulary for each word but sometimes the developer should insert their own translation longer text that a few words. BTW, I am using the UI in English.

Sure there is, it’s just that I didn’t bother to look up the corresponding localisation strings. Please feel free to find and report them: https://translate.sailfishos.org/

1 Like

These values seem work fine for me when I cover the luminosity sensor:

Adaptive dimming threshold: 100 (milliseconds)
Brightness fade [dim]:      100 (milliseconds)
Brightness fade [als]:      100 (milliseconds)
Brightness fade [blank]:    100 (milliseconds)

About this option:

-J, --set-adaptive-dimming-time=<secs>

the help report seconds but in the information is reported in milliseconds which would be fine but it is not. In fact, trying mcetool -J 1 is reported as 1ms.

Moreover, the option is about dimming time but in the information is reported as dimming threshold and the two meaning do not fit togheter, IMHO.