diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java | 2 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java index d8e50ebd..6d11936b 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillActivity.java @@ -34,7 +34,7 @@ public class AutofillActivity extends AppCompatActivity { protected void onActivityResult(int requestCode, int resultCode, Intent data) { finish(); // go back to the password field app if (resultCode == RESULT_OK) { - AutofillService.setUnlockOK(); // report the result to service + AutofillService.setResultData(data); // report the result to service } } } 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()); |