Do not allow toggle to be clickable/focusable
The entire preference is already clickable/focusable. Also, changed it so that
the entire preferenceview is clickable/focusable in non-accessibility mode as well
to better match Settings UX.
Also, no need to setClickable, since it is already by default
Fixes: 130398575
Test: With and without accessibility turned on, toggle works
Test: With accessibility turned on, toggle no longer takes a separate
focus in addition to the preference
Change-Id: Iaff05cdf350f8d4f4c0f53b539770a7ad1f7d8ad
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java b/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java
index dffc67d..f6ba0f9 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollAccessibilityToggle.java
@@ -60,6 +60,8 @@
}
mSwitch = findViewById(R.id.toggle);
mSwitch.setChecked(false);
+ mSwitch.setClickable(false);
+ mSwitch.setFocusable(false);
}
public boolean isChecked() {
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 4bf5a1d..5b30870 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -159,13 +159,12 @@
mSwitchDiversity = findViewById(R.id.toggle_diversity);
mSwitchDiversity.setListener(mSwitchDiversityListener);
+ mSwitchDiversity.setOnClickListener(v -> {
+ mSwitchDiversity.getSwitch().toggle();
+ });
if (accessibilityEnabled) {
accessibilityButton.callOnClick();
- mSwitchDiversity.setClickable(true);
- mSwitchDiversity.setOnClickListener(v -> {
- mSwitchDiversity.getSwitch().toggle();
- });
}
}