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 fbed9b87ce
commit bbca300b30
9 changed files with 230 additions and 87 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.password;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -30,8 +32,6 @@ import androidx.fragment.app.Fragment;
import com.android.settings.R;
import com.android.settings.SetupRedactionInterstitial;
import com.google.android.setupdesign.GlifLayout;
/**
* Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
* from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
@@ -123,15 +123,25 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
startChooseLockActivity(lock, getActivity());
}
private boolean showMinimalUi() {
return getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui);
}
@Override
protected void updateStage(Stage stage) {
super.updateStage(stage);
if (!getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)
&& mOptionsButton != null) {
if (!showMinimalUi() && mOptionsButton != null) {
// In landscape, keep view stub to avoid pattern view shifting, but in portrait the
// header title and description could become multiple lines in confirm stage,
// gone the button view to reserve more room for growth height of header.
@View.Visibility
final int hideOrGone =
getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE
? View.INVISIBLE : View.GONE;
mOptionsButton.setVisibility(
(stage == Stage.Introduction || stage == Stage.HelpScreen ||
stage == Stage.ChoiceTooShort || stage == Stage.FirstChoiceValid)
? View.VISIBLE : View.INVISIBLE);
? View.VISIBLE : hideOrGone);
}
if (stage.leftMode == LeftButtonMode.Gone && stage == Stage.Introduction) {
@@ -141,10 +151,6 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
} else {
mLeftButtonIsSkip = false;
}
final GlifLayout layout = getActivity().findViewById(R.id.setup_wizard_layout);
layout.setDescriptionText(
getString(R.string.lockpassword_choose_your_pattern_description));
}
@Override