aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
diff options
context:
space:
mode:
authorFelix Bechstein <f@ub0r.de>2017-07-22 12:09:34 +0200
committerMohamed Zenadi <zeapo@users.noreply.github.com>2017-07-22 12:09:34 +0200
commit5cba6c62d7b4628dfaf482dd883e333f93d323d4 (patch)
treeb28df0db4ca187df0cabc575bbd89c009f69e127 /app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
parent6ce31056c987b8fd73513d5b4eebc8d0d763a7a2 (diff)
downloadHardenedPass-5cba6c62d7b4628dfaf482dd883e333f93d323d4.tar.gz
HardenedPass-5cba6c62d7b4628dfaf482dd883e333f93d323d4.zip
Parse username from password entry, refs #192 (#318)
This is a first step of letting APS handle usernames from password entries. It shows the username in PgpHandler and allows to copy it to the clipboard.
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.java7
1 files changed, 4 insertions, 3 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 447f39f3..004a0bbd 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
@@ -23,6 +23,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityWindowInfo;
import android.widget.Toast;
+import com.zeapo.pwdstore.PasswordEntry;
import com.zeapo.pwdstore.R;
import com.zeapo.pwdstore.utils.PasswordRepository;
@@ -492,7 +493,7 @@ public class AutofillService extends AccessibilityService {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
case OpenPgpApi.RESULT_CODE_SUCCESS: {
try {
- String[] passContent = os.toString("UTF-8").split("\n");
+ final PasswordEntry entry = new PasswordEntry(os);
// if the user focused on something else, take focus back
// but this will open another dialog...hack to ignore this
@@ -501,11 +502,11 @@ public class AutofillService extends AccessibilityService {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Bundle args = new Bundle();
args.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
- passContent[0]);
+ entry.getPassword());
info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, args);
} else {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip = ClipData.newPlainText("autofill_pm", passContent[0]);
+ ClipData clip = ClipData.newPlainText("autofill_pm", entry.getPassword());
clipboard.setPrimaryClip(clip);
info.performAction(AccessibilityNodeInfo.ACTION_PASTE);