Merge "Setting to change sysui theme"
diff --git a/res/drawable/ic_homepage_storage.xml b/res/drawable/ic_homepage_storage.xml
index 4922844..604cf51 100644
--- a/res/drawable/ic_homepage_storage.xml
+++ b/res/drawable/ic_homepage_storage.xml
@@ -32,5 +32,5 @@
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/dashboard_tile_foreground_image_inset"
android:top="@dimen/dashboard_tile_foreground_image_inset"
- android:drawable="@drawable/ic_settings_storage_white" />
+ android:drawable="@drawable/ic_storage_white" />
</layer-list>
diff --git a/res/drawable/ic_photo_library.xml b/res/drawable/ic_photo_library.xml
index 732a348..a1a58c2 100644
--- a/res/drawable/ic_photo_library.xml
+++ b/res/drawable/ic_photo_library.xml
@@ -21,5 +21,5 @@
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FF000000"
- android:pathData="M22,16V4c0,-1.11 -0.9,-2 -2,-2H8C6.89,2 6,2.89 6,4v12c0,1.1 0.89,2 2,2h12C21.1,18 22,17.1 22,16zM11,12l2.03,2.71L16,11l4,5H8L11,12zM2,7v13c0,1.1 0.9,2 2,2h13c0.55,0 1,-0.45 1,-1v0c0,-0.55 -0.45,-1 -1,-1H4.5C4.22,20 4,19.78 4,19.5V7c0,-0.55 -0.45,-1 -1,-1h0C2.45,6 2,6.45 2,7z"/>
+ android:pathData="M20,4v12H8V4H20M20,2H8C6.9,2 6,2.9 6,4v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C22,2.9 21.1,2 20,2L20,2zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2zM15.67,11l-2.5,2.98L11.5,11.8L9,15h10L15.67,11z"/>
</vector>
diff --git a/res/drawable/ic_settings_accessibility.xml b/res/drawable/ic_settings_accessibility.xml
index 67b6c9a..d5c89b9 100644
--- a/res/drawable/ic_settings_accessibility.xml
+++ b/res/drawable/ic_settings_accessibility.xml
@@ -20,5 +20,8 @@
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
- android:pathData="M20.75,6.99c-0.14,-0.55 -0.69,-0.87 -1.24,-0.75C17.13,6.77 14.48,7 12,7S6.87,6.77 4.49,6.24c-0.55,-0.12 -1.1,0.2 -1.24,0.75l0,0C3.11,7.55 3.45,8.12 4,8.25C5.61,8.61 7.35,8.86 9,9v12c0,0.55 0.45,1 1,1h0c0.55,0 1,-0.45 1,-1v-5h2v5c0,0.55 0.45,1 1,1h0c0.55,0 1,-0.45 1,-1V9c1.65,-0.14 3.39,-0.39 5,-0.75C20.55,8.12 20.89,7.55 20.75,6.99L20.75,6.99zM12,6c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2s-2,0.9 -2,2S10.9,6 12,6z"/>
+ android:pathData="M20.5,4c-2.61,0.7 -5.67,1 -8.5,1S6.11,4.7 3.5,4L3,6c1.86,0.5 4,0.83 6,1v13h2v-6h2v6h2V7c2,-0.17 4.14,-0.5 6,-1L20.5,4zM12,4c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2s-2,0.9 -2,2S10.9,4 12,4z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7,24h2v-2H7V24zM11,24h2v-2h-2V24zM15,24h2v-2h-2V24z"/>
</vector>
diff --git a/res/drawable/ic_settings_memory.xml b/res/drawable/ic_settings_memory.xml
index 830dfc9..78a6b8d 100644
--- a/res/drawable/ic_settings_memory.xml
+++ b/res/drawable/ic_settings_memory.xml
@@ -20,19 +20,6 @@
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
- android:pathData="M6.0,4.0l0.0,16.0 12.0,0.0 0.0,-16.0 -12.0,0.0z
- M6.0,5.25l0,1.5 -3,0 0,-1.5 3,0z
- M6.0,9.25l0,1.5 -3,0 0,-1.5 3,0z
- M6.0,13.25l0,1.5 -3,0 0,-1.5 3,0z
- M6.0,17.25l0,1.5 -3,0 0,-1.5 3,0z
- M21.0,5.25l0,1.5 -3,0 0,-1.5 3,0z
- M21.0,9.25l0,1.5 -3,0 0,-1.5 3,0z
- M21.0,13.25l0,1.5 -3,0 0,-1.5 3,0z
- M21.0,17.25l0,1.5 -3,0 0,-1.5 3,0z
-
- M11.5,14.5l1,0 0,3 -1,0 0,-3z
- M13.25,14.5l1,0 0,3 -1,0 0,-3z
- M15.0,14.5l1,0 0,3 -1,0 0,-3z
- "
- android:fillColor="@android:color/black" />
+ android:fillColor="@android:color/black"
+ android:pathData="M15,9H9v6h6V9zM21,11V9h-2V7c0,-1.1 -0.9,-2 -2,-2h-2V3h-2v2h-2V3H9v2H7C5.9,5 5,5.9 5,7v2H3v2h2v2H3v2h2v2c0,1.1 0.9,2 2,2h2v2h2v-2h2v2h2v-2h2c1.1,0 2,-0.9 2,-2v-2h2v-2h-2v-2H21zM17,17H7V7h10V17z"/>
</vector>
diff --git a/res/drawable/ic_settings_sim.xml b/res/drawable/ic_settings_sim.xml
index d083c9d..3edda49 100644
--- a/res/drawable/ic_settings_sim.xml
+++ b/res/drawable/ic_settings_sim.xml
@@ -16,13 +16,30 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
+ android:width="24dp"
+ android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFFFF"
- android:pathData="M19.99 4c0-1.1-.89-2-1.99-2h-8L4 8v12c0 1.1.9 2 2 2h12.01c1.1 0 1.99-.9 1.99-2l-.01-16zM9 19H7v-2h2v2zm8 0h-2v-2h2v2zm-8-4H7v-4h2v4zm4 4h-2v-4h2v4zm0-6h-2v-2h2v2zm4 2h-2v-4h2v4z"/>
- <path android:pathData="M0 0h24v24H0z"/>
+ android:pathData="M18,2h-8L4,8v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C20,2.9 19.1,2 18,2zM18,4v16H6V8.83L10.83,4L18,4L18,4z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7,17h2v2h-2z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M15,17h2v2h-2z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7,11h2v4h-2z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M11,15h2v4h-2z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M11,11h2v2h-2z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M15,11h2v4h-2z"/>
</vector>
diff --git a/res/drawable/ic_settings_storage.xml b/res/drawable/ic_settings_storage.xml
deleted file mode 100644
index 36dcc38..0000000
--- a/res/drawable/ic_settings_storage.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FF000000"
- android:pathData="M20,16L4,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2zM5,19.1c-0.61,0 -1.1,-0.49 -1.1,-1.1 0,-0.61 0.49,-1.1 1.1,-1.1s1.1,0.49 1.1,1.1c0,0.61 -0.49,1.1 -1.1,1.1zM4,8h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2L4,4c-1.1,0 -2,0.9 -2,2s0.9,2 2,2zM5,4.9c0.61,0 1.1,0.49 1.1,1.1 0,0.61 -0.49,1.1 -1.1,1.1S3.9,6.61 3.9,6c0,-0.61 0.49,-1.1 1.1,-1.1zM20,10L4,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2zM5,13.1c-0.61,0 -1.1,-0.49 -1.1,-1.1 0,-0.61 0.49,-1.1 1.1,-1.1s1.1,0.49 1.1,1.1c0,0.61 -0.49,1.1 -1.1,1.1z"/>
-</vector>
diff --git a/res/drawable/ic_storage.xml b/res/drawable/ic_storage.xml
index 36dcc38..55e66c3 100644
--- a/res/drawable/ic_storage.xml
+++ b/res/drawable/ic_storage.xml
@@ -21,5 +21,5 @@
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FF000000"
- android:pathData="M20,16L4,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2zM5,19.1c-0.61,0 -1.1,-0.49 -1.1,-1.1 0,-0.61 0.49,-1.1 1.1,-1.1s1.1,0.49 1.1,1.1c0,0.61 -0.49,1.1 -1.1,1.1zM4,8h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2L4,4c-1.1,0 -2,0.9 -2,2s0.9,2 2,2zM5,4.9c0.61,0 1.1,0.49 1.1,1.1 0,0.61 -0.49,1.1 -1.1,1.1S3.9,6.61 3.9,6c0,-0.61 0.49,-1.1 1.1,-1.1zM20,10L4,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2zM5,13.1c-0.61,0 -1.1,-0.49 -1.1,-1.1 0,-0.61 0.49,-1.1 1.1,-1.1s1.1,0.49 1.1,1.1c0,0.61 -0.49,1.1 -1.1,1.1z"/>
+ android:pathData="M3,20h18v-4H3V20zM5,17h2v2H5V17zM3,4v4h18V4H3zM7,7H5V5h2V7zM3,14h18v-4H3V14zM5,11h2v2H5V11z"/>
</vector>
diff --git a/res/drawable/ic_settings_storage_white.xml b/res/drawable/ic_storage_white.xml
similarity index 60%
rename from res/drawable/ic_settings_storage_white.xml
rename to res/drawable/ic_storage_white.xml
index 8f662f3..eed9140 100644
--- a/res/drawable/ic_settings_storage_white.xml
+++ b/res/drawable/ic_storage_white.xml
@@ -20,5 +20,5 @@
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFF"
- android:pathData="M20,16L4,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2zM5,19.1c-0.61,0 -1.1,-0.49 -1.1,-1.1 0,-0.61 0.49,-1.1 1.1,-1.1s1.1,0.49 1.1,1.1c0,0.61 -0.49,1.1 -1.1,1.1zM4,8h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2L4,4c-1.1,0 -2,0.9 -2,2s0.9,2 2,2zM5,4.9c0.61,0 1.1,0.49 1.1,1.1 0,0.61 -0.49,1.1 -1.1,1.1S3.9,6.61 3.9,6c0,-0.61 0.49,-1.1 1.1,-1.1zM20,10L4,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2h16c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2zM5,13.1c-0.61,0 -1.1,-0.49 -1.1,-1.1 0,-0.61 0.49,-1.1 1.1,-1.1s1.1,0.49 1.1,1.1c0,0.61 -0.49,1.1 -1.1,1.1z"/>
+ android:pathData="M3,20h18v-4H3V20zM5,17h2v2H5V17zM3,4v4h18V4H3zM7,7H5V5h2V7zM3,14h18v-4H3V14zM5,11h2v2H5V11z"/>
</vector>
diff --git a/res/drawable/ic_videogame_vd_theme_24.xml b/res/drawable/ic_videogame_vd_theme_24.xml
index 8cb9c1c..bd6f74b 100644
--- a/res/drawable/ic_videogame_vd_theme_24.xml
+++ b/res/drawable/ic_videogame_vd_theme_24.xml
@@ -21,5 +21,14 @@
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
- android:pathData="M21,6L3,6c-1.1,0 -2,0.9 -2,2v8c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,8c0,-1.1 -0.9,-2 -2,-2zM11,13L8,13v3L6,16v-3L3,13v-2h3L6,8h2v3h3v2zM15.5,15c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM19.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S18.67,9 19.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
-</vector>
\ No newline at end of file
+ android:pathData="M21,6H3C1.9,6 1,6.9 1,8v8c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2V8C23,6.9 22.1,6 21,6zM21,16H3V8h18V16z"/>
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M6,15l2,0l0,-2l2,0l0,-2l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0z"/>
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M14.5,13.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M18.5,10.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
+</vector>
diff --git a/res/drawable/ic_vpn_key.xml b/res/drawable/ic_vpn_key.xml
index 71b29d6..c2a7e34 100644
--- a/res/drawable/ic_vpn_key.xml
+++ b/res/drawable/ic_vpn_key.xml
@@ -20,7 +20,9 @@
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
- android:pathData="M12.65,10C11.7,7.31,8.9,5.5,5.78,6.12C3.49,6.58,1.62,8.41,1.14,10.7C0.32,14.57,3.26,18,7,18c2.61,0,4.83-1.67,5.65-4H16
-v2c0,1.1,0.9,2,2,2h0c1.1,0,2-0.9,2-2v-2h1c1.1,0,2-0.9,2-2v0c0-1.1-0.9-2-2-2H12.65z M7,14c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2 S8.1,14,7,14z"
- android:fillColor="#FFFFFFFF"/>
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.09,9C11.11,7.5 9.43,6.5 7.5,6.5C4.46,6.5 2,8.96 2,12c0,3.04 2.46,5.5 5.5,5.5c1.93,0 3.61,-1 4.59,-2.5H14v3h6v-3h2V9H12.09zM20,13h-2v3h-2v-3h-5.16c-0.43,1.44 -1.76,2.5 -3.34,2.5C5.57,15.5 4,13.93 4,12c0,-1.93 1.57,-3.5 3.5,-3.5c1.58,0 2.9,1.06 3.34,2.5H20V13z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M7.5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
</vector>
diff --git a/res/drawable/ic_warning_24dp.xml b/res/drawable/ic_warning_24dp.xml
index 8e9fee3..2ca48e0 100644
--- a/res/drawable/ic_warning_24dp.xml
+++ b/res/drawable/ic_warning_24dp.xml
@@ -1,5 +1,5 @@
<!--
-Copyright (C) 2015 The Android Open Source Project
+Copyright (C) 2018 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -16,9 +16,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
- android:viewportWidth="48.0"
- android:viewportHeight="48.0">
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
- android:pathData="M2 42h44L24 4 2 42zm24,-6h-4v-4h4v4zm0,-8h-4v-8h4v8z"/>
+ android:pathData="M12,5.99L19.53,19H4.47L12,5.99M12,2L1,21h22L12,2L12,2z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M13,16l-2,0l0,2l2,0l0,-2z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M13,10l-2,0l0,4l2,0l0,-4z"/>
</vector>
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index fe891e1..2330727 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -604,6 +604,7 @@
<LinearLayout android:id="@+id/hidden_settings_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:visibility="gone"
style="@style/wifi_item">
<TextView android:id="@+id/hidden_settings_title"
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index 4c3ad63..7aa7138 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -67,7 +67,7 @@
Drawable icon;
if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {
- icon = context.getDrawable(R.drawable.ic_settings_storage);
+ icon = context.getDrawable(R.drawable.ic_storage);
} else {
icon = context.getDrawable(R.drawable.ic_sim_sd);
}
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
index 8c41f19..0627cb3 100644
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
@@ -15,6 +15,7 @@
*/
package com.android.settings.network;
+import static android.net.ConnectivityManager.PRIVATE_DNS_DEFAULT_MODE_FALLBACK;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
@@ -79,8 +80,11 @@
static final String HOSTNAME_KEY = Settings.Global.PRIVATE_DNS_SPECIFIER;
public static String getModeFromSettings(ContentResolver cr) {
- final String mode = Settings.Global.getString(cr, MODE_KEY);
- return PRIVATE_DNS_MAP.containsKey(mode) ? mode : PRIVATE_DNS_MODE_OPPORTUNISTIC;
+ String mode = Settings.Global.getString(cr, MODE_KEY);
+ if (!PRIVATE_DNS_MAP.containsKey(mode)) {
+ mode = Settings.Global.getString(cr, Settings.Global.PRIVATE_DNS_DEFAULT_MODE);
+ }
+ return PRIVATE_DNS_MAP.containsKey(mode) ? mode : PRIVATE_DNS_DEFAULT_MODE_FALLBACK;
}
public static String getHostnameFromSettings(ContentResolver cr) {
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java
index f127e6f..13e5bf3 100644
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
@@ -19,6 +19,9 @@
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
+import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;
+import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
+import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
import android.content.Context;
import android.content.ContentResolver;
@@ -51,8 +54,9 @@
private static final String KEY_PRIVATE_DNS_SETTINGS = "private_dns_settings";
private static final Uri[] SETTINGS_URIS = new Uri[]{
- Settings.Global.getUriFor(Settings.Global.PRIVATE_DNS_MODE),
- Settings.Global.getUriFor(Settings.Global.PRIVATE_DNS_SPECIFIER),
+ Settings.Global.getUriFor(PRIVATE_DNS_MODE),
+ Settings.Global.getUriFor(PRIVATE_DNS_DEFAULT_MODE),
+ Settings.Global.getUriFor(PRIVATE_DNS_SPECIFIER),
};
private final Handler mHandler;
diff --git a/src/com/android/settings/notification/NotificationPreferenceController.java b/src/com/android/settings/notification/NotificationPreferenceController.java
index e8af379..49bb08e 100644
--- a/src/com/android/settings/notification/NotificationPreferenceController.java
+++ b/src/com/android/settings/notification/NotificationPreferenceController.java
@@ -83,28 +83,6 @@
return true;
}
- /**
- * Displays or removes preference in this controller.
- */
- @Override
- public void displayPreference(PreferenceScreen screen) {
- if (isAvailable()) {
- final Preference preference = screen.findPreference(getPreferenceKey());
- if (mPreference != null && preference == null) {
- screen.addPreference(mPreference);
- }
- if (preference != null) {
- mPreference = preference;
- }
- if (mPreference != null && this instanceof Preference.OnPreferenceChangeListener) {
- mPreference.setOnPreferenceChangeListener(
- (Preference.OnPreferenceChangeListener) this);
- }
- } else {
- findAndRemovePreference(screen, getPreferenceKey());
- }
- }
-
// finds the preference recursively and removes it from its parent
private void findAndRemovePreference(PreferenceGroup prefGroup, String key) {
final int preferenceCount = prefGroup.getPreferenceCount();
diff --git a/src/com/android/settings/search/DeviceIndexFeatureProvider.java b/src/com/android/settings/search/DeviceIndexFeatureProvider.java
index bf75ee8..1c25399 100644
--- a/src/com/android/settings/search/DeviceIndexFeatureProvider.java
+++ b/src/com/android/settings/search/DeviceIndexFeatureProvider.java
@@ -31,6 +31,7 @@
import com.android.settings.slices.SettingsSliceProvider;
import java.util.List;
+import java.util.Locale;
import java.util.Objects;
public interface DeviceIndexFeatureProvider {
@@ -39,15 +40,21 @@
String TAG = "DeviceIndex";
String INDEX_VERSION = "settings:index_version";
+ String INDEX_LANGUAGE = "settings:language";
// Increment when new items are added to ensure they get pushed to the device index.
String VERSION = Build.FINGERPRINT;
+ // When the device language changes, re-index so Slices trigger in device language.
+ Locale LANGUAGE = Locale.getDefault();
+
boolean isIndexingEnabled();
void index(Context context, CharSequence title, Uri sliceUri, Uri launchUri,
List<String> keywords);
+ void clearIndex(Context context);
+
default void updateIndex(Context context, boolean force) {
if (!isIndexingEnabled()) {
Log.w(TAG, "Skipping: device index is not enabled");
@@ -59,12 +66,14 @@
return;
}
- if (!force && Objects.equals(
- Settings.Secure.getString(context.getContentResolver(), INDEX_VERSION), VERSION)) {
+ if (!force && skipIndex(context)) {
// No need to update.
return;
}
+ // Prevent scheduling multiple jobs
+ setIndexState(context);
+
final ComponentName jobComponent = new ComponentName(context.getPackageName(),
DeviceIndexUpdateJobService.class.getName());
final int jobId = context.getResources().getInteger(R.integer.device_index_update);
@@ -77,7 +86,6 @@
.setOverrideDeadline(1)
.build());
- Settings.Secure.putString(context.getContentResolver(), INDEX_VERSION, VERSION);
}
static Uri createDeepLink(String s) {
@@ -86,4 +94,18 @@
.appendQueryParameter(INTENT, s)
.build();
}
+
+ static boolean skipIndex(Context context) {
+ final boolean isSameVersion = Objects.equals(
+ Settings.Secure.getString(context.getContentResolver(), INDEX_VERSION), VERSION);
+ final boolean isSameLanguage = Objects.equals(
+ Settings.Secure.getString(context.getContentResolver(), INDEX_LANGUAGE), LANGUAGE);
+ return isSameLanguage && isSameVersion;
+ }
+
+ static void setIndexState(Context context) {
+ Settings.Secure.putString(context.getContentResolver(), INDEX_VERSION, VERSION);
+ Settings.Secure.putString(context.getContentResolver(), INDEX_LANGUAGE,
+ LANGUAGE.toString());
+ }
}
diff --git a/src/com/android/settings/search/DeviceIndexFeatureProviderImpl.java b/src/com/android/settings/search/DeviceIndexFeatureProviderImpl.java
index 7a11bd4..087ecf8 100644
--- a/src/com/android/settings/search/DeviceIndexFeatureProviderImpl.java
+++ b/src/com/android/settings/search/DeviceIndexFeatureProviderImpl.java
@@ -31,4 +31,9 @@
List<String> keywords) {
// Not enabled by default.
}
+
+ @Override
+ public void clearIndex(Context context) {
+ // Not enabled by default.
+ }
}
diff --git a/src/com/android/settings/search/DeviceIndexUpdateJobService.java b/src/com/android/settings/search/DeviceIndexUpdateJobService.java
index 19b7d5e..97b0a61 100644
--- a/src/com/android/settings/search/DeviceIndexUpdateJobService.java
+++ b/src/com/android/settings/search/DeviceIndexUpdateJobService.java
@@ -25,6 +25,7 @@
import android.content.Intent;
import android.net.Uri;
import android.net.Uri.Builder;
+import android.provider.SettingsSlicesContract;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -84,11 +85,19 @@
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(SettingsSliceProvider.SLICE_AUTHORITY)
.build();
+ final Uri platformBaseUri = new Builder()
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .authority(SettingsSlicesContract.AUTHORITY)
+ .build();
final Collection<Uri> slices = manager.getSliceDescendants(baseUri);
+ slices.addAll(manager.getSliceDescendants(platformBaseUri));
+
if (DEBUG) {
Log.d(TAG, "Indexing " + slices.size() + " slices");
}
+ indexProvider.clearIndex(this /* context */);
+
for (Uri slice : slices) {
if (!mRunningJob) {
return;
diff --git a/src/com/android/settings/slices/SettingsSliceProvider.java b/src/com/android/settings/slices/SettingsSliceProvider.java
index e8e2e1d..52888b0 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -177,6 +177,13 @@
@Override
public Slice onBindSlice(Uri sliceUri) {
+ final Set<String> blockedKeys = getBlockedKeys();
+ final String key = sliceUri.getLastPathSegment();
+ if (blockedKeys.contains(key)) {
+ Log.e(TAG, "Requested blocked slice with Uri: " + sliceUri);
+ return null;
+ }
+
// If adding a new Slice, do not directly match Slice URIs.
// Use {@link SlicesDatabaseAccessor}.
if (WifiCallingSliceHelper.WIFI_CALLING_URI.equals(sliceUri)) {
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 95f7e9c..22de20c 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -220,8 +220,6 @@
mMeteredSettingsSpinner = mView.findViewById(R.id.metered_settings);
mHiddenSettingsSpinner = mView.findViewById(R.id.hidden_settings);
mHiddenSettingsSpinner.setOnItemSelectedListener(this);
- mHiddenSettingsSpinner.setVisibility(View.GONE);
- mHiddenSettingsSpinner.setEnabled(false);
mHiddenWarningView = mView.findViewById(R.id.hidden_settings_warning);
mHiddenWarningView.setVisibility(
mHiddenSettingsSpinner.getSelectedItemPosition() == NOT_HIDDEN_NETWORK
@@ -241,8 +239,7 @@
showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
// Hidden option can be changed only when the user adds a network manually.
- mHiddenSettingsSpinner.setVisibility(View.VISIBLE);
- mHiddenSettingsSpinner.setEnabled(true);
+ mView.findViewById(R.id.hidden_settings_field).setVisibility(View.VISIBLE);
((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
.setOnCheckedChangeListener(this);
diff --git a/tests/robotests/src/com/android/settings/network/PrivateDnsModeDialogPreferenceTest.java b/tests/robotests/src/com/android/settings/network/PrivateDnsModeDialogPreferenceTest.java
index dfea6fb..72f36c6 100644
--- a/tests/robotests/src/com/android/settings/network/PrivateDnsModeDialogPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/network/PrivateDnsModeDialogPreferenceTest.java
@@ -19,6 +19,7 @@
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
+import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.doReturn;
@@ -158,24 +159,21 @@
public void testOnClick_positiveButtonClicked_saveData() {
// Set the default settings to OFF
final ContentResolver contentResolver = mContext.getContentResolver();
- Settings.Global.putString(contentResolver, Settings.Global.PRIVATE_DNS_MODE,
- ConnectivityManager.PRIVATE_DNS_MODE_OFF);
+ Settings.Global.putString(contentResolver, PRIVATE_DNS_MODE, PRIVATE_DNS_MODE_OFF);
mPreference.mMode = ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
mPreference.onClick(null, DialogInterface.BUTTON_POSITIVE);
// Change to OPPORTUNISTIC
- assertThat(Settings.Global.getString(contentResolver,
- Settings.Global.PRIVATE_DNS_MODE)).isEqualTo(
- ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC);
+ assertThat(Settings.Global.getString(contentResolver, PRIVATE_DNS_MODE)).isEqualTo(
+ PRIVATE_DNS_MODE_OPPORTUNISTIC);
}
@Test
public void testOnClick_negativeButtonClicked_doNothing() {
// Set the default settings to OFF
final ContentResolver contentResolver = mContext.getContentResolver();
- Settings.Global.putString(contentResolver, Settings.Global.PRIVATE_DNS_MODE,
- ConnectivityManager.PRIVATE_DNS_MODE_OFF);
+ Settings.Global.putString(contentResolver, PRIVATE_DNS_MODE, PRIVATE_DNS_MODE_OFF);
mPreference.mMode = ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
mPreference.onClick(null, DialogInterface.BUTTON_NEGATIVE);
diff --git a/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
index 665b3c2..eff20d3 100644
--- a/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
@@ -21,6 +21,7 @@
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
+import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;
import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
import static com.google.common.truth.Truth.assertThat;
@@ -220,6 +221,34 @@
getResourceString(R.string.private_dns_mode_provider_failure));
}
+ @Test
+ public void getSummary_PrivateDnsDefaultMode() {
+ // Default mode is opportunistic, unless overridden by a Settings push.
+ setPrivateDnsMode("");
+ setPrivateDnsProviderHostname("");
+ mController.updateState(mPreference);
+ verify(mController, atLeastOnce()).getSummary();
+ verify(mPreference).setSummary(getResourceString(R.string.private_dns_mode_opportunistic));
+
+ reset(mController);
+ reset(mPreference);
+ // Pretend an emergency gservices setting has disabled default-opportunistic.
+ Settings.Global.putString(mContentResolver, PRIVATE_DNS_DEFAULT_MODE, PRIVATE_DNS_MODE_OFF);
+ mController.updateState(mPreference);
+ verify(mController, atLeastOnce()).getSummary();
+ verify(mPreference).setSummary(getResourceString(R.string.private_dns_mode_off));
+
+ reset(mController);
+ reset(mPreference);
+ // The user interacting with the Private DNS menu, explicitly choosing
+ // opportunistic mode, will be able to use despite the change to the
+ // default setting above.
+ setPrivateDnsMode(PRIVATE_DNS_MODE_OPPORTUNISTIC);
+ mController.updateState(mPreference);
+ verify(mController, atLeastOnce()).getSummary();
+ verify(mPreference).setSummary(getResourceString(R.string.private_dns_mode_opportunistic));
+ }
+
private void setPrivateDnsMode(String mode) {
Settings.Global.putString(mContentResolver, PRIVATE_DNS_MODE, mode);
}
diff --git a/tests/robotests/src/com/android/settings/search/DeviceIndexFeatureProviderTest.java b/tests/robotests/src/com/android/settings/search/DeviceIndexFeatureProviderTest.java
index d4c1580..a900db0 100644
--- a/tests/robotests/src/com/android/settings/search/DeviceIndexFeatureProviderTest.java
+++ b/tests/robotests/src/com/android/settings/search/DeviceIndexFeatureProviderTest.java
@@ -23,6 +23,7 @@
import android.app.Activity;
import android.app.job.JobScheduler;
+import android.os.Build;
import android.provider.Settings;
import com.android.settings.testutils.FakeFeatureFactory;
@@ -76,4 +77,51 @@
mProvider.updateIndex(mActivity, false);
verify(jobScheduler).schedule(any());
}
+
+ @Test
+ public void updateIndex_enabled_provisioned_newBuild_shouldIndex() {
+ Settings.Global.putInt(mActivity.getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 1);
+ DeviceIndexFeatureProvider.setIndexState(mActivity);
+ Settings.Global.putString(mActivity.getContentResolver(),
+ DeviceIndexFeatureProvider.INDEX_VERSION, "new version");
+ Settings.Global.putString(mActivity.getContentResolver(),
+ DeviceIndexFeatureProvider.LANGUAGE.toString(),
+ DeviceIndexFeatureProvider.INDEX_LANGUAGE);
+ JobScheduler jobScheduler = mock(JobScheduler.class);
+ when(mProvider.isIndexingEnabled()).thenReturn(true);
+ when(mActivity.getSystemService(JobScheduler.class)).thenReturn(jobScheduler);
+
+ mProvider.updateIndex(mActivity, false);
+ verify(jobScheduler).schedule(any());
+ }
+
+ @Test
+ public void updateIndex_enabled_provisioned_newIndex_shouldIndex() {
+ Settings.Global.putInt(mActivity.getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 1);
+ DeviceIndexFeatureProvider.setIndexState(mActivity);
+ Settings.Global.putString(mActivity.getContentResolver(),
+ DeviceIndexFeatureProvider.INDEX_LANGUAGE, "new language");
+ JobScheduler jobScheduler = mock(JobScheduler.class);
+ when(mProvider.isIndexingEnabled()).thenReturn(true);
+ when(mActivity.getSystemService(JobScheduler.class)).thenReturn(jobScheduler);
+
+ mProvider.updateIndex(mActivity, false);
+ verify(jobScheduler).schedule(any());
+ }
+
+ @Test
+ public void updateIndex_enabled_provisioned_sameBuild_sameLang_shouldNotIndex() {
+ Settings.Global.putInt(mActivity.getContentResolver(),
+ Settings.Global.DEVICE_PROVISIONED, 1);
+ DeviceIndexFeatureProvider.setIndexState(mActivity);
+ JobScheduler jobScheduler = mock(JobScheduler.class);
+ when(mProvider.isIndexingEnabled()).thenReturn(true);
+ when(mActivity.getSystemService(JobScheduler.class)).thenReturn(jobScheduler);
+
+ mProvider.updateIndex(mActivity, false);
+
+ verify(mProvider, never()).index(any(), any(), any(), any(), any());
+ }
}
diff --git a/tests/robotests/src/com/android/settings/search/DeviceIndexUpdateJobServiceTest.java b/tests/robotests/src/com/android/settings/search/DeviceIndexUpdateJobServiceTest.java
index ec16893..b5de973 100644
--- a/tests/robotests/src/com/android/settings/search/DeviceIndexUpdateJobServiceTest.java
+++ b/tests/robotests/src/com/android/settings/search/DeviceIndexUpdateJobServiceTest.java
@@ -124,6 +124,7 @@
DeviceIndexFeatureProvider indexFeatureProvider = FakeFeatureFactory.getFactory(mActivity)
.getDeviceIndexFeatureProvider();
+ verify(indexFeatureProvider).clearIndex(any());
verify(indexFeatureProvider, times(1)).index(any(), any(), any(), any(), any());
}
diff --git a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
index bb064d1..df960d8 100644
--- a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
@@ -22,6 +22,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -35,6 +36,7 @@
import android.net.Uri;
import android.os.StrictMode;
import android.provider.SettingsSlicesContract;
+import android.util.ArraySet;
import com.android.settings.location.LocationSliceBuilder;
import com.android.settings.wifi.WifiSliceBuilder;
@@ -56,6 +58,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import androidx.slice.Slice;
@@ -193,6 +196,24 @@
}
@Test
+ public void onBindSlice_requestsBlockedSlice_retunsNull() {
+ final String blockedKey = "blocked_key";
+ final Set<String> blockedSet = new ArraySet<>();
+ blockedSet.add(blockedKey);
+ doReturn(blockedSet).when(mProvider).getBlockedKeys();
+ final Uri blockedUri = new Uri.Builder()
+ .scheme(ContentResolver.SCHEME_CONTENT)
+ .authority(SettingsSliceProvider.SLICE_AUTHORITY)
+ .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
+ .appendPath(blockedKey)
+ .build();
+
+ final Slice slice = mProvider.onBindSlice(blockedUri);
+
+ assertThat(slice).isNull();
+ }
+
+ @Test
public void testLoadSlice_cachedEntryRemovedOnUnpin() {
SliceData data = getDummyData();
mProvider.mSliceDataCache.put(data.getUri(), data);
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
index ddbc851..43e87d8 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
@@ -259,26 +259,13 @@
}
@Test
- public void hiddenView_isDisabledWhenAppropriate() {
- View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
- assertThat(hiddenSpinner.isEnabled()).isFalse();
+ public void hiddenField_visibilityUpdatesCorrectly() {
+ View hiddenField = mView.findViewById(R.id.hidden_settings_field);
+ assertThat(hiddenField.getVisibility()).isEqualTo(View.GONE);
mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
WifiConfigUiBase.MODE_CONNECT);
- assertThat(hiddenSpinner.isEnabled()).isTrue();
- }
-
-
- @Test
- public void hiddenSpinner_visibilityUpdatesCorrectly() {
- View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
- assertThat(hiddenSpinner.isEnabled()).isFalse();
- assertThat(hiddenSpinner.getVisibility()).isEqualTo(View.GONE);
-
- mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
- WifiConfigUiBase.MODE_CONNECT);
- assertThat(hiddenSpinner.isEnabled()).isTrue();
- assertThat(hiddenSpinner.getVisibility()).isEqualTo(View.VISIBLE);
+ assertThat(hiddenField.getVisibility()).isEqualTo(View.VISIBLE);
}
public class TestWifiConfigController extends WifiConfigController {