Resolving duplicate “Fingerprint Sensor” talkback in Side-FPS SUW
Prevents Talkback from announcing “Fingerprint Sensor” twice in the side-FPS fingerprint enrollment page in setup wizard. Two accessibility events that speak “Fingerprint Sensor” are sent when the Talkback focus lands on the sensor location indicator, so we override the AccessibilityDelegate dispatcher to intercept and ignore the first event. Fixes: 209933998 Test: atest SidefpsControllerTest Change-Id: Ib5fad6dc0b36eb69b6084296956c12a9b25e28bb
This commit is contained in:
@@ -33,6 +33,8 @@ import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
|
||||
import android.hardware.fingerprint.ISidefpsController
|
||||
import android.os.Handler
|
||||
import android.util.Log
|
||||
import android.view.View.AccessibilityDelegate
|
||||
import android.view.accessibility.AccessibilityEvent
|
||||
import android.view.Display
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
@@ -181,6 +183,23 @@ class SidefpsController @Inject constructor(
|
||||
}
|
||||
lottie.addOverlayDynamicColor(context)
|
||||
|
||||
/**
|
||||
* Intercepts TYPE_WINDOW_STATE_CHANGED accessibility event, preventing Talkback from
|
||||
* speaking @string/accessibility_fingerprint_label twice when sensor location indicator
|
||||
* is in focus
|
||||
*/
|
||||
view.setAccessibilityDelegate(object : AccessibilityDelegate() {
|
||||
override fun dispatchPopulateAccessibilityEvent(
|
||||
host: View,
|
||||
event: AccessibilityEvent
|
||||
): Boolean {
|
||||
return if (event.getEventType() === AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
true
|
||||
} else {
|
||||
super.dispatchPopulateAccessibilityEvent(host, event)
|
||||
}
|
||||
}
|
||||
})
|
||||
return view
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user