Loading src/com/android/settings/password/ChooseLockPattern.java +12 −8 Original line number Diff line number Diff line Loading @@ -412,7 +412,7 @@ public class ChooseLockPattern extends SettingsActivity { private ChooseLockSettingsHelper mChooseLockSettingsHelper; private SaveAndFinishWorker mSaveAndFinishWorker; protected int mUserId; private boolean mForFingerprint; protected boolean mForFingerprint; private static final String KEY_UI_STAGE = "uiStage"; private static final String KEY_PATTERN_CHOICE = "chosenPattern"; Loading Loading @@ -657,13 +657,7 @@ public class ChooseLockPattern extends SettingsActivity { mFooterText.setText(stage.footerMessage); } if (stage.leftMode == LeftButtonMode.Gone) { mFooterLeftButton.setVisibility(View.GONE); } else { mFooterLeftButton.setVisibility(View.VISIBLE); mFooterLeftButton.setText(stage.leftMode.text); mFooterLeftButton.setEnabled(stage.leftMode.enabled); } updateFooterLeftButton(stage, mFooterLeftButton); setRightButtonText(stage.rightMode.text); setRightButtonEnabled(stage.rightMode.enabled); Loading Loading @@ -713,6 +707,16 @@ public class ChooseLockPattern extends SettingsActivity { } } protected void updateFooterLeftButton(Stage stage, TextView footerLeftButton) { if (stage.leftMode == LeftButtonMode.Gone) { footerLeftButton.setVisibility(View.GONE); } else { footerLeftButton.setVisibility(View.VISIBLE); footerLeftButton.setText(stage.leftMode.text); footerLeftButton.setEnabled(stage.leftMode.enabled); } } // clear the wrong pattern unless they have started a new one // already private void postClearPatternRunnable() { Loading src/com/android/settings/password/SetupChooseLockPattern.java +19 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.android.settings.R; import com.android.settings.SetupRedactionInterstitial; Loading Loading @@ -71,6 +72,24 @@ public class SetupChooseLockPattern extends ChooseLockPattern { startChooseLockActivity(lock, getActivity()); } @Override protected void updateFooterLeftButton(Stage stage, TextView footerLeftButton) { super.updateFooterLeftButton(stage, footerLeftButton); // enable skip button only during setupwizard and not with fingerprint flow. if (!mForFingerprint) { footerLeftButton.setVisibility(View.VISIBLE); footerLeftButton.setText(R.string.skip_label); } } @Override public void handleLeftButton() { SetupSkipDialog dialog = SetupSkipDialog.newInstance( getActivity().getIntent() .getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false)); dialog.show(getFragmentManager()); } @Override protected Intent getRedactionInterstitialIntent(Context context) { // Setup wizard's redaction interstitial is deferred to optional step. Enable that Loading tests/robotests/src/com/android/settings/SetupChooseLockPatternTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,33 @@ public class SetupChooseLockPatternTest { assertThat(count).named("List items shown").isEqualTo(3); } @Test public void skipButton_shouldBeVisible_duringNonFingerprintFlow() { Button button = mActivity.findViewById(R.id.footerLeftButton); assertThat(button).isNotNull(); assertThat(button.getVisibility()).isEqualTo(View.VISIBLE); button.performClick(); AlertDialog chooserDialog = ShadowAlertDialog.getLatestAlertDialog(); assertThat(chooserDialog).isNotNull(); } @Test public void skipButton_shouldNotBeVisible_duringFingerprintFlow() { mActivity = Robolectric.buildActivity( SetupChooseLockPattern.class, SetupChooseLockPattern.modifyIntentForSetup( application, new IntentBuilder(application) .setUserId(UserHandle.myUserId()) .setForFingerprint(true) .build())) .setup().get(); Button button = mActivity.findViewById(R.id.footerLeftButton); assertThat(button).isNotNull(); assertThat(button.getVisibility()).isEqualTo(View.GONE); } private ChooseLockPatternFragment findFragment(Activity activity) { return (ChooseLockPatternFragment) activity.getFragmentManager().findFragmentById(R.id.main_content); Loading Loading
src/com/android/settings/password/ChooseLockPattern.java +12 −8 Original line number Diff line number Diff line Loading @@ -412,7 +412,7 @@ public class ChooseLockPattern extends SettingsActivity { private ChooseLockSettingsHelper mChooseLockSettingsHelper; private SaveAndFinishWorker mSaveAndFinishWorker; protected int mUserId; private boolean mForFingerprint; protected boolean mForFingerprint; private static final String KEY_UI_STAGE = "uiStage"; private static final String KEY_PATTERN_CHOICE = "chosenPattern"; Loading Loading @@ -657,13 +657,7 @@ public class ChooseLockPattern extends SettingsActivity { mFooterText.setText(stage.footerMessage); } if (stage.leftMode == LeftButtonMode.Gone) { mFooterLeftButton.setVisibility(View.GONE); } else { mFooterLeftButton.setVisibility(View.VISIBLE); mFooterLeftButton.setText(stage.leftMode.text); mFooterLeftButton.setEnabled(stage.leftMode.enabled); } updateFooterLeftButton(stage, mFooterLeftButton); setRightButtonText(stage.rightMode.text); setRightButtonEnabled(stage.rightMode.enabled); Loading Loading @@ -713,6 +707,16 @@ public class ChooseLockPattern extends SettingsActivity { } } protected void updateFooterLeftButton(Stage stage, TextView footerLeftButton) { if (stage.leftMode == LeftButtonMode.Gone) { footerLeftButton.setVisibility(View.GONE); } else { footerLeftButton.setVisibility(View.VISIBLE); footerLeftButton.setText(stage.leftMode.text); footerLeftButton.setEnabled(stage.leftMode.enabled); } } // clear the wrong pattern unless they have started a new one // already private void postClearPatternRunnable() { Loading
src/com/android/settings/password/SetupChooseLockPattern.java +19 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.android.settings.R; import com.android.settings.SetupRedactionInterstitial; Loading Loading @@ -71,6 +72,24 @@ public class SetupChooseLockPattern extends ChooseLockPattern { startChooseLockActivity(lock, getActivity()); } @Override protected void updateFooterLeftButton(Stage stage, TextView footerLeftButton) { super.updateFooterLeftButton(stage, footerLeftButton); // enable skip button only during setupwizard and not with fingerprint flow. if (!mForFingerprint) { footerLeftButton.setVisibility(View.VISIBLE); footerLeftButton.setText(R.string.skip_label); } } @Override public void handleLeftButton() { SetupSkipDialog dialog = SetupSkipDialog.newInstance( getActivity().getIntent() .getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false)); dialog.show(getFragmentManager()); } @Override protected Intent getRedactionInterstitialIntent(Context context) { // Setup wizard's redaction interstitial is deferred to optional step. Enable that Loading
tests/robotests/src/com/android/settings/SetupChooseLockPatternTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,33 @@ public class SetupChooseLockPatternTest { assertThat(count).named("List items shown").isEqualTo(3); } @Test public void skipButton_shouldBeVisible_duringNonFingerprintFlow() { Button button = mActivity.findViewById(R.id.footerLeftButton); assertThat(button).isNotNull(); assertThat(button.getVisibility()).isEqualTo(View.VISIBLE); button.performClick(); AlertDialog chooserDialog = ShadowAlertDialog.getLatestAlertDialog(); assertThat(chooserDialog).isNotNull(); } @Test public void skipButton_shouldNotBeVisible_duringFingerprintFlow() { mActivity = Robolectric.buildActivity( SetupChooseLockPattern.class, SetupChooseLockPattern.modifyIntentForSetup( application, new IntentBuilder(application) .setUserId(UserHandle.myUserId()) .setForFingerprint(true) .build())) .setup().get(); Button button = mActivity.findViewById(R.id.footerLeftButton); assertThat(button).isNotNull(); assertThat(button.getVisibility()).isEqualTo(View.GONE); } private ChooseLockPatternFragment findFragment(Activity activity) { return (ChooseLockPatternFragment) activity.getFragmentManager().findFragmentById(R.id.main_content); Loading