fix: Screenshot protection #1870

This commit is contained in:
J-Jamet 2024-11-17 19:32:23 +01:00
parent 6866b1a3bb
commit 4c30fa43d3
4 changed files with 18 additions and 3 deletions

View file

@ -7,7 +7,7 @@ KeePassDX(4.1.0)
* Resets the advanced unlock expiration #1600
* Password entropy #1490 #1355
* Upgrade to API 34 (Android 14) #1730
* Small fixes #1711 #1831 #1780 #1821 #1863 #1889 #1289 #1600 #1467
* Small fixes #1711 #1831 #1780 #1821 #1863 #1889 #1289 #1600 #1467 #1870
KeePassDX(4.0.8)
* Fix graphical bug that prevented databases from being opened on some versions of Android #1848 #1850

View file

@ -1,11 +1,14 @@
package com.kunzisoft.keepass.activities.dialogs
import android.os.Bundle
import android.view.View
import android.view.WindowManager.LayoutParams.FLAG_SECURE
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.activityViewModels
import com.kunzisoft.keepass.activities.legacy.DatabaseRetrieval
import com.kunzisoft.keepass.activities.legacy.resetAppTimeoutWhenViewTouchedOrFocused
import com.kunzisoft.keepass.database.ContextualDatabase
import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.tasks.ActionRunnable
import com.kunzisoft.keepass.timeout.TimeoutHelper
import com.kunzisoft.keepass.viewmodels.DatabaseViewModel
@ -29,6 +32,18 @@ abstract class DatabaseDialogFragment : DialogFragment(), DatabaseRetrieval {
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Screenshot mode or hide views
context?.let {
if (PreferencesUtil.isScreenshotModeEnabled(it)) {
dialog?.window?.clearFlags(FLAG_SECURE)
} else {
dialog?.window?.setFlags(FLAG_SECURE, FLAG_SECURE)
}
}
}
@Suppress("DEPRECATION")
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)

View file

@ -6,4 +6,4 @@
* Resets the advanced unlock expiration #1600
* Password entropy #1490 #1355
* Upgrade to API 34 (Android 14) #1730
* Small fixes #1711 #1831 #1780 #1821 #1863 #1889 #1289 #1600 #1467
* Small fixes #1711 #1831 #1780 #1821 #1863 #1889 #1289 #1600 #1467 #1870

View file

@ -5,4 +5,4 @@
* Correction des noms de domaines #1105 #1820
* Entropie de mot de passe #1490 #1355
* Mise à jour vers API 34 (Android 14)
* Petites corrections #1711 #1831 #1780 #1821 #1863 #1889 #1289 #1600 #1467
* Petites corrections #1711 #1831 #1780 #1821 #1863 #1889 #1289 #1600 #1467 #1870