added option (enabled by default) to set FLAG_SECURE (prevent taking screenshots and displaying screenshots in recent apps)

This commit is contained in:
Philipp Crocoll 2014-12-01 07:32:12 +01:00
parent ac55c1fd86
commit fc832dd3dc
5 changed files with 30 additions and 1 deletions

View File

@ -18,7 +18,9 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
using System;
using Android.Content;
using Android.OS;
using Android.Preferences;
using Android.Runtime;
using Android.Views;
using KeePassLib.Serialization;
namespace keepass2android
@ -52,6 +54,14 @@ namespace keepass2android
{
base.OnCreate(savedInstanceState);
_design.ApplyTheme();
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
GetString(Resource.String.ViewDatabaseSecure_key), true))
{
Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
}
_ioc = App.Kp2a.GetDb().Ioc;
if (Intent.GetBooleanExtra(NoLockCheck, false))

View File

@ -20,6 +20,7 @@ using Android.Content;
using Android.OS;
using Android.Preferences;
using Android.Runtime;
using Android.Views;
using KeePassLib.Serialization;
namespace keepass2android
@ -42,6 +43,13 @@ namespace keepass2android
{
base.OnCreate(savedInstanceState);
_design.ApplyTheme();
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
GetString(Resource.String.ViewDatabaseSecure_key), true))
{
Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
}
_ioc = App.Kp2a.GetDb().Ioc;
_intentReceiver = new LockCloseListActivityBroadcastReceiver(this);

View File

@ -72,7 +72,7 @@
<bool name="TanExpiresOnUse_default">true</bool>
<bool name="ShowUsernameInList_default">true</bool>
<bool name="ShowGroupnameInSearchResult_default">true</bool>
<string name="ViewDatabaseSecure_key">ViewDatabaseSecure</string>
<bool name="RememberRecentFiles_default">true</bool>
<string name="TrayTotp_SettingsField_key">TrayTotp_SettingsField_key</string>
<string name="TrayTotp_SeedField_key">TrayTotp_SeedField_key</string>

View File

@ -229,6 +229,8 @@
<string name="QuickUnlock_lockButton">Close database</string>
<string name="QuickUnlockDefaultEnabled_title">Enable QuickUnlock by default</string>
<string name="QuickUnlockDefaultEnabled_summary">Defines whether QuickUnlock is enabled by default or not.</string>
<string name="ViewDatabaseSecure_title">Protect database display</string>
<string name="ViewDatabaseSecure_summary">Protect database display</string>
<string name="QuickUnlockIconHidden_title">Hide QuickUnlock icon</string>
<string name="QuickUnlockIconHidden_summary">QuickUnlock unfortunately does not work without displaying a notification icon. Select this option to use a transparent icon.</string>
<string name="QuickUnlockIconHidden16_title">Hide QuickUnlock icon</string>

View File

@ -160,6 +160,15 @@
android:dialogTitle="@string/list_size_summary"
android:defaultValue="@string/list_size_default"/>
<CheckBoxPreference
android:enabled="true"
android:persistent="true"
android:summary="@string/ViewDatabaseSecure_summary"
android:defaultValue="true"
android:title="@string/ViewDatabaseSecure_title"
android:key="@string/ViewDatabaseSecure_key" />
<ListPreference
android:key="@string/design_key"
android:title="@string/design_title"