Merge "Add turn screen darker fragment in a11y settings text and display" into sc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1fa56f2..9e22f9d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5278,17 +5278,40 @@
     <!-- Summary shown for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] -->
     <string name="daltonizer_mode_tritanomaly_summary">Blue-yellow</string>
 
-    <!-- TODO(b/170970602): remove translatable=false when RBC has official name and strings -->
-    <!-- Title for the accessibility preference to configure Reduce Bright Colors feature. [CHAR LIMIT=NONE] -->
-    <string name="reduce_bright_colors_preference_title" translatable="false">Reduce Bright Colors</string>
-    <!-- Used in the accessibility service settings to control switching Reduce Bright Colors on/off. [CHAR LIMIT=NONE] -->
-    <string name="reduce_bright_colors_switch_title" translatable="false">Use Reduce Bright Colors</string>
-    <!-- Subtitle that describes Reduce Bright Colors. [CHAR LIMIT=NONE] -->
-    <string name="reduce_bright_colors_preference_subtitle" translatable="false">Reduce Bright Colors reduces screen brightness.</string>
-    <!-- Title for setting the brightness intensity of the display using Reduce Bright Colors. [CHAR LIMIT=NONE] -->
-    <string name="reduce_bright_colors_intensity_preference_title" translatable="false">Intensity</string>
-    <!-- Title for setting whether the Reduce Bright Colors activation state persists across reboots. [CHAR LIMIT=NONE] -->
-    <string name="reduce_bright_colors_persist_preference_title" translatable="false">Keeps feature on after a restart</string>
+    <!-- Title for the accessibility preference and switch of the Reduce Brightness feature. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_preference_title">Reduce Brightness</string>
+    <!-- Summary for the accessibility preference to configure Reduce Brightness feature. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_preference_summary" product="default">Make screen darker than your phone\u2019s minimum brightness</string>
+    <!-- Summary for the accessibility preference to configure Reduce Brightness feature. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_preference_summary" product="tablet">Make screen darker than your tablet\u2019s minimum brightness</string>
+    <!-- Subtitle that describes Reduce Brightness. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_preference_subtitle" product="default">
+        <![CDATA[Make your screen darker so it\u2019s more comfortable to read.<br/><br/>
+        This can be helpful when:
+        <ol>
+            <li>\u00a0Your phone\u2019s default minimum brightness is still too bright</li>
+            <li>\u00a0You\u2019re using your phone in dark situations, like at night or in a dark room before bed</li>
+        </ol>
+        ]]>
+    </string>
+    <!-- Subtitle that describes Reduce Brightness. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_preference_subtitle" product="tablet">
+        <![CDATA[Make your screen darker so it\u2019s more comfortable to read.<br/><br/>
+        This can be helpful when:
+        <ol>
+            <li>\u00a0Your tablet\u2019s default minimum brightness is still too bright</li>
+            <li>\u00a0You\u2019re using your tablet in dark situations, like at night or in a dark room before bed</li>
+        </ol>
+        ]]>
+    </string>
+    <!-- Title for setting the brightness intensity of the display using Reduce Brightness. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_intensity_preference_title">Intensity</string>
+    <!-- Start label for setting the brightness intensity of the display using Reduce Brightness. [CHAR LIMIT=50] -->
+    <string name="reduce_bright_colors_intensity_preference_start_label">Slightly darker</string>
+    <!-- End label for setting the brightness intensity of the display using Reduce Brightness. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_intensity_preference_end_label">Darkest</string>
+    <!-- Title for setting whether the Reduce Brightness activation state persists across reboots. [CHAR LIMIT=NONE] -->
+    <string name="reduce_bright_colors_persist_preference_title">Keep on after device restarts</string>
 
     <!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
     <plurals name="accessibilty_autoclick_preference_subtitle_short_delay">
diff --git a/res/xml/app_ops_permissions_details.xml b/res/xml/app_ops_permissions_details.xml
index cbf3e12..eb8188b 100644
--- a/res/xml/app_ops_permissions_details.xml
+++ b/res/xml/app_ops_permissions_details.xml
@@ -20,7 +20,7 @@
     <com.android.settings.widget.FilterTouchesSwitchPreference
         android:key="app_ops_settings_switch" />
 
-    <Preference
+    <com.android.settingslib.widget.FooterPreference
         android:key="app_ops_settings_description"
         android:selectable="false" />
 
diff --git a/res/xml/change_wifi_state_details.xml b/res/xml/change_wifi_state_details.xml
index e3b6755..e0aa6df 100644
--- a/res/xml/change_wifi_state_details.xml
+++ b/res/xml/change_wifi_state_details.xml
@@ -22,9 +22,9 @@
       android:key="app_ops_settings_switch"
       android:title="@string/change_wifi_state_app_detail_switch"/>
 
-  <Preference
+  <com.android.settingslib.widget.FooterPreference
       android:key="app_ops_settings_preference"
-      android:summary="@string/change_wifi_state_app_detail_summary"
+      android:title="@string/change_wifi_state_app_detail_summary"
       android:selectable="false"/>
 
 </PreferenceScreen>
diff --git a/res/xml/draw_overlay_permissions_details.xml b/res/xml/draw_overlay_permissions_details.xml
index d3397a7..603d540 100644
--- a/res/xml/draw_overlay_permissions_details.xml
+++ b/res/xml/draw_overlay_permissions_details.xml
@@ -22,8 +22,8 @@
         android:key="app_ops_settings_switch"
         android:title="@string/permit_draw_overlay"/>
 
-    <Preference
-        android:summary="@string/allow_overlay_description"
+    <com.android.settingslib.widget.FooterPreference
+        android:title="@string/allow_overlay_description"
         android:selectable="false"/>
 
 </PreferenceScreen>
diff --git a/res/xml/external_sources_details.xml b/res/xml/external_sources_details.xml
index 57d5587..7b67871 100644
--- a/res/xml/external_sources_details.xml
+++ b/res/xml/external_sources_details.xml
@@ -21,9 +21,9 @@
         android:key="external_sources_settings_switch"
         android:title="@string/external_source_switch_title" />
 
-    <Preference
+    <com.android.settingslib.widget.FooterPreference
         android:key="external_sources_settings_description"
-        android:summary="@string/install_all_warning"
+        android:title="@string/install_all_warning"
         android:selectable="false" />
 
 </PreferenceScreen>
diff --git a/res/xml/picture_in_picture_permissions_details.xml b/res/xml/picture_in_picture_permissions_details.xml
index 5f2a45a..ba23e2a 100644
--- a/res/xml/picture_in_picture_permissions_details.xml
+++ b/res/xml/picture_in_picture_permissions_details.xml
@@ -22,8 +22,8 @@
         android:key="app_ops_settings_switch"
         android:title="@string/picture_in_picture_app_detail_switch"/>
 
-    <Preference
-        android:summary="@string/picture_in_picture_app_detail_summary"
+    <com.android.settingslib.widget.FooterPreference
+        android:title="@string/picture_in_picture_app_detail_summary"
         android:selectable="false"/>
 
 </PreferenceScreen>
diff --git a/res/xml/write_system_settings_permissions_details.xml b/res/xml/write_system_settings_permissions_details.xml
index 21ea706..a2f9cbd 100644
--- a/res/xml/write_system_settings_permissions_details.xml
+++ b/res/xml/write_system_settings_permissions_details.xml
@@ -22,8 +22,8 @@
         android:key="app_ops_settings_switch"
         android:title="@string/permit_write_settings"/>
 
-    <Preference
-        android:summary="@string/write_settings_description"
+    <com.android.settingslib.widget.FooterPreference
+        android:title="@string/write_settings_description"
         android:selectable="false"/>
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/ProxySelector.java b/src/com/android/settings/ProxySelector.java
index 0b6f16a..a685841 100644
--- a/src/com/android/settings/ProxySelector.java
+++ b/src/com/android/settings/ProxySelector.java
@@ -23,7 +23,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.ConnectivityManager;
-import android.net.Proxy;
 import android.net.ProxyInfo;
 import android.os.Bundle;
 import android.text.Selection;
@@ -186,18 +185,18 @@
      * @return 0 on success, string resource ID on failure
      */
     public static int validate(String hostname, String port, String exclList) {
-        switch (Proxy.validate(hostname, port, exclList)) {
-            case Proxy.PROXY_VALID:
+        switch (ProxyUtils.validate(hostname, port, exclList)) {
+            case ProxyUtils.PROXY_VALID:
                 return 0;
-            case Proxy.PROXY_HOSTNAME_EMPTY:
+            case ProxyUtils.PROXY_HOSTNAME_EMPTY:
                 return R.string.proxy_error_empty_host_set_port;
-            case Proxy.PROXY_HOSTNAME_INVALID:
+            case ProxyUtils.PROXY_HOSTNAME_INVALID:
                 return R.string.proxy_error_invalid_host;
-            case Proxy.PROXY_PORT_EMPTY:
+            case ProxyUtils.PROXY_PORT_EMPTY:
                 return R.string.proxy_error_empty_port;
-            case Proxy.PROXY_PORT_INVALID:
+            case ProxyUtils.PROXY_PORT_INVALID:
                 return R.string.proxy_error_invalid_port;
-            case Proxy.PROXY_EXCLLIST_INVALID:
+            case ProxyUtils.PROXY_EXCLLIST_INVALID:
                 return R.string.proxy_error_invalid_exclusion_list;
             default:
                 // should neven happen
diff --git a/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
index 5562795..ca19681 100644
--- a/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
@@ -157,7 +157,7 @@
 
     @Override
     protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
-        switchPreference.setTitle(R.string.reduce_bright_colors_switch_title);
+        switchPreference.setTitle(R.string.reduce_bright_colors_preference_title);
     }
 
     @Override
diff --git a/src/com/android/settings/applications/UsageAccessDetails.java b/src/com/android/settings/applications/UsageAccessDetails.java
index cddacb3..4681fd8 100644
--- a/src/com/android/settings/applications/UsageAccessDetails.java
+++ b/src/com/android/settings/applications/UsageAccessDetails.java
@@ -74,7 +74,7 @@
 
         getPreferenceScreen().setTitle(R.string.usage_access);
         mSwitchPref.setTitle(R.string.permit_usage_access);
-        mUsageDesc.setSummary(R.string.usage_access_description);
+        mUsageDesc.setTitle(R.string.usage_access_description);
 
         mSwitchPref.setOnPreferenceChangeListener(this);
 
diff --git a/src/com/android/settings/vpn2/ConfigDialog.java b/src/com/android/settings/vpn2/ConfigDialog.java
index 26c1565..a0c7a1e 100644
--- a/src/com/android/settings/vpn2/ConfigDialog.java
+++ b/src/com/android/settings/vpn2/ConfigDialog.java
@@ -21,7 +21,6 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.pm.PackageManager;
-import android.net.Proxy;
 import android.net.ProxyInfo;
 import android.os.Bundle;
 import android.os.SystemProperties;
@@ -41,6 +40,7 @@
 import androidx.appcompat.app.AlertDialog;
 
 import com.android.internal.net.VpnProfile;
+import com.android.net.module.util.ProxyUtils;
 import com.android.settings.R;
 
 import java.net.InetAddress;
@@ -637,7 +637,7 @@
 
         final String host = mProxyHost.getText().toString().trim();
         final String port = mProxyPort.getText().toString().trim();
-        return Proxy.validate(host, port, "") == Proxy.PROXY_VALID;
+        return ProxyUtils.validate(host, port, "") == ProxyUtils.PROXY_VALID;
     }
 
 }