Remove face/fignerprint search if not present

Test: Verified manually with a device that if face/fingerprint are not
present they do not show up.
Fixes: 350599580
Flag: EXEMPT bugfix

Change-Id: I6a691d2985e4839336e9c08dfa6c97abe23f43f2
This commit is contained in:
Joshua McCloskey
2024-07-24 16:19:33 +00:00
committed by Joshua Mccloskey
parent 441a202444
commit ed59922ca8
5 changed files with 77 additions and 1 deletions

View File

@@ -339,6 +339,30 @@ public class SecuritySettingsTest {
assertThat(mPreferenceCombined.isVisible()).isFalse();
}
@Test
public void noFace_isNotIndexable() throws Exception {
when(mFaceManager.isHardwareDetected()).thenReturn(false);
final BaseSearchIndexProvider indexProvider = SecuritySettings.SEARCH_INDEX_DATA_PROVIDER;
final List<String> allXmlKeys = TestUtils.getAllXmlKeys(mContext, indexProvider);
final List<String> nonIndexableKeys = indexProvider.getNonIndexableKeys(mContext);
allXmlKeys.removeAll(nonIndexableKeys);
assertThat(allXmlKeys).doesNotContain(SecuritySettings.KEY_FACE_SETTINGS);
}
@Test
public void noFingerprint_isNotIndexable() throws Exception {
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
final BaseSearchIndexProvider indexProvider = SecuritySettings.SEARCH_INDEX_DATA_PROVIDER;
final List<String> allXmlKeys = TestUtils.getAllXmlKeys(mContext, indexProvider);
final List<String> nonIndexableKeys = indexProvider.getNonIndexableKeys(mContext);
allXmlKeys.removeAll(nonIndexableKeys);
assertThat(allXmlKeys).doesNotContain(SecuritySettings.KEY_FINGERPRINT_SETTINGS);
}
boolean isFacePrefAvailable(List<AbstractPreferenceController> controllers) {
return controllers.stream().filter(
controller -> controller instanceof FaceStatusPreferenceController