Merge "Fix insufficient contrast for the strings "Dimmer" and "Brighter" in the light theme" into tm-qpr-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2fef457..12a3439 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -14333,7 +14333,7 @@
     <!-- The title of the toggle which enables/disables overlays on top of the screen saver [CHAR LIMIT=none] -->
     <string name="dream_complications_toggle_title">Show additional information</string>
     <!-- The summary of what overlays this toggle controls [CHAR LIMIT=none] -->
-    <string name="dream_complications_toggle_summary">Display time, date, weather, air quality, and Cast details on the screen saver</string>
+    <string name="dream_complications_toggle_summary">Display things like the time, weather, or other information on the screen saver</string>
     <!-- The title of the category to show for the screensaver miscellaneous settings [CHAR LIMIT=none] -->
     <string name="dream_more_settings_category">More settings</string>
     <!-- The title of the screen saver setup page [CHAR LIMIT=none] -->
diff --git a/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java
index d272a0b..429fd9d 100644
--- a/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java
+++ b/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java
@@ -102,6 +102,11 @@
     }
 
     private void showQuickSettingsTooltipIfNeeded() {
+        if (mPreference == null) {
+            // Returns if no preference found by slice highlight menu.
+            return;
+        }
+
         final ComponentName tileComponentName = getTileComponentName();
         if (tileComponentName == null) {
             // Returns if no tile service assigned.
diff --git a/src/com/android/settings/accessibility/TextReadingPreviewController.java b/src/com/android/settings/accessibility/TextReadingPreviewController.java
index 1be8c70..98767d9 100644
--- a/src/com/android/settings/accessibility/TextReadingPreviewController.java
+++ b/src/com/android/settings/accessibility/TextReadingPreviewController.java
@@ -108,6 +108,7 @@
         final PreviewPagerAdapter pagerAdapter = new PreviewPagerAdapter(mContext, isLayoutRtl,
                 PREVIEW_SAMPLE_RES_IDS, createConfig(origConfig));
         mPreviewPreference.setPreviewAdapter(pagerAdapter);
+        mPreviewPreference.setCurrentItem(isLayoutRtl ? PREVIEW_SAMPLE_RES_IDS.length - 1 : 0);
         pagerAdapter.setPreviewLayer(/* newLayerIndex= */ 0,
                 /* currentLayerIndex= */ 0,
                 /* currentFrameIndex= */ 0, /* animate= */ false);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index b1b18ff..64a08d3 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -203,7 +203,9 @@
         // Do NOT cancel enrollment progress after rotating, adding mIsOrientationChanged
         // to judge if the focus changed was triggered by rotation, current WMS has triple callbacks
         // (true > false > true), we need to reset mIsOrientationChanged when !hasFocus callback.
-        if (!mIsOrientationChanged) {
+        // Side fps do not have to synchronize udfpsController overlay state, we should bypass sfps
+        // from onWindowFocusChanged() as long press sfps power key will prompt dialog to users.
+        if (!mIsOrientationChanged && !mCanAssumeSfps) {
             onCancelEnrollment(FINGERPRINT_ERROR_USER_CANCELED);
         } else {
             mIsOrientationChanged = false;
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java
index 89c9120..deab745 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java
@@ -118,18 +118,29 @@
         mController = new TestAccessibilityQuickSettingsPrimarySwitchPreferenceController(mContext,
                 TEST_KEY);
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        mController.displayPreference(mScreen);
     }
 
     @Test
     public void setChecked_showTooltipView() {
+        mController.displayPreference(mScreen);
+
         mController.setChecked(true);
 
         assertThat(getLatestPopupWindow().isShowing()).isTrue();
     }
 
     @Test
+    public void setChecked_notCallDisplayPreference_notShowTooltipView() {
+        // Simulates the slice highlight menu that does not call {@link #displayPreference} before
+        // {@link #setChecked} called.
+        mController.setChecked(true);
+
+        assertThat(getLatestPopupWindow()).isNull();
+    }
+
+    @Test
     public void setChecked_tooltipViewShown_notShowTooltipView() {
+        mController.displayPreference(mScreen);
         mController.setChecked(true);
         getLatestPopupWindow().dismiss();
         mController.setChecked(false);
@@ -142,6 +153,7 @@
     @Test
     @Config(shadows = ShadowFragment.class)
     public void restoreValueFromSavedInstanceState_showTooltipView() {
+        mController.displayPreference(mScreen);
         mController.setChecked(true);
         final Bundle savedInstanceState = new Bundle();
         savedInstanceState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true);
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 ef31c39..2c864d6 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
@@ -222,6 +222,16 @@
         );
     }
 
+    @Test
+    public void fingerprintSfpsEnrollment_loseFocus_shouldNotCancel() {
+        initializeActivityFor(FingerprintSensorProperties.TYPE_POWER_BUTTON);
+
+        mActivity.onEnrollmentProgressChange(1, 1);
+        mActivity.onWindowFocusChanged(true);
+
+        verify(mActivity, never()).onCancelEnrollment(anyInt());
+    }
+
     private void initializeActivityFor(int sensorType) {
         final List<ComponentInfoInternal> componentInfo = new ArrayList<>();
         final FingerprintSensorPropertiesInternal prop =