Search in sources :

Example 1 with LockscreenCredential

use of com.android.internal.widget.LockscreenCredential in project android_packages_apps_Settings by omnirom.

the class CryptKeeperSettings method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode != KEYGUARD_REQUEST) {
        return;
    }
    // confirmation prompt; otherwise, go back to the initial state.
    if (resultCode == Activity.RESULT_OK && data != null) {
        int type = data.getIntExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE, -1);
        LockscreenCredential password = data.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
        if (password != null && !password.isNone()) {
            showFinalConfirmation(type, password.getCredential());
        }
    }
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential)

Example 2 with LockscreenCredential

use of com.android.internal.widget.LockscreenCredential in project android_packages_apps_Settings by omnirom.

the class ChooseLockPatternTest method intentBuilder_setProfileToUnify_shouldAddExtras.

@Test
public void intentBuilder_setProfileToUnify_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setProfileToUnify(23, LockscreenCredential.createNone()).build();
    assertWithMessage("EXTRA_KEY_UNIFICATION_PROFILE_ID").that(intent.getIntExtra(ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_ID, 0)).isEqualTo(23);
    assertWithMessage("EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL").that((LockscreenCredential) intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL)).isNotNull();
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential) IntentBuilder(com.android.settings.password.ChooseLockPattern.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 3 with LockscreenCredential

use of com.android.internal.widget.LockscreenCredential in project android_packages_apps_Settings by omnirom.

the class ChooseLockPatternTest method intentBuilder_setPattern_shouldAddExtras.

@Test
public void intentBuilder_setPattern_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setPattern(createPattern("1234")).setUserId(123).build();
    assertWithMessage("EXTRA_KEY_FORCE_VERIFY").that(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false)).isFalse();
    assertWithMessage("EXTRA_KEY_PASSWORD").that((LockscreenCredential) intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD)).isEqualTo(createPattern("1234"));
    assertWithMessage("EXTRA_USER_ID").that(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).isEqualTo(123);
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential) IntentBuilder(com.android.settings.password.ChooseLockPattern.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 4 with LockscreenCredential

use of com.android.internal.widget.LockscreenCredential in project android_packages_apps_Settings by omnirom.

the class ChooseLockPasswordTest method intentBuilder_setProfileToUnify_shouldAddExtras.

@Test
public void intentBuilder_setProfileToUnify_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setProfileToUnify(23, LockscreenCredential.createNone()).build();
    assertWithMessage("EXTRA_KEY_UNIFICATION_PROFILE_ID").that(intent.getIntExtra(ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_ID, 0)).isEqualTo(23);
    assertWithMessage("EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL").that((LockscreenCredential) intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL)).isNotNull();
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential) IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 5 with LockscreenCredential

use of com.android.internal.widget.LockscreenCredential in project android_packages_apps_Settings by omnirom.

the class ChooseLockPasswordTest method intentBuilder_setPassword_shouldAddExtras.

@Test
public void intentBuilder_setPassword_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setPassword(LockscreenCredential.createPassword("password")).setPasswordType(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC).setUserId(123).build();
    assertWithMessage("EXTRA_KEY_FORCE_VERIFY").that(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false)).isFalse();
    assertWithMessage("EXTRA_KEY_PASSWORD").that((LockscreenCredential) intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD)).isEqualTo(LockscreenCredential.createPassword("password"));
    assertWithMessage("PASSWORD_TYPE_KEY").that(intent.getIntExtra(PASSWORD_TYPE_KEY, 0)).isEqualTo(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);
    assertWithMessage("EXTRA_USER_ID").that(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).isEqualTo(123);
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential) IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

LockscreenCredential (com.android.internal.widget.LockscreenCredential)7 Intent (android.content.Intent)6 Test (org.junit.Test)6 Bundle (android.os.Bundle)2 IntentBuilder (com.android.settings.password.ChooseLockPassword.IntentBuilder)2 IntentBuilder (com.android.settings.password.ChooseLockPattern.IntentBuilder)2