Merge "Do not override SUW Glif theme when onApplyThemeResource() callback" into tm-qpr-dev

This commit is contained in:
Bill Lin
2022-09-30 23:54:31 +00:00
committed by Android (Google) Code Review
6 changed files with 27 additions and 17 deletions

View File

@@ -86,7 +86,7 @@ public class FingerprintEnrollEnrollingTest {
@Mock private Display mMockDisplay;
@Mock private Resources.Theme mTheme;
private Resources.Theme mTheme;
private final int[] mSfpsStageThresholds = new int[]{0, 9, 13, 19, 25};
@@ -242,7 +242,8 @@ public class FingerprintEnrollEnrollingTest {
mActivity.onApplyThemeResource(mTheme, R.style.GlifTheme, true /* first */);
verify(mTheme).applyStyle(R.style.SetupWizardPartnerResource, true);
final String appliedThemes = mTheme.toString();
assertThat(appliedThemes.contains("SetupWizardPartnerResource")).isTrue();
}
@Test
@@ -251,7 +252,8 @@ public class FingerprintEnrollEnrollingTest {
mActivity.onApplyThemeResource(mTheme, R.style.GlifTheme, true /* first */);
verify(mTheme).applyStyle(R.style.SetupWizardPartnerResource, true);
final String appliedThemes = mTheme.toString();
assertThat(appliedThemes.contains("SetupWizardPartnerResource")).isTrue();
}
private void initializeActivityFor(int sensorType) {
@@ -291,6 +293,7 @@ public class FingerprintEnrollEnrollingTest {
}
ActivityController.of(mActivity).create(savedInstanceState);
mTheme = mActivity.getTheme();
}
private EnrollmentCallback verifyAndCaptureEnrollmentCallback() {

View File

@@ -89,7 +89,6 @@ public class FingerprintEnrollFindSensorTest {
@Mock
private FingerprintManager mFingerprintManager;
@Mock
private Resources.Theme mTheme;
private ActivityController<FingerprintEnrollFindSensor> mActivityController;
@@ -104,6 +103,7 @@ public class FingerprintEnrollFindSensorTest {
.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0])
);
mActivity = mActivityController.get();
mTheme = mActivity.getTheme();
}
@Before
@@ -560,9 +560,10 @@ public class FingerprintEnrollFindSensorTest {
setupActivity_onSfpsDevice();
verifySidecar_onRearOrSfpsDevice();
mActivity.onApplyThemeResource(mActivity.getTheme(), R.style.GlifTheme, true /* first */);
mActivity.onApplyThemeResource(mTheme, R.style.GlifTheme, true /* first */);
verify(mTheme).applyStyle(R.style.SetupWizardPartnerResource, true);
final String appliedThemes = mTheme.toString();
assertThat(appliedThemes.contains("SetupWizardPartnerResource")).isTrue();
}
private void triggerEnrollProgressAndError_onRearDevice() {

View File

@@ -18,7 +18,6 @@ package com.android.settings.biometrics.fingerprint;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.verify;
import static org.robolectric.RuntimeEnvironment.application;
import android.content.Intent;
@@ -52,7 +51,7 @@ public class SetupFingerprintEnrollFindSensorTest {
@Mock private FingerprintManager mFingerprintManager;
@Mock private Theme mTheme;
private Theme mTheme;
private SetupFingerprintEnrollFindSensor mActivity;
@@ -67,6 +66,7 @@ public class SetupFingerprintEnrollFindSensorTest {
.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
mActivity = Robolectric.buildActivity(SetupFingerprintEnrollFindSensor.class,
intent).setup().get();
mTheme = mActivity.getTheme();
}
@After
@@ -88,7 +88,16 @@ public class SetupFingerprintEnrollFindSensorTest {
public void fingerprintEnroll_activityApplyDarkLightStyle() {
mActivity.onApplyThemeResource(mTheme, R.style.GlifTheme, true /* first */);
verify(mTheme).applyStyle(R.style.SetupWizardPartnerResource, true);
final String appliedThemes = mTheme.toString();
assertThat(appliedThemes.contains("SetupWizardPartnerResource")).isTrue();
}
@Test
public void fingerprintEnroll_showsAlert_setAlertDialogTheme() {
final AlertDialog alertDialog = setupAlertDialog();
assertThat(alertDialog.getContext().getThemeResId()).isEqualTo(
R.style.Theme_AlertDialog);
}
private AlertDialog setupAlertDialog() {