Search in sources :

Example 81 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedNoneComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedNoneComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_none_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(/* isRecreatingActivity= */
    false);
    FooterPreference footer = mFragment.findPreference(KEY_LOCK_SETTINGS_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Example 82 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedHighComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedHighComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_HIGH);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_high_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(false);
    FooterPreference footer = mFragment.findPreference(KEY_LOCK_SETTINGS_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Example 83 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedLowComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedLowComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_LOW);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_low_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(false);
    FooterPreference footer = mFragment.findPreference(KEY_LOCK_SETTINGS_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Example 84 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project android_packages_apps_Settings by omnirom.

the class ChooseLockGenericTest method updatePreferencesOrFinish_ComplexityIsReadFromDPM.

@Test
public void updatePreferencesOrFinish_ComplexityIsReadFromDPM() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    ShadowLockPatternUtils.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_HIGH);
    initActivity(null);
    mFragment.updatePreferencesOrFinish(false);
    FooterPreference footer = mFragment.findPreference(KEY_LOCK_SETTINGS_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(null);
    Intent intent = mFragment.getLockPasswordIntent(PASSWORD_QUALITY_COMPLEX);
    assertThat(intent.getIntExtra(ChooseLockPassword.EXTRA_KEY_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE)).isEqualTo(PASSWORD_COMPLEXITY_HIGH);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Aggregations

FooterPreference (com.android.settingslib.widget.FooterPreference)84 Test (org.junit.Test)22 Before (org.junit.Before)18 Intent (android.content.Intent)17 Preference (androidx.preference.Preference)10 View (android.view.View)8 PreferenceScreen (androidx.preference.PreferenceScreen)7 NotificationChannel (android.app.NotificationChannel)6 NotificationChannelGroup (android.app.NotificationChannelGroup)6 Preference (android.support.v7.preference.Preference)6 PreferenceCategory (android.support.v7.preference.PreferenceCategory)6 TextView (android.widget.TextView)6 LayoutPreference (com.android.settings.applications.LayoutPreference)6 MasterSwitchPreference (com.android.settings.widget.MasterSwitchPreference)6 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)6 Context (android.content.Context)3 Drawable (android.graphics.drawable.Drawable)2 SpannableString (android.text.SpannableString)2 Pair (android.util.Pair)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2