Exclude encrypted fingerprint data from settings backup

This commit is contained in:
Brian Pellin committed 2017-11-02 21:58:36 -05:00
1 parent 893ecb6a91
commit e4ee9ac115
3 files changed
+35 -4

No files matched your search

+1
View File
@@ -15,6 +15,7 @@
android:label="@string/app_name"
android:icon="@drawable/launcher"
android:name="com.keepassdroid.app.App"
android:fullBackupContent="@xml/backup"
android:allowBackup="true"
android:backupAgent="com.keepassdroid.backup.SettingsBackupAgent">
<meta-data android:name="com.google.android.backup.api_key"
@@ -21,6 +21,7 @@ package com.keepassdroid;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
@@ -90,6 +91,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
private Uri mKeyUri = null;
private boolean mRememberKeyfile;
SharedPreferences prefs;
SharedPreferences prefsNoBackup;
private FingerPrintHelper fingerPrintHelper;
private int mode;
@@ -192,6 +194,12 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
Intent i = getIntent();
prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefsNoBackup = getSharedPreferences("nobackup", Context.MODE_PRIVATE);
prefsNoBackup.edit()
.putString("test", "test")
.commit();
mRememberKeyfile = prefs.getBoolean(getString(R.string.keyfile_key), getResources().getBoolean(R.bool.keyfile_default));
setContentView(R.layout.password);
@@ -331,7 +339,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
} else if (mode == Cipher.DECRYPT_MODE) {
// retrieve the encrypted value from preferences
final String encryptedValue = prefs.getString(getPreferenceKeyValue(), null);
final String encryptedValue = prefsNoBackup.getString(getPreferenceKeyValue(), null);
if (encryptedValue != null) {
fingerPrintHelper.decryptData(encryptedValue);
}
@@ -364,7 +372,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
fingerPrintHelper.initEncryptData();
break;
case Cipher.DECRYPT_MODE:
final String ivSpecValue = prefs.getString(getPreferenceKeyIvSpec(), null);
final String ivSpecValue = prefsNoBackup.getString(getPreferenceKeyIvSpec(), null);
fingerPrintHelper.initDecryptData(ivSpecValue);
break;
}
@@ -412,7 +420,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
fingerprintView.setAlpha(1f);
}
// fingerprint available but no stored password found yet for this DB so show info don't listen
if (prefs.getString(getPreferenceKeyValue(), null) == null) {
if (prefsNoBackup.getString(getPreferenceKeyValue(), null) == null) {
confirmationView.setText(R.string.no_password_stored);
}
@@ -431,7 +439,7 @@ public class PasswordActivity extends LockingActivity implements FingerPrintHelp
final String value,
final String ivSpec) {
prefs.edit()
prefsNoBackup.edit()
.putString(getPreferenceKeyValue(), value)
.putString(getPreferenceKeyIvSpec(), ivSpec)
.commit();
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Brian Pellin.
This file is part of KeePassDroid.
KeePassDroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
KeePassDroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with KeePassDroid. If not, see <http://www.gnu.org/licenses/>.
-->
<full-backup-content>
<exclude domain="sharedpref" path="nobackup.xml"/>
</full-backup-content>