[FRP] Remove None and Swipe from screen lock options

Removed "None" and "Swipe" from screen lock options in the choosing
lock screen during setup wizard, because at this step, the user has
already chosen to pick a screen lock, hence it's unnecessory to show
"none" and "swipe".

Implemented this by overriding the DisableUnusablePreferences in
SetupChooseLockGenericFragment to disable the insecure lock methods
and adding a flag to hide disabled methods for setup wizard.

Bug: 18631416
Change-Id: I3feccf591da25bd6eadcc03c75b28cfc1d069db7
This commit is contained in:
Lucky Zhang
2014-12-05 15:00:20 -08:00
parent 7dca460af7
commit df8566a9a1
2 changed files with 45 additions and 3 deletions

View File

@@ -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;
@@ -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,