"Unable to perform this action on an unsealed instance" java.lang.IllegalStateException exception

Using an android AccessibilityServicethat can be inserted into another EditTextField application , but testfieldsit doesn’t work with the browser (the default emulator for the emulator browser or Samsung deault Browser), throwing error:

This action cannot be performed on an unsealed instance.

In the android browser, chrome with some text field singnup works, but not for all text fields.

 @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"
    }
}   
+4
source share
1 answer

I do not believe that you are trying to do what you think you are trying to do.

"" accessibilityNodeInfo, , , , . , EditText, accessibilityNodeInfo. , , . , . , , , . , , , . ( ). . , node, View API. , , .

, , , . "ACTION_PASTE" () , , - . , Android, , - .. . , , WebView ( -, + + WebViews WebKit, ). Nexus, Android 5.0 , . , . -?

+5

Source: https://habr.com/ru/post/1609078/


All Articles