5/ Refine SetupChooseLockPattern layout by design

Since the SetupChooseLockPattern include header icon
header title, header sub-title, pattern state description,
LockPatternView and FooterBar, there was a limited room
for LockPatternView especially in the confirm steps which
both header title and pattern description occupy 2 lines space.
Hance the PatternView size used to inconsistence in-between
1st draw and 2nd confirm draw, besides it's visual looks
jumping and small on some device which have smaller display.

This solution includes 3 changes:
1. Organized the pattern view message to leverage
   header sub-title view, then we can resever more space.
   (Set minHeight=2 for sub-title)
2. Set screen_lock_options button visibilty to GONE when
   the stage in 2nd confirmation.(Previously it's INVISIBLE
   and reserve additional space)
3. Let LockPatternView align bottom of FrameLayout to prevent
   the view juming and flicker.
4. Clean up unused forAnyBiometric flag and code.
5. GlifLayout.getDescriptionTextView() == mHeaderView
   Need setDescriptionText() to make the view from GONE -> VISIBLE
6. Polish the stage flow and ensure IntroductionStage show
   correct message
7. Add ChooseLockPattern into embeded activity white list
   Force show ChooseLockPattern in fullscreen in case the Pattern
   view truncated in `NeedToConfirmStage` where the title showing
   2 lines and push pattern view down, and get bad UX in the
   device which integrate a shorter display.
8. Add test cases for all stage and polish legacy test code.

Test: make RunSettingsRoboTests ROBOTEST_FILTER= \
     "com.android.settings.password.SetupChooseLockPatternTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER= \
     "com.android.settings.password.ChooseLockPatternTest"
Bug: 249974175
Bug: 260027850
Change-Id: I868af9b14ba99af5d78a05f6c2a570ccc07aea15
This commit is contained in:
lbill
2023-01-05 05:24:57 +00:00
parent 238b7b4620
commit 7135d36d37
9 changed files with 230 additions and 87 deletions

View File

@@ -210,7 +210,7 @@ public class ChooseLockPattern extends SettingsActivity {
protected LockPatternView mLockPatternView;
protected TextView mFooterText;
protected FooterButton mSkipOrClearButton;
private FooterButton mNextButton;
protected FooterButton mNextButton;
@VisibleForTesting protected LockscreenCredential mChosenPattern;
private ColorStateList mDefaultHeaderColorList;
private View mSudContent;
@@ -366,31 +366,34 @@ public class ChooseLockPattern extends SettingsActivity {
Introduction(
R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpattern_recording_intro_header,
R.string.lockpassword_choose_your_pattern_description,
LeftButtonMode.Gone, RightButtonMode.ContinueDisabled,
ID_EMPTY_MESSAGE, true),
HelpScreen(
ID_EMPTY_MESSAGE, R.string.lockpattern_settings_help_how_to_record,
R.string.lockpattern_settings_help_how_to_record,
R.string.lockpattern_settings_help_how_to_record,
LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false),
ChoiceTooShort(
R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpattern_recording_incorrect_too_short,
R.string.lockpattern_recording_incorrect_too_short,
LeftButtonMode.Retry, RightButtonMode.ContinueDisabled,
ID_EMPTY_MESSAGE, true),
FirstChoiceValid(
R.string.lock_settings_picker_biometrics_added_security_message,
R.string.lockpattern_pattern_entered_header,
R.string.lockpattern_pattern_entered_header,
LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false),
NeedToConfirm(
ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_confirm,
R.string.lockpattern_need_to_confirm, R.string.lockpattern_need_to_confirm,
LeftButtonMode.Gone, RightButtonMode.ConfirmDisabled,
ID_EMPTY_MESSAGE, true),
ConfirmWrong(
ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_unlock_wrong,
R.string.lockpattern_need_to_unlock_wrong,
R.string.lockpattern_need_to_unlock_wrong,
LeftButtonMode.Gone, RightButtonMode.ConfirmDisabled,
ID_EMPTY_MESSAGE, true),
ChoiceConfirmed(
ID_EMPTY_MESSAGE, R.string.lockpattern_pattern_confirmed_header,
R.string.lockpattern_pattern_confirmed_header,
R.string.lockpattern_pattern_confirmed_header,
LeftButtonMode.Gone, RightButtonMode.Confirm, ID_EMPTY_MESSAGE, false);
@@ -535,7 +538,9 @@ public class ChooseLockPattern extends SettingsActivity {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mHeaderText = (TextView) view.findViewById(R.id.headerText);
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
mHeaderText = layout.getDescriptionTextView();
mHeaderText.setMinLines(2);
mDefaultHeaderColorList = mHeaderText.getTextColors();
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
@@ -710,30 +715,24 @@ public class ChooseLockPattern extends SettingsActivity {
*/
protected void updateStage(Stage stage) {
final Stage previousStage = mUiStage;
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
mUiStage = stage;
if (stage == Stage.Introduction) {
layout.setDescriptionText(stage.headerMessage);
}
// header text, footer text, visibility and
// enabled state all known from the stage
if (stage == Stage.ChoiceTooShort) {
mHeaderText.setText(
layout.setDescriptionText(
getResources().getString(
stage.headerMessage,
LockPatternUtils.MIN_LOCK_PATTERN_SIZE));
} else {
mHeaderText.setText(stage.headerMessage);
}
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
final boolean forAnyBiometric = mForFingerprint || mForFace || mForBiometrics;
if (forAnyBiometric) {
if (stage.messageForBiometrics == ID_EMPTY_MESSAGE) {
layout.setDescriptionText("");
} else {
layout.setDescriptionText(stage.messageForBiometrics);
}
} else {
layout.getDescriptionTextView().setVisibility(View.GONE);
layout.setDescriptionText(stage.headerMessage);
}
if (stage.footerMessage == ID_EMPTY_MESSAGE) {
mFooterText.setText("");
} else {
@@ -751,8 +750,8 @@ public class ChooseLockPattern extends SettingsActivity {
mHeaderText.setTextColor(mDefaultHeaderColorList);
}
if (stage == Stage.NeedToConfirm && forAnyBiometric) {
mHeaderText.setText("");
if (stage == Stage.NeedToConfirm) {
mHeaderText.setText(stage.headerMessage);
layout.setHeaderText(R.string.lockpassword_draw_your_pattern_again_header);
}
}
@@ -782,6 +781,7 @@ public class ChooseLockPattern extends SettingsActivity {
mLockPatternView.setPattern(DisplayMode.Animate, mAnimatePattern);
break;
case ChoiceTooShort:
case ConfirmWrong:
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
postClearPatternRunnable();
announceAlways = true;
@@ -791,11 +791,6 @@ public class ChooseLockPattern extends SettingsActivity {
case NeedToConfirm:
mLockPatternView.clearPattern();
break;
case ConfirmWrong:
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
postClearPatternRunnable();
announceAlways = true;
break;
case ChoiceConfirmed:
break;
}