Do not override SUW Glif theme when onApplyThemeResource() callback
1. Accodring to settings & setupdesign lib theme architecture
Only force apply sytle SetupWizardPartnerResource for current
activity/contextThemeWrapper is sufficient, override GlifV3Theme
again will cause incorrect resource mapping of private attributes.
2. Set Theme_AlertDialog style for AlertDialog in for Material design
- FingerprintEnrollEnrolling
- FingerprintEnrollFindSensor
3. Add test for AlertDialog theme, and fix broken test cases
Fixes: 245684949
Bug: 249789759
Bug: 248994476
Test: manual in SUW `adb shell cmd uimode night yes` and check visual
Test: manual in SUW enrolling check timeout dialog apply theme
Test: manual in SUW enroll UDFPS tips lottie view showing expectedly
Test: manual in SUW enroll UDFPS landscape showing correct layout
Test: m RunSettingsRoboTests -j30 ROBOTEST_FILTER= \
SetupFingerprintEnrollFindSensorTest
Test: m RunSettingsRoboTests -j30 ROBOTEST_FILTER= \
FingerprintEnrollEnrollingTest
Test: m RunSettingsRoboTests -j30 ROBOTEST_FILTER= \
FingerprintEnrollFindSensorTest
Change-Id: I17cbf26e38318e6681ba124d23bf86317a0f1e1d
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user