From eb15861b139de9f31d222b3cbde06614608d7c8f Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 29 Jul 2025 10:22:18 +0200 Subject: [PATCH 1/4] fix QuickUnlock layout to close #2956 --- .../Resources/layout/QuickUnlock.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/keepass2android-app/Resources/layout/QuickUnlock.xml b/src/keepass2android-app/Resources/layout/QuickUnlock.xml index 0c4da5c4..25fccc4d 100644 --- a/src/keepass2android-app/Resources/layout/QuickUnlock.xml +++ b/src/keepass2android-app/Resources/layout/QuickUnlock.xml @@ -78,21 +78,21 @@ android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="16dp"> - + - + Date: Tue, 29 Jul 2025 10:22:37 +0200 Subject: [PATCH 2/4] remove no longer used file --- .../Resources/layout/sftp_credentials.axml | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/keepass2android-app/Resources/layout/sftp_credentials.axml diff --git a/src/keepass2android-app/Resources/layout/sftp_credentials.axml b/src/keepass2android-app/Resources/layout/sftp_credentials.axml deleted file mode 100644 index f36879d2..00000000 --- a/src/keepass2android-app/Resources/layout/sftp_credentials.axml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file From a718c7ed7e521b31b5a7aa023a0384557dd28a47 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 29 Jul 2025 10:50:43 +0200 Subject: [PATCH 3/4] fix quickunlock layout also when showing the "blocked" message --- .../Resources/layout/QuickUnlock.xml | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/keepass2android-app/Resources/layout/QuickUnlock.xml b/src/keepass2android-app/Resources/layout/QuickUnlock.xml index 25fccc4d..4bf8fbaf 100644 --- a/src/keepass2android-app/Resources/layout/QuickUnlock.xml +++ b/src/keepass2android-app/Resources/layout/QuickUnlock.xml @@ -78,21 +78,27 @@ android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="16dp"> - - - + + + + - - + + From edb4907bf5060b29c4035637efe2fe68ef991c03 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 29 Jul 2025 10:53:02 +0200 Subject: [PATCH 4/4] add option to disable QuickUnlock blocking behavior, closes #2960 --- src/keepass2android-app/PasswordActivity.cs | 10 ++++++---- src/keepass2android-app/QuickUnlock.cs | 2 +- src/keepass2android-app/Resources/values/config.xml | 1 + src/keepass2android-app/Resources/values/strings.xml | 2 ++ .../Resources/xml/pref_app_quick_unlock.xml | 8 ++++++++ src/keepass2android-app/app/App.cs | 1 + 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/keepass2android-app/PasswordActivity.cs b/src/keepass2android-app/PasswordActivity.cs index 9cd6d54b..54374e28 100644 --- a/src/keepass2android-app/PasswordActivity.cs +++ b/src/keepass2android-app/PasswordActivity.cs @@ -1425,18 +1425,20 @@ namespace keepass2android App.Kp2a.SetQuickUnlockEnabled(cbQuickUnlock.Checked); App.Kp2a.ScreenLockWasEnabledWhenOpeningDatabase = (((KeyguardManager)GetSystemService(Context.KeyguardService)!)!).IsDeviceSecure; + App.Kp2a.QuickUnlockBlockedWhenDeviceNotSecureWhenOpeningDatabase = PreferenceManager.GetDefaultSharedPreferences(this) + .GetBoolean(GetString(Resource.String.QuickUnlockBlockedWhenDeviceNotSecure_key), true); - if ((_loadDbFileTask != null) && (App.Kp2a.OfflineMode != _loadDbTaskOffline)) + if ((_loadDbFileTask != null) && (App.Kp2a.OfflineMode != _loadDbTaskOffline)) { - if (App.Kp2a == null) + if (App.Kp2a == null) throw new NullPointerException("App.Kp2a"); //keep the loading result if we loaded in online-mode (now offline) and the task is completed if (!App.Kp2a.OfflineMode || !_loadDbFileTask.IsCompleted) { //discard the pre-loading task - _loadDbFileTask = null; + _loadDbFileTask = null; } - + } //avoid password being visible while loading: diff --git a/src/keepass2android-app/QuickUnlock.cs b/src/keepass2android-app/QuickUnlock.cs index 4a8b35fa..dd120953 100644 --- a/src/keepass2android-app/QuickUnlock.cs +++ b/src/keepass2android-app/QuickUnlock.cs @@ -175,7 +175,7 @@ namespace keepass2android App.Kp2a.Lock(false); }; - if (App.Kp2a.ScreenLockWasEnabledWhenOpeningDatabase == false) + if (App.Kp2a.ScreenLockWasEnabledWhenOpeningDatabase == false && App.Kp2a.QuickUnlockBlockedWhenDeviceNotSecureWhenOpeningDatabase) { FindViewById(Resource.Id.QuickUnlockForm).Visibility = ViewStates.Gone; FindViewById(Resource.Id.QuickUnlockBlocked).Visibility = ViewStates.Visible; diff --git a/src/keepass2android-app/Resources/values/config.xml b/src/keepass2android-app/Resources/values/config.xml index e5c3a97c..30b58fd4 100644 --- a/src/keepass2android-app/Resources/values/config.xml +++ b/src/keepass2android-app/Resources/values/config.xml @@ -123,6 +123,7 @@ 3 QuickUnlockIconHidden_key QuickUnlockIconHidden16_key + QuickUnlockBlockedWhenDeviceNotSecure_key UsageCount LastInfoVersion diff --git a/src/keepass2android-app/Resources/values/strings.xml b/src/keepass2android-app/Resources/values/strings.xml index 6c4f3c87..acea8843 100644 --- a/src/keepass2android-app/Resources/values/strings.xml +++ b/src/keepass2android-app/Resources/values/strings.xml @@ -330,6 +330,8 @@ QuickUnlock unfortunately does not work without displaying a notification icon. Select this option to use a transparent icon. Hide QuickUnlock icon QuickUnlock requires a notification to work properly. Select this option to display a notification without an icon. + Block entering the QuickUnlock key if the device is not secured by screen lock. This prevents shoulder surfing attacks. Only disable this option if you understand the risk. Note that QuickUnlock can still be used with biometrics. + Block QuickUnlock when device is not secure Length of QuickUnlock key Maximum number of characters used as QuickUnlock password. Hide QuickUnlock length diff --git a/src/keepass2android-app/Resources/xml/pref_app_quick_unlock.xml b/src/keepass2android-app/Resources/xml/pref_app_quick_unlock.xml index 5c676c5f..dedab5e0 100644 --- a/src/keepass2android-app/Resources/xml/pref_app_quick_unlock.xml +++ b/src/keepass2android-app/Resources/xml/pref_app_quick_unlock.xml @@ -26,6 +26,14 @@ android:defaultValue="false" android:title="@string/QuickUnlockIconHidden_title" android:key="@string/QuickUnlockIconHidden_key" /> + +