Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What triggers a call to AccessibilityInteractionController.performAccessibilityActionUiThread on Android?

There is a crash on a Samsung Galaxy S 7 Edge when a user is interacting with an EditText that has a LengthFilter InputFilter applied. How would a user cause the method AccessibilityInteractionController.performAccessibilityActionUiThread to be called?

I looked at the source of AccessibilityInteractionController but I cannot find good documentation of how a user would trigger that method.

My crash's stack trace is similar to what is posted in these questions:

  • Android exception - Unknown origin (possibly widget)
  • My Android App has IndexOutOfBoundsException,how to solved?
like image 460
B W Avatar asked Nov 29 '25 15:11

B W


1 Answers

Looking into Android's issue tracker, it seems that this issue is due to password managers using Accessibility events to generate passwords. However, generated password don't respect the maxLength property, causing the crash.

The suggested solution seems to work: creating a subclass, and using that instead. (Copying the code for reference)

public class SafePinEntryEditText extends EditText {

    public SafePinEntryEditText(Context context) {
        super(context);
    }

    public SafePinEntryEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public SafePinEntryEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(21)
    public SafePinEntryEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public void setSelection(int index) {
        // prevent index out of bounds caused by AccessibilityService events
        if (index > length()) {
            index = length();
        }
        super.setSelection(index);
    }

    @Override
    public void setSelection(int start, int stop) {
        // prevent index out of bounds caused by AccessibilityService events
        if (start > length()) {
            start = length();
        }
        if (stop > length()) {
            stop = length();
        }
        super.setSelection(start, stop);
    }
}
like image 129
verybadalloc Avatar answered Dec 01 '25 06:12

verybadalloc