Merge "Skip option missing on pattern lock screen"
This commit is contained in:
committed by
Android (Google) Code Review
commit
807bedfab6
@@ -412,7 +412,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
||||||
private SaveAndFinishWorker mSaveAndFinishWorker;
|
private SaveAndFinishWorker mSaveAndFinishWorker;
|
||||||
protected int mUserId;
|
protected int mUserId;
|
||||||
private boolean mForFingerprint;
|
protected boolean mForFingerprint;
|
||||||
|
|
||||||
private static final String KEY_UI_STAGE = "uiStage";
|
private static final String KEY_UI_STAGE = "uiStage";
|
||||||
private static final String KEY_PATTERN_CHOICE = "chosenPattern";
|
private static final String KEY_PATTERN_CHOICE = "chosenPattern";
|
||||||
@@ -657,13 +657,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
mFooterText.setText(stage.footerMessage);
|
mFooterText.setText(stage.footerMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stage.leftMode == LeftButtonMode.Gone) {
|
updateFooterLeftButton(stage, mFooterLeftButton);
|
||||||
mFooterLeftButton.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
mFooterLeftButton.setVisibility(View.VISIBLE);
|
|
||||||
mFooterLeftButton.setText(stage.leftMode.text);
|
|
||||||
mFooterLeftButton.setEnabled(stage.leftMode.enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
setRightButtonText(stage.rightMode.text);
|
setRightButtonText(stage.rightMode.text);
|
||||||
setRightButtonEnabled(stage.rightMode.enabled);
|
setRightButtonEnabled(stage.rightMode.enabled);
|
||||||
@@ -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
|
// clear the wrong pattern unless they have started a new one
|
||||||
// already
|
// already
|
||||||
private void postClearPatternRunnable() {
|
private void postClearPatternRunnable() {
|
||||||
|
@@ -22,6 +22,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SetupRedactionInterstitial;
|
import com.android.settings.SetupRedactionInterstitial;
|
||||||
@@ -71,6 +72,24 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
|||||||
startChooseLockActivity(lock, getActivity());
|
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
|
@Override
|
||||||
protected Intent getRedactionInterstitialIntent(Context context) {
|
protected Intent getRedactionInterstitialIntent(Context context) {
|
||||||
// Setup wizard's redaction interstitial is deferred to optional step. Enable that
|
// Setup wizard's redaction interstitial is deferred to optional step. Enable that
|
||||||
|
@@ -102,6 +102,33 @@ public class SetupChooseLockPatternTest {
|
|||||||
assertThat(count).named("List items shown").isEqualTo(3);
|
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) {
|
private ChooseLockPatternFragment findFragment(Activity activity) {
|
||||||
return (ChooseLockPatternFragment)
|
return (ChooseLockPatternFragment)
|
||||||
activity.getFragmentManager().findFragmentById(R.id.main_content);
|
activity.getFragmentManager().findFragmentById(R.id.main_content);
|
||||||
|
Reference in New Issue
Block a user