Loading src/com/android/settings/ChooseLockGeneric.java +22 −3 Original line number Diff line number Diff line Loading @@ -287,15 +287,31 @@ public class ChooseLockGeneric extends SettingsActivity { return quality; } /*** * Disables preferences that are less secure than required quality. The actual * implementation is in disableUnusablePreferenceImpl. * * @param quality the requested quality. * @param allowBiometric whether to allow biometic screen lock. */ protected void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) { disableUnusablePreferencesImpl(quality, allowBiometric, false /* hideDisabled */); } /*** * Disables preferences that are less secure than required quality. * * @param quality the requested quality. * @param allowBiometric whether to allow biometic screen lock. * @param hideDisabled whether to hide disable screen lock options. */ private void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) { protected void disableUnusablePreferencesImpl(final int quality, MutableBoolean allowBiometric, boolean hideDisabled) { final PreferenceScreen entries = getPreferenceScreen(); final boolean onlyShowFallback = getActivity().getIntent() .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false); final Intent intent = getActivity().getIntent(); final boolean onlyShowFallback = intent.getBooleanExtra( LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false); final boolean weakBiometricAvailable = mChooseLockSettingsHelper.utils().isBiometricWeakInstalled(); Loading Loading @@ -326,6 +342,9 @@ public class ChooseLockGeneric extends SettingsActivity { } else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) { enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; } if (hideDisabled) { visible = visible && enabled; } if (!visible || (onlyShowFallback && !allowedForFallback(key))) { entries.removePreference(pref); } else if (!enabled) { Loading src/com/android/settings/SetupChooseLockGeneric.java +23 −0 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ package com.android.settings; import com.android.setupwizard.navigationbar.SetupWizardNavBar; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.preference.PreferenceFragment; import android.util.MutableBoolean; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -92,6 +94,27 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle()); } /*** * Disables preferences that are less secure than required quality and shows only secure * screen lock options here. * * @param quality the requested quality. * @param allowBiometric whether to allow biometic screen lock */ @Override protected void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) { // At this part of the flow, the user has already indicated they want to add a pin, // pattern or password, so don't show "None" or "Slide". We disable them here and set // the HIDE_DISABLED flag to true to hide them. This only happens for setup wizard. // We do the following max check here since the device may already have a Device Admin // installed with a policy we need to honor. final int newQuality = Math.max(quality, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); super.disableUnusablePreferencesImpl(newQuality, allowBiometric, true /* hideDisabled */); } @Override protected Intent getLockPasswordIntent(Context context, int quality, boolean isFallback, int minLength, int maxLength, boolean requirePasswordToDecrypt, Loading Loading
src/com/android/settings/ChooseLockGeneric.java +22 −3 Original line number Diff line number Diff line Loading @@ -287,15 +287,31 @@ public class ChooseLockGeneric extends SettingsActivity { return quality; } /*** * Disables preferences that are less secure than required quality. The actual * implementation is in disableUnusablePreferenceImpl. * * @param quality the requested quality. * @param allowBiometric whether to allow biometic screen lock. */ protected void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) { disableUnusablePreferencesImpl(quality, allowBiometric, false /* hideDisabled */); } /*** * Disables preferences that are less secure than required quality. * * @param quality the requested quality. * @param allowBiometric whether to allow biometic screen lock. * @param hideDisabled whether to hide disable screen lock options. */ private void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) { protected void disableUnusablePreferencesImpl(final int quality, MutableBoolean allowBiometric, boolean hideDisabled) { final PreferenceScreen entries = getPreferenceScreen(); final boolean onlyShowFallback = getActivity().getIntent() .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false); final Intent intent = getActivity().getIntent(); final boolean onlyShowFallback = intent.getBooleanExtra( LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false); final boolean weakBiometricAvailable = mChooseLockSettingsHelper.utils().isBiometricWeakInstalled(); Loading Loading @@ -326,6 +342,9 @@ public class ChooseLockGeneric extends SettingsActivity { } else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) { enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; } if (hideDisabled) { visible = visible && enabled; } if (!visible || (onlyShowFallback && !allowedForFallback(key))) { entries.removePreference(pref); } else if (!enabled) { Loading
src/com/android/settings/SetupChooseLockGeneric.java +23 −0 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ package com.android.settings; import com.android.setupwizard.navigationbar.SetupWizardNavBar; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.preference.PreferenceFragment; import android.util.MutableBoolean; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; Loading Loading @@ -92,6 +94,27 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle()); } /*** * Disables preferences that are less secure than required quality and shows only secure * screen lock options here. * * @param quality the requested quality. * @param allowBiometric whether to allow biometic screen lock */ @Override protected void disableUnusablePreferences(final int quality, MutableBoolean allowBiometric) { // At this part of the flow, the user has already indicated they want to add a pin, // pattern or password, so don't show "None" or "Slide". We disable them here and set // the HIDE_DISABLED flag to true to hide them. This only happens for setup wizard. // We do the following max check here since the device may already have a Device Admin // installed with a policy we need to honor. final int newQuality = Math.max(quality, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); super.disableUnusablePreferencesImpl(newQuality, allowBiometric, true /* hideDisabled */); } @Override protected Intent getLockPasswordIntent(Context context, int quality, boolean isFallback, int minLength, int maxLength, boolean requirePasswordToDecrypt, Loading