Use RestrictedPreference for all biometric settings.
Fix hardcoded preference key in settings controller. Fix: 194708564 Bug: 194246380 Test: manual Test: make RunSettingsRoboTests Change-Id: I86bdd40fd848c5ba2d39acfde4771f5969e640d1
This commit is contained in:
@@ -48,6 +48,8 @@ import org.robolectric.shadows.ShadowApplication;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class CombinedBiometricStatusPreferenceControllerTest {
|
||||
|
||||
private static final String TEST_PREF_KEY = "foo";
|
||||
|
||||
@Mock
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
@Mock
|
||||
@@ -80,7 +82,7 @@ public class CombinedBiometricStatusPreferenceControllerTest {
|
||||
when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(mContext))
|
||||
.thenReturn(mLockPatternUtils);
|
||||
when(mUm.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[] {1234});
|
||||
mController = new CombinedBiometricStatusPreferenceController(mContext);
|
||||
mController = new CombinedBiometricStatusPreferenceController(mContext, TEST_PREF_KEY);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -55,6 +55,9 @@ import java.util.Collections;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class FaceStatusPreferenceControllerTest {
|
||||
|
||||
private static final String TEST_PREF_KEY = "baz";
|
||||
|
||||
@Mock
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
@Mock
|
||||
@@ -82,7 +85,7 @@ public class FaceStatusPreferenceControllerTest {
|
||||
when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(mContext))
|
||||
.thenReturn(mLockPatternUtils);
|
||||
when(mUm.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[] {1234});
|
||||
mController = new FaceStatusPreferenceController(mContext);
|
||||
mController = new FaceStatusPreferenceController(mContext, TEST_PREF_KEY);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -44,6 +44,7 @@ import org.robolectric.shadows.ShadowApplication;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class FingerprintProfileStatusPreferenceControllerTest {
|
||||
|
||||
private static final String TEST_PREF_KEY = "bar";
|
||||
private static final int FAKE_PROFILE_USER_ID = 1234;
|
||||
|
||||
@Mock
|
||||
@@ -73,7 +74,7 @@ public class FingerprintProfileStatusPreferenceControllerTest {
|
||||
when(mFeatureFactory.securityFeatureProvider.getLockPatternUtils(mContext))
|
||||
.thenReturn(mLockPatternUtils);
|
||||
when(mUm.getProfileIdsWithDisabled(anyInt())).thenReturn(new int[] {1234});
|
||||
mController = new FingerprintProfileStatusPreferenceController(mContext);
|
||||
mController = new FingerprintProfileStatusPreferenceController(mContext, TEST_PREF_KEY);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,6 +105,8 @@ public class FingerprintProfileStatusPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void getPreferenceKey_byDefault_returnsDefaultValue() {
|
||||
mController = new FingerprintProfileStatusPreferenceController(mContext);
|
||||
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo("fingerprint_settings_profile");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user