Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit acb38db8 authored by mxyyiyi's avatar mxyyiyi Committed by Xinyi Mao
Browse files

[A11y] Ignore the INTERRUPT event in spinner.

- Fix the incorrect talkback info which that in each time screen updated, Spinner will send a interrupt event TYPE_VIEW_SELECTED to let talkback speak for it.

Fix: 401123984
Test: talkback
Flag: EXEMPT for simple fix
Change-Id: I1d7146b77e3a7c93ab1ba7bba7d989bc73f55e37
parent 5adfd4a5
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settingslib.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.AdapterView;
import android.widget.Spinner;

@@ -110,7 +111,6 @@ public class SettingsSpinnerPreference extends Preference
        notifyChanged();
    }


    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
@@ -119,6 +119,18 @@ public class SettingsSpinnerPreference extends Preference
        spinner.setSelection(mPosition);
        spinner.setOnItemSelectedListener(mOnSelectedListener);
        spinner.setLongClickable(false);
        spinner.setAccessibilityDelegate(
                new View.AccessibilityDelegate() {
                    @Override
                    public void sendAccessibilityEvent(View host, int eventType) {
                        if (eventType == AccessibilityEvent.TYPE_VIEW_SELECTED) {
                            // Ignore the INTERRUPT events TYPE_VIEW_SELECTED or Talkback will speak
                            // for it while fragment updating.
                            return;
                        }
                        super.sendAccessibilityEvent(host, eventType);
                    }
                });
        if (mShouldPerformClick) {
            mShouldPerformClick = false;
            // To show dropdown view.