Set appropriate theme for SkipFingerprintDialog
The SkipFingerprintDialog is instantiation in SetupFingerprintEnrollFindSensor#onSkipButtonClick() Due to the call flow did not set appropriate theme defined in setuplib for skip alertDialog instance we set GlifV2ThemeAlertDialog AlertDialog.Builder. Test: m RunSettingsRoboTests -j30 ROBOTEST_FILTER= \ SetupFingerprintEnrollFindSensorTest Test: manual factory reset, go through SUW, and check skip AlertDialog Bottom Bar Buttons visual. Bug: 233243999 Change-Id: Ic198a23eb3e76d70e287b24f2ab1ef249b30b2fc
This commit is contained in:
@@ -77,7 +77,7 @@ public class SetupFingerprintEnrollFindSensor extends FingerprintEnrollFindSenso
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public AlertDialog.Builder onCreateDialogBuilder() {
|
public AlertDialog.Builder onCreateDialogBuilder() {
|
||||||
return new AlertDialog.Builder(getContext())
|
return new AlertDialog.Builder(getActivity(), R.style.GlifV2ThemeAlertDialog)
|
||||||
.setTitle(R.string.setup_fingerprint_enroll_skip_title)
|
.setTitle(R.string.setup_fingerprint_enroll_skip_title)
|
||||||
.setPositiveButton(R.string.skip_anyway_button_label, this)
|
.setPositiveButton(R.string.skip_anyway_button_label, this)
|
||||||
.setNegativeButton(R.string.go_back_button_label, this)
|
.setNegativeButton(R.string.go_back_button_label, this)
|
||||||
|
@@ -22,7 +22,6 @@ import static org.robolectric.RuntimeEnvironment.application;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
@@ -66,6 +65,23 @@ public class SetupFingerprintEnrollFindSensorTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fingerprintEnroll_showsAlert_whenClickingSkip() {
|
public void fingerprintEnroll_showsAlert_whenClickingSkip() {
|
||||||
|
final AlertDialog alertDialog = setupAlertDialog();
|
||||||
|
final ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(
|
||||||
|
alertDialog);
|
||||||
|
final int titleRes = R.string.setup_fingerprint_enroll_skip_title;
|
||||||
|
|
||||||
|
assertThat(application.getString(titleRes)).isEqualTo(shadowAlertDialog.getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fingerprintEnroll_showsAlert_setSudTheme() {
|
||||||
|
final AlertDialog alertDialog = setupAlertDialog();
|
||||||
|
|
||||||
|
assertThat(alertDialog.getContext().getThemeResId()).isEqualTo(
|
||||||
|
R.style.GlifV2ThemeAlertDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AlertDialog setupAlertDialog() {
|
||||||
final Intent intent = new Intent()
|
final Intent intent = new Intent()
|
||||||
// Set the challenge token so the confirm screen will not be shown
|
// Set the challenge token so the confirm screen will not be shown
|
||||||
.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
||||||
@@ -80,9 +96,6 @@ public class SetupFingerprintEnrollFindSensorTest {
|
|||||||
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||||
assertThat(alertDialog).isNotNull();
|
assertThat(alertDialog).isNotNull();
|
||||||
|
|
||||||
final ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(
|
return alertDialog;
|
||||||
alertDialog);
|
|
||||||
final int titleRes = R.string.setup_fingerprint_enroll_skip_title;
|
|
||||||
assertThat(application.getString(titleRes)).isEqualTo(shadowAlertDialog.getTitle());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user