Merge "Do not override SUW Glif theme when onApplyThemeResource() callback" into tm-qpr-dev
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index ff38552..d65c8c7 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -64,7 +64,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
-import com.android.settings.SetupWizardUtils;
import com.android.settings.biometrics.BiometricEnrollSidecar;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.biometrics.BiometricsEnrollEnrolling;
@@ -216,9 +215,8 @@
@Override
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int newResid = SetupWizardUtils.getTheme(this, getIntent());
theme.applyStyle(R.style.SetupWizardPartnerResource, true);
- super.onApplyThemeResource(theme, newResid, first);
+ super.onApplyThemeResource(theme, resid, first);
}
@Override
@@ -1058,7 +1056,8 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),
+ R.style.Theme_AlertDialog);
builder.setTitle(R.string.security_settings_fingerprint_enroll_touch_dialog_title)
.setMessage(R.string.security_settings_fingerprint_enroll_touch_dialog_message)
.setPositiveButton(R.string.security_settings_fingerprint_enroll_dialog_ok,
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
index f4576a2..20f8af6 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
@@ -32,7 +32,6 @@
import androidx.annotation.Nullable;
import com.android.settings.R;
-import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollBase;
import com.android.settings.biometrics.BiometricEnrollSidecar;
@@ -216,9 +215,8 @@
@Override
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int newResid = SetupWizardUtils.getTheme(this, getIntent());
theme.applyStyle(R.style.SetupWizardPartnerResource, true);
- super.onApplyThemeResource(theme, newResid, first);
+ super.onApplyThemeResource(theme, resid, first);
}
protected int getContentView() {
diff --git a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensor.java
index f6b947a..a71bb65 100644
--- a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensor.java
@@ -77,7 +77,7 @@
@NonNull
public AlertDialog.Builder onCreateDialogBuilder() {
- return new AlertDialog.Builder(getActivity())
+ return new AlertDialog.Builder(getActivity(), R.style.Theme_AlertDialog)
.setTitle(R.string.setup_fingerprint_enroll_skip_title)
.setPositiveButton(R.string.skip_anyway_button_label, this)
.setNegativeButton(R.string.go_back_button_label, this)
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
index 2dfcee2..3a890b4 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
@@ -86,7 +86,7 @@
@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 @@
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 @@
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 @@
}
ActivityController.of(mActivity).create(savedInstanceState);
+ mTheme = mActivity.getTheme();
}
private EnrollmentCallback verifyAndCaptureEnrollmentCallback() {
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensorTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensorTest.java
index b6fcc47..8727153 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensorTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensorTest.java
@@ -89,7 +89,6 @@
@Mock
private FingerprintManager mFingerprintManager;
- @Mock
private Resources.Theme mTheme;
private ActivityController<FingerprintEnrollFindSensor> mActivityController;
@@ -104,6 +103,7 @@
.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0])
);
mActivity = mActivityController.get();
+ mTheme = mActivity.getTheme();
}
@Before
@@ -560,9 +560,10 @@
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() {
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensorTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensorTest.java
index 71cecc0..03b6db3 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensorTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFindSensorTest.java
@@ -18,7 +18,6 @@
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 @@
@Mock private FingerprintManager mFingerprintManager;
- @Mock private Theme mTheme;
+ private Theme mTheme;
private SetupFingerprintEnrollFindSensor mActivity;
@@ -67,6 +66,7 @@
.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 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() {