Update the fingerprint skip dialog

Test: atest
Bug: 124028212
Change-Id: I1a1151c231862ef21b302317f0f105de1a79eac7
This commit is contained in:
pastychang
2019-03-18 20:10:32 +08:00
committed by Pasty Chang
parent 703e6aa092
commit 5145dc1529
5 changed files with 169 additions and 14 deletions

View File

@@ -35,13 +35,22 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
public static final String EXTRA_FRP_SUPPORTED = ":settings:frp_supported";
private static final String ARG_FRP_SUPPORTED = "frp_supported";
// The key indicates type of lock screen is pattern setup.
private static final String ARG_LOCK_TYPE_PATTERN = "lock_type_pattern";
// The key indicates type of lock screen setup is alphanumeric for password setup.
private static final String ARG_LOCK_TYPE_ALPHANUMERIC = "lock_type_alphanumeric";
private static final String TAG_SKIP_DIALOG = "skip_dialog";
public static final int RESULT_SKIP = Activity.RESULT_FIRST_USER + 10;
public static SetupSkipDialog newInstance(boolean isFrpSupported) {
public static SetupSkipDialog newInstance(boolean isFrpSupported, boolean isPatternMode,
boolean isAlphanumericMode, boolean isFingerprintSupported, boolean isFaceSupported) {
SetupSkipDialog dialog = new SetupSkipDialog();
Bundle args = new Bundle();
args.putBoolean(ARG_FRP_SUPPORTED, isFrpSupported);
args.putBoolean(ARG_LOCK_TYPE_PATTERN, isPatternMode);
args.putBoolean(ARG_LOCK_TYPE_ALPHANUMERIC, isAlphanumericMode);
args.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, isFingerprintSupported);
args.putBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, isFaceSupported);
dialog.setArguments(args);
return dialog;
}
@@ -59,13 +68,36 @@ public class SetupSkipDialog extends InstrumentedDialogFragment
@NonNull
public AlertDialog.Builder onCreateDialogBuilder() {
Bundle args = getArguments();
return new AlertDialog.Builder(getContext())
.setPositiveButton(R.string.skip_anyway_button_label, this)
.setNegativeButton(R.string.go_back_button_label, this)
.setTitle(R.string.lock_screen_intro_skip_title)
.setMessage(args.getBoolean(ARG_FRP_SUPPORTED) ?
R.string.lock_screen_intro_skip_dialog_text_frp :
R.string.lock_screen_intro_skip_dialog_text);
final boolean isFaceSupported =
args.getBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE);
final boolean isFingerprintSupported =
args.getBoolean(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT);
if (isFaceSupported || isFingerprintSupported) {
final int titleId;
if (args.getBoolean(ARG_LOCK_TYPE_PATTERN)) {
titleId = R.string.lock_screen_pattern_skip_title;
} else {
titleId = args.getBoolean(ARG_LOCK_TYPE_ALPHANUMERIC) ?
R.string.lock_screen_password_skip_title : R.string.lock_screen_pin_skip_title;
}
return new AlertDialog.Builder(getContext())
.setPositiveButton(R.string.skip_lock_screen_dialog_button_label, this)
.setNegativeButton(R.string.cancel_lock_screen_dialog_button_label, this)
.setTitle(titleId)
.setMessage(isFaceSupported ?
R.string.face_lock_screen_setup_skip_dialog_text :
R.string.fingerprint_lock_screen_setup_skip_dialog_text);
} else {
return new AlertDialog.Builder(getContext())
.setPositiveButton(R.string.skip_anyway_button_label, this)
.setNegativeButton(R.string.go_back_button_label, this)
.setTitle(R.string.lock_screen_intro_skip_title)
.setMessage(args.getBoolean(ARG_FRP_SUPPORTED) ?
R.string.lock_screen_intro_skip_dialog_text_frp :
R.string.lock_screen_intro_skip_dialog_text);
}
}
@Override