fix(android): api17 crash on a11y service (#9792)

This commit is contained in:
Igor Randjelovic
2022-02-21 18:34:32 +01:00
committed by Nathan Walker
parent 3140b9c8fe
commit 2efcdf5787

View File

@@ -71,19 +71,20 @@ function ensureStateListener(): SharedA11YObservable {
} }
}, },
}); });
touchExplorationStateChangeListener = new android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener({
onTouchExplorationStateChanged(enabled) {
updateAccessibilityState();
if (Trace.isEnabled()) {
Trace.write(`TouchExplorationStateChangeListener state changed to: ${!!enabled}`, Trace.categories.Accessibility);
}
},
});
accessibilityManager.addAccessibilityStateChangeListener(accessibilityStateChangeListener); accessibilityManager.addAccessibilityStateChangeListener(accessibilityStateChangeListener);
accessibilityManager.addTouchExplorationStateChangeListener(touchExplorationStateChangeListener);
if (android.os.Build.VERSION.SDK_INT >= 19) {
touchExplorationStateChangeListener = new android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener({
onTouchExplorationStateChanged(enabled) {
updateAccessibilityState();
if (Trace.isEnabled()) {
Trace.write(`TouchExplorationStateChangeListener state changed to: ${!!enabled}`, Trace.categories.Accessibility);
}
},
});
accessibilityManager.addTouchExplorationStateChangeListener(touchExplorationStateChangeListener);
}
updateAccessibilityState(); updateAccessibilityState();