- Skip present during suw/deferred + non-fingerprint flow
- Skip hidden when opened from settings
- Skip hidden during suw/deferred when trying to setup up fingerprint
Test: Manually verified, robolectric tests updated
bug:
71763670
Change-Id: Ie3aac68a6d04c7727320af83532640580248bd47
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";
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);
}
}
+ 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() {
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;
}
@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
// optional step if the lock screen was set up.
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);