javaandroidaccessibilitylastpass

Fill in EditText of any app from (Accessibility)Service?


How does Lastpass manage this?!

AccessibilityNodeInfo has a setText() method, but I feel like this is a red herring as the docs state,

Note: Cannot be called from an AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Another user asked a similar question a while back, but the recent updates to LastPass prove that it is indeed possible.

Set text in AccessibilityNodeInfo


Solution

  • I found some better solution rather than ACTION_PASTE. I feel ACTION_PASTE makes delay and didn't work properly. ACTION_SET_TEXT works fine for me, check with you.

    public void pasteText(AccessibilityNodeInfo node, String text) {
            Bundle arguments = new Bundle();
            arguments.putString(AccessibilityNodeInfoCompat.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
            node.performAction(AccessibilityNodeInfoCompat.ACTION_SET_TEXT, arguments);
        }