KeyguardFeatures { static int setFingerprintDisabled( int currentDisabledFeatures, boolean fingerprintDisabled) { int keyguardDisabledFeatures; if(fingerprintDisabled){ keyguardDisabledFeatures = currentDisabledFeatures | DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT; } else { keyguardDisabledFeatures = currentDisabledFeatures & (~DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT); } return keyguardDisabledFeatures; }    }
@Test public void test_noChangeNoKeyguardFeaturesDisabled() throws Exception { int result = KeyguardFeatures.setFingerprintDisabled( DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE, false); assertEquals(DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE, result); }
@Test public void test_changeNoKeyguardFeaturesDisabled() throws Exception { int result = KeyguardFeatures.setFingerprintDisabled( DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE, true); assertEquals(DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT, result); }
@Test public void test_noChangeOneKeyguardFeaturesDisabled() throws Exception { int result = KeyguardFeatures.setFingerprintDisabled( DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS, false); assertEquals(DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS, result); }
@Test public void test_changeOneKeyguardFeaturesDisabled() throws Exception { int expected = DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS + DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT; int result = KeyguardFeatures.setFingerprintDisabled( DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS, true); assertEquals(expected, result); }
@Test public void test_changeAllKeyguardFeaturesDisabled() throws Exception { int expected = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL; int result = KeyguardFeatures.setFingerprintDisabled( DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL, true); assertEquals(expected, result); }