Loading src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java +2 −6 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class ActiveUnlockStatusUtils { * used. */ public boolean useUnlockIntentLayout() { return isAvailable() && UNLOCK_INTENT_LAYOUT.equals(getFlagState()); return isAvailable(); } /** Loading @@ -84,7 +84,7 @@ public class ActiveUnlockStatusUtils { * should be used. */ public boolean useBiometricFailureLayout() { return isAvailable() && BIOMETRIC_FAILURE_LAYOUT.equals(getFlagState()); return false; } /** Loading Loading @@ -156,10 +156,6 @@ public class ActiveUnlockStatusUtils { if (!Utils.hasFingerprintHardware(mContext) && !Utils.hasFaceHardware(mContext)) { return BasePreferenceController.UNSUPPORTED_ON_DEVICE; } if (!UNLOCK_INTENT_LAYOUT.equals(getFlagState()) && !BIOMETRIC_FAILURE_LAYOUT.equals(getFlagState())) { return BasePreferenceController.CONDITIONALLY_UNAVAILABLE; } if (getAuthority() != null && getIntent() != null) { return BasePreferenceController.AVAILABLE; } Loading tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusPreferenceControllerTest.java +0 −42 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.UserManager; import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.testutils.ActiveUnlockTestUtils; import com.android.settings.testutils.shadow.ShadowDeviceConfig; import com.android.settingslib.RestrictedPreference; Loading Loading @@ -163,47 +162,6 @@ public class ActiveUnlockStatusPreferenceControllerTest { assertThat(mPreference.getSummary().toString()).isEqualTo(summary); } @Test public void biometricsNotSetUp_deviceNameIsNotSet_setupBiometricStringShown() { ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); updateSummary("newSummary"); mController.displayPreference(mPreferenceScreen); mController.onStart(); idleMainLooper(); assertThat(mPreference.getSummary()).isEqualTo(mContext.getString( R.string.security_settings_activeunlock_require_face_fingerprint_setup_title)); } @Test public void biometricNotSetUp_deviceNameIsSet_summaryShown() { ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); String summary = "newSummary"; updateSummary(summary); updateDeviceName("deviceName"); mController.displayPreference(mPreferenceScreen); mController.onStart(); idleMainLooper(); assertThat(mPreference.getSummary()).isEqualTo(summary); } @Test public void biometricSetUp_summaryShown() { when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(true); ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); String summary = "newSummary"; updateSummary(summary); mController.displayPreference(mPreferenceScreen); mController.onStart(); idleMainLooper(); assertThat(mPreference.getSummary()).isEqualTo(summary); } private void updateSummary(String summary) { FakeContentProvider.setTileSummary(summary); mContext.getContentResolver().notifyChange(FakeContentProvider.URI, null /* observer */); Loading tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java +0 −33 Original line number Diff line number Diff line Loading @@ -128,15 +128,6 @@ public class ActiveUnlockStatusUtilsTest { assertThat(mActiveUnlockStatusUtils.useBiometricFailureLayout()).isFalse(); } @Test public void configIsBiometricFailure_useBiometricFailureLayoutIsTrue() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); assertThat(mActiveUnlockStatusUtils.useUnlockIntentLayout()).isFalse(); assertThat(mActiveUnlockStatusUtils.useBiometricFailureLayout()).isTrue(); } @Test public void getTitle_faceEnabled_returnsFacePreferenceTitle() { when(mFingerprintManager.isHardwareDetected()).thenReturn(false); Loading @@ -157,30 +148,6 @@ public class ActiveUnlockStatusUtilsTest { R.string.security_settings_fingerprint_preference_title)); } @Test public void getIntro_faceEnabled_returnsIntroWithFace() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); when(mFingerprintManager.isHardwareDetected()).thenReturn(false); when(mFaceManager.isHardwareDetected()).thenReturn(true); assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) .isEqualTo(mApplicationContext.getString( R.string.biometric_settings_intro_with_face)); } @Test public void getIntro_fingerprintEnabled_returnsIntroWithFingerprint() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); when(mFingerprintManager.isHardwareDetected()).thenReturn(true); when(mFaceManager.isHardwareDetected()).thenReturn(false); assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) .isEqualTo(mApplicationContext.getString( R.string.biometric_settings_intro_with_fingerprint)); } @Test public void getIntro_unlockOnIntentAndFaceEnabled_returnsEmpty() { ActiveUnlockTestUtils.enable( Loading tests/robotests/src/com/android/settings/testutils/ActiveUnlockTestUtils.java +2 −0 Original line number Diff line number Diff line Loading @@ -84,5 +84,7 @@ public final class ActiveUnlockTestUtils { ActiveUnlockStatusUtils.CONFIG_FLAG_NAME, null /* value */, false /* makeDefault */); Settings.Secure.putString(context.getContentResolver(), TARGET_SETTING, null); Settings.Secure.putString(context.getContentResolver(), PROVIDER_SETTING, null); } } tests/unit/src/com/android/settings/testutils/ActiveUnlockTestUtils.java +2 −0 Original line number Diff line number Diff line Loading @@ -84,5 +84,7 @@ public final class ActiveUnlockTestUtils { ActiveUnlockStatusUtils.CONFIG_FLAG_NAME, null /* value */, false /* makeDefault */); Settings.Secure.putString(context.getContentResolver(), TARGET_SETTING, null); Settings.Secure.putString(context.getContentResolver(), PROVIDER_SETTING, null); } } Loading
src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java +2 −6 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class ActiveUnlockStatusUtils { * used. */ public boolean useUnlockIntentLayout() { return isAvailable() && UNLOCK_INTENT_LAYOUT.equals(getFlagState()); return isAvailable(); } /** Loading @@ -84,7 +84,7 @@ public class ActiveUnlockStatusUtils { * should be used. */ public boolean useBiometricFailureLayout() { return isAvailable() && BIOMETRIC_FAILURE_LAYOUT.equals(getFlagState()); return false; } /** Loading Loading @@ -156,10 +156,6 @@ public class ActiveUnlockStatusUtils { if (!Utils.hasFingerprintHardware(mContext) && !Utils.hasFaceHardware(mContext)) { return BasePreferenceController.UNSUPPORTED_ON_DEVICE; } if (!UNLOCK_INTENT_LAYOUT.equals(getFlagState()) && !BIOMETRIC_FAILURE_LAYOUT.equals(getFlagState())) { return BasePreferenceController.CONDITIONALLY_UNAVAILABLE; } if (getAuthority() != null && getIntent() != null) { return BasePreferenceController.AVAILABLE; } Loading
tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusPreferenceControllerTest.java +0 −42 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.UserManager; import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.testutils.ActiveUnlockTestUtils; import com.android.settings.testutils.shadow.ShadowDeviceConfig; import com.android.settingslib.RestrictedPreference; Loading Loading @@ -163,47 +162,6 @@ public class ActiveUnlockStatusPreferenceControllerTest { assertThat(mPreference.getSummary().toString()).isEqualTo(summary); } @Test public void biometricsNotSetUp_deviceNameIsNotSet_setupBiometricStringShown() { ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); updateSummary("newSummary"); mController.displayPreference(mPreferenceScreen); mController.onStart(); idleMainLooper(); assertThat(mPreference.getSummary()).isEqualTo(mContext.getString( R.string.security_settings_activeunlock_require_face_fingerprint_setup_title)); } @Test public void biometricNotSetUp_deviceNameIsSet_summaryShown() { ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); String summary = "newSummary"; updateSummary(summary); updateDeviceName("deviceName"); mController.displayPreference(mPreferenceScreen); mController.onStart(); idleMainLooper(); assertThat(mPreference.getSummary()).isEqualTo(summary); } @Test public void biometricSetUp_summaryShown() { when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(true); ActiveUnlockTestUtils.enable(mContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); String summary = "newSummary"; updateSummary(summary); mController.displayPreference(mPreferenceScreen); mController.onStart(); idleMainLooper(); assertThat(mPreference.getSummary()).isEqualTo(summary); } private void updateSummary(String summary) { FakeContentProvider.setTileSummary(summary); mContext.getContentResolver().notifyChange(FakeContentProvider.URI, null /* observer */); Loading
tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java +0 −33 Original line number Diff line number Diff line Loading @@ -128,15 +128,6 @@ public class ActiveUnlockStatusUtilsTest { assertThat(mActiveUnlockStatusUtils.useBiometricFailureLayout()).isFalse(); } @Test public void configIsBiometricFailure_useBiometricFailureLayoutIsTrue() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); assertThat(mActiveUnlockStatusUtils.useUnlockIntentLayout()).isFalse(); assertThat(mActiveUnlockStatusUtils.useBiometricFailureLayout()).isTrue(); } @Test public void getTitle_faceEnabled_returnsFacePreferenceTitle() { when(mFingerprintManager.isHardwareDetected()).thenReturn(false); Loading @@ -157,30 +148,6 @@ public class ActiveUnlockStatusUtilsTest { R.string.security_settings_fingerprint_preference_title)); } @Test public void getIntro_faceEnabled_returnsIntroWithFace() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); when(mFingerprintManager.isHardwareDetected()).thenReturn(false); when(mFaceManager.isHardwareDetected()).thenReturn(true); assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) .isEqualTo(mApplicationContext.getString( R.string.biometric_settings_intro_with_face)); } @Test public void getIntro_fingerprintEnabled_returnsIntroWithFingerprint() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.BIOMETRIC_FAILURE_LAYOUT); when(mFingerprintManager.isHardwareDetected()).thenReturn(true); when(mFaceManager.isHardwareDetected()).thenReturn(false); assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) .isEqualTo(mApplicationContext.getString( R.string.biometric_settings_intro_with_fingerprint)); } @Test public void getIntro_unlockOnIntentAndFaceEnabled_returnsEmpty() { ActiveUnlockTestUtils.enable( Loading
tests/robotests/src/com/android/settings/testutils/ActiveUnlockTestUtils.java +2 −0 Original line number Diff line number Diff line Loading @@ -84,5 +84,7 @@ public final class ActiveUnlockTestUtils { ActiveUnlockStatusUtils.CONFIG_FLAG_NAME, null /* value */, false /* makeDefault */); Settings.Secure.putString(context.getContentResolver(), TARGET_SETTING, null); Settings.Secure.putString(context.getContentResolver(), PROVIDER_SETTING, null); } }
tests/unit/src/com/android/settings/testutils/ActiveUnlockTestUtils.java +2 −0 Original line number Diff line number Diff line Loading @@ -84,5 +84,7 @@ public final class ActiveUnlockTestUtils { ActiveUnlockStatusUtils.CONFIG_FLAG_NAME, null /* value */, false /* makeDefault */); Settings.Secure.putString(context.getContentResolver(), TARGET_SETTING, null); Settings.Secure.putString(context.getContentResolver(), PROVIDER_SETTING, null); } }