With android AccessibilityService
able to paste in other app EditText
Field, but with browser testfields
(Emulator Default Browser or Samsung deault Browser) its not working, throwing error:
Cannot perform this action on a not sealed instance.
In android chrome browser with some singnup textfield its working but not for all textfields.
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
AccessibilityNodeInfo source = event.getSource();
if (source != null && ( event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED ) ) {
// || event.getEventType() == AccessibilityEvent.TYPE_VIEW_CLICKED ) &&
//event.getClassName().equals("android.widget.EditText")
//) {
ctx = getApplicationContext();
ClipboardManager clipboard = (ClipboardManager) ctx.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", "XYZ");
clipboard.setPrimaryClip(clip);
source.performAction(AccessibilityNodeInfo.ACTION_PASTE);
//Not Working, always return false.
//Tried with other options
Bundle argumentsTest = new Bundle();
argumentsTest.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, "Bundle Test Data");
source.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT,argumentsTest )
// Not Working, throw java.lang.IllegalStateException exception
//Message: "Cannot perform this action on a not sealed instance"
}
}