diff options
| author | Matthew Wong <wongma@protonmail.ch> | 2015-08-11 18:32:16 -0400 |
|---|---|---|
| committer | Matthew Wong <wongma@protonmail.ch> | 2015-08-14 17:36:51 -0400 |
| commit | b75190fcd7926c3994f8191996661c19b7b12466 (patch) | |
| tree | 55cb027f2902113d77c4826cac7f53d618000a0d /app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java | |
| parent | d42c526b648030ee251d9136b8d924395b74bb9c (diff) | |
| download | HardenedPass-b75190fcd7926c3994f8191996661c19b7b12466.tar.gz HardenedPass-b75190fcd7926c3994f8191996661c19b7b12466.zip | |
Add 'automatically match by default' setting; respect it & per-app settings when creating autofill dialog
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java index 37066b8f..2a80a449 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java @@ -102,7 +102,7 @@ public class AutofillService extends AccessibilityService { dialog.dismiss(); } - // ignore the ACTION_FOCUS from decryptAndVerify + // ignore the ACTION_FOCUS from decryptAndVerify otherwise dialog will appear after Fill if (ignoreActionFocus) { ignoreActionFocus = false; return; @@ -124,7 +124,23 @@ public class AutofillService extends AccessibilityService { applicationInfo = null; } final String appName = (applicationInfo != null ? packageManager.getApplicationLabel(applicationInfo) : "").toString(); - items = recursiveFilter(appName, null); + + // if autofill_default is checked and prefs.getString DNE, 'Automatically match with password'/"first" otherwise "never" + String defValue = settings.getBoolean("autofill_default", true) ? "first" : "never"; + SharedPreferences prefs = getSharedPreferences("autofill", Context.MODE_PRIVATE); + String preference = prefs.getString(event.getPackageName().toString(), defValue); + switch (preference) { + case "first": + items = recursiveFilter(appName, null); + break; + case "never": + return; + default: + String path = PasswordRepository.getWorkTree() + "/" + preference + ".gpg"; + File file = new File(path); + items = new ArrayList<>(); + items.add(PasswordItem.newPassword(file.getName(), file)); + } if (items.isEmpty()) { return; } |
