diff options
| author | Matthew Wong <wongma@protonmail.ch> | 2015-09-03 15:00:01 -0400 |
|---|---|---|
| committer | Matthew Wong <wongma@protonmail.ch> | 2015-09-03 15:00:01 -0400 |
| commit | 68e1495ef26645750e111cb7a7299c2b9efd2be3 (patch) | |
| tree | 4714747eefc984403bdfa10719b83b595e8ec55d /app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java | |
| parent | c534cfe49875c6fc84050cc02c653eb5a57bcddc (diff) | |
| download | HardenedPass-68e1495ef26645750e111cb7a7299c2b9efd2be3.tar.gz HardenedPass-68e1495ef26645750e111cb7a7299c2b9efd2be3.zip | |
Use openpgpapi correctly to address #128
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 | 17 |
1 files changed, 11 insertions, 6 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 ea09c863..8a4a80bf 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java @@ -44,7 +44,7 @@ public class AutofillService extends AccessibilityService { private ArrayList<PasswordItem> items; // password choices private AlertDialog dialog; private AccessibilityWindowInfo window; - private static boolean unlockOK = false; // if openkeychain user interaction was successful + private static Intent resultData = null; // need the intent which contains results from user interaction private CharSequence packageName; private boolean ignoreActionFocus = false; @@ -52,7 +52,7 @@ public class AutofillService extends AccessibilityService { public static final String TAG = "Keychain"; } - public static void setUnlockOK() { unlockOK = true; } + public static void setResultData(Intent data) { resultData = data; } @Override protected void onServiceConnected() { @@ -66,7 +66,7 @@ public class AutofillService extends AccessibilityService { public void onAccessibilityEvent(AccessibilityEvent event) { // if returning to the source app from a successful AutofillActivity if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED - && event.getPackageName().equals(packageName) && unlockOK) { + && event.getPackageName().equals(packageName) && resultData != null) { decryptAndVerify(); } @@ -203,10 +203,15 @@ public class AutofillService extends AccessibilityService { } public void decryptAndVerify() { - unlockOK = false; packageName = info.getPackageName(); - Intent data = new Intent(); - data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); + Intent data; + if (resultData == null) { + data = new Intent(); + data.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); + } else { + data = resultData; + resultData = null; + } InputStream is = null; try { is = FileUtils.openInputStream(items.get(0).getFile()); |
