Merge "Add metric for Tap & Pay Foreground Setting"
diff --git a/Android.mk b/Android.mk
index c99e30c..e385b34 100644
--- a/Android.mk
+++ b/Android.mk
@@ -23,6 +23,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_ANDROID_LIBRARIES := \
+ androidx-constraintlayout_constraintlayout \
androidx.slice_slice-builders \
androidx.slice_slice-core \
androidx.slice_slice-view \
@@ -40,6 +41,7 @@
ims-common
LOCAL_STATIC_JAVA_LIBRARIES := \
+ androidx-constraintlayout_constraintlayout-solver \
androidx.lifecycle_lifecycle-runtime \
androidx.lifecycle_lifecycle-extensions \
guava \
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 69a67ad..e57705e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1477,7 +1477,7 @@
<activity android:name=".SetupRedactionInterstitial"
android:enabled="false"
android:exported="true"
- android:theme="@style/SuwThemeGlif.DayNight"
+ android:theme="@style/SudThemeGlif.DayNight"
android:label="@string/lock_screen_notifications_interstitial_title"
android:icon="@drawable/ic_suggested_notifications">
<intent-filter>
@@ -2595,7 +2595,7 @@
android:exported="true"
android:permission="android.permission.NETWORK_SETTINGS">
<intent-filter>
- <action android:name="com.android.settings.wifi.NETWORK_REQUEST" />
+ <action android:name="com.android.settings.wifi.action.NETWORK_REQUEST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
diff --git a/res/drawable/ic_battery_saver_accent_24dp.xml b/res/drawable/ic_battery_saver_accent_24dp.xml
new file mode 100644
index 0000000..c8def54
--- /dev/null
+++ b/res/drawable/ic_battery_saver_accent_24dp.xml
@@ -0,0 +1,29 @@
+<!--
+ 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.
+ 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/colorAccent">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M15,14l-2,0l0,2l-2,0l0,-2l-2,0l0,-2l2,0l0,-2l2,0l0,2l2,0z"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M16.2,22.5H7.8c-1.3,0 -2.3,-1 -2.3,-2.3V5.8c0,-1.3 1,-2.3 2.3,-2.3h0.7v-2h7v2h0.7c1.3,0 2.3,1.1 2.3,2.3v14.3C18.5,21.5 17.5,22.5 16.2,22.5zM7.8,5.5c-0.2,0 -0.3,0.2 -0.3,0.3v14.3c0,0.2 0.2,0.3 0.3,0.3h8.3c0.2,0 0.3,-0.1 0.3,-0.3V5.8c0,-0.2 -0.1,-0.3 -0.3,-0.3h-2.7v-2h-3v2H7.8z"/>
+</vector>
diff --git a/res/drawable/ic_fingerprint_list_icon.xml b/res/drawable/ic_fingerprint_list_icon.xml
index ce1ce5e..6a563aa 100644
--- a/res/drawable/ic_fingerprint_list_icon.xml
+++ b/res/drawable/ic_fingerprint_list_icon.xml
@@ -19,6 +19,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M17.81,4.47c-0.08,0 -0.16,-0.02 -0.23,-0.06C15.66,3.42 14,3 12.01,3c-1.98,0 -3.86,0.47 -5.57,1.41 -0.24,0.13 -0.54,0.04 -0.68,-0.2 -0.13,-0.24 -0.04,-0.55 0.2,-0.68C7.82,2.52 9.86,2 12.01,2c2.13,0 3.99,0.47 6.03,1.52 0.25,0.13 0.34,0.43 0.21,0.67 -0.09,0.18 -0.26,0.28 -0.44,0.28zM3.5,9.72c-0.1,0 -0.2,-0.03 -0.29,-0.09 -0.23,-0.16 -0.28,-0.47 -0.12,-0.7 0.99,-1.4 2.25,-2.5 3.75,-3.27C9.98,4.04 14,4.03 17.15,5.65c1.5,0.77 2.76,1.86 3.75,3.25 0.16,0.22 0.11,0.54 -0.12,0.7 -0.23,0.16 -0.54,0.11 -0.7,-0.12 -0.9,-1.26 -2.04,-2.25 -3.39,-2.94 -2.87,-1.47 -6.54,-1.47 -9.4,0.01 -1.36,0.7 -2.5,1.7 -3.4,2.96 -0.08,0.14 -0.23,0.21 -0.39,0.21zM9.75,21.79c-0.13,0 -0.26,-0.05 -0.35,-0.15 -0.87,-0.87 -1.34,-1.43 -2.01,-2.64 -0.69,-1.23 -1.05,-2.73 -1.05,-4.34 0,-2.97 2.54,-5.39 5.66,-5.39s5.66,2.42 5.66,5.39c0,0.28 -0.22,0.5 -0.5,0.5s-0.5,-0.22 -0.5,-0.5c0,-2.42 -2.09,-4.39 -4.66,-4.39 -2.57,0 -4.66,1.97 -4.66,4.39 0,1.44 0.32,2.77 0.93,3.85 0.64,1.15 1.08,1.64 1.85,2.42 0.19,0.2 0.19,0.51 0,0.71 -0.11,0.1 -0.24,0.15 -0.37,0.15zM16.92,19.94c-1.19,0 -2.24,-0.3 -3.1,-0.89 -1.49,-1.01 -2.38,-2.65 -2.38,-4.39 0,-0.28 0.22,-0.5 0.5,-0.5s0.5,0.22 0.5,0.5c0,1.41 0.72,2.74 1.94,3.56 0.71,0.48 1.54,0.71 2.54,0.71 0.24,0 0.64,-0.03 1.04,-0.1 0.27,-0.05 0.53,0.13 0.58,0.41 0.05,0.27 -0.13,0.53 -0.41,0.58 -0.57,0.11 -1.07,0.12 -1.21,0.12zM14.91,22c-0.04,0 -0.09,-0.01 -0.13,-0.02 -1.59,-0.44 -2.63,-1.03 -3.72,-2.1 -1.4,-1.39 -2.17,-3.24 -2.17,-5.22 0,-1.62 1.38,-2.94 3.08,-2.94 1.7,0 3.08,1.32 3.08,2.94 0,1.07 0.93,1.94 2.08,1.94s2.08,-0.87 2.08,-1.94c0,-3.77 -3.25,-6.83 -7.25,-6.83 -2.84,0 -5.44,1.58 -6.61,4.03 -0.39,0.81 -0.59,1.76 -0.59,2.8 0,0.78 0.07,2.01 0.67,3.61 0.1,0.26 -0.03,0.55 -0.29,0.64 -0.26,0.1 -0.55,-0.04 -0.64,-0.29 -0.49,-1.31 -0.73,-2.61 -0.73,-3.96 0,-1.2 0.23,-2.29 0.68,-3.24 1.33,-2.79 4.28,-4.6 7.51,-4.6 4.55,0 8.25,3.51 8.25,7.83 0,1.62 -1.38,2.94 -3.08,2.94s-3.08,-1.32 -3.08,-2.94c0,-1.07 -0.93,-1.94 -2.08,-1.94s-2.08,0.87 -2.08,1.94c0,1.71 0.66,3.31 1.87,4.51 0.95,0.94 1.86,1.46 3.27,1.85 0.27,0.07 0.42,0.35 0.35,0.61 -0.05,0.23 -0.26,0.38 -0.47,0.38z"/>
</vector>
diff --git a/res/drawable/ic_lock_list_icon.xml b/res/drawable/ic_lock_list_icon.xml
index 7a323f2..9660f9c 100644
--- a/res/drawable/ic_lock_list_icon.xml
+++ b/res/drawable/ic_lock_list_icon.xml
@@ -18,7 +18,7 @@
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
- android:tint="?attr/suwListItemIconColor">
+ android:tint="?attr/sudListItemIconColor">
<path
android:fillColor="@android:color/white"
android:pathData="M18.0,8.0l-1.0,0.0L17.0,6.0c0.0,-2.76 -2.24,-5.0 -5.0,-5.0S7.0,3.24 7.0,6.0l0.0,2.0L6.0,8.0c-1.1,0.0 -2.0,0.9 -2.0,2.0l0.0,10.0c0.0,1.0 0.9,2.0 2.0,2.0l12.0,0.0c1.1,0.0 2.0,-0.9 2.0,-2.0L20.0,10.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0zm-6.0,9.0c-1.1,0.0 -2.0,-0.9 -2.0,-2.0s0.9,-2.0 2.0,-2.0 2.0,0.9 2.0,2.0 -0.9,2.0 -2.0,2.0zm3.1,-9.0L8.9,8.0L8.9,6.0c0.0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0.0 3.1,1.39 3.1,3.1l0.0,2.0z"/>
diff --git a/res/drawable/ic_password.xml b/res/drawable/ic_password.xml
index 57591c2..7d5f471 100644
--- a/res/drawable/ic_password.xml
+++ b/res/drawable/ic_password.xml
@@ -20,15 +20,15 @@
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M21.5,9.39l-1.63,0l0.81,-1.42l-0.86,-0.5l-0.82,1.42l-0.82,-1.42l-0.86,0.5l0.81,1.42l-1.63,0l0,1l1.63,0l-0.81,1.41l0.86,0.5l0.82,-1.41l0.82,1.41l0.86,-0.5l-0.81,-1.41l1.63,0z" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M13.68,7.97l-0.86,-0.5l-0.82,1.42l-0.82,-1.42l-0.86,0.5l0.81,1.42l-1.63,0l0,1l1.63,0l-0.81,1.41l0.86,0.5l0.82,-1.41l0.82,1.41l0.86,-0.5l-0.81,-1.41l1.63,0l0,-1l-1.63,0z" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M6.68,7.97l-0.86,-0.5l-0.82,1.42l-0.82,-1.42l-0.86,0.5l0.81,1.42l-1.63,0l0,1l1.63,0l-0.81,1.41l0.86,0.5l0.82,-1.41l0.82,1.41l0.86,-0.5l-0.81,-1.41l1.63,0l0,-1l-1.63,0z" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M21,17.89H3c-0.28,0 -0.5,-0.22 -0.5,-0.5v-1c0,-0.28 0.22,-0.5 0.5,-0.5h18c0.28,0 0.5,0.22 0.5,0.5v1C21.5,17.66 21.28,17.89 21,17.89z" />
</vector>
diff --git a/res/drawable/ic_pattern.xml b/res/drawable/ic_pattern.xml
index 003111e..b41129f 100644
--- a/res/drawable/ic_pattern.xml
+++ b/res/drawable/ic_pattern.xml
@@ -20,18 +20,18 @@
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M4,4m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M4,12m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M12,4m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M20,12m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" />
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M20,18c-0.93,0 -1.7,0.64 -1.93,1.5h-4.14c-0.22,-0.86 -1,-1.5 -1.93,-1.5s-1.7,0.64 -1.93,1.5H5.93c-0.05,-0.18 -0.12,-0.35 -0.21,-0.51l5.28,-5.28C11.29,13.89 11.63,14 12,14c1.1,0 2,-0.9 2,-2c0,-0.37 -0.11,-0.71 -0.28,-1.01l5.28,-5.28C19.29,5.89 19.63,6 20,6c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2s-2,0.9 -2,2c0,0.37 0.11,0.71 0.28,1.01l-5.28,5.28C12.71,10.11 12.37,10 12,10c-1.1,0 -2,0.9 -2,2c0,0.37 0.11,0.71 0.28,1.01l-5.28,5.28C4.71,18.11 4.37,18 4,18c-1.1,0 -2,0.9 -2,2s0.9,2 2,2c0.93,0 1.7,-0.64 1.93,-1.5h4.14c0.22,0.86 1,1.5 1.93,1.5s1.7,-0.64 1.93,-1.5h4.14c0.22,0.86 1,1.5 1.93,1.5c1.1,0 2,-0.9 2,-2S21.1,18 20,18z" />
</vector>
diff --git a/res/drawable/ic_pin.xml b/res/drawable/ic_pin.xml
index 0176019..577e04f 100644
--- a/res/drawable/ic_pin.xml
+++ b/res/drawable/ic_pin.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M20,4L4,4A2,2 0,0 0,2 6L2,18a2,2 0,0 0,2 2L20,20a2,2 0,0 0,2 -2L22,6A2,2 0,0 0,20 4ZM7.1,15L5.9,15L5.9,10.2L4.7,10.2L4.7,9L7.1,9v6ZM13.2,11.4A1.2,1.2 0,0 1,12 12.6L10.8,12.6v1.2h2.4L13.2,15L9.6,15L9.6,12.6a1.2,1.2 0,0 1,1.2 -1.2L12,11.4L12,10.2L9.6,10.2L9.6,9L12,9a1.2,1.2 0,0 1,1.2 1.2v1.2ZM19.3,11.1a0.9,0.9 0,0 1,-0.9 0.9,0.9 0.9,0 0,1 0.9,0.9v0.9A1.2,1.2 0,0 1,18.1 15L15.7,15L15.7,13.8h2.4L18.1,12.6L16.9,12.6L16.9,11.4h1.2L18.1,10.2L15.7,10.2L15.7,9h2.4a1.2,1.2 0,0 1,1.2 1.2v0.9Z" />
</vector>
diff --git a/res/drawable/ic_skip.xml b/res/drawable/ic_skip.xml
index 4376215..9d8ae2b 100644
--- a/res/drawable/ic_skip.xml
+++ b/res/drawable/ic_skip.xml
@@ -21,6 +21,6 @@
android:viewportHeight="24"
android:autoMirrored="true">
<path
- android:fillColor="?attr/suwListItemIconColor"
+ android:fillColor="?attr/sudListItemIconColor"
android:pathData="M18.4,10.6C16.55,8.99 14.15,8 11.5,8c-4.65,0 -8.58,3.03 -9.96,7.22L3.9,16c1.05,-3.19 4.05,-5.5 7.6,-5.5 1.95,0 3.73,0.72 5.12,1.88L13,16h9V7l-3.6,3.6z"/>
</vector>
diff --git a/res/drawable/ic_suggested_notifications.xml b/res/drawable/ic_suggested_notifications.xml
index d15d13a..5bce000 100644
--- a/res/drawable/ic_suggested_notifications.xml
+++ b/res/drawable/ic_suggested_notifications.xml
@@ -19,9 +19,9 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
- android:fillColor="@color/suw_color_accent_light"
+ android:fillColor="@color/sud_color_accent_light"
android:pathData="M18,17v-6c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5S10.5,3.17 10.5,4v0.68C7.64,5.36 6,7.92 6,11v6H4v2h10h0.38H20v-2H18zM16,17H8v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5V17z"/>
<path
- android:fillColor="@color/suw_color_accent_light"
+ android:fillColor="@color/sud_color_accent_light"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22z"/>
</vector>
diff --git a/res/layout-land/choose_lock_pattern.xml b/res/layout-land/choose_lock_pattern.xml
index d2d436f..1cc4352 100644
--- a/res/layout-land/choose_lock_pattern.xml
+++ b/res/layout-land/choose_lock_pattern.xml
@@ -22,7 +22,7 @@
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
android:layout="@layout/sud_glif_blank_template"
- settings:suwHeaderText="@string/lock_settings_picker_title">
+ settings:sucHeaderText="@string/lock_settings_picker_title">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"
@@ -37,18 +37,18 @@
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1.0"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginBottom="@dimen/sud_content_frame_padding_bottom"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="?attr/suwGlifHeaderGravity"
+ android:layout_gravity="?attr/sudGlifHeaderGravity"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:src="@drawable/ic_lock"/>
@@ -65,8 +65,8 @@
android:orientation="vertical">
<TextView
- android:id="@+id/suw_layout_title"
- style="@style/SuwGlifHeaderTitle"
+ android:id="@+id/suc_layout_title"
+ style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
@@ -74,7 +74,7 @@
<TextView
android:id="@+id/message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="2" />
@@ -85,16 +85,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
- android:gravity="?attr/suwGlifHeaderGravity"
+ android:gravity="?attr/sudGlifHeaderGravity"
android:textSize="18sp"/>
<Button
android:id="@+id/screen_lock_options"
- style="@style/SuwGlifButton.Tertiary"
+ style="@style/SudGlifButton.Tertiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
- android:gravity="?attr/suwGlifHeaderGravity"
+ android:gravity="?attr/sudGlifHeaderGravity"
android:text="@string/setup_lock_settings_options_button_label"
android:visibility="gone" />
@@ -122,7 +122,7 @@
<!-- left : skip -->
<Button android:id="@+id/skip_button"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/skip_label"
diff --git a/res/layout-land/confirm_lock_pattern_normal.xml b/res/layout-land/confirm_lock_pattern_normal.xml
index 993a84e..21c9b1e 100644
--- a/res/layout-land/confirm_lock_pattern_normal.xml
+++ b/res/layout-land/confirm_lock_pattern_normal.xml
@@ -40,34 +40,34 @@
android:paddingBottom="24dp">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="?attr/suwGlifHeaderGravity"
+ android:layout_gravity="?attr/sudGlifHeaderGravity"
android:src="@drawable/ic_lock" />
<TextView
android:id="@+id/headerText"
- style="@style/SuwGlifHeaderTitle"
+ style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:id="@+id/detailsText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides" />
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides" />
<Button
android:id="@+id/cancelButton"
style="@style/SetupWizardButton.Negative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides"
android:text="@string/cancel" />
<Space
@@ -81,8 +81,8 @@
android:id="@+id/errorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides"
android:layout_marginBottom="24dp"
android:gravity="center_vertical"/>
</LinearLayout>
diff --git a/res/layout-land/fingerprint_enroll_enrolling.xml b/res/layout-land/fingerprint_enroll_enrolling.xml
index e71725e..ba2c420 100644
--- a/res/layout-land/fingerprint_enroll_enrolling.xml
+++ b/res/layout-land/fingerprint_enroll_enrolling.xml
@@ -28,7 +28,7 @@
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
@@ -42,25 +42,25 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginBottom="@dimen/sud_content_frame_padding_bottom"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="?attr/suwGlifHeaderGravity"
+ android:layout_gravity="?attr/sudGlifHeaderGravity"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:src="@drawable/ic_fingerprint_header" />
<TextView
- android:id="@+id/suw_layout_title"
- style="@style/SuwGlifHeaderTitle"
+ android:id="@+id/suc_layout_title"
+ style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
@@ -71,14 +71,14 @@
android:layout_height="wrap_content">
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:id="@+id/start_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_start_message"/>
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:id="@+id/repeat_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -92,13 +92,6 @@
android:layout_height="0dp"
android:layout_weight="1" />
- <Button
- android:id="@+id/skip_button"
- style="@style/SuwGlifButton.Secondary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/security_settings_fingerprint_enroll_enrolling_skip" />
-
</LinearLayout>
<LinearLayout
diff --git a/res/layout-land/fingerprint_enroll_find_sensor.xml b/res/layout-land/fingerprint_enroll_find_sensor.xml
index 0decbf2..28d982e 100644
--- a/res/layout-land/fingerprint_enroll_find_sensor.xml
+++ b/res/layout-land/fingerprint_enroll_find_sensor.xml
@@ -34,8 +34,8 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginBottom="@dimen/suw_content_frame_padding_bottom"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginBottom="@dimen/sud_content_frame_padding_bottom"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
@@ -55,25 +55,25 @@
android:clipToPadding="false">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="?attr/suwGlifHeaderGravity"
+ android:layout_gravity="?attr/sudGlifHeaderGravity"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:src="@drawable/ic_fingerprint_header" />
<TextView
- android:id="@+id/suw_layout_title"
- style="@style/SuwGlifHeaderTitle"
+ android:id="@+id/suc_layout_title"
+ style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp" />
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
@@ -83,14 +83,6 @@
android:layout_height="0dp"
android:layout_weight="1" />
- <Button
- style="@style/SetupWizardButton.Negative"
- android:id="@+id/skip_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:text="@string/skip_label" />
-
</LinearLayout>
</ScrollView>
diff --git a/res/layout-land/fingerprint_enroll_finish.xml b/res/layout-land/fingerprint_enroll_finish.xml
index 53e430e..7d292c6 100644
--- a/res/layout-land/fingerprint_enroll_finish.xml
+++ b/res/layout-land/fingerprint_enroll_finish.xml
@@ -29,7 +29,7 @@
android:fillViewport="true">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
@@ -45,19 +45,19 @@
android:orientation="vertical">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="?attr/suwGlifHeaderGravity"
+ android:layout_gravity="?attr/sudGlifHeaderGravity"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:contentDescription="@null"
android:src="@drawable/ic_fingerprint_header"/>
<TextView
- android:id="@+id/suw_layout_title"
- style="@style/SuwGlifHeaderTitle"
+ android:id="@+id/suc_layout_title"
+ style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
@@ -65,7 +65,7 @@
<TextView
android:id="@+id/message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
@@ -79,7 +79,7 @@
<ImageView
android:id="@+id/fingerprint_in_app_indicator"
- style="@style/SuwContentIllustration"
+ style="@style/SudContentIllustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@android:string/fingerprint_icon_content_description"
diff --git a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
index 21df686..4eed0f6 100644
--- a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
@@ -19,29 +19,40 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent">
- <include layout="@layout/wifi_dpp_fragment_header"/>
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
- <com.android.settings.wifi.qrcode.QrPreviewLayout
- android:layout_width="@dimen/qrcode_preview_size"
- android:layout_height="@dimen/qrcode_preview_size"
- android:layout_gravity="center">
- <TextureView
- android:id="@+id/preview_view"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"/>
- <com.android.settings.wifi.qrcode.QrDecorateView
- android:id="@+id/decorate_view"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"/>
- </com.android.settings.wifi.qrcode.QrPreviewLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center_horizontal">
- <TextView android:id="@+id/error_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"/>
+ <include layout="@layout/wifi_dpp_fragment_header"/>
+
+ <com.android.settings.wifi.qrcode.QrPreviewLayout
+ android:layout_width="@dimen/qrcode_preview_size"
+ android:layout_height="@dimen/qrcode_preview_size">
+ <TextureView
+ android:id="@+id/preview_view"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"/>
+ <com.android.settings.wifi.qrcode.QrDecorateView
+ android:id="@+id/decorate_view"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"/>
+ </com.android.settings.wifi.qrcode.QrPreviewLayout>
+
+ <TextView android:id="@+id/error_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </LinearLayout>
+
+ </ScrollView>
</LinearLayout>
diff --git a/res/layout/choose_lock_password.xml b/res/layout/choose_lock_password.xml
index 1962ee0..68583b5 100644
--- a/res/layout/choose_lock_password.xml
+++ b/res/layout/choose_lock_password.xml
@@ -22,10 +22,10 @@
android:icon="@drawable/ic_lock"
android:importantForAutofill="noExcludeDescendants"
settings:sucFooter="@layout/choose_lock_password_footer"
- settings:suwHeaderText="@string/lockpassword_choose_your_screen_lock_header">
+ settings:sucHeaderText="@string/lockpassword_choose_your_screen_lock_header">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
@@ -35,7 +35,7 @@
<TextView
android:id="@+id/message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="2"/>
@@ -71,7 +71,7 @@
<Button
android:id="@+id/screen_lock_options"
- style="@style/SuwGlifButton.Tertiary"
+ style="@style/SudGlifButton.Tertiary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setup_lock_settings_options_button_label"
diff --git a/res/layout/choose_lock_password_footer.xml b/res/layout/choose_lock_password_footer.xml
index 0b7791c..58d80cf 100644
--- a/res/layout/choose_lock_password_footer.xml
+++ b/res/layout/choose_lock_password_footer.xml
@@ -17,13 +17,13 @@
<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar"
+ style="@style/SudGlifButtonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- left : skip -->
<Button android:id="@+id/skip_button"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/skip_label"
@@ -32,7 +32,7 @@
<!-- left : clear -->
<Button android:id="@+id/clear_button"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
@@ -45,7 +45,7 @@
<!-- right : continue -->
<Button android:id="@+id/next_button"
- style="@style/SuwGlifButton.Primary"
+ style="@style/SudGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next_label" />
diff --git a/res/layout/choose_lock_pattern_common.xml b/res/layout/choose_lock_pattern_common.xml
index 6d64b88..b31062e 100644
--- a/res/layout/choose_lock_pattern_common.xml
+++ b/res/layout/choose_lock_pattern_common.xml
@@ -24,7 +24,7 @@
android:icon="@drawable/ic_lock"
android:layout="@layout/sud_glif_blank_template"
settings:sucFooter="@layout/choose_lock_pattern_common_footer"
- settings:suwHeaderText="@string/lockpassword_choose_your_screen_lock_header">
+ settings:sucHeaderText="@string/lockpassword_choose_your_screen_lock_header">
<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
android:id="@+id/topLayout"
@@ -35,21 +35,21 @@
android:orientation="vertical">
<LinearLayout
- style="@style/SuwGlifHeaderContainer"
+ style="@style/SudGlifHeaderContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_lock" />
<TextView
- android:id="@+id/suw_layout_title"
- style="@style/SuwGlifHeaderTitle"
+ android:id="@+id/suc_layout_title"
+ style="@style/SudGlifHeaderTitle"
android:accessibilityLiveRegion="polite"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@@ -58,7 +58,7 @@
<!-- takes up all space above button bar at bottom -->
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
@@ -71,10 +71,10 @@
<TextView
android:id="@+id/message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="?attr/suwMarginSides"
+ android:layout_marginHorizontal="?attr/sudMarginSides"
android:minLines="2" />
<TextView android:id="@+id/headerText"
@@ -82,7 +82,7 @@
android:layout_height="wrap_content"
android:minLines="2"
android:gravity="center"
- android:paddingHorizontal="?attr/suwMarginSides"
+ android:paddingHorizontal="?attr/sudMarginSides"
android:textSize="12sp" />
<com.google.android.setupdesign.view.FillContentLayout
@@ -111,7 +111,7 @@
<Button
android:id="@+id/screen_lock_options"
- style="@style/SuwGlifButton.Tertiary"
+ style="@style/SudGlifButton.Tertiary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setup_lock_settings_options_button_label"
diff --git a/res/layout/choose_lock_pattern_common_footer.xml b/res/layout/choose_lock_pattern_common_footer.xml
index b0397ea..b582854 100644
--- a/res/layout/choose_lock_pattern_common_footer.xml
+++ b/res/layout/choose_lock_pattern_common_footer.xml
@@ -18,13 +18,13 @@
<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
<com.google.android.setupdesign.view.ButtonBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwGlifButtonBar.Stackable"
+ style="@style/SudGlifButtonBar.Stackable"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- left : skip -->
<Button android:id="@+id/skip_button"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/skip_label"
@@ -32,7 +32,7 @@
<!-- left : retry -->
<Button android:id="@+id/footerLeftButton"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lockpattern_tutorial_cancel_label" />
@@ -44,7 +44,7 @@
<!-- right : confirm or ok -->
<Button android:id="@+id/footerRightButton"
- style="@style/SuwGlifButton.Primary"
+ style="@style/SudGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lockpattern_tutorial_continue_label" />
diff --git a/res/layout/confirm_lock_password_normal.xml b/res/layout/confirm_lock_password_normal.xml
index 44d96e0..7b04127 100644
--- a/res/layout/confirm_lock_password_normal.xml
+++ b/res/layout/confirm_lock_password_normal.xml
@@ -29,11 +29,11 @@
<TextView
android:id="@+id/detailsText"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides" />
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides" />
<Space
android:layout_width="match_parent"
@@ -72,11 +72,11 @@
<Button
android:id="@+id/cancelButton"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides"
android:layout_marginBottom="80dp"
android:layout_gravity="center_horizontal"
android:text="@string/cancel" />
diff --git a/res/layout/confirm_lock_pattern_normal_base.xml b/res/layout/confirm_lock_pattern_normal_base.xml
index 8cf8f87..a08d516 100644
--- a/res/layout/confirm_lock_pattern_normal_base.xml
+++ b/res/layout/confirm_lock_pattern_normal_base.xml
@@ -33,31 +33,31 @@
android:orientation="vertical">
<ImageView
- android:id="@+id/suw_layout_icon"
- style="@style/SuwGlifIcon"
+ android:id="@+id/suc_layout_icon"
+ style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="?attr/suwGlifHeaderGravity"
+ android:layout_gravity="?attr/sudGlifHeaderGravity"
android:src="@drawable/ic_lock" />
<TextView
android:id="@+id/headerText"
- style="@style/SuwGlifHeaderTitle"
+ style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:id="@+id/detailsText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides" />
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides" />
</LinearLayout>
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -86,17 +86,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:layout_marginHorizontal="?attr/suwMarginSides"
+ android:layout_marginHorizontal="?attr/sudMarginSides"
android:layout_marginTop="12dp"
android:gravity="center_vertical"/>
<Button
android:id="@+id/cancelButton"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="?attr/suwMarginSides"
- android:layout_marginEnd="?attr/suwMarginSides"
+ android:layout_marginStart="?attr/sudMarginSides"
+ android:layout_marginEnd="?attr/sudMarginSides"
android:layout_marginBottom="80dp"
android:text="@string/cancel" />
diff --git a/res/layout/encryption_interstitial.xml b/res/layout/encryption_interstitial.xml
index 5acc7b1..3e227cb1 100644
--- a/res/layout/encryption_interstitial.xml
+++ b/res/layout/encryption_interstitial.xml
@@ -23,7 +23,7 @@
android:icon="@drawable/ic_lock">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
@@ -32,7 +32,7 @@
<TextView
android:id="@+id/encryption_message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
diff --git a/res/layout/face_enroll_enrolling.xml b/res/layout/face_enroll_enrolling.xml
index 38a26a2..e7af493 100644
--- a/res/layout/face_enroll_enrolling.xml
+++ b/res/layout/face_enroll_enrolling.xml
@@ -24,7 +24,7 @@
style="?attr/face_layout_theme">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
diff --git a/res/layout/face_enroll_finish.xml b/res/layout/face_enroll_finish.xml
index df46098..62176a7 100644
--- a/res/layout/face_enroll_finish.xml
+++ b/res/layout/face_enroll_finish.xml
@@ -24,7 +24,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@@ -44,7 +44,7 @@
android:layout_weight="1">
<ImageView
- style="@style/SuwContentIllustration"
+ style="@style/SudContentIllustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
diff --git a/res/layout/face_enroll_introduction.xml b/res/layout/face_enroll_introduction.xml
index df3cf72..69b00fe 100644
--- a/res/layout/face_enroll_introduction.xml
+++ b/res/layout/face_enroll_introduction.xml
@@ -25,7 +25,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
@@ -34,14 +34,14 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/description_text"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_face_enroll_introduction_message" />
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/error_text"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@@ -51,7 +51,7 @@
android:layout_weight="1">
<ImageView
- style="@style/SuwContentIllustration"
+ style="@style/SudContentIllustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
@@ -65,7 +65,7 @@
android:layout_gravity="center">
<Button
android:id="@+id/accessibility_button"
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/res/layout/fingerprint_enroll_enrolling_base.xml b/res/layout/fingerprint_enroll_enrolling_base.xml
index 4439b08..3a476fa 100644
--- a/res/layout/fingerprint_enroll_enrolling_base.xml
+++ b/res/layout/fingerprint_enroll_enrolling_base.xml
@@ -24,7 +24,7 @@
style="?attr/fingerprint_layout_theme">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@@ -38,7 +38,7 @@
android:layout_height="wrap_content">
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:id="@+id/start_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -46,7 +46,7 @@
android:text="@string/security_settings_fingerprint_enroll_start_message"/>
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:id="@+id/repeat_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/layout/fingerprint_enroll_find_sensor_base.xml b/res/layout/fingerprint_enroll_find_sensor_base.xml
index 56d3ea4..c03ac5a 100644
--- a/res/layout/fingerprint_enroll_find_sensor_base.xml
+++ b/res/layout/fingerprint_enroll_find_sensor_base.xml
@@ -31,7 +31,7 @@
android:clipChildren="false">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -39,10 +39,10 @@
android:clipChildren="false">
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_glif_margin_top"
+ android:layout_marginTop="@dimen/sud_description_glif_margin_top"
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
</LinearLayout>
diff --git a/res/layout/fingerprint_enroll_finish_base.xml b/res/layout/fingerprint_enroll_finish_base.xml
index 1849f51..2fa5da6 100644
--- a/res/layout/fingerprint_enroll_finish_base.xml
+++ b/res/layout/fingerprint_enroll_finish_base.xml
@@ -24,7 +24,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@@ -33,10 +33,10 @@
<TextView
android:id="@+id/message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_glif_margin_top"
+ android:layout_marginTop="@dimen/sud_description_glif_margin_top"
android:minLines="3"
android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
@@ -57,7 +57,7 @@
<ImageView
android:id="@+id/fingerprint_in_app_indicator"
- style="@style/SuwContentIllustration"
+ style="@style/SudContentIllustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="7dp"
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index adb46e5..4ee7057 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -24,7 +24,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
@@ -33,14 +33,14 @@
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/description_text"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_introduction_message" />
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/error_text"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@@ -50,7 +50,7 @@
android:layout_weight="1">
<ImageView
- style="@style/SuwContentIllustration"
+ style="@style/SudContentIllustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
diff --git a/res/layout/master_clear.xml b/res/layout/master_clear.xml
index 83b02ff..9c1dd80 100644
--- a/res/layout/master_clear.xml
+++ b/res/layout/master_clear.xml
@@ -21,9 +21,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:theme="@style/SuwThemeGlifV3.DayNight"
+ android:theme="@style/SudThemeGlifV3.DayNight"
android:icon="@drawable/ic_delete_accent"
- app:suwHeaderText="@string/master_clear_title">
+ app:sucHeaderText="@string/master_clear_title">
<ScrollView
android:id="@+id/master_clear_scrollview"
@@ -34,33 +34,33 @@
<LinearLayout
android:id="@+id/master_clear_container"
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/master_clear_desc"/>
<TextView
android:id="@+id/also_erases_external"
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/master_clear_desc_also_erases_external"/>
<TextView
android:id="@+id/also_erases_esim"
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/master_clear_desc_also_erases_esim"/>
<TextView
android:id="@+id/accounts_label"
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
@@ -76,21 +76,21 @@
</LinearLayout>
<TextView
android:id="@+id/other_users_present"
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/master_clear_other_users_present"/>
<TextView
android:id="@+id/no_cancel_mobile_plan"
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/master_clear_desc_no_cancel_mobile_plan"/>
<TextView
android:id="@+id/erase_external_option_text"
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/master_clear_desc_erase_external_storage"/>
@@ -103,7 +103,7 @@
android:clickable="true">
<CheckBox
android:id="@+id/erase_external"
- style="@style/SuwCheckBox"
+ style="@style/SudCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
@@ -116,12 +116,12 @@
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
- style="@style/TextAppearance.SuwGlifItemTitle"
+ style="@style/TextAppearance.SudGlifItemTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/erase_external_storage"/>
<TextView
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/erase_external_storage_description"/>
diff --git a/res/layout/master_clear_account.xml b/res/layout/master_clear_account.xml
index 0b522f2..f95a44f 100644
--- a/res/layout/master_clear_account.xml
+++ b/res/layout/master_clear_account.xml
@@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
- style="@style/SuwDescription.Glif" >
+ style="@style/SudDescription.Glif" >
<ImageView
android:id="@android:id/icon"
android:layout_width="56dp"
@@ -30,6 +30,6 @@
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- style="@style/TextAppearance.SuwGlifItemSummary"/>
+ style="@style/TextAppearance.SudGlifItemSummary"/>
</LinearLayout>
diff --git a/res/layout/master_clear_confirm.xml b/res/layout/master_clear_confirm.xml
index 2acdfce..b4c0270 100644
--- a/res/layout/master_clear_confirm.xml
+++ b/res/layout/master_clear_confirm.xml
@@ -19,20 +19,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:theme="@style/SuwThemeGlifV3.DayNight"
+ android:theme="@style/SudThemeGlifV3.DayNight"
android:id="@+id/setup_wizard_layout"
android:icon="@drawable/ic_delete_accent"
- app:suwHeaderText="@string/master_clear_confirm_title">
+ app:sucHeaderText="@string/master_clear_confirm_title">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/master_clear_confirm"
- style="@style/SuwItemTitle.GlifDescription"
+ style="@style/SudItemTitle.GlifDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/master_clear_final_desc"/>
diff --git a/res/layout/password_requirement_item.xml b/res/layout/password_requirement_item.xml
index 8080f10..ff7e04c 100644
--- a/res/layout/password_requirement_item.xml
+++ b/res/layout/password_requirement_item.xml
@@ -18,5 +18,5 @@
android:id="@+id/description_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="?attr/suwGlifHeaderGravity"
+ android:gravity="?attr/sudGlifHeaderGravity"
android:textSize="14sp"/>
diff --git a/res/layout/redaction_interstitial.xml b/res/layout/redaction_interstitial.xml
index ab7e0b3..f911572 100644
--- a/res/layout/redaction_interstitial.xml
+++ b/res/layout/redaction_interstitial.xml
@@ -22,10 +22,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_suggested_notifications"
- settings:suwHeaderText="@string/lock_screen_notifications_interstitial_title">
+ settings:sucHeaderText="@string/lock_screen_notifications_interstitial_title">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
@@ -34,7 +34,7 @@
<TextView
android:id="@+id/message"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/lock_screen_notifications_interstitial_message" />
@@ -48,7 +48,7 @@
<com.android.settings.RestrictedRadioButton
android:id="@+id/show_all"
- style="@style/SuwRadioButton"
+ style="@style/SudRadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
@@ -57,7 +57,7 @@
<com.android.settings.RestrictedRadioButton
android:id="@+id/redact_sensitive"
- style="@style/SuwRadioButton"
+ style="@style/SudRadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
@@ -66,7 +66,7 @@
<RadioButton
android:id="@+id/hide_all"
- style="@style/SuwRadioButton"
+ style="@style/SudRadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
diff --git a/res/layout/reset_esim_checkbox.xml b/res/layout/reset_esim_checkbox.xml
index e2ae4bb..2195435 100644
--- a/res/layout/reset_esim_checkbox.xml
+++ b/res/layout/reset_esim_checkbox.xml
@@ -15,7 +15,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwDescription"
+ style="@style/SudDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@@ -25,7 +25,7 @@
<CheckBox
android:id="@+id/erase_esim"
- style="@style/SuwCheckBox"
+ style="@style/SudCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
@@ -42,12 +42,12 @@
<TextView
android:id="@+id/erase_esim_title"
- style="@style/TextAppearance.SuwGlifItemTitle"
+ style="@style/TextAppearance.SudGlifItemTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
- style="@style/TextAppearance.SuwGlifItemSummary"
+ style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset_esim_desc"/>
diff --git a/res/layout/setup_choose_lock_generic_biometrics_header.xml b/res/layout/setup_choose_lock_generic_biometrics_header.xml
index ca808e8..daeeedd 100644
--- a/res/layout/setup_choose_lock_generic_biometrics_header.xml
+++ b/res/layout/setup_choose_lock_generic_biometrics_header.xml
@@ -16,11 +16,11 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="@dimen/suw_description_glif_margin_top"
- android:paddingBottom="@dimen/suw_description_glif_margin_bottom_lists"
+ android:paddingTop="@dimen/sud_description_glif_margin_top"
+ android:paddingBottom="@dimen/sud_description_glif_margin_bottom_lists"
android:text="@string/lock_settings_picker_biometrics_added_security_message" />
diff --git a/res/layout/setup_choose_lock_generic_header.xml b/res/layout/setup_choose_lock_generic_header.xml
index 8875e1f..7ec16d2 100644
--- a/res/layout/setup_choose_lock_generic_header.xml
+++ b/res/layout/setup_choose_lock_generic_header.xml
@@ -16,11 +16,11 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="@dimen/suw_description_glif_margin_top"
- android:paddingBottom="@dimen/suw_description_glif_margin_bottom_lists"
+ android:paddingTop="@dimen/sud_description_glif_margin_top"
+ android:paddingBottom="@dimen/sud_description_glif_margin_bottom_lists"
android:text="@string/setup_lock_settings_picker_message" />
diff --git a/res/layout/setup_screen_lock_fingerprint_details.xml b/res/layout/setup_screen_lock_fingerprint_details.xml
index 06ca778..fc4ed98 100644
--- a/res/layout/setup_screen_lock_fingerprint_details.xml
+++ b/res/layout/setup_screen_lock_fingerprint_details.xml
@@ -20,6 +20,6 @@
android:layout_height="wrap_content"
android:paddingTop="6dip"
android:paddingBottom="6dip"
- android:paddingStart="@dimen/suw_layout_margin_sides"
- android:paddingEnd="@dimen/suw_layout_margin_sides"
+ android:paddingStart="@dimen/sud_layout_margin_sides"
+ android:paddingEnd="@dimen/sud_layout_margin_sides"
android:text="@string/unlock_setup_wizard_fingerprint_details" />
diff --git a/res/layout/slice_preference_layout.xml b/res/layout/slice_preference_layout.xml
index 4cea9c0..ae58901 100644
--- a/res/layout/slice_preference_layout.xml
+++ b/res/layout/slice_preference_layout.xml
@@ -25,5 +25,5 @@
<androidx.slice.widget.SliceView
android:id="@+id/slice_view"
android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+ android:layout_height="@dimen/slice_preference_group_height"/>
</FrameLayout>
diff --git a/res/layout/storage_internal_forget.xml b/res/layout/storage_internal_forget.xml
index 5ff232a..a2b646e 100644
--- a/res/layout/storage_internal_forget.xml
+++ b/res/layout/storage_internal_forget.xml
@@ -28,11 +28,11 @@
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/suw_description_margin_top"
- android:paddingBottom="@dimen/suw_description_margin_bottom"
- android:paddingStart="@dimen/suw_layout_margin_sides"
- android:paddingEnd="@dimen/suw_layout_margin_sides"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:paddingTop="@dimen/sud_description_margin_top"
+ android:paddingBottom="@dimen/sud_description_margin_bottom"
+ android:paddingStart="@dimen/sud_layout_margin_sides"
+ android:paddingEnd="@dimen/sud_layout_margin_sides"
+ android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>
diff --git a/res/layout/storage_internal_format.xml b/res/layout/storage_internal_format.xml
index 500592f..08434b0 100644
--- a/res/layout/storage_internal_format.xml
+++ b/res/layout/storage_internal_format.xml
@@ -28,11 +28,11 @@
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/suw_description_margin_top"
- android:paddingBottom="@dimen/suw_description_margin_bottom"
- android:paddingStart="@dimen/suw_layout_margin_sides"
- android:paddingEnd="@dimen/suw_layout_margin_sides"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:paddingTop="@dimen/sud_description_margin_top"
+ android:paddingBottom="@dimen/sud_description_margin_bottom"
+ android:paddingStart="@dimen/sud_layout_margin_sides"
+ android:paddingEnd="@dimen/sud_layout_margin_sides"
+ android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>
diff --git a/res/layout/storage_internal_unmount.xml b/res/layout/storage_internal_unmount.xml
index 2e394df..2ae489c 100644
--- a/res/layout/storage_internal_unmount.xml
+++ b/res/layout/storage_internal_unmount.xml
@@ -28,11 +28,11 @@
android:id="@+id/body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/suw_description_margin_top"
- android:paddingBottom="@dimen/suw_description_margin_bottom"
- android:paddingStart="@dimen/suw_layout_margin_sides"
- android:paddingEnd="@dimen/suw_layout_margin_sides"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:paddingTop="@dimen/sud_description_margin_top"
+ android:paddingBottom="@dimen/sud_description_margin_bottom"
+ android:paddingStart="@dimen/sud_layout_margin_sides"
+ android:paddingEnd="@dimen/sud_layout_margin_sides"
+ android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:textColor="?android:attr/textColorPrimary" />
</ScrollView>
diff --git a/res/layout/storage_wizard_checklist.xml b/res/layout/storage_wizard_checklist.xml
index 6f21bb8..842cbdb 100644
--- a/res/layout/storage_wizard_checklist.xml
+++ b/res/layout/storage_wizard_checklist.xml
@@ -22,36 +22,36 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
android:textColor="?android:attr/textColorPrimary"
android:text="@string/storage_wizard_migrate_v2_checklist" />
<TextView
android:id="@+id/storage_wizard_migrate_v2_checklist_media"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textColor="?android:attr/textColorPrimary"
android:text="@string/storage_wizard_migrate_v2_checklist_media"
android:drawableStart="@drawable/ic_sd_card"
android:drawableTint="?android:attr/textColorSecondary"
- android:drawablePadding="@dimen/suw_description_margin_bottom" />
+ android:drawablePadding="@dimen/sud_description_margin_bottom" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textColor="?android:attr/textColorPrimary"
android:text="@string/storage_wizard_migrate_v2_checklist_apps"
android:drawableStart="@drawable/ic_apps_alt"
android:drawableTint="?android:attr/textColorSecondary"
- android:drawablePadding="@dimen/suw_description_margin_bottom" />
+ android:drawablePadding="@dimen/sud_description_margin_bottom" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textColor="?android:attr/textColorPrimary"
android:text="@string/storage_wizard_migrate_v2_checklist_battery"
android:drawableStart="@drawable/ic_battery_charging_full"
android:drawableTint="?android:attr/textColorSecondary"
- android:drawablePadding="@dimen/suw_description_margin_bottom" />
+ android:drawablePadding="@dimen/sud_description_margin_bottom" />
</LinearLayout>
diff --git a/res/layout/storage_wizard_generic.xml b/res/layout/storage_wizard_generic.xml
index 0e7c1fd..2b96101 100644
--- a/res/layout/storage_wizard_generic.xml
+++ b/res/layout/storage_wizard_generic.xml
@@ -22,7 +22,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -31,8 +31,8 @@
android:id="@+id/storage_wizard_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
+ android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
android:textColor="?android:attr/textColorPrimary" />
<FrameLayout
diff --git a/res/layout/storage_wizard_init.xml b/res/layout/storage_wizard_init.xml
index bca2676..d02e871 100644
--- a/res/layout/storage_wizard_init.xml
+++ b/res/layout/storage_wizard_init.xml
@@ -22,7 +22,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -30,7 +30,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
@@ -42,23 +42,23 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:layout_marginStart="@dimen/suw_glif_margin_sides"
+ android:layout_marginStart="@dimen/sud_glif_margin_sides"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:text="@string/storage_wizard_init_v2_internal_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textColor="?android:attr/textColorSecondary"
android:text="@string/storage_wizard_init_v2_internal_summary" />
<Button
android:id="@+id/storage_wizard_init_internal"
- style="@style/SuwGlifButton.Primary"
+ style="@style/SudGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/storage_wizard_init_v2_internal_action"
@@ -69,7 +69,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
android:orientation="horizontal"
android:gravity="center_vertical">
<View
@@ -97,7 +97,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
@@ -109,23 +109,23 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:layout_marginStart="@dimen/suw_glif_margin_sides"
+ android:layout_marginStart="@dimen/sud_glif_margin_sides"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:text="@string/storage_wizard_init_v2_external_title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/suw_description_margin_bottom"
+ android:layout_marginBottom="@dimen/sud_description_margin_bottom"
android:textColor="?android:attr/textColorSecondary"
android:text="@string/storage_wizard_init_v2_external_summary" />
<Button
android:id="@+id/storage_wizard_init_external"
- style="@style/SuwGlifButton.Primary"
+ style="@style/SudGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/storage_wizard_init_v2_external_action"
diff --git a/res/layout/storage_wizard_progress.xml b/res/layout/storage_wizard_progress.xml
index a68750f..cf5bc43 100644
--- a/res/layout/storage_wizard_progress.xml
+++ b/res/layout/storage_wizard_progress.xml
@@ -22,7 +22,7 @@
android:layout_height="match_parent">
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -31,22 +31,22 @@
android:id="@+id/storage_wizard_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
android:indeterminate="false"
style="?android:attr/progressBarStyleHorizontal" />
<TextView
android:id="@+id/storage_wizard_progress_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
android:textColor="?android:attr/textColorSecondary" />
<TextView
android:id="@+id/storage_wizard_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_margin_top"
- android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+ android:layout_marginTop="@dimen/sud_description_margin_top"
+ android:lineSpacingExtra="@dimen/sud_description_line_spacing_extra"
android:textColor="?android:attr/textColorPrimary"
android:visibility="gone" />
diff --git a/res/layout/wifi_dpp_activity.xml b/res/layout/wifi_dpp_activity.xml
index 48f2b65..cb82f66 100644
--- a/res/layout/wifi_dpp_activity.xml
+++ b/res/layout/wifi_dpp_activity.xml
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<ScrollView
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
@@ -27,4 +27,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
-</ScrollView>
+</LinearLayout>
diff --git a/res/layout/wifi_dpp_add_device_fragment.xml b/res/layout/wifi_dpp_add_device_fragment.xml
index 5e70396..97f5764 100644
--- a/res/layout/wifi_dpp_add_device_fragment.xml
+++ b/res/layout/wifi_dpp_add_device_fragment.xml
@@ -15,31 +15,49 @@
limitations under the License.
-->
-<LinearLayout
+<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent">
- <include layout="@layout/wifi_dpp_fragment_header"/>
-
- <ImageView
- android:id="@+id/wifi_ap_picture_view"
+ <ScrollView
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"/>
+ android:layout_height="match_parent">
- <TextView
- android:id="@+id/choose_different_network"
- android:layout_width="wrap_content"
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <include layout="@layout/wifi_dpp_fragment_header"/>
+
+ <ImageView
+ android:id="@+id/wifi_ap_picture_view"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintTop_toBottomOf="@+id/header"/>
+
+ <Button
+ android:id="@+id/choose_different_network"
+ style="@style/SudGlifButton.Secondary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:layout_constraintTop_toBottomOf="@+id/wifi_ap_picture_view"
+ android:layout_marginTop="8dp"
+ android:text="@string/wifi_dpp_choose_different_network"/>
+
+ </LinearLayout>
+
+ </ScrollView>
+
+ <include
+ layout="@layout/wifi_dpp_fragment_footer"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginTop="8dp"
- android:text="@string/wifi_dpp_choose_different_network"/>
+ app:layout_constraintBottom_toBottomOf="parent"/>
- <include layout="@layout/wifi_dpp_fragment_footer"
- android:gravity="center|bottom"/>
-
-</LinearLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml b/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml
index a65cf3e..c3fccd0 100644
--- a/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml
+++ b/res/layout/wifi_dpp_choose_saved_wifi_network_fragment.xml
@@ -15,21 +15,39 @@
limitations under the License.
-->
-<LinearLayout
+<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent">
- <include layout="@layout/wifi_dpp_fragment_header"/>
-
- <ListView android:id="@+id/saved_wifi_network_list"
+ <ScrollView
android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+ android:layout_height="match_parent">
- <include layout="@layout/wifi_dpp_fragment_footer"
- android:gravity="center|bottom"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
-</LinearLayout>
+ <include layout="@layout/wifi_dpp_fragment_header"/>
+
+ <ListView android:id="@+id/saved_wifi_network_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layout_constraintTop_toBottomOf="@+id/header"/>
+
+ </LinearLayout>
+
+ </ScrollView>
+
+ <include
+ layout="@layout/wifi_dpp_fragment_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layout_constraintBottom_toBottomOf="parent"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/wifi_dpp_fragment_footer.xml b/res/layout/wifi_dpp_fragment_footer.xml
index 98c6485..d29f16e 100644
--- a/res/layout/wifi_dpp_fragment_footer.xml
+++ b/res/layout/wifi_dpp_fragment_footer.xml
@@ -18,16 +18,15 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
+ android:layout_height="wrap_content"
+ style="@style/SudGlifButtonBar">
<Button
android:id="@+id/button_left"
+ style="@style/SudGlifButton.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|start"
- android:text="left"
- style="?android:attr/borderlessButtonStyle"/>
+ android:layout_gravity="start"/>
<Space
android:layout_width="0dp"
@@ -36,9 +35,9 @@
<Button
android:id="@+id/button_right"
+ style="@style/SudGlifButton.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom|end"
- android:text="right"/>
+ android:layout_gravity="end"/>
</LinearLayout>
diff --git a/res/layout/wifi_dpp_qrcode_generator_fragment.xml b/res/layout/wifi_dpp_qrcode_generator_fragment.xml
index c7c258b..2617aea 100644
--- a/res/layout/wifi_dpp_qrcode_generator_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_generator_fragment.xml
@@ -22,14 +22,27 @@
android:layout_height="match_parent"
android:orientation="vertical">
- <include layout="@layout/wifi_dpp_fragment_header"/>
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
- <ImageView
- android:id="@+id/qrcode_view"
- android:layout_width="@dimen/qrcode_size"
- android:layout_height="@dimen/qrcode_size"
- android:src="@android:color/transparent"
- android:layout_gravity="center"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <include layout="@layout/wifi_dpp_fragment_header"/>
+
+ <ImageView
+ android:id="@+id/qrcode_view"
+ android:layout_width="@dimen/qrcode_size"
+ android:layout_height="@dimen/qrcode_size"
+ android:src="@android:color/transparent"/>
+
+ </LinearLayout>
+
+ </ScrollView>
</LinearLayout>
diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
index f09fc69..c5e416b 100644
--- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
@@ -19,35 +19,45 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:layout_height="match_parent">
- <include layout="@layout/wifi_dpp_fragment_header"/>
-
- <com.android.settings.wifi.qrcode.QrPreviewLayout
+ <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
- <TextureView
- android:id="@+id/preview_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"/>
- <com.android.settings.wifi.qrcode.QrDecorateView
- android:id="@+id/decorate_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"/>
- </com.android.settings.wifi.qrcode.QrPreviewLayout>
- <TextView
- android:id="@+id/error_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginTop="8dp"
- android:text="@string/wifi_dpp_could_not_detect_valid_qr_code"
- android:visibility="invisible"
- android:textColor="?android:attr/colorError"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center_horizontal">
+
+ <include layout="@layout/wifi_dpp_fragment_header"/>
+
+ <com.android.settings.wifi.qrcode.QrPreviewLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextureView
+ android:id="@+id/preview_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+ <com.android.settings.wifi.qrcode.QrDecorateView
+ android:id="@+id/decorate_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+ </com.android.settings.wifi.qrcode.QrPreviewLayout>
+
+ <TextView
+ android:id="@+id/error_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:text="@string/wifi_dpp_could_not_detect_valid_qr_code"
+ android:visibility="invisible"
+ android:textColor="?android:attr/colorError"/>
+
+ </LinearLayout>
+
+ </ScrollView>
</LinearLayout>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index a88d6f6..b2d5468 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -72,6 +72,8 @@
<attr name="platform_slice" format="boolean" />
<!-- Whether or not dynamic summary text from PreferenceController is allowed when creating slice object, by default it's false. -->
<attr name="allowDynamicSummaryInSlice" format="boolean" />
+ <!-- customized subtitle if it's an unavailable slice -->
+ <attr name="unavailableSliceSubtitle" format="string" />
</declare-styleable>
<declare-styleable name="PreferenceScreen">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index a1381c3..da01be0 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -30,7 +30,7 @@
<color name="title_color">@android:color/holo_blue_light</color>
<color name="setup_lock_pattern_view_regular_color_light">@color/lock_pattern_view_regular_color</color>
<color name="setup_lock_pattern_view_success_color_dark">#ff84ffff</color>
- <color name="setup_lock_pattern_view_success_color_light">@color/suw_color_accent_light</color>
+ <color name="setup_lock_pattern_view_success_color_light">@color/sud_color_accent_light</color>
<color name="setup_lock_pattern_view_error_color_dark">#fff44336</color>
<color name="setup_wizard_wifi_color_dark">#89ffffff</color>
<color name="setup_wizard_wifi_color_light">#89000000</color>
diff --git a/res/values/config.xml b/res/values/config.xml
index 8efa6b2..1a504dd 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -174,4 +174,7 @@
<!-- Max allowed value for screen timeout, in milliseconds -->
<integer name="max_lock_after_timeout_ms">1800000</integer>
+
+ <!-- App intent -->
+ <string name="config_account_intent_uri" translatable="false"></string>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 1a3d6ff..8b535e3 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -370,4 +370,6 @@
<dimen name="qrcode_size">264dp</dimen>
<dimen name="qrcode_preview_size">360dp</dimen>
+ <!-- Height for slice preference, which contains 6 items at most -->
+ <dimen name="slice_preference_group_height">360dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ad94614..bf0e8a5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -927,10 +927,12 @@
<string name="security_settings_face_settings_require_attention">Eyes open to unlock</string>
<!-- Text shown on the details of a toggle which disables/enables face authentication, depending if the user's eyes are open. [CHAR LIMIT=70] -->
<string name="security_settings_face_settings_require_attention_details">When using face authentication, your eyes must be open</string>
+ <!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=50] -->
+ <string name="security_settings_face_settings_require_confirmation">Always require confirmation</string>
+ <!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=70] -->
+ <string name="security_settings_face_settings_require_confirmation_details">When authenticating in apps, always require confirmation</string>
<!-- Button text in face settings which removes the user's faces from the device [CHAR LIMIT=20] -->
<string name="security_settings_face_settings_remove_face_data">Remove face data</string>
- <!-- Text shown in face settings allowing the user to update/improve the enrolled face. This brings the user back to the enrollment flow. [CHAR LIMIT=30] -->
- <string name="security_settings_face_settings_improve_face">Improve your face data</string>
<!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_footer">Your face can be used to unlock your device and access apps.
<annotation id="url">Learn more</annotation></string>
@@ -2104,6 +2106,12 @@
<string name="wifi_dpp_add_another_device">Add another device</string>
<!-- Button label to choose different Wi-Fi network [CHAR LIMIT=80] -->
<string name="wifi_dpp_choose_different_network">Choose different network</string>
+ <!-- Hint for QR code detection [CHAR LIMIT=50] -->
+ <string name="wifi_dpp_could_not_add_device">Couldn\u2019t add device</string>
+ <!-- Title for the fragment to show that device found but naming known [CHAR LIMIT=50] -->
+ <string name="wifi_dpp_device_found">Device found</string>
+ <!-- Label for the try again button [CHAR LIMIT=20]-->
+ <string name="retry">Retry</string>
<!-- Label for the check box to share a network with other users on the same device -->
<string name="wifi_shared">Share with other device users</string>
<!-- Hint for unchanged fields -->
@@ -4220,13 +4228,9 @@
<!-- Manage applications. application installation location summary -->
<string name="app_install_location_summary">Change the preferred installation location for new apps</string>
<!-- [CHAR LIMIT=30] Manage applications, label for option to disable app -->
- <string name="app_disable_dlg_positive">Disable app</string>
+ <string name="app_disable_dlg_positive">Uninstall app</string>
<!-- [CHAR LIMIT=200] Manage applications, text for dialog when disabling apps -->
- <string name="app_disable_dlg_text">If you disable this app, Android and other apps may no longer function as intended.</string>
- <!-- [CHAR LIMIT=NONE] Manage applications, title for dialog when disabling updated apps -->
- <string name="app_special_disable_dlg_title">Delete data and disable app?</string>
- <!-- [CHAR LIMIT=NONE] Manage applications, text for dialog when disabling update apps -->
- <string name="app_special_disable_dlg_text">If you disable this app, Android and other apps may no longer function as intended. Your data will also be deleted.</string>
+ <string name="app_disable_dlg_text">If you uninstall this app, Android and other apps may no longer function as intended.</string>
<!-- [CHAR LIMIT=30] Manage applications, title for dialog when disabling notifications for an app -->
<string name="app_disable_notifications_dlg_title">Turn off notifications?</string>
<!-- Manage applications, individual application info screen, section heading for information about the app installer [CHAR_LIMIT=25] -->
@@ -4687,7 +4691,9 @@
<!-- Title for accessibility preference screen for configuring vibrations. -->
<string name="accessibility_vibration_settings_title">Vibration</string>
<!-- Title for accessibility preference for configuring notification vibrations. -->
- <string name="accessibility_notification_vibration_title">Ring & notification vibration</string>
+ <string name="accessibility_notification_vibration_title">Notification vibration</string>
+ <!-- Title for accessibility preference for configuring ring vibrations. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_ring_vibration_title">Ring vibration</string>
<!-- Title for accessibility preference for configuring touch feedback vibrations. -->
<string name="accessibility_touch_vibration_title">Touch vibration</string>
<!-- Used in the acessibilty service settings to control turning on/off the service entirely -->
@@ -4757,8 +4763,8 @@
<item quantity="other">Very long delay (<xliff:g id="click_delay_label" example="200">%1$d</xliff:g> ms)</item>
</plurals>
- <!-- Summary for vibration settings preference when notification vibration and haptic feedback intensity are set. [CHAR LIMIT=32] -->
- <string name="accessibility_vibration_summary">Ring <xliff:g id="summary_ring" example="Medium">%1$s</xliff:g>, touch <xliff:g id="summary_touch" example="High">%2$s</xliff:g></string>
+ <!-- Summary for vibration settings preference when notification vibration and haptic feedback intensity are set. [CHAR LIMIT=50] -->
+ <string name="accessibility_vibration_summary">Ring <xliff:g id="summary_ring" example="Medium">%1$s</xliff:g>, notification <xliff:g id="summary_notification" example="Low">%2$s</xliff:g>, touch <xliff:g id="summary_touch" example="High">%3$s</xliff:g></string>
<!-- Summary for vibration settings preference when ring & notification are set to off-->
<string name="accessibility_vibration_summary_off">Ring & notification set to off</string>
@@ -7052,8 +7058,10 @@
<!-- List of synonyms for touch vibration setting (where you get a haptic response for touching things on the screen), used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_touch_vibration">haptics, vibrate, screen, sensitivity</string>
- <!-- List of synonyms for ring and notification vibration setting (changes whether your phone vibrates when it rings), used to match in settings search [CHAR LIMIT=NONE] -->
- <string name="keywords_ring_vibration">haptics, vibrate, phone, call, sensitivity</string>
+ <!-- List of synonyms for ring vibration setting (changes whether your phone vibrates when it rings), used to match in settings search [CHAR LIMIT=NONE] -->
+ <string name="keywords_ring_vibration">haptics, vibrate, phone, call, sensitivity, ring</string>
+ <!-- List of synonyms for notification vibration setting (changes whether your phone vibrates when it shows a notification), used to match in settings search [CHAR LIMIT=NONE] -->
+ <string name="keywords_notification_vibration">haptics, vibrate, sensitivity</string>
<!-- NFC Wi-Fi pairing/setup strings-->
@@ -7139,7 +7147,7 @@
<!-- Sound: Other sounds: Title for the option enabling touch sounds for screen locking sounds. [CHAR LIMIT=30] -->
<string name="screen_locking_sounds_title">Screen locking sounds</string>
- <!-- Sound: Other sounds: Title for the option enabling charging sounds and vibration. [CHAR LIMIT=30] -->
+ <!-- Sound: Other sounds: Title for the option enabling charging sounds and vibration. [CHAR LIMIT=50] -->
<string name="charging_sounds_title">Charging sounds and vibration</string>
<!-- Sound: Other sounds: Title for the option enabling docking sounds. [CHAR LIMIT=30] -->
@@ -7347,6 +7355,12 @@
<!-- Do not disturb: Label for button that will turn off zen mode. [CHAR LIMIT=30] -->
<string name="zen_mode_button_turn_off">Turn off now</string>
+ <!-- Setting title for controlling how caption text display in real time [CHAR LIMIT=40]-->
+ <string name="live_captions_title">Live Caption</string>
+
+ <!-- Setting summary for controlling how caption text display in real time [CHAR LIMIT=NONE]-->
+ <string name="live_captions_summary">Auto-convert on-device audio to captions</string>
+
<!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing end time of DND -->
<string name="zen_mode_settings_dnd_manual_end_time">Do Not Disturb is on until <xliff:g id="formatted_time" example="7:00 AM">%s</xliff:g></string>
@@ -9091,6 +9105,12 @@
<!-- Summary of condition that do not disturb is on [CHAR LIMIT=36] -->
<string name="condition_zen_summary">Impacts what you hear and see</string>
+ <!-- Title of condition that battery saver is on [CHAR LIMIT=30] -->
+ <string name="condition_battery_title">Battery Saver is on</string>
+
+ <!-- Summary of condition that battery saver is on [CHAR LIMIT=NONE] -->
+ <string name="condition_battery_summary">Features restricted</string>
+
<!-- Title of condition that cellular data is off [CHAR LIMIT=50] -->
<string name="condition_cellular_title">Mobile data is off</string>
@@ -10055,17 +10075,24 @@
<!-- UI debug setting: ANGLE enabled app has been set [CHAR LIMIT=NONE] -->
<string name="angle_enabled_app_set">ANGLE enabled application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
- <!-- UI debug setting: select an app to use Game Update Package [CHAR LIMIT=100] -->
- <string name="gup_dev_opt_in_app">Use Game Update Package</string>
- <!-- UI debug setting: no app selected to use Game Update Package [CHAR LIMIT=100] -->
- <string name="gup_dev_opt_in_app_not_set">No selected app</string>
- <!-- UI debug setting: app selected to use Game Update Package [CHAR LIMIT=NONE] -->
- <string name="gup_dev_opt_in_app_set"><xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
-
- <!-- Title for Game Update Packages dashboard where developers can configure apps to use GUP or not [CHAR LIMIT=50] -->
- <string name="gup_dashboard_title">Game Update Packages Preferences</string>
- <!-- Summary for Game Update Packages dashboard [CHAR LIMIT=50] -->
- <string name="gup_dashboard_summary">Modify Game Update Packages settings</string>
+ <!-- Title for Game Update Package dashboard where developers can configure apps to use GUP or not [CHAR LIMIT=50] -->
+ <string name="gup_dashboard_title">Game Update Package Preferences</string>
+ <!-- Summary for Game Update Package dashboard [CHAR LIMIT=50] -->
+ <string name="gup_dashboard_summary">Modify Game Update Package settings</string>
+ <!-- Title for Game Update Package preference [CHAR LIMIT=50] -->
+ <string name="gup_app_preference_title">Select Graphics Driver</string>
+ <!-- The default value for Game Update Package preference [CHAR LIMIT=50] -->
+ <string name="gup_app_preference_default">Default</string>
+ <!-- The gup value for Game Update Package preference [CHAR LIMIT=50] -->
+ <string name="gup_app_preference_gup">Game Update Package</string>
+ <!-- The system value for Game Update Package preference [CHAR LIMIT=50] -->
+ <string name="gup_app_preference_system">System Graphics Driver</string>
+ <!-- All the values for Game Update Package preference [CHAR LIMIT=50] -->
+ <string-array name="gup_app_preference_values">
+ <item>@string/gup_app_preference_default</item>
+ <item>@string/gup_app_preference_gup</item>
+ <item>@string/gup_app_preference_system</item>
+ </string-array>
<!-- Slices Strings -->
@@ -10183,12 +10210,6 @@
<!-- Homepage bottom menu. Title for display personalized Settings [CHAR LIMIT=30] -->
<string name="homepage_personal_settings">Suggestions</string>
- <!-- Setting Checkbox title whether to enable CBRS data. [CHAR LIMIT=40] -->
- <string name="cbrs_data_switch">CBRS Data</string>
-
- <!-- Title of implications of enabling CBRS Data -->
- <string name="cbrs_data_switch_summary">CBRS Data</string>
-
<!-- Available networks screen, name of button when user wants to select network manually [CHAR LIMIT=60] -->
<string name="choose_network_title">Choose network</string>
<!-- Available networks screen, text when no networks connected [CHAR LIMIT=60] -->
@@ -10402,7 +10423,7 @@
<!-- Title for the top level Privacy Settings [CHAR LIMIT=30]-->
<string name="privacy_dashboard_title">Privacy</string>
<!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
- <string name="privacy_dashboard_summary">Permission, permission usage</string>
+ <string name="privacy_dashboard_summary">Permissions, activity controls, data shown on screen</string>
<!-- Label for button in contextual card for users to remove the card [CHAR LIMIT=30] -->
<string name="contextual_card_dismiss_remove">Remove</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 111cdbd..1668b37 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -174,13 +174,13 @@
<item name="android:background">#ff000000</item>
</style>
- <style name="SetupWizardButton.Negative" parent="@style/SuwGlifButton.Secondary">
+ <style name="SetupWizardButton.Negative" parent="@style/SudGlifButton.Secondary">
<!-- Negative margin to offset for padding of the button itself. We want the label to be
aligned with the text above it -->
<item name="android:layout_marginStart">-16dp</item>
</style>
- <style name="SetupWizardButton.Positive" parent="@style/SuwGlifButton.Primary"/>
+ <style name="SetupWizardButton.Positive" parent="@style/SudGlifButton.Primary"/>
<style name="AccentColorHighlightBorderlessButton">
<item name="android:colorControlHighlight">?android:attr/colorAccent</item>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 6041ef8..c7fafad 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -39,7 +39,7 @@
<item name="wifi_friction">@drawable/wifi_friction</item>
<item name="side_margin">@dimen/settings_side_margin</item>
- <item name="suwListItemIconColor">?android:attr/colorAccent</item>
+ <item name="sudListItemIconColor">?android:attr/colorAccent</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Widget.ActionBar</item>
diff --git a/res/values/themes_suw.xml b/res/values/themes_suw.xml
index e0d25c9..9bb67cf 100644
--- a/res/values/themes_suw.xml
+++ b/res/values/themes_suw.xml
@@ -17,7 +17,7 @@
<!-- SUW related themes -->
<resources>
- <style name="GlifTheme" parent="SuwThemeGlif.DayNight">
+ <style name="GlifTheme" parent="SudThemeGlif.DayNight">
<!-- For all AndroidX Alert Dialogs -->
<item name="alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -36,7 +36,7 @@
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
</style>
- <style name="GlifTheme.Light" parent="SuwThemeGlif.Light">
+ <style name="GlifTheme.Light" parent="SudThemeGlif.Light">
<!-- For all AndroidX Alert Dialogs -->
<item name="alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -55,7 +55,7 @@
<item name="*android:colorError">@color/glif_error_color</item>
</style>
- <style name="GlifV2Theme" parent="SuwThemeGlifV2.DayNight">
+ <style name="GlifV2Theme" parent="SudThemeGlifV2.DayNight">
<!-- For all AndroidX Alert Dialogs -->
<item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -74,7 +74,7 @@
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
</style>
- <style name="GlifV2Theme.Light" parent="SuwThemeGlifV2.Light">
+ <style name="GlifV2Theme.Light" parent="SudThemeGlifV2.Light">
<!-- For all AndroidX Alert Dialogs -->
<item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog.Light</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -93,7 +93,7 @@
<item name="*android:colorError">@color/glif_error_color</item>
</style>
- <style name="GlifV3Theme" parent="SuwThemeGlifV3.DayNight">
+ <style name="GlifV3Theme" parent="SudThemeGlifV3.DayNight">
<!-- For all AndroidX Alert Dialogs -->
<item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -112,7 +112,7 @@
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
</style>
- <style name="GlifV3Theme.Light" parent="SuwThemeGlifV3.Light">
+ <style name="GlifV3Theme.Light" parent="SudThemeGlifV3.Light">
<!-- For all AndroidX Alert Dialogs -->
<item name="alertDialogTheme">@style/GlifV2ThemeAlertDialog.Light</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
diff --git a/res/xml/accessibility_ring_vibration_settings.xml b/res/xml/accessibility_ring_vibration_settings.xml
new file mode 100644
index 0000000..078f76c
--- /dev/null
+++ b/res/xml/accessibility_ring_vibration_settings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+ 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.
+ -->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/accessibility_ring_vibration_title" />
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index cc07ce1..b3e1704 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -124,6 +124,12 @@
android:key="audio_and_captions_category"
android:title="@string/audio_and_captions_category_title">
+ <Preference
+ android:key="live_caption"
+ android:title="@string/live_captions_title"
+ android:summary="@string/live_captions_summary"
+ settings:controller="com.android.settings.accessibility.LiveCaptionPreferenceController"/>
+
<SwitchPreference
android:key="toggle_master_mono"
android:title="@string/accessibility_toggle_master_mono_title"
diff --git a/res/xml/accessibility_vibration_settings.xml b/res/xml/accessibility_vibration_settings.xml
index b2b3596..dc2b16a 100644
--- a/res/xml/accessibility_vibration_settings.xml
+++ b/res/xml/accessibility_vibration_settings.xml
@@ -22,10 +22,17 @@
android:title="@string/accessibility_vibration_settings_title">
<Preference
+ android:fragment="com.android.settings.accessibility.RingVibrationPreferenceFragment"
+ android:key="ring_vibration_preference_screen"
+ android:title="@string/accessibility_ring_vibration_title"
+ settings:keywords="@string/keywords_ring_vibration"
+ app:controller="com.android.settings.accessibility.RingVibrationIntensityPreferenceController" />
+
+ <Preference
android:fragment="com.android.settings.accessibility.NotificationVibrationPreferenceFragment"
android:key="notification_vibration_preference_screen"
android:title="@string/accessibility_notification_vibration_title"
- settings:keywords="@string/keywords_ring_vibration"
+ settings:keywords="@string/keywords_notification_vibration"
app:controller="com.android.settings.accessibility.NotificationVibrationIntensityPreferenceController" />
<Preference
diff --git a/res/xml/bluetooth_device_details_fragment.xml b/res/xml/bluetooth_device_details_fragment.xml
index 90895f2..cf9fbf9 100644
--- a/res/xml/bluetooth_device_details_fragment.xml
+++ b/res/xml/bluetooth_device_details_fragment.xml
@@ -31,7 +31,7 @@
<com.android.settings.slices.SlicePreference
android:key="bt_device_slice"
- settings:controller="com.android.settings.slices.SlicePreferenceController"
+ settings:controller="com.android.settings.slices.BlockingSlicePrefController"
settings:allowDividerBelow="true"
settings:allowDividerAbove="true"/>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 2eedca5..4cdab33 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -195,7 +195,8 @@
android:key="gup_dashboard"
android:title="@string/gup_dashboard_title"
android:summary="@string/gup_dashboard_summary"
- android:fragment="com.android.settings.development.gup.GupDashboard" />
+ android:fragment="com.android.settings.development.gup.GupDashboard"
+ settings:searchable="false" />
</PreferenceCategory>
@@ -240,11 +241,6 @@
android:title="@string/usb_default_label"/>
<SwitchPreference
- android:key="cbrs_data_switch"
- android:title="@string/cbrs_data_switch"
- android:summary="@string/cbrs_data_switch" />
-
- <SwitchPreference
android:key="bluetooth_show_devices_without_names"
android:title="@string/bluetooth_show_devices_without_names"
android:summary="@string/bluetooth_show_devices_without_names_summary" />
@@ -430,11 +426,6 @@
android:summary="%s"
android:title="@string/simulate_color_space" />
- <Preference
- android:title="@string/gup_dev_opt_in_app"
- android:key="gup_dev_opt_in_app"
- android:summary="@string/gup_dev_opt_in_app_summary" />
-
</PreferenceCategory>
<PreferenceCategory
diff --git a/res/xml/gup_settings.xml b/res/xml/gup_settings.xml
index 6344adb..43ba39b 100644
--- a/res/xml/gup_settings.xml
+++ b/res/xml/gup_settings.xml
@@ -17,4 +17,14 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/gup_dashboard_title" />
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="gup_settings"
+ android:title="@string/gup_dashboard_title">
+
+ <PreferenceCategory
+ android:key="gup_category"
+ android:title="@string/gup_app_preference_title"
+ settings:controller="com.android.settings.development.gup.GupPreferenceController">
+ </PreferenceCategory>
+
+</PreferenceScreen>
diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml
index 3960103..d669977 100644
--- a/res/xml/my_device_info.xml
+++ b/res/xml/my_device_info.xml
@@ -102,8 +102,7 @@
settings:keywords="@string/keywords_model_and_hardware"
android:summary="@string/summary_placeholder"
settings:allowDynamicSummaryInSlice="true"
- settings:controller=
- "com.android.settings.deviceinfo.DeviceModelPreferenceController"/>
+ settings:controller="com.android.settings.deviceinfo.DeviceModelPreferenceController"/>
<!-- IMEI -->
<Preference
@@ -111,7 +110,8 @@
android:order="22"
android:title="@string/status_imei"
settings:keywords="@string/keywords_imei_info"
- android:summary="@string/summary_placeholder"/>
+ android:summary="@string/summary_placeholder"
+ settings:controller="com.android.settings.deviceinfo.imei.ImeiInfoPreferenceController"/>
<!-- Android version -->
<Preference
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index c202a6c..f5dde8b 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -47,13 +47,16 @@
<SwitchPreference
android:key="security_settings_face_require_attention"
android:title="@string/security_settings_face_settings_require_attention"
+ android:summary="@string/security_settings_face_settings_require_attention_details"
app:keywords="@string/keywords_face_unlock"
app:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>
- <Preference
- android:key="security_settings_face_improve"
- android:title="@string/security_settings_face_settings_improve_face">
- </Preference>
+ <SwitchPreference
+ android:key="security_settings_face_require_confirmation"
+ android:title="@string/security_settings_face_settings_require_confirmation"
+ android:summary="@string/security_settings_face_settings_require_confirmation_details"
+ app:keywords="@string/keywords_face_unlock"
+ app:controller="com.android.settings.biometrics.face.FaceSettingsConfirmPreferenceController"/>
<com.android.settingslib.widget.LayoutPreference
android:key="security_settings_face_delete_faces_container"
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index 656b18c..6060892 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -156,7 +156,7 @@
.setText(R.string.encryption_interstitial_no)
.setListener(this::onNoButtonClicked)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
@@ -165,7 +165,7 @@
.setText(R.string.encryption_interstitial_yes)
.setListener(this::onYesButtonClicked)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index e4ce6443..c03d499 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -423,7 +423,7 @@
.setText(R.string.master_clear_button_text)
.setListener(mInitiateListener)
.setButtonType(ButtonType.OTHER)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
mInitiateButton = buttonFooterMixin.getPrimaryButton();
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index 0750cb1..cbd4924 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -160,7 +160,7 @@
.setText(R.string.master_clear_button_text)
.setListener(mFinalClickListener)
.setButtonType(ButtonType.OTHER)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 76be66d..6f6149f 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -91,7 +91,7 @@
private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
- private static final String[] CATEGORIES = new String[] {
+ private static final String[] CATEGORIES = new String[]{
CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
};
@@ -132,7 +132,8 @@
"accessibility_content_timeout_preference_fragment";
private static final String ACCESSIBILITY_CONTROL_TIMEOUT_PREFERENCE =
"accessibility_control_timeout_preference_fragment";
-
+ private static final String LIVE_CAPTION_PREFERENCE_KEY =
+ "live_caption";
// Extras passed to sub-fragments.
static final String EXTRA_PREFERENCE_KEY = "preference_key";
@@ -232,9 +233,11 @@
private Preference mDisplayDaltonizerPreferenceScreen;
private Preference mHearingAidPreference;
private Preference mVibrationPreferenceScreen;
+ private Preference mLiveCaptionPreference;
private SwitchPreference mToggleInversionPreference;
private ColorInversionPreferenceController mInversionPreferenceController;
private AccessibilityHearingAidPreferenceController mHearingAidPreferenceController;
+ private LiveCaptionPreferenceController mLiveCaptionPreferenceController;
private int mLongPressTimeoutDefault;
@@ -293,6 +296,9 @@
(context, HEARING_AID_PREFERENCE);
mHearingAidPreferenceController.setFragmentManager(getFragmentManager());
getLifecycle().addObserver(mHearingAidPreferenceController);
+
+ mLiveCaptionPreferenceController = new LiveCaptionPreferenceController(context,
+ LIVE_CAPTION_PREFERENCE_KEY);
}
@Override
@@ -481,6 +487,10 @@
// Captioning.
mCaptioningPreferenceScreen = findPreference(CAPTIONING_PREFERENCE_SCREEN);
+ // Live caption
+ mLiveCaptionPreference = findPreference(LIVE_CAPTION_PREFERENCE_KEY);
+ mLiveCaptionPreferenceController.displayPreference(getPreferenceScreen());
+
// Display magnification.
mDisplayMagnificationPreferenceScreen = findPreference(
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
@@ -716,6 +726,8 @@
mHearingAidPreferenceController.updateState(mHearingAidPreference);
+ mLiveCaptionPreferenceController.updateState(mLiveCaptionPreference);
+
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED,
mCaptioningPreferenceScreen);
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
@@ -736,7 +748,6 @@
}
void updateAccessibilityTimeoutSummary(ContentResolver resolver, Preference pref) {
-
String[] timeoutSummarys = getResources().getStringArray(
R.array.accessibility_timeout_summaries);
int[] timeoutValues = getResources().getIntArray(
@@ -805,20 +816,35 @@
pref.setSummary(entries[index]);
}
- @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ @VisibleForTesting
void updateVibrationSummary(Preference pref) {
final Context context = getContext();
final Vibrator vibrator = context.getSystemService(Vibrator.class);
- final int ringIntensity = Settings.System.getInt(context.getContentResolver(),
- Settings.System.NOTIFICATION_VIBRATION_INTENSITY,
- vibrator.getDefaultNotificationVibrationIntensity());
+ int ringIntensity = Settings.System.getInt(context.getContentResolver(),
+ Settings.System.RING_VIBRATION_INTENSITY,
+ vibrator.getDefaultRingVibrationIntensity());
+ if (Settings.System.getInt(context.getContentResolver(),
+ Settings.System.VIBRATE_WHEN_RINGING, 0) == 0) {
+ ringIntensity = Vibrator.VIBRATION_INTENSITY_OFF;
+ }
CharSequence ringIntensityString =
VibrationIntensityPreferenceController.getIntensityString(context, ringIntensity);
- final int touchIntensity = Settings.System.getInt(context.getContentResolver(),
+ int notificationIntensity = Settings.System.getInt(context.getContentResolver(),
+ Settings.System.NOTIFICATION_VIBRATION_INTENSITY,
+ vibrator.getDefaultNotificationVibrationIntensity());
+ CharSequence notificationIntensityString =
+ VibrationIntensityPreferenceController.getIntensityString(context,
+ notificationIntensity);
+
+ int touchIntensity = Settings.System.getInt(context.getContentResolver(),
Settings.System.HAPTIC_FEEDBACK_INTENSITY,
vibrator.getDefaultHapticFeedbackIntensity());
+ if (Settings.System.getInt(context.getContentResolver(),
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) == 0) {
+ touchIntensity = Vibrator.VIBRATION_INTENSITY_OFF;
+ }
CharSequence touchIntensityString =
VibrationIntensityPreferenceController.getIntensityString(context, touchIntensity);
@@ -826,12 +852,14 @@
mVibrationPreferenceScreen = findPreference(VIBRATION_PREFERENCE_SCREEN);
}
- if (ringIntensity == touchIntensity) {
+ if (ringIntensity == touchIntensity && ringIntensity == notificationIntensity) {
mVibrationPreferenceScreen.setSummary(ringIntensityString);
} else {
mVibrationPreferenceScreen.setSummary(
getString(R.string.accessibility_vibration_summary,
- ringIntensityString, touchIntensityString));
+ ringIntensityString,
+ notificationIntensityString,
+ touchIntensityString));
}
}
diff --git a/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java b/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java
index 343ebb1..a2142a2 100644
--- a/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java
@@ -28,7 +28,8 @@
static final String PREF_KEY = "touch_vibration_preference_screen";
public HapticFeedbackIntensityPreferenceController(Context context) {
- super(context, PREF_KEY, Settings.System.HAPTIC_FEEDBACK_INTENSITY);
+ super(context, PREF_KEY, Settings.System.HAPTIC_FEEDBACK_INTENSITY,
+ Settings.System.HAPTIC_FEEDBACK_ENABLED);
}
@Override
diff --git a/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java b/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java
new file mode 100644
index 0000000..94ee1c0
--- /dev/null
+++ b/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.settings.accessibility;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+
+import java.util.List;
+
+public class LiveCaptionPreferenceController extends BasePreferenceController {
+
+ @VisibleForTesting
+ static final Intent LIVE_CAPTION_INTENT = new Intent(
+ "com.android.settings.action.live_caption");
+
+ private final PackageManager mPackageManager;
+
+ public LiveCaptionPreferenceController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ mPackageManager = context.getPackageManager();
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ final List<ResolveInfo> resolved =
+ mPackageManager.queryIntentActivities(LIVE_CAPTION_INTENT, 0 /* flags */);
+ return resolved != null && !resolved.isEmpty()
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ super.updateState(preference);
+ preference.setIntent(LIVE_CAPTION_INTENT);
+ }
+}
diff --git a/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java
index 4aff513..4ace4c6 100644
--- a/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java
@@ -28,7 +28,7 @@
static final String PREF_KEY = "notification_vibration_preference_screen";
public NotificationVibrationIntensityPreferenceController(Context context) {
- super(context, PREF_KEY, Settings.System.NOTIFICATION_VIBRATION_INTENSITY);
+ super(context, PREF_KEY, Settings.System.NOTIFICATION_VIBRATION_INTENSITY, "");
}
@Override
diff --git a/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java b/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java
index 6804abc..ba7d51d 100644
--- a/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java
@@ -45,6 +45,11 @@
}
@Override
+ protected String getVibrationEnabledSetting() {
+ return "";
+ }
+
+ @Override
protected int getPreviewVibrationAudioAttributesUsage() {
return AudioAttributes.USAGE_NOTIFICATION;
}
diff --git a/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java
new file mode 100644
index 0000000..818c414
--- /dev/null
+++ b/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ * 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.
+ */
+
+package com.android.settings.accessibility;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+
+public class RingVibrationIntensityPreferenceController
+ extends VibrationIntensityPreferenceController {
+
+ @VisibleForTesting
+ static final String PREF_KEY = "ring_vibration_preference_screen";
+
+ public RingVibrationIntensityPreferenceController(Context context) {
+ super(context, PREF_KEY, Settings.System.RING_VIBRATION_INTENSITY,
+ Settings.System.VIBRATE_WHEN_RINGING);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ @Override
+ protected int getDefaultIntensity() {
+ return mVibrator.getDefaultRingVibrationIntensity();
+ }
+}
diff --git a/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java b/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java
new file mode 100644
index 0000000..df05231
--- /dev/null
+++ b/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ * 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.
+ */
+package com.android.settings.accessibility;
+
+import android.media.AudioAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.settings.R;
+
+/**
+ * Fragment for picking accessibility shortcut service
+ */
+public class RingVibrationPreferenceFragment extends VibrationPreferenceFragment {
+ @Override
+ public int getMetricsCategory() {
+ return MetricsEvent.ACCESSIBILITY_VIBRATION_RING;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.accessibility_ring_vibration_settings;
+ }
+
+ /**
+ * Get the setting string of the vibration intensity setting this preference is dealing with.
+ */
+ @Override
+ protected String getVibrationIntensitySetting() {
+ return Settings.System.RING_VIBRATION_INTENSITY;
+ }
+
+ @Override
+ protected String getVibrationEnabledSetting() {
+ return Settings.System.VIBRATE_WHEN_RINGING;
+ }
+
+ @Override
+ protected int getPreviewVibrationAudioAttributesUsage() {
+ return AudioAttributes.USAGE_NOTIFICATION;
+ }
+
+ @Override
+ protected int getDefaultVibrationIntensity() {
+ Vibrator vibrator = getContext().getSystemService(Vibrator.class);
+ return vibrator.getDefaultRingVibrationIntensity();
+ }
+}
diff --git a/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java b/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java
index ba08a43..52fd069 100644
--- a/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java
@@ -45,6 +45,11 @@
}
@Override
+ protected String getVibrationEnabledSetting() {
+ return Settings.System.HAPTIC_FEEDBACK_ENABLED;
+ }
+
+ @Override
protected int getDefaultVibrationIntensity() {
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
return vibrator.getDefaultHapticFeedbackIntensity();
@@ -54,13 +59,4 @@
protected int getPreviewVibrationAudioAttributesUsage() {
return AudioAttributes.USAGE_ASSISTANCE_SONIFICATION;
}
-
- @Override
- public void onVibrationIntensitySelected(int intensity) {
- // We want to keep HAPTIC_FEEDBACK_ENABLED consistent with this setting since some
- // applications check it directly before triggering their own haptic feedback.
- final boolean hapticFeedbackEnabled = !(intensity == Vibrator.VIBRATION_INTENSITY_OFF);
- Settings.System.putInt(getContext().getContentResolver(),
- Settings.System.HAPTIC_FEEDBACK_ENABLED, hapticFeedbackEnabled ? 1 : 0);
- }
}
diff --git a/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java
index d9b1d79..e52f92d 100644
--- a/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java
@@ -39,14 +39,16 @@
protected final Vibrator mVibrator;
private final SettingObserver mSettingsContentObserver;
private final String mSettingKey;
+ private final String mEnabledKey;
private Preference mPreference;
public VibrationIntensityPreferenceController(Context context, String prefkey,
- String settingKey) {
+ String settingKey, String enabledKey) {
super(context, prefkey);
mVibrator = mContext.getSystemService(Vibrator.class);
mSettingKey = settingKey;
+ mEnabledKey = enabledKey;
mSettingsContentObserver = new SettingObserver(settingKey) {
@Override
public void onChange(boolean selfChange, Uri uri) {
@@ -78,7 +80,9 @@
public CharSequence getSummary() {
final int intensity = Settings.System.getInt(mContext.getContentResolver(),
mSettingKey, getDefaultIntensity());
- return getIntensityString(mContext, intensity);
+ final boolean enabled = Settings.System.getInt(mContext.getContentResolver(),
+ mEnabledKey, 1) == 1;
+ return getIntensityString(mContext, enabled ? intensity : Vibrator.VIBRATION_INTENSITY_OFF);
}
public static CharSequence getIntensityString(Context context, int intensity) {
diff --git a/src/com/android/settings/accessibility/VibrationPreferenceFragment.java b/src/com/android/settings/accessibility/VibrationPreferenceFragment.java
index 1101611..648acad 100644
--- a/src/com/android/settings/accessibility/VibrationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/VibrationPreferenceFragment.java
@@ -26,6 +26,7 @@
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.Settings;
+import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -117,6 +118,11 @@
protected abstract String getVibrationIntensitySetting();
/**
+ * Get the setting string of the vibration enabledness setting this preference is dealing with.
+ */
+ protected abstract String getVibrationEnabledSetting();
+
+ /**
* Get the default intensity for the desired setting.
*/
protected abstract int getDefaultVibrationIntensity();
@@ -154,8 +160,13 @@
@Override
protected String getDefaultKey() {
- final int vibrationIntensity = Settings.System.getInt(getContext().getContentResolver(),
+ int vibrationIntensity = Settings.System.getInt(getContext().getContentResolver(),
getVibrationIntensitySetting(), getDefaultVibrationIntensity());
+ final boolean vibrationEnabled = Settings.System.getInt(getContext().getContentResolver(),
+ getVibrationEnabledSetting(), 1) == 1;
+ if (!vibrationEnabled) {
+ vibrationIntensity = Vibrator.VIBRATION_INTENSITY_OFF;
+ }
for (VibrationIntensityCandidateInfo candidate : mCandidates.values()) {
final boolean matchesIntensity = candidate.getIntensity() == vibrationIntensity;
final boolean matchesOn = candidate.getKey().equals(KEY_INTENSITY_ON)
@@ -174,8 +185,11 @@
Log.e(TAG, "Tried to set unknown intensity (key=" + key + ")!");
return false;
}
- Settings.System.putInt(getContext().getContentResolver(),
- getVibrationIntensitySetting(), candidate.getIntensity());
+ if (candidate.getIntensity() != Vibrator.VIBRATION_INTENSITY_OFF ||
+ TextUtils.isEmpty(getVibrationEnabledSetting())) {
+ Settings.System.putInt(getContext().getContentResolver(),
+ getVibrationIntensitySetting(), candidate.getIntensity());
+ }
onVibrationIntensitySelected(candidate.getIntensity());
return true;
}
diff --git a/src/com/android/settings/accounts/AccountFeatureProvider.java b/src/com/android/settings/accounts/AccountFeatureProvider.java
index fd65095..ef14fa0 100644
--- a/src/com/android/settings/accounts/AccountFeatureProvider.java
+++ b/src/com/android/settings/accounts/AccountFeatureProvider.java
@@ -23,5 +23,4 @@
public interface AccountFeatureProvider {
String getAccountType();
Account[] getAccounts(Context context);
- Intent getAccountSettingsDeeplinkIntent();
}
diff --git a/src/com/android/settings/accounts/AccountFeatureProviderImpl.java b/src/com/android/settings/accounts/AccountFeatureProviderImpl.java
index 2e0f432..90b581b 100644
--- a/src/com/android/settings/accounts/AccountFeatureProviderImpl.java
+++ b/src/com/android/settings/accounts/AccountFeatureProviderImpl.java
@@ -2,7 +2,6 @@
import android.accounts.Account;
import android.content.Context;
-import android.content.Intent;
public class AccountFeatureProviderImpl implements AccountFeatureProvider {
@Override
@@ -14,9 +13,4 @@
public Account[] getAccounts(Context context) {
return new Account[0];
}
-
- @Override
- public Intent getAccountSettingsDeeplinkIntent() {
- return null;
- }
}
diff --git a/src/com/android/settings/accounts/AvatarViewMixin.java b/src/com/android/settings/accounts/AvatarViewMixin.java
index 35a3cbf..43531b3 100644
--- a/src/com/android/settings/accounts/AvatarViewMixin.java
+++ b/src/com/android/settings/accounts/AvatarViewMixin.java
@@ -40,6 +40,7 @@
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.utils.ThreadUtils;
+import java.net.URISyntaxException;
import java.util.List;
/**
@@ -57,7 +58,6 @@
private static final String KEY_AVATAR_BITMAP = "account_avatar";
private static final String KEY_ACCOUNT_NAME = "account_name";
private static final String EXTRA_ACCOUNT_NAME = "extra.accountName";
- private static final int REQUEST_CODE = 1013;
private final Context mContext;
private final ImageView mAvatarView;
@@ -69,23 +69,32 @@
mContext = activity.getApplicationContext();
mAvatarView = avatarView;
mAvatarView.setOnClickListener(v -> {
- final Intent intent = FeatureFactory.getFactory(mContext)
- .getAccountFeatureProvider()
- .getAccountSettingsDeeplinkIntent();
-
- if (intent == null) {
+ Intent intent;
+ try {
+ final String uri = mContext.getResources().getString(
+ R.string.config_account_intent_uri);
+ intent = Intent.parseUri(uri, Intent.URI_INTENT_SCHEME);
+ } catch (URISyntaxException e) {
+ Log.w(TAG, "Error parsing avatar mixin intent, skipping", e);
return;
}
if (!TextUtils.isEmpty(mAccountName)) {
- //TODO(b/117509285) launch the new page of the MeCard
intent.putExtra(EXTRA_ACCOUNT_NAME, mAccountName);
}
+ final List<ResolveInfo> matchedIntents =
+ mContext.getPackageManager().queryIntentActivities(intent,
+ PackageManager.MATCH_SYSTEM_ONLY);
+ if (matchedIntents.isEmpty()) {
+ Log.w(TAG, "Cannot find any matching action VIEW_ACCOUNT intent.");
+ return;
+ }
+
// Here may have two different UI while start the activity.
// It will display adding account UI when device has no any account.
// It will display account information page when intent added the specified account.
- activity.startActivityForResult(intent, REQUEST_CODE);
+ activity.startActivity(intent);
});
mAvatarImage = new MutableLiveData<>();
diff --git a/src/com/android/settings/applications/defaultapps/RolesPreferenceController.java b/src/com/android/settings/applications/defaultapps/RolesPreferenceController.java
index 59166dd..c7cab15 100644
--- a/src/com/android/settings/applications/defaultapps/RolesPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/RolesPreferenceController.java
@@ -16,31 +16,44 @@
package com.android.settings.applications.defaultapps;
+import android.app.role.RoleManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.icu.text.ListFormatter;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.applications.AppUtils;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* STOPSHIP(b/110557011): Remove once the new UI is ready.
*/
public class RolesPreferenceController extends BasePreferenceController {
- private Intent mIntent;
+ private final PackageManager mPackageManager;
+ private final RoleManager mRoleManager;
+
+ private final Intent mIntent;
public RolesPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
- PackageManager packageManager = context.getPackageManager();
- String packageName = packageManager.getPermissionControllerPackageName();
+ mPackageManager = context.getPackageManager();
+ mRoleManager = context.getSystemService(RoleManager.class);
+
+ final String packageName = mPackageManager.getPermissionControllerPackageName();
if (packageName != null) {
mIntent = new Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS)
.setPackage(packageName);
+ } else {
+ mIntent = null;
}
}
@@ -59,4 +72,34 @@
}
return false;
}
+
+ @Override
+ public CharSequence getSummary() {
+ final List<CharSequence> defaultAppLabels = new ArrayList<>();
+ final CharSequence defaultBrowserLabel = getDefaultAppLabel(RoleManager.ROLE_BROWSER);
+ if(!TextUtils.isEmpty(defaultBrowserLabel)) {
+ defaultAppLabels.add(defaultBrowserLabel);
+ }
+ final CharSequence defaultPhoneLabel = getDefaultAppLabel(RoleManager.ROLE_DIALER);
+ if(!TextUtils.isEmpty(defaultPhoneLabel)) {
+ defaultAppLabels.add(defaultPhoneLabel);
+ }
+ final CharSequence defaultSmsLabel = getDefaultAppLabel(RoleManager.ROLE_SMS);
+ if(!TextUtils.isEmpty(defaultSmsLabel)) {
+ defaultAppLabels.add(defaultSmsLabel);
+ }
+ if (defaultAppLabels.isEmpty()) {
+ return null;
+ }
+ return ListFormatter.getInstance().format(defaultAppLabels);
+ }
+
+ private CharSequence getDefaultAppLabel(String roleName) {
+ final List<String> packageNames = mRoleManager.getRoleHolders(roleName);
+ if (packageNames.isEmpty()) {
+ return null;
+ }
+ final String packageName = packageNames.get(0);
+ return AppUtils.getApplicationLabel(mPackageManager, packageName);
+ }
}
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index 798c188..79e699d 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -217,7 +217,7 @@
updatePasswordQuality();
mToken = data.getByteArrayExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
- overridePendingTransition(R.anim.suw_slide_next_in, R.anim.suw_slide_next_out);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
return;
} else {
setResult(result, data);
@@ -226,13 +226,13 @@
} else if (requestCode == CONFIRM_REQUEST) {
if (resultCode == RESULT_OK && data != null) {
mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
- overridePendingTransition(R.anim.suw_slide_next_in, R.anim.suw_slide_next_out);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
} else {
setResult(result, data);
finish();
}
} else if (requestCode == LEARN_MORE_REQUEST) {
- overridePendingTransition(R.anim.suw_slide_back_in, R.anim.suw_slide_back_out);
+ overridePendingTransition(R.anim.sud_slide_back_in, R.anim.sud_slide_back_out);
}
super.onActivityResult(requestCode, resultCode, data);
}
diff --git a/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java b/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java
index 7ad2d17..12ffc6b 100644
--- a/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java
@@ -111,7 +111,7 @@
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
}
startActivity(intent);
- overridePendingTransition(R.anim.suw_slide_next_in, R.anim.suw_slide_next_out);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
finish();
}
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEnrolling.java b/src/com/android/settings/biometrics/face/FaceEnrollEnrolling.java
index ec75266..2323afc 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEnrolling.java
@@ -97,7 +97,7 @@
.setText(R.string.security_settings_face_enroll_enrolling_skip)
.setListener(this::onSkipButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollFinish.java b/src/com/android/settings/biometrics/face/FaceEnrollFinish.java
index afd6f55..c347d0f 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollFinish.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollFinish.java
@@ -43,7 +43,7 @@
.setText(R.string.security_settings_face_enroll_done)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index 9311810..ba5a85e 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -66,7 +66,7 @@
.setText(R.string.security_settings_face_enroll_introduction_cancel)
.setListener(this::onCancelButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
@@ -75,7 +75,7 @@
.setText(R.string.wizard_next)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 8eabf00..84745d2 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -51,11 +51,10 @@
public class FaceSettings extends DashboardFragment {
private static final String TAG = "FaceSettings";
- private static final String KEY_LAUNCHED_CONFIRM = "key_launched_confirm";
+ private static final String KEY_TOKEN = "key_token";
private FaceManager mFaceManager;
private int mUserId;
- private boolean mLaunchedConfirm;
private byte[] mToken;
private FaceSettingsAttentionPreferenceController mAttentionController;
@@ -86,7 +85,7 @@
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putBoolean(KEY_LAUNCHED_CONFIRM, mLaunchedConfirm);
+ outState.putByteArray(KEY_TOKEN, mToken);
}
@Override
@@ -98,10 +97,10 @@
Intent.EXTRA_USER_ID, UserHandle.myUserId());
if (savedInstanceState != null) {
- mLaunchedConfirm = savedInstanceState.getBoolean(KEY_LAUNCHED_CONFIRM, false);
+ mToken = savedInstanceState.getByteArray(KEY_TOKEN);
}
- if (!mLaunchedConfirm) {
+ if (mToken == null) {
final long challenge = mFaceManager.generateChallenge();
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
if (!helper.launchConfirmationActivity(CONFIRM_REQUEST,
@@ -114,6 +113,14 @@
}
@Override
+ public void onResume() {
+ super.onResume();
+ if (mToken != null) {
+ mAttentionController.setToken(mToken);
+ }
+ }
+
+ @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CONFIRM_REQUEST) {
@@ -172,6 +179,7 @@
controllers.add(new FaceSettingsAttentionPreferenceController(context));
controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
controllers.add(new FaceSettingsFooterPreferenceController(context));
+ controllers.add(new FaceSettingsConfirmPreferenceController(context));
return controllers;
}
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java
new file mode 100644
index 0000000..08740cf
--- /dev/null
+++ b/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceController.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 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
+ */
+
+package com.android.settings.biometrics.face;
+
+import static android.provider.Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+/**
+ * Preference controller giving the user an option to always require confirmation.
+ */
+public class FaceSettingsConfirmPreferenceController extends TogglePreferenceController {
+
+ private static final String KEY = "security_settings_face_require_confirmation";
+
+ private static final int ON = 1;
+ private static final int OFF = 0;
+ private static final int DEFAULT = OFF;
+
+ public FaceSettingsConfirmPreferenceController(Context context) {
+ this(context, KEY);
+ }
+
+ public FaceSettingsConfirmPreferenceController(Context context,
+ String preferenceKey) {
+ super(context, preferenceKey);
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Settings.Secure.getInt(mContext.getContentResolver(),
+ FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, DEFAULT) == ON;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ return Settings.Secure.putInt(mContext.getContentResolver(),
+ FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, isChecked ? ON : OFF);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+}
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index 88e1c6a..4c1ca62 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -143,7 +143,7 @@
.setText(R.string.security_settings_fingerprint_enroll_enrolling_skip)
.setListener(this::onSkipButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
index 1b97d19..72e115b 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
@@ -53,7 +53,7 @@
.setText(R.string.skip_label)
.setListener(this::onSkipButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
@@ -155,7 +155,7 @@
if (requestCode == CONFIRM_REQUEST) {
if (resultCode == RESULT_OK && data != null) {
mToken = data.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
- overridePendingTransition(R.anim.suw_slide_next_in, R.anim.suw_slide_next_out);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
getIntent().putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
startLookingForFingerprint();
} else {
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
index db7d92e..4cf3a46 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
@@ -47,7 +47,7 @@
new FooterButton.Builder(this)
.setText(R.string.fingerprint_enroll_button_add)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
@@ -56,7 +56,7 @@
.setText(R.string.security_settings_fingerprint_enroll_done)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
index 1ad11e3..f603e24 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
@@ -53,7 +53,7 @@
.setText(R.string.security_settings_face_enroll_introduction_cancel)
.setListener(this::onCancelButtonClick)
.setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
@@ -62,7 +62,7 @@
.setText(R.string.wizard_next)
.setListener(this::onNextButtonClick)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
index 6ec419b..43de5a4 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
@@ -30,7 +30,7 @@
import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.slices.SlicePreferenceController;
+import com.android.settings.slices.BlockingSlicePrefController;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -106,7 +106,7 @@
if (FeatureFlagUtils.isEnabled(context, FeatureFlags.SLICE_INJECTION)) {
final BluetoothFeatureProvider featureProvider = FeatureFactory.getFactory(context)
.getBluetoothFeatureProvider(context);
- use(SlicePreferenceController.class).setSliceUri(
+ use(BlockingSlicePrefController.class).setSliceUri(
featureProvider.getBluetoothDeviceSettingsUri(mDeviceAddress));
}
}
diff --git a/src/com/android/settings/core/BasePreferenceController.java b/src/com/android/settings/core/BasePreferenceController.java
index facec4a..1c85009 100644
--- a/src/com/android/settings/core/BasePreferenceController.java
+++ b/src/com/android/settings/core/BasePreferenceController.java
@@ -106,6 +106,7 @@
protected final String mPreferenceKey;
+ protected UiBlockListener mUiBlockListener;
/**
* Instantiate a controller as specified controller type and user-defined key.
@@ -289,4 +290,36 @@
*/
public void updateRawDataToIndex(List<SearchIndexableRaw> rawData) {
}
+
+ /**
+ * Set {@link UiBlockListener}
+ * @param uiBlockListener listener to set
+ */
+ public void setUiBlockListener(UiBlockListener uiBlockListener) {
+ mUiBlockListener = uiBlockListener;
+ }
+
+ /**
+ * Listener to invoke when background job is finished
+ */
+ public interface UiBlockListener {
+ /**
+ * To notify client that UI related background work is finished.
+ * (i.e. Slice is fully loaded.)
+ * @param controller Controller that contains background work
+ */
+ void onBlockerWorkFinished(BasePreferenceController controller);
+ }
+
+ /**
+ * Used for {@link BasePreferenceController} to decide whether it is ui blocker.
+ * If it is, entire UI will be invisible for a certain period until controller
+ * invokes {@link UiBlockListener}
+ *
+ * This won't block UI thread however has similar side effect. Please use it if you
+ * want to avoid janky animation(i.e. new preference is added in the middle of page).
+ *
+ * This music be used in {@link BasePreferenceController}
+ */
+ public interface UiBlocker {}
}
\ No newline at end of file
diff --git a/src/com/android/settings/core/PreferenceXmlParserUtils.java b/src/com/android/settings/core/PreferenceXmlParserUtils.java
index ce5c505..db6cd41 100644
--- a/src/com/android/settings/core/PreferenceXmlParserUtils.java
+++ b/src/com/android/settings/core/PreferenceXmlParserUtils.java
@@ -72,9 +72,11 @@
MetadataFlag.FLAG_NEED_PREF_SUMMARY,
MetadataFlag.FLAG_NEED_PREF_ICON,
MetadataFlag.FLAG_NEED_SEARCHABLE,
- MetadataFlag.FLAG_ALLOW_DYNAMIC_SUMMARY_IN_SLICE})
+ MetadataFlag.FLAG_ALLOW_DYNAMIC_SUMMARY_IN_SLICE,
+ MetadataFlag.FLAG_UNAVAILABLE_SLICE_SUBTITLE})
@Retention(RetentionPolicy.SOURCE)
public @interface MetadataFlag {
+
int FLAG_INCLUDE_PREF_SCREEN = 1;
int FLAG_NEED_KEY = 1 << 1;
int FLAG_NEED_PREF_TYPE = 1 << 2;
@@ -87,6 +89,7 @@
int FLAG_NEED_SEARCHABLE = 1 << 9;
int FLAG_ALLOW_DYNAMIC_SUMMARY_IN_SLICE = 1 << 10;
int FLAG_NEED_PREF_APPEND = 1 << 11;
+ int FLAG_UNAVAILABLE_SLICE_SUBTITLE = 1 << 12;
}
public static final String METADATA_PREF_TYPE = "type";
@@ -101,6 +104,8 @@
public static final String METADATA_ALLOW_DYNAMIC_SUMMARY_IN_SLICE =
"allow_dynamic_summary_in_slice";
public static final String METADATA_APPEND = "staticPreferenceLocation";
+ public static final String METADATA_UNAVAILABLE_SLICE_SUBTITLE =
+ "unavailable_slice_subtitle";
private static final String ENTRIES_SEPARATOR = "|";
@@ -249,6 +254,10 @@
preferenceMetadata.putBoolean(METADATA_APPEND,
isAppended(preferenceScreenAttributes));
}
+ if (hasFlag(flags, MetadataFlag.FLAG_UNAVAILABLE_SLICE_SUBTITLE)) {
+ preferenceMetadata.putString(METADATA_UNAVAILABLE_SLICE_SUBTITLE,
+ getUnavailableSliceSubtitle(preferenceAttributes));
+ }
metadata.add(preferenceMetadata);
preferenceAttributes.recycle();
@@ -344,6 +353,11 @@
private static boolean isAppended(TypedArray styledAttributes) {
return styledAttributes.getInt(R.styleable.PreferenceScreen_staticPreferenceLocation,
- PREPEND_VALUE) == APPEND_VALUE;
+ PREPEND_VALUE) == APPEND_VALUE;
}
-}
+
+ private static String getUnavailableSliceSubtitle(TypedArray styledAttributes) {
+ return styledAttributes.getString(
+ R.styleable.Preference_unavailableSliceSubtitle);
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/dashboard/DashboardFragment.java b/src/com/android/settings/dashboard/DashboardFragment.java
index 1916110..11858a7 100644
--- a/src/com/android/settings/dashboard/DashboardFragment.java
+++ b/src/com/android/settings/dashboard/DashboardFragment.java
@@ -56,7 +56,8 @@
*/
public abstract class DashboardFragment extends SettingsPreferenceFragment
implements SettingsBaseActivity.CategoryListener, Indexable,
- SummaryLoader.SummaryConsumer, PreferenceGroup.OnExpandButtonClickListener {
+ SummaryLoader.SummaryConsumer, PreferenceGroup.OnExpandButtonClickListener,
+ BasePreferenceController.UiBlockListener {
private static final String TAG = "DashboardFragment";
private final Map<Class, List<AbstractPreferenceController>> mPreferenceControllers =
@@ -67,6 +68,7 @@
private DashboardTilePlaceholderPreferenceController mPlaceholderPreferenceController;
private boolean mListeningToCategoryChange;
private SummaryLoader mSummaryLoader;
+ private UiBlockerController mBlockerController;
@Override
public void onAttach(Context context) {
@@ -105,6 +107,22 @@
for (AbstractPreferenceController controller : controllers) {
addPreferenceController(controller);
}
+
+ checkUiBlocker(controllers);
+ }
+
+ private void checkUiBlocker(List<AbstractPreferenceController> controllers) {
+ final List<String> keys = new ArrayList<>();
+ controllers
+ .stream()
+ .filter(controller -> controller instanceof BasePreferenceController.UiBlocker)
+ .forEach(controller -> {
+ ((BasePreferenceController) controller).setUiBlockListener(this);
+ keys.add(controller.getPreferenceKey());
+ });
+
+ mBlockerController = new UiBlockerController(keys);
+ mBlockerController.start(()->updatePreferenceVisibility());
}
@Override
@@ -319,10 +337,11 @@
* DashboardCategory.
*/
private void refreshAllPreferences(final String TAG) {
+ final PreferenceScreen screen = getPreferenceScreen();
// First remove old preferences.
- if (getPreferenceScreen() != null) {
+ if (screen != null) {
// Intentionally do not cache PreferenceScreen because it will be recreated later.
- getPreferenceScreen().removeAll();
+ screen.removeAll();
}
// Add resource based tiles.
@@ -335,6 +354,27 @@
Log.d(TAG, "All preferences added, reporting fully drawn");
activity.reportFullyDrawn();
}
+
+ updatePreferenceVisibility();
+ }
+
+ private void updatePreferenceVisibility() {
+ final PreferenceScreen screen = getPreferenceScreen();
+ if (screen == null) {
+ return;
+ }
+
+ final boolean visible = mBlockerController.isBlockerFinished();
+ for (List<AbstractPreferenceController> controllerList :
+ mPreferenceControllers.values()) {
+ for (AbstractPreferenceController controller : controllerList) {
+ final String key = controller.getPreferenceKey();
+ final Preference preference = screen.findPreference(key);
+ if (preference != null) {
+ preference.setVisible(visible && controller.isAvailable());
+ }
+ }
+ }
}
/**
@@ -413,4 +453,9 @@
}
mSummaryLoader.setListening(true);
}
+
+ @Override
+ public void onBlockerWorkFinished(BasePreferenceController controller) {
+ mBlockerController.countDown(controller.getPreferenceKey());
+ }
}
diff --git a/src/com/android/settings/dashboard/UiBlockerController.java b/src/com/android/settings/dashboard/UiBlockerController.java
new file mode 100644
index 0000000..eeb56e6
--- /dev/null
+++ b/src/com/android/settings/dashboard/UiBlockerController.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.settings.dashboard;
+
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.utils.ThreadUtils;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Control ui blocker data and check whether it is finished
+ *
+ * @see BasePreferenceController.UiBlocker
+ * @see BasePreferenceController.OnUiBlockListener
+ */
+public class UiBlockerController {
+ private static final String TAG = "UiBlockerController";
+ private static final int TIMEOUT_MILLIS = 500;
+
+ private CountDownLatch mCountDownLatch;
+ private boolean mBlockerFinished;
+ private Set<String> mKeys;
+ private long mTimeoutMillis;
+
+ public UiBlockerController(@NonNull List<String> keys) {
+ this(keys, TIMEOUT_MILLIS);
+ }
+
+ public UiBlockerController(@NonNull List<String> keys, long timeout) {
+ mCountDownLatch = new CountDownLatch(keys.size());
+ mBlockerFinished = keys.isEmpty();
+ mKeys = new HashSet<>(keys);
+ mTimeoutMillis = timeout;
+ }
+
+ /**
+ * Start background thread, it will invoke {@code finishRunnable} if any condition is met
+ *
+ * 1. Waiting time exceeds {@link #mTimeoutMillis}
+ * 2. All background work that associated with {@link #mCountDownLatch} is finished
+ */
+ public boolean start(Runnable finishRunnable) {
+ if (mKeys.isEmpty()) {
+ // Don't need to run finishRunnable because it doesn't start
+ return false;
+ }
+ ThreadUtils.postOnBackgroundThread(() -> {
+ try {
+ mCountDownLatch.await(mTimeoutMillis, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ Log.w(TAG, "interrupted");
+ }
+ mBlockerFinished = true;
+ ThreadUtils.postOnMainThread(finishRunnable);
+ });
+
+ return true;
+ }
+
+ /**
+ * Return {@code true} if all work finished
+ */
+ public boolean isBlockerFinished() {
+ return mBlockerFinished;
+ }
+
+ /**
+ * Count down latch by {@code key}. It only count down 1 time if same key count down multiple
+ * times.
+ */
+ public boolean countDown(String key) {
+ if (mKeys.remove(key)) {
+ mCountDownLatch.countDown();
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/src/com/android/settings/development/CbrsDataSwitchPreferenceController.java b/src/com/android/settings/development/CbrsDataSwitchPreferenceController.java
deleted file mode 100644
index d5c78e8..0000000
--- a/src/com/android/settings/development/CbrsDataSwitchPreferenceController.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- * 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.
- */
-
-package com.android.settings.development;
-
-import android.content.Context;
-import android.util.Log;
-import android.telephony.TelephonyManager;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.SwitchPreference;
-import androidx.preference.Preference;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-public class CbrsDataSwitchPreferenceController extends DeveloperOptionsPreferenceController
- implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
- private static final String CBRS_DATA_SWITCH_KEY = "cbrs_data_switch";
- private static final String TAG = "CbrsDataSwitchPreferenceController";
- private Context mContext;
-
- private TelephonyManager mTelephonyManager;
-
- public CbrsDataSwitchPreferenceController(Context context) {
- super(context);
- mContext = context;
- mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
- }
-
- @Override
- public String getPreferenceKey() {
- return CBRS_DATA_SWITCH_KEY;
- }
-
- @Override
- public boolean isAvailable() {
- return mTelephonyManager != null;
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- boolean state = (Boolean)newValue;
- return mTelephonyManager.setAlternativeNetworkState(state);
- }
-
- @Override
- public void updateState(Preference preference) {
- boolean state = mTelephonyManager.isAlternativeNetworkEnabled();
- ((SwitchPreference) mPreference).setChecked(state);
- }
-
-}
diff --git a/src/com/android/settings/development/ClearAdbKeysPreferenceController.java b/src/com/android/settings/development/ClearAdbKeysPreferenceController.java
index e1fda67..6613cfd 100644
--- a/src/com/android/settings/development/ClearAdbKeysPreferenceController.java
+++ b/src/com/android/settings/development/ClearAdbKeysPreferenceController.java
@@ -22,6 +22,7 @@
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserManager;
+import android.sysprop.AdbProperties;
import android.text.TextUtils;
import android.util.Log;
@@ -39,9 +40,6 @@
private static final String TAG = "ClearAdbPrefCtrl";
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
- @VisibleForTesting
- static final String RO_ADB_SECURE_PROPERTY_KEY = "ro.adb.secure";
-
private final IAdbManager mAdbManager;
private final DevelopmentSettingsDashboardFragment mFragment;
@@ -55,7 +53,7 @@
@Override
public boolean isAvailable() {
- return SystemProperties.getBoolean(RO_ADB_SECURE_PROPERTY_KEY, false /* default */);
+ return AdbProperties.secure().orElse(false);
}
@Override
diff --git a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
index a67aac4..564f2c3 100644
--- a/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
+++ b/src/com/android/settings/development/DevelopmentOptionsActivityRequestCodes.java
@@ -31,6 +31,4 @@
int REQUEST_CODE_ANGLE_DRIVER_PKGS = 4;
int REQUEST_CODE_ANGLE_DRIVER_VALUES = 5;
-
- int REQUEST_CODE_GUP_DEV_OPT_IN_APPS = 6;
}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 5990320..2a9919a 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -423,7 +423,6 @@
controllers.add(new SelectDebugAppPreferenceController(context, fragment));
controllers.add(new WaitForDebuggerPreferenceController(context));
controllers.add(new EnableGpuDebugLayersPreferenceController(context));
- controllers.add(new GameUpdatePackageDevOptInPreferenceController(context, fragment));
controllers.add(new VerifyAppsOverUsbPreferenceController(context));
controllers.add(new LogdSizePreferenceController(context));
controllers.add(new LogPersistPreferenceController(context, fragment, lifecycle));
@@ -482,7 +481,6 @@
controllers.add(new SmsAccessRestrictionPreferenceController(context));
controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
- controllers.add(new CbrsDataSwitchPreferenceController(context));
controllers.add(new DefaultLaunchPreferenceController(context, "running_apps"));
controllers.add(new DefaultLaunchPreferenceController(context, "demo_mode"));
controllers.add(new DefaultLaunchPreferenceController(context, "quick_settings_tiles"));
diff --git a/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java b/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
deleted file mode 100644
index 2d29505..0000000
--- a/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceController.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 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.
- * 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.
- */
-
-package com.android.settings.development;
-
-import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes
- .REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.provider.Settings;
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-// TODO(b/119221883): Need to override isAvailable() to return false when updatable graphics driver is not supported.
-public class GameUpdatePackageDevOptInPreferenceController
- extends DeveloperOptionsPreferenceController
- implements PreferenceControllerMixin, OnActivityResultListener {
-
- private static final String GUP_DEV_OPT_IN_APP_KEY = "gup_dev_opt_in_app";
-
- private final DevelopmentSettingsDashboardFragment mFragment;
- private final PackageManager mPackageManager;
-
- public GameUpdatePackageDevOptInPreferenceController(Context context,
- DevelopmentSettingsDashboardFragment fragment) {
- super(context);
- mFragment = fragment;
- mPackageManager = mContext.getPackageManager();
- }
-
- @Override
- public String getPreferenceKey() {
- return GUP_DEV_OPT_IN_APP_KEY;
- }
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (GUP_DEV_OPT_IN_APP_KEY.equals(preference.getKey())) {
- // pass it on to settings
- final Intent intent = getActivityStartIntent();
- mFragment.startActivityForResult(intent, REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
- return true;
- }
- return false;
- }
-
- @Override
- public void updateState(Preference preference) {
- updatePreferenceSummary();
- }
-
- @Override
- public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode != REQUEST_CODE_GUP_DEV_OPT_IN_APPS
- || resultCode != Activity.RESULT_OK) {
- return false;
- }
- Settings.Global.putString(mContext.getContentResolver(),
- Settings.Global.GUP_DEV_OPT_IN_APPS, data.getAction());
- updatePreferenceSummary();
- return true;
- }
-
- @Override
- protected void onDeveloperOptionsSwitchDisabled() {
- super.onDeveloperOptionsSwitchDisabled();
- mPreference.setSummary(mContext.getResources().getString(
- R.string.gup_dev_opt_in_app_not_set));
- }
-
- @VisibleForTesting
- Intent getActivityStartIntent() {
- Intent intent = new Intent(mContext, AppPicker.class);
- intent.putExtra(AppPicker.EXTRA_NON_SYSTEM, true /* value */);
- return intent;
- }
-
- private void updatePreferenceSummary() {
- final String optInApp = Settings.Global.getString(
- mContext.getContentResolver(), Settings.Global.GUP_DEV_OPT_IN_APPS);
- if (optInApp != null && !optInApp.isEmpty()) {
- mPreference.setSummary(mContext.getResources().getString(
- R.string.gup_dev_opt_in_app_set, getAppLabel(optInApp)));
- } else {
- mPreference.setSummary(mContext.getResources().getString(
- R.string.gup_dev_opt_in_app_not_set));
- }
- }
-
- private String getAppLabel(String applicationPackageName) {
- try {
- final ApplicationInfo ai = mPackageManager.getApplicationInfo(applicationPackageName,
- PackageManager.GET_DISABLED_COMPONENTS);
- final CharSequence lab = mPackageManager.getApplicationLabel(ai);
- return lab != null ? lab.toString() : applicationPackageName;
- } catch (PackageManager.NameNotFoundException e) {
- return applicationPackageName;
- }
- }
-}
diff --git a/src/com/android/settings/development/gup/GupDashboard.java b/src/com/android/settings/development/gup/GupDashboard.java
index 674a0a9..31f01dd 100644
--- a/src/com/android/settings/development/gup/GupDashboard.java
+++ b/src/com/android/settings/development/gup/GupDashboard.java
@@ -17,14 +17,22 @@
package com.android.settings.development.gup;
import android.content.Context;
+import android.provider.SearchIndexableResource;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.development.DevelopmentSettingsEnabler;
+import com.android.settingslib.search.SearchIndexable;
+import java.util.ArrayList;
import java.util.List;
+@SearchIndexable
public class GupDashboard extends DashboardFragment {
private static final String TAG = "GupDashboard";
@@ -47,4 +55,22 @@
public int getHelpResource() {
return 0;
}
+
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final List<SearchIndexableResource> result = new ArrayList<>();
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.gup_settings;
+ result.add(sir);
+ return result;
+ }
+
+ @Override
+ protected boolean isPageSearchEnabled(Context context) {
+ return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context);
+ }
+ };
}
diff --git a/src/com/android/settings/development/gup/GupPreferenceController.java b/src/com/android/settings/development/gup/GupPreferenceController.java
new file mode 100644
index 0000000..d4cd2f1
--- /dev/null
+++ b/src/com/android/settings/development/gup/GupPreferenceController.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2019 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.
+ */
+
+package com.android.settings.development.gup;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Resources;
+import android.provider.Settings;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.development.DevelopmentSettingsEnabler;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class GupPreferenceController
+ extends BasePreferenceController implements Preference.OnPreferenceChangeListener {
+ private final CharSequence[] mEntryList;
+ private final String mPreferenceTitle;
+ private final String mPreferenceDefault;
+ private final String mPreferenceGup;
+ private final String mPreferenceSystem;
+
+ private final List<AppInfo> mAppInfos;
+ private final Set<String> mDevOptInApps;
+ private final Set<String> mDevOptOutApps;
+
+ public GupPreferenceController(Context context, String key) {
+ super(context, key);
+
+ final Resources resources = context.getResources();
+ mEntryList = resources.getStringArray(R.array.gup_app_preference_values);
+ mPreferenceTitle = resources.getString(R.string.gup_app_preference_title);
+ mPreferenceDefault = resources.getString(R.string.gup_app_preference_default);
+ mPreferenceGup = resources.getString(R.string.gup_app_preference_gup);
+ mPreferenceSystem = resources.getString(R.string.gup_app_preference_system);
+
+ // TODO: Move this task to background if there's potential ANR/Jank.
+ // Update the UI when all the app infos are ready.
+ mAppInfos = getAppInfos(context);
+
+ final ContentResolver contentResolver = context.getContentResolver();
+ mDevOptInApps =
+ getGlobalSettingsString(contentResolver, Settings.Global.GUP_DEV_OPT_IN_APPS);
+ mDevOptOutApps =
+ getGlobalSettingsString(contentResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
+ ? AVAILABLE
+ : DISABLED_DEPENDENT_SETTING;
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ final PreferenceGroup preferenceGroup =
+ (PreferenceGroup) screen.findPreference(getPreferenceKey());
+ if (preferenceGroup == null) {
+ return;
+ }
+
+ for (AppInfo appInfo : mAppInfos) {
+ preferenceGroup.addPreference(
+ createListPreference(appInfo.info.packageName, appInfo.label));
+ }
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final ListPreference listPref = (ListPreference) preference;
+ final String value = newValue.toString();
+ final String packageName = preference.getKey();
+
+ // When user choose a new preference, update both Sets for
+ // opt-in and opt-out apps. Then set the new summary text.
+ if (value.equals(mPreferenceSystem)) {
+ mDevOptInApps.remove(packageName);
+ mDevOptOutApps.add(packageName);
+ } else if (value.equals(mPreferenceGup)) {
+ mDevOptInApps.add(packageName);
+ mDevOptOutApps.remove(packageName);
+ } else {
+ mDevOptInApps.remove(packageName);
+ mDevOptOutApps.remove(packageName);
+ }
+ listPref.setValue(value);
+ listPref.setSummary(value);
+
+ // Push the updated Sets for opt-in and opt-out apps to
+ // corresponding Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.GUP_DEV_OPT_IN_APPS, String.join(",", mDevOptInApps));
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.GUP_DEV_OPT_OUT_APPS, String.join(",", mDevOptOutApps));
+
+ return true;
+ }
+
+ // AppInfo class to achieve loading the application label only once
+ class AppInfo {
+ AppInfo(PackageManager packageManager, ApplicationInfo applicationInfo) {
+ info = applicationInfo;
+ label = packageManager.getApplicationLabel(applicationInfo).toString();
+ }
+ final ApplicationInfo info;
+ final String label;
+ }
+
+ // List of non-system packages that are installed for the current user.
+ private List<AppInfo> getAppInfos(Context context) {
+ final PackageManager packageManager = context.getPackageManager();
+ final List<ApplicationInfo> applicationInfos =
+ packageManager.getInstalledApplications(0 /* flags */);
+
+ final List<AppInfo> appInfos = new ArrayList<>();
+ for (ApplicationInfo applicationInfo : applicationInfos) {
+ if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
+ appInfos.add(new AppInfo(packageManager, applicationInfo));
+ }
+ }
+
+ Collections.sort(appInfos, appInfoComparator);
+
+ return appInfos;
+ }
+
+ // Parse the raw comma separated package names into a String Set
+ private Set<String> getGlobalSettingsString(ContentResolver contentResolver, String name) {
+ final String settingsValue = Settings.Global.getString(contentResolver, name);
+ if (settingsValue == null) {
+ return new HashSet<>();
+ }
+
+ final Set<String> valueSet = new HashSet<>(Arrays.asList(settingsValue.split(",")));
+ valueSet.remove("");
+
+ return valueSet;
+ }
+
+ private final Comparator<AppInfo> appInfoComparator = new Comparator<AppInfo>() {
+ public final int compare(AppInfo a, AppInfo b) {
+ return Collator.getInstance().compare(a.label, b.label);
+ }
+ };
+
+ @VisibleForTesting
+ protected ListPreference createListPreference(String packageName, String appName) {
+ final ListPreference listPreference = new ListPreference(mContext);
+
+ listPreference.setKey(packageName);
+ listPreference.setTitle(appName);
+ listPreference.setDialogTitle(mPreferenceTitle);
+ listPreference.setEntries(mEntryList);
+ listPreference.setEntryValues(mEntryList);
+
+ // Initialize preference default and summary with the opt in/out choices
+ // from Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
+ if (mDevOptOutApps.contains(packageName)) {
+ listPreference.setValue(mPreferenceSystem);
+ listPreference.setSummary(mPreferenceSystem);
+ } else if (mDevOptInApps.contains(packageName)) {
+ listPreference.setValue(mPreferenceGup);
+ listPreference.setSummary(mPreferenceGup);
+ } else {
+ listPreference.setValue(mPreferenceDefault);
+ listPreference.setSummary(mPreferenceDefault);
+ }
+
+ listPreference.setOnPreferenceChangeListener(this);
+
+ return listPreference;
+ }
+}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java
index 4d6ded1..db0d0d0 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardBase.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java
@@ -100,7 +100,7 @@
.setText(R.string.wizard_back)
.setListener(this::onNavigateBack)
.setButtonType(FooterButton.ButtonType.OTHER)
- .setTheme(R.style.SuwGlifButton_Secondary)
+ .setTheme(R.style.SudGlifButton_Secondary)
.build()
);
mButtonFooterMixin.setPrimaryButton(
@@ -108,7 +108,7 @@
.setText(R.string.wizard_next)
.setListener(this::onNavigateNext)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
mBack = mButtonFooterMixin.getSecondaryButton();
diff --git a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
index 19b6975..e836d1f 100644
--- a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
+++ b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java
@@ -79,8 +79,9 @@
@Override
public void onAttach(Context context) {
super.onAttach(context);
- use(FirmwareVersionPreferenceController.class).setHost(this /*parent*/);
+ use(FirmwareVersionPreferenceController.class).setHost(this /* parent */);
use(DeviceModelPreferenceController.class).setHost(this /* parent */);
+ use(ImeiInfoPreferenceController.class).setHost(this /* parent */);
mBuildNumberPreferenceController = use(BuildNumberPreferenceController.class);
mBuildNumberPreferenceController.setHost(this /* parent */);
}
@@ -121,7 +122,6 @@
}
controllers.add(deviceNamePreferenceController);
controllers.add(new SimStatusPreferenceController(context, fragment));
- controllers.add(new ImeiInfoPreferenceController(context, fragment));
controllers.add(new IpAddressPreferenceController(context, lifecycle));
controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
@@ -197,7 +197,7 @@
@Override
public List<AbstractPreferenceController> createPreferenceControllers(
Context context) {
- return buildPreferenceControllers(context, null /*activity */,
+ return buildPreferenceControllers(context, null /* activity */,
null /* fragment */, null /* lifecycle */);
}
};
diff --git a/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java b/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java
index 66d68a6..96ff83c 100644
--- a/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceController.java
@@ -19,6 +19,7 @@
import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;
import android.content.Context;
+import android.os.UserManager;
import android.telephony.TelephonyManager;
import androidx.annotation.VisibleForTesting;
@@ -27,8 +28,9 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.deviceinfo.AbstractSimStatusImeiInfoPreferenceController;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.slices.Copyable;
+import com.android.settingslib.Utils;
import java.util.ArrayList;
import java.util.List;
@@ -36,39 +38,30 @@
/**
* Controller that manages preference for single and multi sim devices.
*/
-public class ImeiInfoPreferenceController extends
- AbstractSimStatusImeiInfoPreferenceController implements PreferenceControllerMixin {
-
- private static final String KEY_IMEI_INFO = "imei_info";
+public class ImeiInfoPreferenceController extends BasePreferenceController implements Copyable {
private final boolean mIsMultiSim;
private final TelephonyManager mTelephonyManager;
private final List<Preference> mPreferenceList = new ArrayList<>();
- private final Fragment mFragment;
+ private Fragment mFragment;
- public ImeiInfoPreferenceController(Context context, Fragment fragment) {
- super(context);
-
- mFragment = fragment;
+ public ImeiInfoPreferenceController(Context context, String key) {
+ super(context, key);
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
mIsMultiSim = mTelephonyManager.getPhoneCount() > 1;
}
- @Override
- public String getPreferenceKey() {
- return KEY_IMEI_INFO;
+ public void setHost(Fragment fragment) {
+ mFragment = fragment;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final Preference preference = screen.findPreference(getPreferenceKey());
- if (!isAvailable() || preference == null || !preference.isVisible()) {
- return;
- }
mPreferenceList.add(preference);
- updatePreference(preference, 0 /* sim slot */);
+ updatePreference(preference, 0 /* simSlot */);
final int imeiPreferenceOrder = preference.getOrder();
// Add additional preferences for each sim in the device
@@ -76,7 +69,7 @@
simSlotNumber++) {
final Preference multiSimPreference = createNewPreference(screen.getContext());
multiSimPreference.setOrder(imeiPreferenceOrder + simSlotNumber);
- multiSimPreference.setKey(KEY_IMEI_INFO + simSlotNumber);
+ multiSimPreference.setKey(getPreferenceKey() + simSlotNumber);
screen.addPreference(multiSimPreference);
mPreferenceList.add(multiSimPreference);
updatePreference(multiSimPreference, simSlotNumber);
@@ -84,6 +77,13 @@
}
@Override
+ public CharSequence getSummary() {
+ final int phoneType = mTelephonyManager.getPhoneType();
+ return phoneType == PHONE_TYPE_CDMA ? mTelephonyManager.getMeid()
+ : mTelephonyManager.getImei();
+ }
+
+ @Override
public boolean handlePreferenceTreeClick(Preference preference) {
final int simSlot = mPreferenceList.indexOf(preference);
if (simSlot == -1) {
@@ -94,6 +94,22 @@
return true;
}
+ @Override
+ public int getAvailabilityStatus() {
+ return mContext.getSystemService(UserManager.class).isAdminUser()
+ && !Utils.isWifiOnly(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public boolean isSliceable() {
+ return true;
+ }
+
+ @Override
+ public void copy() {
+ Copyable.setCopyContent(mContext, getSummary(), mContext.getText(R.string.status_imei));
+ }
+
private void updatePreference(Preference preference, int simSlot) {
final int phoneType = mTelephonyManager.getPhoneType();
if (phoneType == PHONE_TYPE_CDMA) {
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java
index 215f400..6c11576 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSeekBarController.java
@@ -54,9 +54,11 @@
mContext = context;
mSeekBarPreference = new SeekBarPreference(context);
mSeekBarPreference.setOnPreferenceChangeListener(this);
- mSeekBarPreference.setMax(BatterySaverScheduleSeekBarController.MAX_SEEKBAR_VALUE);
- mSeekBarPreference.setMin(BatterySaverScheduleSeekBarController.MIN_SEEKBAR_VALUE);
+ mSeekBarPreference.setContinuousUpdates(true);
+ mSeekBarPreference.setMax(MAX_SEEKBAR_VALUE);
+ mSeekBarPreference.setMin(MIN_SEEKBAR_VALUE);
mSeekBarPreference.setKey(KEY_BATTERY_SAVER_SEEK_BAR);
+ updateSeekBar();
}
@Override
@@ -83,11 +85,12 @@
if (threshold <= 0) {
mSeekBarPreference.setVisible(false);
} else {
+ final int currentSeekbarValue = Math.max(threshold / 5, MIN_SEEKBAR_VALUE);
mSeekBarPreference.setVisible(true);
- mSeekBarPreference.setProgress(MIN_SEEKBAR_VALUE);
+ mSeekBarPreference.setProgress(currentSeekbarValue);
mSeekBarPreference.setTitle(mContext.getString(
R.string.battery_saver_seekbar_title,
- Utils.formatPercentage(MIN_SEEKBAR_VALUE * 5)));
+ Utils.formatPercentage(currentSeekbarValue * 5)));
}
} else {
mSeekBarPreference.setVisible(false);
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java
index 6e9c711..bfd36f3 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java
@@ -17,10 +17,14 @@
package com.android.settings.fuelgauge.batterysaver;
import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.preference.PreferenceScreen;
import com.android.settings.widget.RadioButtonPickerFragment;
import com.android.settings.R;
@@ -59,6 +63,13 @@
}
@Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ setDivider(new ColorDrawable(Color.TRANSPARENT));
+ setDividerHeight(0);
+ }
+
+ @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
diff --git a/src/com/android/settings/homepage/contextualcards/conditional/BatterySaverConditionController.java b/src/com/android/settings/homepage/contextualcards/conditional/BatterySaverConditionController.java
new file mode 100644
index 0000000..bce7c5d
--- /dev/null
+++ b/src/com/android/settings/homepage/contextualcards/conditional/BatterySaverConditionController.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ * 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.
+ */
+
+package com.android.settings.homepage.contextualcards.conditional;
+
+import android.content.Context;
+import android.os.PowerManager;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.fuelgauge.BatterySaverReceiver;
+import com.android.settings.fuelgauge.batterysaver.BatterySaverSettings;
+import com.android.settings.homepage.contextualcards.ContextualCard;
+import com.android.settingslib.fuelgauge.BatterySaverUtils;
+
+import java.util.Objects;
+
+public class BatterySaverConditionController implements ConditionalCardController,
+ BatterySaverReceiver.BatterySaverListener {
+ static final int ID = Objects.hash("BatterySaverConditionController");
+
+ private final Context mAppContext;
+ private final ConditionManager mConditionManager;
+ private final BatterySaverReceiver mReceiver;
+ private final PowerManager mPowerManager;
+
+ public BatterySaverConditionController(Context appContext, ConditionManager conditionManager) {
+ mAppContext = appContext;
+ mConditionManager = conditionManager;
+ mPowerManager = appContext.getSystemService(PowerManager.class);
+ mReceiver = new BatterySaverReceiver(appContext);
+ mReceiver.setBatterySaverListener(this);
+ }
+
+ @Override
+ public long getId() {
+ return ID;
+ }
+
+ @Override
+ public boolean isDisplayable() {
+ return mPowerManager.isPowerSaveMode();
+ }
+
+ @Override
+ public void onPrimaryClick(Context context) {
+ new SubSettingLauncher(context)
+ .setDestination(BatterySaverSettings.class.getName())
+ .setSourceMetricsCategory(MetricsProto.MetricsEvent.DASHBOARD_SUMMARY)
+ .setTitleRes(R.string.battery_saver)
+ .launch();
+ }
+
+ @Override
+ public void onActionClick() {
+ BatterySaverUtils.setPowerSaveMode(mAppContext, false,
+ /*needFirstTimeWarning*/ false);
+ }
+
+ @Override
+ public ContextualCard buildContextualCard() {
+ return new ConditionalContextualCard.Builder()
+ .setConditionId(ID)
+ .setMetricsConstant(MetricsProto.MetricsEvent.SETTINGS_CONDITION_BATTERY_SAVER)
+ .setActionText(mAppContext.getText(R.string.condition_turn_off))
+ .setName(mAppContext.getPackageName() + "/"
+ + mAppContext.getText(R.string.condition_battery_title))
+ .setTitleText(mAppContext.getText(R.string.condition_battery_title).toString())
+ .setSummaryText(mAppContext.getText(R.string.condition_battery_summary).toString())
+ .setIconDrawable(mAppContext.getDrawable(R.drawable.ic_battery_saver_accent_24dp))
+ .setIsHalfWidth(true)
+ .build();
+ }
+
+ @Override
+ public void startMonitoringStateChange() {
+ mReceiver.setListening(true);
+ }
+
+ @Override
+ public void stopMonitoringStateChange() {
+ mReceiver.setListening(false);
+ }
+
+ @Override
+ public void onPowerSaveModeChanged() {
+ mConditionManager.onConditionChanged();
+ }
+
+ @Override
+ public void onBatteryChanged(boolean pluggedIn) {
+
+ }
+}
diff --git a/src/com/android/settings/homepage/contextualcards/conditional/ConditionManager.java b/src/com/android/settings/homepage/contextualcards/conditional/ConditionManager.java
index 39f4903..c741b98 100644
--- a/src/com/android/settings/homepage/contextualcards/conditional/ConditionManager.java
+++ b/src/com/android/settings/homepage/contextualcards/conditional/ConditionManager.java
@@ -154,6 +154,7 @@
mCardControllers.add(new AirplaneModeConditionController(mAppContext, this /* manager */));
mCardControllers.add(
new BackgroundDataConditionController(mAppContext, this /* manager */));
+ mCardControllers.add(new BatterySaverConditionController(mAppContext, this /* manager */));
mCardControllers.add(new CellularDataConditionController(mAppContext, this /* manager */));
mCardControllers.add(new DndConditionCardController(mAppContext, this /* manager */));
mCardControllers.add(new HotspotConditionController(mAppContext, this /* manager */));
diff --git a/src/com/android/settings/homepage/contextualcards/deviceinfo/BatterySlice.java b/src/com/android/settings/homepage/contextualcards/deviceinfo/BatteryInfoSlice.java
similarity index 96%
rename from src/com/android/settings/homepage/contextualcards/deviceinfo/BatterySlice.java
rename to src/com/android/settings/homepage/contextualcards/deviceinfo/BatteryInfoSlice.java
index 5271e12..41095a4 100644
--- a/src/com/android/settings/homepage/contextualcards/deviceinfo/BatterySlice.java
+++ b/src/com/android/settings/homepage/contextualcards/deviceinfo/BatteryInfoSlice.java
@@ -42,15 +42,15 @@
/**
* Utility class to build a Battery Slice, and handle all associated actions.
*/
-public class BatterySlice implements CustomSliceable {
- private static final String TAG = "BatterySlice";
+public class BatteryInfoSlice implements CustomSliceable {
+ private static final String TAG = "BatteryInfoSlice";
private final Context mContext;
private BatteryInfo mBatteryInfo;
private boolean mIsBatteryInfoLoading;
- public BatterySlice(Context context) {
+ public BatteryInfoSlice(Context context) {
mContext = context;
}
diff --git a/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java
index 531501b..c0cfb3f 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSlice.java
@@ -25,7 +25,6 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
-import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
@@ -49,6 +48,7 @@
import com.android.settings.slices.SliceBuilderUtils;
import com.android.settingslib.utils.ThreadUtils;
+import java.util.Arrays;
import java.util.List;
public class BatteryFixSlice implements CustomSliceable {
@@ -58,6 +58,11 @@
@VisibleForTesting
static final String KEY_CURRENT_TIPS_TYPE = "current_tip_type";
+ private static final List<Integer> UNIMPORTANT_BATTERY_TIPS = Arrays.asList(
+ BatteryTip.TipType.SUMMARY,
+ BatteryTip.TipType.BATTERY_SAVER
+ );
+
private static final String TAG = "BatteryFixSlice";
private final Context mContext;
@@ -78,7 +83,7 @@
.setAccentColor(-1);
// TipType.SUMMARY is battery good
- if (readBatteryTipAvailabilityCache(mContext) == BatteryTip.TipType.SUMMARY) {
+ if (UNIMPORTANT_BATTERY_TIPS.contains(readBatteryTipAvailabilityCache(mContext))) {
return buildBatteryGoodSlice(sliceBuilder, true);
}
@@ -91,19 +96,21 @@
}
for (BatteryTip batteryTip : batteryTips) {
- if (batteryTip.getState() != BatteryTip.StateType.INVISIBLE) {
- final IconCompat icon = IconCompat.createWithResource(mContext, batteryTip.getIconId());
- final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(),
- icon,
- ListBuilder.ICON_IMAGE,
- batteryTip.getTitle(mContext));
- sliceBuilder.addRow(new RowBuilder()
- .setTitleItem(icon, ListBuilder.ICON_IMAGE)
- .setTitle(batteryTip.getTitle(mContext))
- .setSubtitle(batteryTip.getSummary(mContext))
- .setPrimaryAction(primaryAction));
- break;
+ if (batteryTip.getState() == BatteryTip.StateType.INVISIBLE) {
+ continue;
}
+ final IconCompat icon = IconCompat.createWithResource(mContext,
+ batteryTip.getIconId());
+ final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(),
+ icon,
+ ListBuilder.ICON_IMAGE,
+ batteryTip.getTitle(mContext));
+ sliceBuilder.addRow(new RowBuilder()
+ .setTitleItem(icon, ListBuilder.ICON_IMAGE)
+ .setTitle(batteryTip.getTitle(mContext))
+ .setSubtitle(batteryTip.getSummary(mContext))
+ .setPrimaryAction(primaryAction));
+ break;
}
return sliceBuilder.build();
}
diff --git a/src/com/android/settings/notification/ChannelSummaryPreference.java b/src/com/android/settings/notification/ChannelSummaryPreference.java
new file mode 100644
index 0000000..c716038
--- /dev/null
+++ b/src/com/android/settings/notification/ChannelSummaryPreference.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.settings.notification;
+
+import android.content.Context;
+import android.content.Intent;
+import android.view.View;
+import android.widget.CheckBox;
+
+import com.android.settings.R;
+import com.android.settingslib.TwoTargetPreference;
+
+import androidx.preference.PreferenceViewHolder;
+
+/**
+ * A custom preference that provides inline checkbox and tappable target.
+ */
+public class ChannelSummaryPreference extends TwoTargetPreference {
+
+ private Context mContext;
+ private Intent mIntent;
+ private CheckBox mCheckBox;
+ private boolean mChecked;
+ private boolean mEnableCheckBox = true;
+
+ public ChannelSummaryPreference(Context context) {
+ super(context);
+ setLayoutResource(R.layout.preference_checkable_two_target);
+ mContext = context;
+ setWidgetLayoutResource(R.layout.zen_rule_widget);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+ View settingsWidget = view.findViewById(android.R.id.widget_frame);
+ View divider = view.findViewById(R.id.two_target_divider);
+ if (mIntent != null) {
+ divider.setVisibility(View.VISIBLE);
+ settingsWidget.setVisibility(View.VISIBLE);
+ settingsWidget.setOnClickListener(v -> mContext.startActivity(mIntent));
+ } else {
+ divider.setVisibility(View.GONE);
+ settingsWidget.setVisibility(View.GONE);
+ settingsWidget.setOnClickListener(null);
+ }
+
+ View checkboxContainer = view.findViewById(R.id.checkbox_container);
+ if (checkboxContainer != null) {
+ checkboxContainer.setOnClickListener(mOnCheckBoxClickListener);
+ }
+ mCheckBox = (CheckBox) view.findViewById(com.android.internal.R.id.checkbox);
+ if (mCheckBox != null) {
+ mCheckBox.setChecked(mChecked);
+ mCheckBox.setEnabled(mEnableCheckBox);
+ }
+ }
+
+ public boolean isChecked() {
+ return mChecked;
+ }
+
+ @Override
+ public void setIntent(Intent intent) {
+ mIntent = intent;
+ }
+
+ @Override
+ public void onClick() {
+ mOnCheckBoxClickListener.onClick(null);
+ }
+
+ public void setChecked(boolean checked) {
+ mChecked = checked;
+ if (mCheckBox != null) {
+ mCheckBox.setChecked(checked);
+ }
+ }
+
+ public void setCheckBoxEnabled(boolean enabled) {
+ mEnableCheckBox = enabled;
+ if (mCheckBox != null) {
+ mCheckBox.setEnabled(enabled);
+ }
+ }
+
+ private View.OnClickListener mOnCheckBoxClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mCheckBox != null && !mCheckBox.isEnabled()) {
+ return;
+ }
+ setChecked(!mChecked);
+ if (!callChangeListener(mChecked)) {
+ setChecked(!mChecked);
+ } else {
+ persistBoolean(mChecked);
+ }
+ }
+ };
+}
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index ed0b123..7053bb3 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -273,8 +273,7 @@
protected Preference populateSingleChannelPrefs(PreferenceGroup parent,
final NotificationChannel channel, final boolean groupBlocked) {
- MasterCheckBoxPreference channelPref = new MasterCheckBoxPreference(
- getPrefContext());
+ ChannelSummaryPreference channelPref = new ChannelSummaryPreference(getPrefContext());
channelPref.setCheckBoxEnabled(mSuspendedAppsAdmin == null
&& isChannelBlockable(channel)
&& isChannelConfigurable(channel)
diff --git a/src/com/android/settings/notification/NotificationStation.java b/src/com/android/settings/notification/NotificationStation.java
index 116980f..91ebc88 100644
--- a/src/com/android/settings/notification/NotificationStation.java
+++ b/src/com/android/settings/notification/NotificationStation.java
@@ -372,7 +372,7 @@
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_sound)))
.append(delim);
- if (channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
+ if (channel == null || channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
if (0 != (n.defaults & Notification.DEFAULT_SOUND)) {
sb.append(getString(R.string.notification_log_details_default));
@@ -387,7 +387,7 @@
sb.append("\n")
.append(bold(getString(R.string.notification_log_details_vibrate)))
.append(delim);
- if (channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
+ if (channel == null || channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
if (0 != (n.defaults & Notification.DEFAULT_VIBRATE)) {
sb.append(getString(R.string.notification_log_details_default));
} else if (n.vibrate != null) {
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index b2f2d25..11861e0 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -139,7 +139,7 @@
.setText(R.string.app_notifications_dialog_done)
.setListener(this::onDoneButtonClicked)
.setButtonType(FooterButton.ButtonType.NEXT)
- .setTheme(R.style.SuwGlifButton_Primary)
+ .setTheme(R.style.SudGlifButton_Primary)
.build()
);
}
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 32d4edf..35bc45e 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -408,9 +408,9 @@
ViewGroup container = view.findViewById(R.id.password_container);
container.setOpticalInsets(Insets.NONE);
- mSkipButton = (Button) view.findViewById(R.id.skip_button);
+ mSkipButton = view.findViewById(R.id.skip_button);
mSkipButton.setOnClickListener(this);
- mNextButton = (Button) view.findViewById(R.id.next_button);
+ mNextButton = view.findViewById(R.id.next_button);
mNextButton.setOnClickListener(this);
mClearButton = view.findViewById(R.id.clear_button);
mClearButton.setOnClickListener(this);
@@ -894,12 +894,13 @@
mPasswordRequirementAdapter.setRequirements(messages);
// Enable/Disable the next button accordingly.
setNextEnabled(errorCode == NO_ERROR);
+ mClearButton.setVisibility(View.GONE);
} else {
// Hide password requirement view when we are just asking user to confirm the pw.
mPasswordRestrictionView.setVisibility(View.GONE);
setHeaderText(getString(mUiStage.getHint(mIsAlphaMode, getStageType())));
setNextEnabled(canInput && length >= mPasswordMinLength);
- mClearButton.setEnabled(canInput && length > 0);
+ mClearButton.setVisibility(toVisibility(canInput && length > 0));
}
int message = mUiStage.getMessage(mIsAlphaMode, getStageType());
if (message != 0) {
@@ -909,13 +910,11 @@
mMessage.setVisibility(View.INVISIBLE);
}
- mClearButton.setVisibility(toVisibility(mUiStage != Stage.Introduction));
-
setNextText(mUiStage.buttonText);
mPasswordEntryInputDisabler.setInputEnabled(canInput);
}
- private int toVisibility(boolean visibleOrGone) {
+ protected int toVisibility(boolean visibleOrGone) {
return visibleOrGone ? View.VISIBLE : View.GONE;
}
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index 1c9e3ff..2738a26 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -476,7 +476,7 @@
R.layout.choose_lock_pattern, container, false);
layout.setHeaderText(getActivity().getTitle());
if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
- View iconView = layout.findViewById(R.id.suw_layout_icon);
+ View iconView = layout.findViewById(R.id.suc_layout_icon);
if (iconView != null) {
iconView.setVisibility(View.GONE);
}
@@ -494,7 +494,7 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- mTitleText = view.findViewById(R.id.suw_layout_title);
+ mTitleText = view.findViewById(R.id.suc_layout_title);
mHeaderText = (TextView) view.findViewById(R.id.headerText);
mDefaultHeaderColorList = mHeaderText.getTextColors();
mMessageText = view.findViewById(R.id.message);
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index 45b8129..b5bca15 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -135,7 +135,7 @@
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
if (mHeaderTextView == null) {
- mHeaderTextView = view.findViewById(R.id.suw_layout_title);
+ mHeaderTextView = view.findViewById(R.id.suc_layout_title);
}
mDetailsTextView = (TextView) view.findViewById(R.id.detailsText);
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
diff --git a/src/com/android/settings/password/SetupChooseLockGeneric.java b/src/com/android/settings/password/SetupChooseLockGeneric.java
index 8cd40d5..a0f8bae 100644
--- a/src/com/android/settings/password/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/password/SetupChooseLockGeneric.java
@@ -86,7 +86,7 @@
GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
- R.dimen.suw_items_glif_text_divider_inset));
+ R.dimen.sud_items_glif_text_divider_inset));
layout.setIcon(getContext().getDrawable(R.drawable.ic_lock));
diff --git a/src/com/android/settings/password/SetupChooseLockPassword.java b/src/com/android/settings/password/SetupChooseLockPassword.java
index 8454cc5..2c443c2 100644
--- a/src/com/android/settings/password/SetupChooseLockPassword.java
+++ b/src/com/android/settings/password/SetupChooseLockPassword.java
@@ -135,9 +135,13 @@
@Override
protected void updateUi() {
super.updateUi();
-
// Show the skip button during SUW but not during Settings > Biometric Enrollment
- mSkipButton.setVisibility(View.VISIBLE);
+ if (mUiStage == Stage.Introduction) {
+ mSkipButton.setVisibility(View.VISIBLE);
+ } else {
+ mSkipButton.setVisibility(View.GONE);
+ }
+
if (mOptionsButton != null) {
mOptionsButton.setVisibility(
mUiStage == Stage.Introduction ? View.VISIBLE : View.GONE);
diff --git a/src/com/android/settings/password/SetupChooseLockPattern.java b/src/com/android/settings/password/SetupChooseLockPattern.java
index b24936b..0a32468 100644
--- a/src/com/android/settings/password/SetupChooseLockPattern.java
+++ b/src/com/android/settings/password/SetupChooseLockPattern.java
@@ -59,6 +59,7 @@
@Nullable
private Button mOptionsButton;
+ private Button mSkipButton;
@Override
public View onCreateView(
@@ -71,9 +72,8 @@
.show(getChildFragmentManager(), null));
}
// Show the skip button during SUW but not during Settings > Biometric Enrollment
- Button skipButton = view.findViewById(R.id.skip_button);
- skipButton.setVisibility(View.VISIBLE);
- skipButton.setOnClickListener(v -> {
+ mSkipButton = view.findViewById(R.id.skip_button);
+ mSkipButton.setOnClickListener(v -> {
SetupSkipDialog dialog = SetupSkipDialog.newInstance(
getActivity().getIntent()
.getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
@@ -100,6 +100,12 @@
stage == Stage.ChoiceTooShort || stage == Stage.FirstChoiceValid)
? View.VISIBLE : View.INVISIBLE);
}
+
+ if (stage.leftMode == LeftButtonMode.Gone && stage == Stage.Introduction) {
+ mSkipButton.setVisibility(View.VISIBLE);
+ } else {
+ mSkipButton.setVisibility(View.GONE);
+ }
}
@Override
diff --git a/src/com/android/settings/slices/BlockingSlicePrefController.java b/src/com/android/settings/slices/BlockingSlicePrefController.java
new file mode 100644
index 0000000..94810c5
--- /dev/null
+++ b/src/com/android/settings/slices/BlockingSlicePrefController.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ * 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.
+ */
+
+package com.android.settings.slices;
+
+import android.content.Context;
+
+import androidx.slice.Slice;
+
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * The blocking slice preference controller. It will make whole page invisible for a certain time
+ * until {@link Slice} is fully loaded.
+ */
+public class BlockingSlicePrefController extends SlicePreferenceController implements
+ BasePreferenceController.UiBlocker {
+
+ public BlockingSlicePrefController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ }
+
+ @Override
+ public void onChanged(Slice slice) {
+ super.onChanged(slice);
+ if (mUiBlockListener != null) {
+ mUiBlockListener.onBlockerWorkFinished(this);
+ }
+ }
+}
diff --git a/src/com/android/settings/slices/CustomSliceManager.java b/src/com/android/settings/slices/CustomSliceManager.java
index bb47df2..24ee680 100644
--- a/src/com/android/settings/slices/CustomSliceManager.java
+++ b/src/com/android/settings/slices/CustomSliceManager.java
@@ -23,7 +23,7 @@
import androidx.annotation.VisibleForTesting;
import com.android.settings.flashlight.FlashlightSlice;
-import com.android.settings.homepage.contextualcards.deviceinfo.BatterySlice;
+import com.android.settings.homepage.contextualcards.deviceinfo.BatteryInfoSlice;
import com.android.settings.homepage.contextualcards.deviceinfo.DataUsageSlice;
import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
import com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice;
@@ -106,7 +106,7 @@
private void addSlices() {
mUriMap.put(CustomSliceRegistry.BATTERY_FIX_SLICE_URI, BatteryFixSlice.class);
- mUriMap.put(CustomSliceRegistry.BATTERY_INFO_SLICE_URI, BatterySlice.class);
+ mUriMap.put(CustomSliceRegistry.BATTERY_INFO_SLICE_URI, BatteryInfoSlice.class);
mUriMap.put(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI, BluetoothDevicesSlice.class);
mUriMap.put(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI, ContextualWifiSlice.class);
mUriMap.put(CustomSliceRegistry.DATA_USAGE_SLICE_URI, DataUsageSlice.class);
diff --git a/src/com/android/settings/slices/SliceBuilderUtils.java b/src/com/android/settings/slices/SliceBuilderUtils.java
index b2b8310..925306e 100644
--- a/src/com/android/settings/slices/SliceBuilderUtils.java
+++ b/src/com/android/settings/slices/SliceBuilderUtils.java
@@ -425,7 +425,10 @@
final String title = data.getTitle();
final Set<String> keywords = buildSliceKeywords(data);
@ColorInt final int color = Utils.getColorAccentDefaultColor(context);
- final CharSequence summary = context.getText(R.string.disabled_dependent_setting_summary);
+
+ final String customSubtitle = data.getUnavailableSliceSubtitle();
+ final CharSequence subtitle = !TextUtils.isEmpty(customSubtitle) ? customSubtitle
+ : context.getText(R.string.disabled_dependent_setting_summary);
final IconCompat icon = getSafeIcon(context, data);
final SliceAction primaryAction = SliceAction.createDeeplink(
getContentPendingIntent(context, data),
@@ -436,7 +439,7 @@
.addRow(new RowBuilder()
.setTitle(title)
.setTitleItem(icon, ListBuilder.ICON_IMAGE)
- .setSubtitle(summary)
+ .setSubtitle(subtitle)
.setPrimaryAction(primaryAction))
.setKeywords(keywords)
.build();
diff --git a/src/com/android/settings/slices/SliceData.java b/src/com/android/settings/slices/SliceData.java
index 8705884..9d52d56 100644
--- a/src/com/android/settings/slices/SliceData.java
+++ b/src/com/android/settings/slices/SliceData.java
@@ -28,7 +28,6 @@
* Note that {@link #mKey} is treated as a primary key for this class and determines equality.
*/
public class SliceData {
-
/**
* Flags indicating the UI type of the Slice.
*/
@@ -76,6 +75,8 @@
private final boolean mIsDynamicSummaryAllowed;
+ private final String mUnavailableSliceSubtitle;
+
public String getKey() {
return mKey;
}
@@ -124,6 +125,10 @@
return mIsDynamicSummaryAllowed;
}
+ public String getUnavailableSliceSubtitle() {
+ return mUnavailableSliceSubtitle;
+ }
+
private SliceData(Builder builder) {
mKey = builder.mKey;
mTitle = builder.mTitle;
@@ -137,6 +142,7 @@
mSliceType = builder.mSliceType;
mIsPlatformDefined = builder.mIsPlatformDefined;
mIsDynamicSummaryAllowed = builder.mIsDynamicSummaryAllowed;
+ mUnavailableSliceSubtitle = builder.mUnavailableSliceSubtitle;
}
@Override
@@ -178,6 +184,8 @@
private boolean mIsDynamicSummaryAllowed;
+ private String mUnavailableSliceSubtitle;
+
public Builder setKey(String key) {
mKey = key;
return this;
@@ -238,6 +246,12 @@
return this;
}
+ public Builder setUnavailableSliceSubtitle(
+ String unavailableSliceSubtitle) {
+ mUnavailableSliceSubtitle = unavailableSliceSubtitle;
+ return this;
+ }
+
public SliceData build() {
if (TextUtils.isEmpty(mKey)) {
throw new InvalidSliceDataException("Key cannot be empty");
diff --git a/src/com/android/settings/slices/SliceDataConverter.java b/src/com/android/settings/slices/SliceDataConverter.java
index cb2980d..dcc8089 100644
--- a/src/com/android/settings/slices/SliceDataConverter.java
+++ b/src/com/android/settings/slices/SliceDataConverter.java
@@ -16,12 +16,12 @@
package com.android.settings.slices;
-import static com.android.settings.core.PreferenceXmlParserUtils
- .METADATA_ALLOW_DYNAMIC_SUMMARY_IN_SLICE;
+import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_ALLOW_DYNAMIC_SUMMARY_IN_SLICE;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_CONTROLLER;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_ICON;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_KEY;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_PLATFORM_SLICE_FLAG;
+import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_UNAVAILABLE_SLICE_SUBTITLE;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_SUMMARY;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_TITLE;
@@ -189,7 +189,8 @@
| MetadataFlag.FLAG_NEED_PREF_ICON
| MetadataFlag.FLAG_NEED_PREF_SUMMARY
| MetadataFlag.FLAG_NEED_PLATFORM_SLICE_FLAG
- | MetadataFlag.FLAG_ALLOW_DYNAMIC_SUMMARY_IN_SLICE);
+ | MetadataFlag.FLAG_ALLOW_DYNAMIC_SUMMARY_IN_SLICE
+ | MetadataFlag.FLAG_UNAVAILABLE_SLICE_SUBTITLE);
for (Bundle bundle : metadata) {
// TODO (b/67996923) Non-controller Slices should become intent-only slices.
@@ -208,6 +209,8 @@
final boolean isPlatformSlice = bundle.getBoolean(METADATA_PLATFORM_SLICE_FLAG);
final boolean isDynamicSummaryAllowed = bundle.getBoolean(
METADATA_ALLOW_DYNAMIC_SUMMARY_IN_SLICE);
+ final String unavailableSliceSubtitle = bundle.getString(
+ METADATA_UNAVAILABLE_SLICE_SUBTITLE);
final SliceData xmlSlice = new SliceData.Builder()
.setKey(key)
@@ -220,6 +223,7 @@
.setSliceType(sliceType)
.setPlatformDefined(isPlatformSlice)
.setDynamicSummaryAllowed(isDynamicSummaryAllowed)
+ .setUnavailableSliceSubtitle(unavailableSliceSubtitle)
.build();
final BasePreferenceController controller =
diff --git a/src/com/android/settings/slices/SlicePreference.java b/src/com/android/settings/slices/SlicePreference.java
index 37a53f4..a88ae76 100644
--- a/src/com/android/settings/slices/SlicePreference.java
+++ b/src/com/android/settings/slices/SlicePreference.java
@@ -44,6 +44,7 @@
private void init() {
mSliceView = findViewById(R.id.slice_view);
mSliceView.showTitleItems(true);
+ mSliceView.setScrollable(false);
}
public void onSliceUpdated(Slice slice) {
diff --git a/src/com/android/settings/slices/SlicePreferenceController.java b/src/com/android/settings/slices/SlicePreferenceController.java
index 8c751c8..d7fcc18 100644
--- a/src/com/android/settings/slices/SlicePreferenceController.java
+++ b/src/com/android/settings/slices/SlicePreferenceController.java
@@ -50,9 +50,7 @@
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
-
- mSlicePreference = (SlicePreference) screen.findPreference(
- getPreferenceKey());
+ mSlicePreference = screen.findPreference(getPreferenceKey());
}
@Override
diff --git a/src/com/android/settings/slices/SlicesDatabaseAccessor.java b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
index c75f3ef..ae77dd2 100644
--- a/src/com/android/settings/slices/SlicesDatabaseAccessor.java
+++ b/src/com/android/settings/slices/SlicesDatabaseAccessor.java
@@ -50,6 +50,7 @@
IndexColumns.PLATFORM_SLICE,
IndexColumns.SLICE_TYPE,
IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE,
+ IndexColumns.UNAVAILABLE_SLICE_SUBTITLE,
};
// Cursor value for boolean true
@@ -167,6 +168,8 @@
cursor.getColumnIndex(IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE)) == TRUE;
int sliceType = cursor.getInt(
cursor.getColumnIndex(IndexColumns.SLICE_TYPE));
+ final String unavailableSliceSubtitle = cursor.getString(
+ cursor.getColumnIndex(IndexColumns.UNAVAILABLE_SLICE_SUBTITLE));
if (isIntentOnly) {
sliceType = SliceData.SliceType.INTENT;
@@ -185,6 +188,7 @@
.setPlatformDefined(isPlatformDefined)
.setSliceType(sliceType)
.setDynamicSummaryAllowed(isDynamicSummaryAllowed)
+ .setUnavailableSliceSubtitle(unavailableSliceSubtitle)
.build();
}
diff --git a/src/com/android/settings/slices/SlicesDatabaseHelper.java b/src/com/android/settings/slices/SlicesDatabaseHelper.java
index e463099..8dc86fb 100644
--- a/src/com/android/settings/slices/SlicesDatabaseHelper.java
+++ b/src/com/android/settings/slices/SlicesDatabaseHelper.java
@@ -36,7 +36,7 @@
private static final String DATABASE_NAME = "slices_index.db";
private static final String SHARED_PREFS_TAG = "slices_shared_prefs";
- private static final int DATABASE_VERSION = 3;
+ private static final int DATABASE_VERSION = 4;
public interface Tables {
String TABLE_SLICES_INDEX = "slices_index";
@@ -99,6 +99,11 @@
* preference controller.
*/
String ALLOW_DYNAMIC_SUMMARY_IN_SLICE = "allow_dynamic_summary_in_slice";
+
+ /**
+ * Customized subtitle if it's a unavailable slice
+ */
+ String UNAVAILABLE_SLICE_SUBTITLE = "unavailable_slice_subtitle";
}
private static final String CREATE_SLICES_TABLE =
@@ -125,6 +130,8 @@
IndexColumns.SLICE_TYPE +
", " +
IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE +
+ ", " +
+ IndexColumns.UNAVAILABLE_SLICE_SUBTITLE +
");";
private final Context mContext;
@@ -151,7 +158,7 @@
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < DATABASE_VERSION) {
- Log.d(TAG, "Reconstructing DB from " + oldVersion + "to " + newVersion);
+ Log.d(TAG, "Reconstructing DB from " + oldVersion + " to " + newVersion);
reconstruct(db);
}
}
diff --git a/src/com/android/settings/slices/SlicesIndexer.java b/src/com/android/settings/slices/SlicesIndexer.java
index 0c39429..ec2be29 100644
--- a/src/com/android/settings/slices/SlicesIndexer.java
+++ b/src/com/android/settings/slices/SlicesIndexer.java
@@ -113,6 +113,8 @@
values.put(IndexColumns.SLICE_TYPE, dataRow.getSliceType());
values.put(IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE,
dataRow.isDynamicSummaryAllowed());
+ values.put(IndexColumns.UNAVAILABLE_SLICE_SUBTITLE,
+ dataRow.getUnavailableSliceSubtitle());
database.replaceOrThrow(Tables.TABLE_SLICES_INDEX, null /* nullColumnHack */,
values);
diff --git a/src/com/android/settings/widget/UpdatableListPreferenceDialogFragment.java b/src/com/android/settings/widget/UpdatableListPreferenceDialogFragment.java
index 998434e..bd7f78a 100644
--- a/src/com/android/settings/widget/UpdatableListPreferenceDialogFragment.java
+++ b/src/com/android/settings/widget/UpdatableListPreferenceDialogFragment.java
@@ -84,8 +84,8 @@
@Override
public void onDialogClosed(boolean positiveResult) {
- final ListPreference preference = getListPreference();
if (positiveResult && mClickedDialogEntryIndex >= 0) {
+ final ListPreference preference = getListPreference();
final String value = mEntryValues[mClickedDialogEntryIndex].toString();
if (preference.callChangeListener(value)) {
preference.setValue(value);
@@ -144,7 +144,8 @@
return mMetricsCategory;
}
- private ListPreference getListPreference() {
+ @VisibleForTesting
+ ListPreference getListPreference() {
return (ListPreference) getPreference();
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 67f59ea..26db583 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -621,7 +621,7 @@
config.requirePMF = true;
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
- config.allowedGroupMgmtCiphers.set(WifiConfiguration.GroupMgmtCipher
+ config.allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher
.BIP_GMAC_256);
config.allowedSuiteBCiphers.set(WifiConfiguration.SuiteBCipher.ECDHE_RSA);
}
diff --git a/src/com/android/settings/wifi/WifiUtils.java b/src/com/android/settings/wifi/WifiUtils.java
index 7970b2a..751fc91 100644
--- a/src/com/android/settings/wifi/WifiUtils.java
+++ b/src/com/android/settings/wifi/WifiUtils.java
@@ -196,7 +196,7 @@
config.requirePMF = true;
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
- config.allowedGroupMgmtCiphers.set(WifiConfiguration.GroupMgmtCipher
+ config.allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher
.BIP_GMAC_256);
config.allowedSuiteBCiphers.set(WifiConfiguration.SuiteBCipher.ECDHE_RSA);
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
index 8fa58f3..0821ec0 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppAddDeviceFragment.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Bundle;
+import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -28,7 +29,6 @@
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
-import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
@@ -41,7 +41,7 @@
private static final String TAG = "WifiDppAddDeviceFragment";
private ImageView mWifiApPictureView;
- private TextView mChooseDifferentNetwork;
+ private Button mChooseDifferentNetwork;
private Button mButtonLeft;
private Button mButtonRight;
@@ -56,6 +56,7 @@
// Update success UI.
mTitle.setText(R.string.wifi_dpp_wifi_shared_with_device);
mSummary.setVisibility(View.INVISIBLE);
+ mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
mButtonLeft.setText(R.string.wifi_dpp_add_another_device);
mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
mButtonRight.setText(R.string.done);
@@ -64,8 +65,13 @@
@Override
public void onFailure(int code) {
- //TODO(b/122429170): Show DPP configuration error state UI
Log.d(TAG, "DppStatusCallback.onFailure " + code);
+
+ // Update fail UI.
+ mTitle.setText(R.string.wifi_dpp_could_not_add_device);
+ mSummary.setVisibility(View.INVISIBLE);
+ mChooseDifferentNetwork.setVisibility(View.INVISIBLE);
+ mButtonRight.setText(R.string.retry);
}
@Override
@@ -100,6 +106,15 @@
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
+ final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
+ .getWifiDppQrCode();
+ final String information = wifiQrCode.getInformation();
+ if (TextUtils.isEmpty(information)) {
+ mTitle.setText(R.string.wifi_dpp_device_found);
+ } else {
+ mTitle.setText(information);
+ }
+
final WifiNetworkConfig wifiNetworkConfig = ((WifiDppConfiguratorActivity) getActivity())
.getWifiNetworkConfig();
if (!WifiNetworkConfig.isValidConfig(wifiNetworkConfig)) {
@@ -109,10 +124,17 @@
wifiNetworkConfig.getSsid()));
mWifiApPictureView = view.findViewById(R.id.wifi_ap_picture_view);
+
mChooseDifferentNetwork = view.findViewById(R.id.choose_different_network);
+ mChooseDifferentNetwork.setOnClickListener(v ->
+ mClickChooseDifferentNetworkListener.onClickChooseDifferentNetwork());
+
mButtonLeft = view.findViewById(R.id.button_left);
mButtonLeft.setText(R.string.cancel);
- mButtonLeft.setOnClickListener(v -> getFragmentManager().popBackStack());
+ mButtonLeft.setOnClickListener(v -> {
+ getActivity().setResult(Activity.RESULT_CANCELED);
+ getActivity().finish();
+ });
mButtonRight = view.findViewById(R.id.button_right);
mButtonRight.setText(R.string.wifi_dpp_share_wifi);
@@ -120,11 +142,34 @@
}
private void startWifiDppInitiator() {
- final String enrolleeUri = ((WifiDppConfiguratorActivity) getActivity()).getDppUri();
+ final WifiQrCode wifiQrCode = ((WifiDppConfiguratorActivity) getActivity())
+ .getWifiDppQrCode();
+ final String qrCode = wifiQrCode.getQrCode();
final int networkId =
((WifiDppConfiguratorActivity) getActivity()).getWifiNetworkConfig().getNetworkId();
final WifiManager wifiManager = getContext().getSystemService(WifiManager.class);
- wifiManager.startDppAsConfiguratorInitiator(enrolleeUri, networkId,
+
+ wifiManager.startDppAsConfiguratorInitiator(qrCode, networkId,
WifiManager.DPP_NETWORK_ROLE_STA, /* handler */ null, new DppStatusCallback());
}
+
+ // Container Activity must implement this interface
+ public interface OnClickChooseDifferentNetworkListener {
+ public void onClickChooseDifferentNetwork();
+ }
+ OnClickChooseDifferentNetworkListener mClickChooseDifferentNetworkListener;
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+
+ mClickChooseDifferentNetworkListener = (OnClickChooseDifferentNetworkListener) context;
+ }
+
+ @Override
+ public void onDetach() {
+ mClickChooseDifferentNetworkListener = null;
+
+ super.onDetach();
+ }
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
index b08546c..97ee71a 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java
@@ -22,6 +22,7 @@
import android.os.Bundle;
import android.util.Log;
+import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@@ -51,7 +52,8 @@
WifiNetworkConfig.Retriever,
WifiDppQrCodeGeneratorFragment.OnQrCodeGeneratorFragmentAddButtonClickedListener,
WifiDppQrCodeScannerFragment.OnScanWifiDppSuccessListener,
- WifiDppQrCodeScannerFragment.OnScanZxingWifiFormatSuccessListener {
+ WifiDppQrCodeScannerFragment.OnScanZxingWifiFormatSuccessListener,
+ WifiDppAddDeviceFragment.OnClickChooseDifferentNetworkListener {
private static final String TAG = "WifiDppConfiguratorActivity";
public static final String ACTION_CONFIGURATOR_QR_CODE_SCANNER =
@@ -61,14 +63,19 @@
public static final String ACTION_PROCESS_WIFI_DPP_QR_CODE =
"android.settings.PROCESS_WIFI_DPP_QR_CODE";
+ // Key for Bundle usage
+ private static final String KEY_QR_CODE = "key_qr_code";
+ private static final String KEY_WIFI_SECURITY = "key_wifi_security";
+ private static final String KEY_WIFI_SSID = "key_wifi_ssid";
+ private static final String KEY_WIFI_PRESHARED_KEY = "key_wifi_preshared_key";
+ private static final String KEY_WIFI_HIDDEN_SSID = "key_wifi_hidden_ssid";
+ private static final String KEY_WIFI_NETWORK_ID = "key_wifi_network_id";
+
private FragmentManager mFragmentManager;
/** The Wi-Fi network which will be configured */
private WifiNetworkConfig mWifiNetworkConfig;
- /** The uri from Wi-Fi DPP QR code */
- private String mDppUri;
-
/** The Wi-Fi DPP QR code from intent ACTION_PROCESS_WIFI_DPP_QR_CODE */
private WifiQrCode mWifiDppQrCode;
@@ -81,6 +88,21 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ if (savedInstanceState != null) {
+ String qrCode = savedInstanceState.getString(KEY_QR_CODE);
+
+ mWifiDppQrCode = getValidWifiDppQrCodeOrNull(qrCode);
+
+ String security = savedInstanceState.getString(KEY_WIFI_SECURITY);
+ String ssid = savedInstanceState.getString(KEY_WIFI_SSID);
+ String preSharedKey = savedInstanceState.getString(KEY_WIFI_PRESHARED_KEY);
+ boolean hiddenSsid = savedInstanceState.getBoolean(KEY_WIFI_HIDDEN_SSID);
+ int networkId = savedInstanceState.getInt(KEY_WIFI_NETWORK_ID);
+
+ mWifiNetworkConfig = WifiNetworkConfig.getValidConfigOrNull(security, ssid,
+ preSharedKey, hiddenSsid, networkId);
+ }
+
setContentView(R.layout.wifi_dpp_activity);
mFragmentManager = getSupportFragmentManager();
@@ -117,7 +139,7 @@
break;
case ACTION_PROCESS_WIFI_DPP_QR_CODE:
String qrCode = intent.getStringExtra(WifiDppUtils.EXTRA_QR_CODE);
- mWifiDppQrCode = getValidWiFiDppQrCodeOrNull(qrCode);
+ mWifiDppQrCode = getValidWifiDppQrCodeOrNull(qrCode);
if (mWifiDppQrCode == null) {
cancelActivity = true;
} else {
@@ -205,7 +227,7 @@
fragmentTransaction.commit();
}
- private WifiQrCode getValidWiFiDppQrCodeOrNull(String qrCode) {
+ private WifiQrCode getValidWifiDppQrCodeOrNull(String qrCode) {
WifiQrCode wifiQrCode;
try {
wifiQrCode = new WifiQrCode(qrCode);
@@ -225,16 +247,12 @@
return mWifiNetworkConfig;
}
- public String getDppUri() {
- return mDppUri;
- }
-
public WifiQrCode getWifiDppQrCode() {
return mWifiDppQrCode;
}
- @Override
- public boolean setWifiNetworkConfig(WifiNetworkConfig config) {
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ protected boolean setWifiNetworkConfig(WifiNetworkConfig config) {
if(!WifiNetworkConfig.isValidConfig(config)) {
return false;
} else {
@@ -243,6 +261,20 @@
}
}
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ protected boolean setWifiDppQrCode(WifiQrCode wifiQrCode) {
+ if (wifiQrCode == null) {
+ return false;
+ }
+
+ if (!WifiQrCode.SCHEME_DPP.equals(wifiQrCode.getScheme())) {
+ return false;
+ }
+
+ mWifiDppQrCode = new WifiQrCode(wifiQrCode.getQrCode());
+ return true;
+ }
+
@Override
public boolean onNavigateUp() {
Fragment fragment = mFragmentManager.findFragmentById(R.id.fragment_container);
@@ -263,17 +295,38 @@
}
@Override
- public void onScanWifiDppSuccess(String uri) {
- mDppUri = uri;
+ public void onScanWifiDppSuccess(WifiQrCode wifiQrCode) {
+ mWifiDppQrCode = wifiQrCode;
showAddDeviceFragment(/* addToBackStack */ true);
}
@Override
public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig) {
- mDppUri = null;
- mWifiNetworkConfig = new WifiNetworkConfig(wifiNetworkConfig);
+ // Do nothing, it's impossible to be a configurator without a Wi-Fi DPP QR code
+ }
- showAddDeviceFragment(/* addToBackStack */ true);
+ @Override
+ public void onClickChooseDifferentNetwork() {
+ mWifiNetworkConfig = null;
+
+ showChooseSavedWifiNetworkFragment(/* addToBackStack */ true);
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ if (mWifiDppQrCode != null) {
+ outState.putString(KEY_QR_CODE, mWifiDppQrCode.getQrCode());
+ }
+
+ if (mWifiNetworkConfig != null) {
+ outState.putString(KEY_WIFI_SECURITY, mWifiNetworkConfig.getSecurity());
+ outState.putString(KEY_WIFI_SSID, mWifiNetworkConfig.getSsid());
+ outState.putString(KEY_WIFI_PRESHARED_KEY, mWifiNetworkConfig.getPreSharedKey());
+ outState.putBoolean(KEY_WIFI_HIDDEN_SSID, mWifiNetworkConfig.getHiddenSsid());
+ outState.putInt(KEY_WIFI_NETWORK_ID, mWifiNetworkConfig.getNetworkId());
+ }
+
+ super.onSaveInstanceState(outState);
}
}
diff --git a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
index 8c0e1f0..3a1b6bc 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppEnrolleeActivity.java
@@ -145,9 +145,10 @@
}
@Override
- public void onScanWifiDppSuccess(String uri) {
+ public void onScanWifiDppSuccess(WifiQrCode wifiQrCode) {
final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
- wifiManager.startDppAsEnrolleeInitiator(uri, /* handler */ null, new DppStatusCallback());
+ wifiManager.startDppAsEnrolleeInitiator(wifiQrCode.getQrCode(), /* handler */ null,
+ new DppStatusCallback());
}
@Override
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 2f59e18..21534dc 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -64,6 +64,7 @@
// Key for Bundle usage
private static final String KEY_PUBLIC_URI = "key_public_uri";
+ private static final String KEY_IS_CONFIGURATOR_MODE = "key_is_configurator_mode";
private QrCamera mCamera;
private TextureView mTextureView;
@@ -71,7 +72,7 @@
private TextView mErrorMessage;
/** true if the fragment working for configurator, false enrollee*/
- private final boolean mIsConfiguratorMode;
+ private boolean mIsConfiguratorMode;
/** The SSID of the Wi-Fi network which the user specify to enroll */
private String mSsid;
@@ -80,6 +81,15 @@
private WifiQrCode mWifiQrCode;
@Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (savedInstanceState != null) {
+ mIsConfiguratorMode = savedInstanceState.getBoolean(KEY_IS_CONFIGURATOR_MODE);
+ }
+ }
+
+ @Override
public int getMetricsCategory() {
if (mIsConfiguratorMode) {
return MetricsProto.MetricsEvent.SETTINGS_WIFI_DPP_CONFIGURATOR;
@@ -90,7 +100,7 @@
// Container Activity must implement this interface
public interface OnScanWifiDppSuccessListener {
- public void onScanWifiDppSuccess(String uri);
+ public void onScanWifiDppSuccess(WifiQrCode wifiQrCode);
}
OnScanWifiDppSuccessListener mScanWifiDppSuccessListener;
@@ -98,7 +108,7 @@
public interface OnScanZxingWifiFormatSuccessListener {
public void onScanZxingWifiFormatSuccess(WifiNetworkConfig wifiNetworkConfig);
}
- OnScanZxingWifiFormatSuccessListener mScanScanZxingWifiFormatSuccessListener;
+ OnScanZxingWifiFormatSuccessListener mScanZxingWifiFormatSuccessListener;
/**
* Configurator container activity of the fragment should create instance with this constructor.
@@ -136,13 +146,13 @@
super.onAttach(context);
mScanWifiDppSuccessListener = (OnScanWifiDppSuccessListener) context;
- mScanScanZxingWifiFormatSuccessListener = (OnScanZxingWifiFormatSuccessListener) context;
+ mScanZxingWifiFormatSuccessListener = (OnScanZxingWifiFormatSuccessListener) context;
}
@Override
public void onDetach() {
mScanWifiDppSuccessListener = null;
- mScanScanZxingWifiFormatSuccessListener = null;
+ mScanZxingWifiFormatSuccessListener = null;
super.onDetach();
}
@@ -262,17 +272,17 @@
}
/**
- * This method is only called when QrCamera.ScannerCallback.isValid returns true;
+ * This method is only called when QrCamera.ScannerCallback.isValid returns true;
*/
@Override
public void handleSuccessfulResult(String qrCode) {
switch (mWifiQrCode.getScheme()) {
case WifiQrCode.SCHEME_DPP:
- handleWifiDpp(qrCode);
+ handleWifiDpp();
break;
case WifiQrCode.SCHEME_ZXING_WIFI_NETWORK_CONFIG:
- handleZxingWifiFormat(mWifiQrCode.getWifiNetworkConfig());
+ handleZxingWifiFormat();
break;
default:
@@ -280,25 +290,22 @@
}
}
- private void handleWifiDpp(String uri) {
+ private void handleWifiDpp() {
destroyCamera();
mDecorateView.setFocused(true);
- final Bundle bundle = new Bundle();
- bundle.putString(KEY_PUBLIC_URI, uri);
-
Message message = mHandler.obtainMessage(MESSAGE_SCAN_WIFI_DPP_SUCCESS);
- message.setData(bundle);
+ message.obj = new WifiQrCode(mWifiQrCode.getQrCode());
mHandler.sendMessageDelayed(message, SHOW_SUCCESS_SQUARE_INTERVAL);
}
- private void handleZxingWifiFormat(WifiNetworkConfig wifiNetworkConfig) {
+ private void handleZxingWifiFormat() {
destroyCamera();
mDecorateView.setFocused(true);
Message message = mHandler.obtainMessage(MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS);
- message.obj = wifiNetworkConfig;
+ message.obj = new WifiQrCode(mWifiQrCode.getQrCode()).getWifiNetworkConfig();
mHandler.sendMessageDelayed(message, SHOW_SUCCESS_SQUARE_INTERVAL);
}
@@ -349,17 +356,14 @@
if (mScanWifiDppSuccessListener == null) {
return;
}
- final Bundle bundle = msg.getData();
- final String uri = bundle.getString(KEY_PUBLIC_URI);
-
- mScanWifiDppSuccessListener.onScanWifiDppSuccess(uri);
+ mScanWifiDppSuccessListener.onScanWifiDppSuccess((WifiQrCode)msg.obj);
break;
case MESSAGE_SCAN_ZXING_WIFI_FORMAT_SUCCESS:
- if (mScanScanZxingWifiFormatSuccessListener == null) {
+ if (mScanZxingWifiFormatSuccessListener == null) {
return;
}
- mScanScanZxingWifiFormatSuccessListener.onScanZxingWifiFormatSuccess(
+ mScanZxingWifiFormatSuccessListener.onScanZxingWifiFormatSuccess(
(WifiNetworkConfig)msg.obj);
break;
@@ -368,4 +372,11 @@
}
}
};
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ outState.putBoolean(KEY_IS_CONFIGURATOR_MODE, mIsConfiguratorMode);
+
+ super.onSaveInstanceState(outState);
+ }
}
diff --git a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
index a9e88a9..915e90d 100644
--- a/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
+++ b/src/com/android/settings/wifi/dpp/WifiNetworkConfig.java
@@ -30,6 +30,7 @@
import android.util.Log;
import androidx.annotation.Keep;
+import androidx.annotation.VisibleForTesting;
/**
* Wraps the parameters of ZXing reader library's Wi-Fi Network config format.
@@ -48,8 +49,9 @@
private boolean mHiddenSsid;
private int mNetworkId;
- private WifiNetworkConfig(String security, String ssid, String preSharedKey, boolean hiddenSsid,
- int networkId) {
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ protected WifiNetworkConfig(String security, String ssid, String preSharedKey,
+ boolean hiddenSsid, int networkId) {
mSecurity = security;
mSsid = ssid;
mPreSharedKey = preSharedKey;
@@ -71,7 +73,6 @@
*/
public interface Retriever {
public WifiNetworkConfig getWifiNetworkConfig();
- public boolean setWifiNetworkConfig(WifiNetworkConfig config);
}
/**
diff --git a/src/com/android/settings/wifi/dpp/WifiQrCode.java b/src/com/android/settings/wifi/dpp/WifiQrCode.java
index 8eae3a4..b60289f 100644
--- a/src/com/android/settings/wifi/dpp/WifiQrCode.java
+++ b/src/com/android/settings/wifi/dpp/WifiQrCode.java
@@ -20,7 +20,6 @@
import android.net.wifi.WifiConfiguration;
import android.text.TextUtils;
-import androidx.annotation.Keep;
import androidx.annotation.VisibleForTesting;
import java.util.Arrays;
@@ -49,7 +48,6 @@
* H true Optional. True if the network SSID is hidden.
*
*/
-@Keep
public class WifiQrCode {
public static final String SCHEME_DPP = "DPP";
public static final String SCHEME_ZXING_WIFI_NETWORK_CONFIG = "WIFI";
@@ -86,7 +84,6 @@
// Data from parsed ZXing reader library's Wi-Fi Network config format
private WifiNetworkConfig mWifiNetworkConfig;
- @Keep
public WifiQrCode(String qrCode) throws IllegalArgumentException {
if (TextUtils.isEmpty(qrCode)) {
throw new IllegalArgumentException("Empty QR code");
@@ -172,7 +169,6 @@
return null;
}
- @Keep
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
protected String removeBackSlash(String input) {
if (input == null) {
@@ -199,7 +195,6 @@
return sb.toString();
}
- @Keep
public String getQrCode() {
return mQrCode;
}
@@ -210,25 +205,22 @@
* SCHEME_DPP for standard Wi-Fi device provision protocol; SCHEME_ZXING_WIFI_NETWORK_CONFIG
* for ZXing reader library' Wi-Fi Network config format
*/
- @Keep
public String getScheme() {
return mScheme;
}
/** Available when {@code getScheme()} returns SCHEME_DPP */
- @Keep
- public String getPublicKey() {
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ protected String getPublicKey() {
return mPublicKey;
}
/** May be available when {@code getScheme()} returns SCHEME_DPP */
- @Keep
public String getInformation() {
return mInformation;
}
/** Available when {@code getScheme()} returns SCHEME_ZXING_WIFI_NETWORK_CONFIG */
- @Keep
public WifiNetworkConfig getWifiNetworkConfig() {
if (mWifiNetworkConfig == null) {
return null;
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
index 01218cb..50133d9 100644
--- a/tests/robotests/Android.mk
+++ b/tests/robotests/Android.mk
@@ -25,6 +25,7 @@
$(SETTINGS_AOSP_PATH)/res
LOCAL_STATIC_ANDROID_LIBRARIES := \
+ androidx-constraintlayout_constraintlayout \
androidx.slice_slice-builders \
androidx.slice_slice-core \
androidx.slice_slice-view \
@@ -42,6 +43,7 @@
ims-common
LOCAL_STATIC_JAVA_LIBRARIES := \
+ androidx-constraintlayout_constraintlayout-solver \
androidx.lifecycle_lifecycle-runtime \
androidx.lifecycle_lifecycle-extensions \
guava \
diff --git a/tests/robotests/assets/grandfather_not_implementing_index_provider b/tests/robotests/assets/grandfather_not_implementing_index_provider
index 2622eb3..447de00 100644
--- a/tests/robotests/assets/grandfather_not_implementing_index_provider
+++ b/tests/robotests/assets/grandfather_not_implementing_index_provider
@@ -28,7 +28,6 @@
com.android.settings.datausage.AppDataUsage
com.android.settings.datausage.DataUsageList
com.android.settings.datetime.timezone.TimeZoneSettings
-com.android.settings.development.gup.GupDashboard
com.android.settings.deviceinfo.PrivateVolumeSettings
com.android.settings.deviceinfo.PublicVolumeSettings
com.android.settings.deviceinfo.StorageProfileFragment
diff --git a/tests/robotests/res/layout-mcc999/fingerprint_enroll_find_sensor.xml b/tests/robotests/res/layout-mcc999/fingerprint_enroll_find_sensor.xml
index 83eb781..595cfb4 100644
--- a/tests/robotests/res/layout-mcc999/fingerprint_enroll_find_sensor.xml
+++ b/tests/robotests/res/layout-mcc999/fingerprint_enroll_find_sensor.xml
@@ -46,7 +46,7 @@
</FrameLayout>
<LinearLayout
- style="@style/SuwContentFrame"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@@ -54,10 +54,10 @@
android:clipChildren="false">
<TextView
- style="@style/SuwDescription.Glif"
+ style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/suw_description_glif_margin_top"
+ android:layout_marginTop="@dimen/sud_description_glif_margin_top"
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
<View
@@ -66,7 +66,7 @@
android:layout_weight="1"/>
<Button
- style="@style/SuwGlifButton.Secondary"
+ style="@style/SudGlifButton.Secondary"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/tests/robotests/res/xml-mcc999/location_settings.xml b/tests/robotests/res/xml-mcc999/location_settings.xml
index 91e4c41..a25f36d 100644
--- a/tests/robotests/res/xml-mcc999/location_settings.xml
+++ b/tests/robotests/res/xml-mcc999/location_settings.xml
@@ -27,6 +27,7 @@
settings:controller="com.android.settings.slices.FakePreferenceController"
settings:keywords="a, b, c"
settings:platform_slice="true"
- settings:allowDynamicSummaryInSlice="true"/>
+ settings:allowDynamicSummaryInSlice="true"
+ settings:unavailableSliceSubtitle="subtitleOfUnavailableSlice"/>
</PreferenceScreen>
\ No newline at end of file
diff --git a/tests/robotests/res/xml-mcc999/night_display_settings.xml b/tests/robotests/res/xml-mcc999/night_display_settings.xml
new file mode 100644
index 0000000..c23a2cf
--- /dev/null
+++ b/tests/robotests/res/xml-mcc999/night_display_settings.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+ 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.
+ -->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="fake_title_key"
+ android:title="screen_title">
+
+ <Preference
+ android:key="key1"
+ android:title="title"
+ android:icon="@drawable/ic_android"
+ android:summary="summary"
+ settings:controller="com.android.settings.slices.FakePreferenceController"
+ settings:keywords="keyword"
+ settings:platform_slice="true"/>
+
+ <Preference
+ android:key="key2"
+ android:title="title"
+ android:icon="@drawable/ic_android"
+ android:summary="summary"
+ settings:controller="com.android.settings.slices.FakePreferenceController"
+ settings:keywords="keyword"
+ settings:platform_slice="true"
+ settings:unavailableSliceSubtitle="subtitleOfUnavailable"/>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java
new file mode 100644
index 0000000..f6160b2
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.settings.accessibility;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.pm.ResolveInfo;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.Shadows;
+import org.robolectric.shadows.ShadowPackageManager;
+
+import java.util.Collections;
+
+@RunWith(RobolectricTestRunner.class)
+public class LiveCaptionPreferenceControllerTest {
+
+ private LiveCaptionPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mController = new LiveCaptionPreferenceController(RuntimeEnvironment.application,
+ "test_key");
+ }
+
+ @Test
+ public void getAvailabilityStatus_canResolveIntent_shouldReturnAvailable() {
+ final ShadowPackageManager pm = Shadows.shadowOf(
+ RuntimeEnvironment.application.getPackageManager());
+ pm.addResolveInfoForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT,
+ new ResolveInfo());
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_noResolveIntent_shouldReturnUnavailable() {
+ final ShadowPackageManager pm = Shadows.shadowOf(
+ RuntimeEnvironment.application.getPackageManager());
+ pm.setResolveInfosForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT,
+ Collections.emptyList());
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/VibrationPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/VibrationPreferenceFragmentTest.java
index 68d5e36..9f83f72 100644
--- a/tests/robotests/src/com/android/settings/accessibility/VibrationPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/VibrationPreferenceFragmentTest.java
@@ -161,6 +161,11 @@
}
@Override
+ protected String getVibrationEnabledSetting() {
+ return "";
+ }
+
+ @Override
protected int getDefaultVibrationIntensity() {
return Vibrator.VIBRATION_INTENSITY_MEDIUM;
}
diff --git a/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java b/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java
index 7b4fb6f..6a2348c 100644
--- a/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java
@@ -30,6 +30,7 @@
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.ProviderInfo;
@@ -167,12 +168,22 @@
assertThat(bundle.getString("account_name")).isEqualTo(DUMMY_ACCOUNT);
}
+ @Test
+ public void onClickAvatar_withEmptyUri_startActivityShouldNotBeExecuted() {
+ final SettingsHomepageActivity activity = spy((SettingsHomepageActivity) mController.get());
+ final AvatarViewMixin avatarViewMixin = new AvatarViewMixin(activity, mImageView);
+
+ mImageView.performClick();
+
+ verify(activity, never()).startActivity(any(Intent.class));
+ }
+
@Implements(value = AccountFeatureProviderImpl.class)
public static class ShadowAccountFeatureProviderImpl {
@Implementation
protected Account[] getAccounts(Context context) {
- return new Account[] {new Account(DUMMY_ACCOUNT, DUMMY_DOMAIN)};
+ return new Account[]{new Account(DUMMY_ACCOUNT, DUMMY_DOMAIN)};
}
}
}
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java
index 5bf2b7e..92468a0 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java
@@ -19,13 +19,17 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.app.role.RoleManager;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.provider.Settings;
@@ -41,32 +45,59 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
+import java.util.Collections;
+
@RunWith(RobolectricTestRunner.class)
public class RolesPreferenceControllerTest {
private static final String PREFERENCE_KEY = "roles";
private static final String DIFFERENT_PREFERENCE_KEY = "different";
+
private static final String PERMISSION_CONTROLLER_PACKAGE_NAME =
"com.android.permissioncontroller";
+ private static final String BROWSER_PACKAGE_NAME = "com.example.browser1";
+ private static final String DIALER_PACKAGE_NAME = "com.example.dialer1";
+ private static final String SMS_PACKAGE_NAME = "com.example.sms1";
+
@Mock
private Context mContext;
@Mock
private PackageManager mPackageManager;
+ @Mock
+ private RoleManager mRoleManager;
+ @Mock
+ private ApplicationInfo mBrowserApplicationInfo;
+ @Mock
+ private ApplicationInfo mDialerApplicationInfo;
+ @Mock
+ private ApplicationInfo mSmsApplicationInfo;
@Before
- public void setUp() {
+ public void setUp() throws PackageManager.NameNotFoundException {
MockitoAnnotations.initMocks(this);
+
when(mContext.getPackageManager()).thenReturn(mPackageManager);
+ when(mContext.getSystemService(RoleManager.class)).thenReturn(mRoleManager);
+
+ when(mBrowserApplicationInfo.loadLabel(mPackageManager)).thenReturn("Browser1");
+ when(mPackageManager.getApplicationInfo(eq(BROWSER_PACKAGE_NAME), anyInt())).thenReturn(
+ mBrowserApplicationInfo);
+ when(mDialerApplicationInfo.loadLabel(mPackageManager)).thenReturn("Phone1");
+ when(mPackageManager.getApplicationInfo(eq(DIALER_PACKAGE_NAME), anyInt())).thenReturn(
+ mDialerApplicationInfo);
+ when(mSmsApplicationInfo.loadLabel(mPackageManager)).thenReturn("Sms1");
+ when(mPackageManager.getApplicationInfo(eq(SMS_PACKAGE_NAME), anyInt())).thenReturn(
+ mSmsApplicationInfo);
}
@Test
public void getAvailabilityStatus_noPermissionController_shouldReturnUnsupportedOnDevice() {
when(mPackageManager.getPermissionControllerPackageName()).thenReturn(null);
- RolesPreferenceController controller = new RolesPreferenceController(mContext,
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
PREFERENCE_KEY);
- assertThat(controller.getAvailabilityStatus())
+ assertThat(preferenceController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE);
}
@@ -74,10 +105,10 @@
public void getAvailabilityStatus_hasPermissionController_shouldReturnAvailableUnsearchable() {
when(mPackageManager.getPermissionControllerPackageName())
.thenReturn(PERMISSION_CONTROLLER_PACKAGE_NAME);
- RolesPreferenceController controller = new RolesPreferenceController(mContext,
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
PREFERENCE_KEY);
- assertThat(controller.getAvailabilityStatus())
+ assertThat(preferenceController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE_UNSEARCHABLE);
}
@@ -85,34 +116,34 @@
public void handlePreferenceTreeClick_differentKey_shouldReturnFalse() {
when(mPackageManager.getPermissionControllerPackageName())
.thenReturn(PERMISSION_CONTROLLER_PACKAGE_NAME);
- RolesPreferenceController controller = new RolesPreferenceController(mContext,
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
PREFERENCE_KEY);
Preference preference = mock(Preference.class);
when(preference.getKey()).thenReturn(DIFFERENT_PREFERENCE_KEY);
- assertThat(controller.handlePreferenceTreeClick(preference)).isFalse();
+ assertThat(preferenceController.handlePreferenceTreeClick(preference)).isFalse();
}
@Test
public void handlePreferenceTreeClick_sameKey_shouldReturnTrue() {
when(mPackageManager.getPermissionControllerPackageName())
.thenReturn(PERMISSION_CONTROLLER_PACKAGE_NAME);
- RolesPreferenceController controller = new RolesPreferenceController(mContext,
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
PREFERENCE_KEY);
Preference preference = mock(Preference.class);
when(preference.getKey()).thenReturn(PREFERENCE_KEY);
- assertThat(controller.handlePreferenceTreeClick(preference)).isTrue();
+ assertThat(preferenceController.handlePreferenceTreeClick(preference)).isTrue();
}
@Test
public void handlePreferenceTreeClick_noPermissionController_shouldNotStartActivity() {
when(mPackageManager.getPermissionControllerPackageName()).thenReturn(null);
- RolesPreferenceController controller = new RolesPreferenceController(mContext,
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
PREFERENCE_KEY);
Preference preference = mock(Preference.class);
when(preference.getKey()).thenReturn(PREFERENCE_KEY);
- controller.handlePreferenceTreeClick(preference);
+ preferenceController.handlePreferenceTreeClick(preference);
verify(mContext, never()).startActivity(any(Intent.class));
}
@@ -121,11 +152,11 @@
public void handlePreferenceTreeClick_hasPermissionController_shouldStartActivityWithIntent() {
when(mPackageManager.getPermissionControllerPackageName())
.thenReturn(PERMISSION_CONTROLLER_PACKAGE_NAME);
- RolesPreferenceController controller = new RolesPreferenceController(mContext,
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
PREFERENCE_KEY);
Preference preference = mock(Preference.class);
when(preference.getKey()).thenReturn(PREFERENCE_KEY);
- controller.handlePreferenceTreeClick(preference);
+ preferenceController.handlePreferenceTreeClick(preference);
ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(mContext).startActivity(intent.capture());
@@ -133,4 +164,112 @@
.isEqualTo(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS);
assertThat(intent.getValue().getPackage()).isEqualTo(PERMISSION_CONTROLLER_PACKAGE_NAME);
}
+
+ @Test
+ public void getSummary_allAvailable_shouldReturnAll() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.singletonList(BROWSER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.singletonList(DIALER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(
+ Collections.singletonList(SMS_PACKAGE_NAME));
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Browser1, Phone1, and Sms1");
+ }
+
+ @Test
+ public void getSummary_browserAndDialerAvailable_shouldReturnBrowserAndDialer() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.singletonList(BROWSER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.singletonList(DIALER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(Collections.emptyList());
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Browser1 and Phone1");
+ }
+
+ @Test
+ public void getSummary_browserAndSmsAvailable_shouldReturnBrowserAndSms() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.singletonList(BROWSER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(
+ Collections.singletonList(SMS_PACKAGE_NAME));
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Browser1 and Sms1");
+ }
+
+ @Test
+ public void getSummary_dialerAndSmsAvailable_shouldReturnDialerAndSms() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.singletonList(DIALER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(
+ Collections.singletonList(SMS_PACKAGE_NAME));
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Phone1 and Sms1");
+ }
+
+ @Test
+ public void getSummary_browserAvailable_shouldReturnBrowser() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.singletonList(BROWSER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(Collections.emptyList());
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Browser1");
+ }
+
+ @Test
+ public void getSummary_dialerAvailable_shouldReturnDialer() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.singletonList(DIALER_PACKAGE_NAME));
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(Collections.emptyList());
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Phone1");
+ }
+
+ @Test
+ public void getSummary_smsAvailable_shouldReturnSms() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(
+ Collections.singletonList(SMS_PACKAGE_NAME));
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isEqualTo("Sms1");
+ }
+
+ @Test
+ public void getSummary_noneAvailable_shouldReturnNull() {
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_BROWSER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_DIALER)).thenReturn(
+ Collections.emptyList());
+ when(mRoleManager.getRoleHolders(RoleManager.ROLE_SMS)).thenReturn(Collections.emptyList());
+ RolesPreferenceController preferenceController = new RolesPreferenceController(mContext,
+ PREFERENCE_KEY);
+
+ assertThat(preferenceController.getSummary()).isNull();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
index 21d62bc..be77283 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
@@ -26,6 +26,8 @@
import android.content.Context;
import android.os.Bundle;
+import androidx.preference.PreferenceScreen;
+
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
@@ -49,9 +51,10 @@
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private CachedBluetoothDevice mCachedDevice;
-
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private LocalBluetoothManager mLocalManager;
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
@Before
public void setUp() {
@@ -62,6 +65,7 @@
mFragment = spy(BluetoothDeviceDetailsFragment.newInstance(TEST_ADDRESS));
doReturn(mLocalManager).when(mFragment).getLocalBluetoothManager(any());
doReturn(mCachedDevice).when(mFragment).getCachedDevice(any());
+ doReturn(mPreferenceScreen).when(mFragment).getPreferenceScreen();
when(mCachedDevice.getAddress()).thenReturn(TEST_ADDRESS);
Bundle args = new Bundle();
diff --git a/tests/robotests/src/com/android/settings/core/PreferenceXmlParserUtilsTest.java b/tests/robotests/src/com/android/settings/core/PreferenceXmlParserUtilsTest.java
index 9627a48..b8051a1 100644
--- a/tests/robotests/src/com/android/settings/core/PreferenceXmlParserUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/core/PreferenceXmlParserUtilsTest.java
@@ -16,12 +16,12 @@
package com.android.settings.core;
-import static com.android.settings.core.PreferenceXmlParserUtils
- .METADATA_ALLOW_DYNAMIC_SUMMARY_IN_SLICE;
+import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_ALLOW_DYNAMIC_SUMMARY_IN_SLICE;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_APPEND;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_KEY;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_KEYWORDS;
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_SEARCHABLE;
+import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_UNAVAILABLE_SLICE_SUBTITLE;
import static com.google.common.truth.Truth.assertThat;
@@ -35,7 +35,6 @@
import com.android.settings.R;
import com.android.settings.core.PreferenceXmlParserUtils.MetadataFlag;
-import java.util.Objects;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,6 +46,7 @@
import java.io.IOException;
import java.util.List;
+import java.util.Objects;
/**
* These tests use a series of preferences that have specific attributes which are sometimes
@@ -320,7 +320,7 @@
@Test
@Config(qualifiers = "mcc999")
public void extractMetadata_requestAppendProperty_shouldDefaultToFalse()
- throws Exception {
+ throws Exception {
final List<Bundle> metadata = PreferenceXmlParserUtils.extractMetadata(mContext,
R.xml.display_settings,
MetadataFlag.FLAG_INCLUDE_PREF_SCREEN | MetadataFlag.FLAG_NEED_PREF_APPEND);
@@ -333,7 +333,7 @@
@Test
@Config(qualifiers = "mcc999")
public void extractMetadata_requestAppendProperty_shouldReturnCorrectValue()
- throws Exception {
+ throws Exception {
final List<Bundle> metadata = PreferenceXmlParserUtils.extractMetadata(mContext,
R.xml.battery_saver_schedule_settings,
MetadataFlag.FLAG_INCLUDE_PREF_SCREEN | MetadataFlag.FLAG_NEED_PREF_APPEND);
@@ -343,6 +343,46 @@
}
}
+ @Test
+ @Config(qualifiers = "mcc999")
+ public void extractMetadata_requestUnavailableSliceSubtitle_shouldDefaultNull()
+ throws Exception {
+ final List<Bundle> metadata = PreferenceXmlParserUtils.extractMetadata(mContext,
+ R.xml.night_display_settings,
+ MetadataFlag.FLAG_NEED_KEY | MetadataFlag.FLAG_UNAVAILABLE_SLICE_SUBTITLE);
+
+ boolean bundleWithKey1Found = false;
+ for (Bundle bundle : metadata) {
+ if (bundle.getString(METADATA_KEY).equals("key1")) {
+ assertThat(bundle.getString(METADATA_UNAVAILABLE_SLICE_SUBTITLE)).isNull();
+ bundleWithKey1Found = true;
+ break;
+ }
+ }
+ assertThat(bundleWithKey1Found).isTrue();
+ }
+
+ @Test
+ @Config(qualifiers = "mcc999")
+ public void extractMetadata_requestUnavailableSliceSubtitle_shouldReturnAttributeValue()
+ throws Exception {
+ final String expectedSubtitle = "subtitleOfUnavailable";
+ final List<Bundle> metadata = PreferenceXmlParserUtils.extractMetadata(mContext,
+ R.xml.night_display_settings,
+ MetadataFlag.FLAG_NEED_KEY | MetadataFlag.FLAG_UNAVAILABLE_SLICE_SUBTITLE);
+
+ boolean bundleWithKey2Found = false;
+ for (Bundle bundle : metadata) {
+ if (bundle.getString(METADATA_KEY).equals("key2")) {
+ assertThat(bundle.getString(METADATA_UNAVAILABLE_SLICE_SUBTITLE)).isEqualTo(
+ expectedSubtitle);
+ bundleWithKey2Found = true;
+ break;
+ }
+ }
+ assertThat(bundleWithKey2Found).isTrue();
+ }
+
/**
* @param resId the ID for the XML preference
* @return an XML resource parser that points to the start tag
diff --git a/tests/robotests/src/com/android/settings/development/CbrsDataSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/CbrsDataSwitchPreferenceControllerTest.java
deleted file mode 100644
index d955a6e..0000000
--- a/tests/robotests/src/com/android/settings/development/CbrsDataSwitchPreferenceControllerTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.
- * 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.
- */
-
-package com.android.settings.development;
-
-import static org.mockito.Mockito.when;
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-import android.telephony.TelephonyManager;
-
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public final class CbrsDataSwitchPreferenceControllerTest {
-
- @Mock
- private PreferenceScreen mPreferenceScreen;
- private Context mContext;
- private TelephonyManager mTelephonyManager;
- private SwitchPreference mPreference;
- private CbrsDataSwitchPreferenceController mController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mController = new CbrsDataSwitchPreferenceController(mContext);
- mPreference = new SwitchPreference(mContext);
- when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
- .thenReturn(mPreference);
- mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
- mController.displayPreference(mPreferenceScreen);
- }
-
- @Test
- public void onPreferenceChanged_settingEnabled_shouldEnableANAS() {
- mController.onPreferenceChange(mPreference, true);
-
- assertThat(mTelephonyManager.isAlternativeNetworkEnabled()).isTrue();
- }
-
- @Test
- public void onPreferenceChanged_settingDisabled_shouldDisableANAS() {
- mController.onPreferenceChange(mPreference, false);
-
- assertThat(mTelephonyManager.isAlternativeNetworkEnabled()).isFalse();
- }
-
- @Test
- public void updateState_settingEnabled_shouldEnablePreference() {
- mTelephonyManager.setAlternativeNetworkState(true);
- mController.updateState(mPreference);
-
- assertThat(mPreference.isChecked()).isTrue();
- }
-
- @Test
- public void updateState_settingDisabled_shouldDisablePreference() {
- mTelephonyManager.setAlternativeNetworkState(false);
- mController.updateState(mPreference);
-
- assertThat(mPreference.isChecked()).isFalse();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java
index 3dc6ad9..770dd60 100644
--- a/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java
@@ -16,9 +16,6 @@
package com.android.settings.development;
-import static com.android.settings.development.ClearAdbKeysPreferenceController
- .RO_ADB_SECURE_PROPERTY_KEY;
-
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
@@ -30,7 +27,7 @@
import android.content.Context;
import android.debug.IAdbManager;
import android.os.RemoteException;
-import android.os.SystemProperties;
+import android.sysprop.AdbProperties;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceScreen;
@@ -83,21 +80,21 @@
@Test
public void isAvailable_roAdbSecureEnabled_shouldBeTrue() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void isAvailable_roAdbSecureDisabled_shouldBeFalse() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(false));
+ AdbProperties.secure(false);
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void displayPreference_isNotAdminUser_preferenceShouldBeDisabled() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
doReturn(false).when(mController).isAdminUser();
mController.displayPreference(mScreen);
@@ -108,7 +105,7 @@
@Test
@Config(shadows = ShadowClearAdbKeysWarningDialog.class)
public void handlePreferenceTreeClick_clearAdbKeysPreference_shouldShowWarningDialog() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
mController.displayPreference(mScreen);
final String preferenceKey = mController.getPreferenceKey();
@@ -121,7 +118,7 @@
@Test
public void handlePreferenceTreeClick_notClearAdbKeysPreference_shouldReturnFalse() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
mController.displayPreference(mScreen);
when(mPreference.getKey()).thenReturn("Some random key!!!");
@@ -132,7 +129,7 @@
@Test
public void handlePreferenceTreeClick_monkeyUser_shouldReturnFalse() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
ShadowUtils.setIsUserAMonkey(true);
mController.displayPreference(mScreen);
@@ -146,7 +143,7 @@
@Test
public void onDeveloperOptionsSwitchEnabled_isAdminUser_shouldEnablePreference() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
doReturn(true).when(mController).isAdminUser();
mController.displayPreference(mScreen);
mController.onDeveloperOptionsSwitchEnabled();
@@ -156,7 +153,7 @@
@Test
public void onDeveloperOptionsSwitchEnabled_isNotAdminUser_shouldNotEnablePreference() {
- SystemProperties.set(RO_ADB_SECURE_PROPERTY_KEY, Boolean.toString(true));
+ AdbProperties.secure(true);
doReturn(false).when(mController).isAdminUser();
mController.displayPreference(mScreen);
mController.onDeveloperOptionsSwitchEnabled();
diff --git a/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
deleted file mode 100644
index 199cad6..0000000
--- a/tests/robotests/src/com/android/settings/development/GameUpdatePackageDevOptInPreferenceControllerTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 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.
- * 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.
- */
-
-package com.android.settings.development;
-
-import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.Activity;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.provider.Settings;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class GameUpdatePackageDevOptInPreferenceControllerTest {
-
- @Mock
- private PreferenceScreen mPreferenceScreen;
- @Mock
- private DevelopmentSettingsDashboardFragment mFragment;
-
- private Context mContext;
- private Preference mPreference;
- private GameUpdatePackageDevOptInPreferenceController mController;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mController = spy(new GameUpdatePackageDevOptInPreferenceController(mContext, mFragment));
- mPreference = new Preference(mContext);
- mPreference.setKey(mController.getPreferenceKey());
-
- when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
- .thenReturn(mPreference);
- mController.displayPreference(mPreferenceScreen);
- }
-
- @Test
- public void handlePreferenceTreeClick_preferenceClicked_launchActivity() {
- final Intent activityStartIntent = new Intent(mContext, AppPicker.class);
- doReturn(activityStartIntent).when(mController).getActivityStartIntent();
- mController.handlePreferenceTreeClick(mPreference);
-
- verify(mFragment).startActivityForResult(activityStartIntent,
- REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
- }
-
- @Test
- public void updateState_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInAppLabel() {
- final String selectedApp = "foobar";
- final ContentResolver contentResolver = mContext.getContentResolver();
- Settings.Global.putString(contentResolver,
- Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
- mController.updateState(mPreference);
-
- assertThat(mPreference.getSummary()).isEqualTo(
- mContext.getString(R.string.gup_dev_opt_in_app_set, selectedApp));
- }
-
- @Test
- public void updateState_noAppSelected_shouldUpdateSummaryWithNoAppSelected() {
- final String selectedApp = null;
- final ContentResolver contentResolver = mContext.getContentResolver();
- Settings.Global.putString(contentResolver,
- Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
- mController.updateState(mPreference);
-
- assertThat(mPreference.getSummary()).isEqualTo(
- mContext.getString(R.string.gup_dev_opt_in_app_not_set));
- }
-
- @Test
- public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInLabel() {
- Intent activityResultIntent = new Intent(mContext, AppPicker.class);
- final String appLabel = "foobar";
- activityResultIntent.setAction(appLabel);
- final boolean result = mController
- .onActivityResult(REQUEST_CODE_GUP_DEV_OPT_IN_APPS, Activity.RESULT_OK,
- activityResultIntent);
-
- assertThat(result).isTrue();
- assertThat(mPreference.getSummary()).isEqualTo(
- mContext.getString(R.string.gup_dev_opt_in_app_set, appLabel));
- }
-
- @Test
- public void onActivityResult_badRequestCode_shouldReturnFalse() {
- assertThat(mController.onActivityResult(
- -1 /* requestCode */, -1 /* resultCode */, null /* intent */)).isFalse();
- }
-
- @Test
- public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() {
- mController.onDeveloperOptionsSwitchDisabled();
-
- assertThat(mPreference.isEnabled()).isFalse();
- assertThat(mPreference.getSummary()).isEqualTo(
- mContext.getString(R.string.gup_dev_opt_in_app_not_set));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java
index b0de024..73c0d8e 100644
--- a/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java
@@ -74,7 +74,7 @@
final AppOpsManager.PackageOps packageOps =
new AppOpsManager.PackageOps(appName, 0,
Collections.singletonList(createOpEntry(AppOpsManager.MODE_ALLOWED)));
- when(mAppOpsManager.getPackagesForOps(any())).thenReturn(
+ when(mAppOpsManager.getPackagesForOps(any(int[].class))).thenReturn(
Collections.singletonList(packageOps));
mController.updateState(mPreference);
@@ -84,7 +84,8 @@
@Test
public void updateState_noAppSelected_shouldSetSummaryToDefault() {
- when(mAppOpsManager.getPackagesForOps(any())).thenReturn(Collections.emptyList());
+ when(mAppOpsManager.getPackagesForOps(any(int[].class)))
+ .thenReturn(Collections.emptyList());
mController.updateState(mPreference);
@@ -101,7 +102,7 @@
final AppOpsManager.PackageOps packageOps = new AppOpsManager.PackageOps(prevAppName, 0,
Collections.singletonList(createOpEntry(AppOpsManager.MODE_ALLOWED)));
- when(mAppOpsManager.getPackagesForOps(any()))
+ when(mAppOpsManager.getPackagesForOps(any(int[].class)))
.thenReturn(Collections.singletonList(packageOps));
when(mPackageManager.getApplicationInfo(anyString(),
eq(PackageManager.MATCH_DISABLED_COMPONENTS))).thenReturn(mApplicationInfo);
diff --git a/tests/robotests/src/com/android/settings/development/gup/GupPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/gup/GupPreferenceControllerTest.java
new file mode 100644
index 0000000..d5e7a85
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/gup/GupPreferenceControllerTest.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2019 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.
+ */
+
+package com.android.settings.development.gup;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING;
+import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.provider.Settings;
+
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+
+import java.util.Arrays;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class GupPreferenceControllerTest {
+ private static final int DEFAULT = 0;
+ private static final int GUP = 1;
+ private static final int SYSTEM = 2;
+ private static final String TEST_APP_NAME = "testApp";
+ private static final String TEST_PKG_NAME = "testPkg";
+
+ // Pre-installed Apps in the Mock PackageManager
+ private static final String APP_1 = "app1";
+ private static final String APP_2 = "app2";
+ private static final String APP_3 = "app3";
+
+ @Mock
+ private PackageManager mPackageManager;
+ @Mock
+ private PreferenceScreen mScreen;
+
+ private Context mContext;
+ private PreferenceGroup mGroup;
+ private PreferenceManager mPreferenceManager;
+ private ContentResolver mResolver;
+ private GupPreferenceController mController;
+ private CharSequence[] mValueList;
+ private String mDialogTitle;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+ mResolver = mContext.getContentResolver();
+ mValueList = mContext.getResources().getStringArray(R.array.gup_app_preference_values);
+ mDialogTitle = mContext.getResources().getString(R.string.gup_app_preference_title);
+ }
+
+ @Test
+ public void getAvailability_developmentSettingsEnabled_available() {
+ loadDefaultConfig();
+ Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getAvailability_developmentSettingsDisabled_disabledDependentSetting() {
+ loadDefaultConfig();
+ Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_DEPENDENT_SETTING);
+ }
+
+ @Test
+ public void displayPreference_shouldAddTwoPreferencesAndSortAscendingly() {
+ mockPackageManager();
+ loadDefaultConfig();
+
+ // Only non-system app has preference
+ assertThat(mGroup.getPreferenceCount()).isEqualTo(2);
+ assertThat(mGroup.getPreference(0).getKey()).isEqualTo(APP_1);
+ assertThat(mGroup.getPreference(1).getKey()).isEqualTo(APP_3);
+ }
+
+ @Test
+ public void createPreference_configDefault_shouldSetDefaultAttributes() {
+ loadDefaultConfig();
+ final ListPreference preference =
+ mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
+
+ assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
+ assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
+ assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
+ assertThat(preference.getEntries()).isEqualTo(mValueList);
+ assertThat(preference.getEntryValues()).isEqualTo(mValueList);
+ assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
+ assertThat(preference.getValue()).isEqualTo(mValueList[DEFAULT]);
+ assertThat(preference.getSummary()).isEqualTo(mValueList[DEFAULT]);
+ }
+
+ @Test
+ public void createPreference_configGup_shouldSetGupAttributes() {
+ loadConfig(TEST_PKG_NAME, "");
+ final ListPreference preference =
+ mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
+
+ assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
+ assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
+ assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
+ assertThat(preference.getEntries()).isEqualTo(mValueList);
+ assertThat(preference.getEntryValues()).isEqualTo(mValueList);
+ assertThat(preference.getEntry()).isEqualTo(mValueList[GUP]);
+ assertThat(preference.getValue()).isEqualTo(mValueList[GUP]);
+ assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
+ }
+
+ @Test
+ public void createPreference_configSystem_shouldSetSystemAttributes() {
+ loadConfig("", TEST_PKG_NAME);
+ final ListPreference preference =
+ mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
+
+ assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
+ assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
+ assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
+ assertThat(preference.getEntries()).isEqualTo(mValueList);
+ assertThat(preference.getEntryValues()).isEqualTo(mValueList);
+ assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
+ assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
+ assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
+ }
+
+ @Test
+ public void onPreferenceChange_selectDefault_shouldUpdateAttributesAndSettingsGlobal() {
+ loadDefaultConfig();
+ final ListPreference preference =
+ mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
+ mController.onPreferenceChange(preference, mValueList[DEFAULT]);
+
+ assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
+ assertThat(preference.getValue()).isEqualTo(mValueList[DEFAULT]);
+ assertThat(preference.getSummary()).isEqualTo(mValueList[DEFAULT]);
+ assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
+ .isEqualTo("");
+ assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
+ .isEqualTo("");
+ }
+
+ @Test
+ public void onPreferenceChange_selectGup_shouldUpdateAttributesAndSettingsGlobal() {
+ loadDefaultConfig();
+ final ListPreference preference =
+ mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
+ mController.onPreferenceChange(preference, mValueList[GUP]);
+
+ assertThat(preference.getEntry()).isEqualTo(mValueList[GUP]);
+ assertThat(preference.getValue()).isEqualTo(mValueList[GUP]);
+ assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
+ assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
+ .isEqualTo(TEST_PKG_NAME);
+ assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
+ .isEqualTo("");
+ }
+
+ @Test
+ public void onPreferenceChange_selectSystem_shouldUpdateAttributesAndSettingsGlobal() {
+ loadDefaultConfig();
+ final ListPreference preference =
+ mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
+ mController.onPreferenceChange(preference, mValueList[SYSTEM]);
+
+ assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
+ assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
+ assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
+ assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
+ .isEqualTo("");
+ assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
+ .isEqualTo(TEST_PKG_NAME);
+ }
+
+ private void mockPackageManager() {
+ final int uid = mContext.getUserId();
+ final ApplicationInfo app1 = buildInfo(uid, APP_1, 0 /* flags */, 0 /* targetSdkVersion */);
+ final ApplicationInfo app2 =
+ buildInfo(uid, APP_2, ApplicationInfo.FLAG_SYSTEM, 0 /* targetSdkVersion */);
+ final ApplicationInfo app3 = buildInfo(uid, APP_3, 0 /* flags */, 0 /* targetSdkVersion */);
+
+ when(mPackageManager.getInstalledApplications(0 /* flags */))
+ .thenReturn(Arrays.asList(app3, app2, app1));
+ when(mPackageManager.getApplicationLabel(app1)).thenReturn(APP_1);
+ when(mPackageManager.getApplicationLabel(app2)).thenReturn(APP_2);
+ when(mPackageManager.getApplicationLabel(app3)).thenReturn(APP_3);
+ when(mContext.getPackageManager()).thenReturn(mPackageManager);
+ }
+
+ private void loadDefaultConfig() { loadConfig("", ""); }
+
+ private void loadConfig(String optIn, String optOut) {
+ Settings.Global.putString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS, optIn);
+ Settings.Global.putString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS, optOut);
+
+ mController = new GupPreferenceController(mContext, "testKey");
+ mGroup = spy(new PreferenceCategory(mContext));
+ final PreferenceManager preferenceManager = new PreferenceManager(mContext);
+ when(mGroup.getPreferenceManager()).thenReturn(preferenceManager);
+ when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mGroup);
+ mController.displayPreference(mScreen);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerTest.java
index e56baa1..69bc494 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerTest.java
@@ -16,9 +16,14 @@
package com.android.settings.deviceinfo.imei;
+import static android.content.Context.CLIPBOARD_SERVICE;
import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;
import static android.telephony.TelephonyManager.PHONE_TYPE_GSM;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -26,6 +31,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.content.ClipboardManager;
import android.content.Context;
import android.os.UserManager;
import android.telephony.TelephonyManager;
@@ -71,8 +77,9 @@
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);
- mController = spy(new ImeiInfoPreferenceController(mContext, mFragment));
- doReturn(true).when(mController).isAvailable();
+ mController = spy(new ImeiInfoPreferenceController(mContext, "imei_info"));
+ mController.setHost(mFragment);
+ doReturn(AVAILABLE).when(mController).getAvailabilityStatus();
when(mScreen.getContext()).thenReturn(mContext);
doReturn(mSecondSimPreference).when(mController).createNewPreference(mContext);
ReflectionHelpers.setField(mController, "mTelephonyManager", mTelephonyManager);
@@ -156,7 +163,7 @@
@Test
public void handlePreferenceTreeClick_shouldStartDialogFragment() {
when(mFragment.getChildFragmentManager())
- .thenReturn(mock(FragmentManager.class, Answers.RETURNS_DEEP_STUBS));
+ .thenReturn(mock(FragmentManager.class, Answers.RETURNS_DEEP_STUBS));
when(mPreference.getTitle()).thenReturn("SomeTitle");
mController.displayPreference(mScreen);
@@ -164,4 +171,19 @@
verify(mFragment).getChildFragmentManager();
}
+
+ @Test
+ public void copy_shouldCopyImeiToClipboard() {
+ ReflectionHelpers.setField(mController, "mIsMultiSim", false);
+ final String meid = "125132215123";
+ when(mTelephonyManager.getPhoneType()).thenReturn(PHONE_TYPE_CDMA);
+ when(mTelephonyManager.getMeid()).thenReturn(meid);
+
+ mController.copy();
+
+ final ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(
+ CLIPBOARD_SERVICE);
+ final CharSequence data = clipboard.getPrimaryClip().getItemAt(0).getText();
+ assertThat(data.toString()).isEqualTo(meid);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/RestrictAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/RestrictAppPreferenceControllerTest.java
index 3746d64..368a93a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/RestrictAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/RestrictAppPreferenceControllerTest.java
@@ -111,7 +111,7 @@
@Test
public void testUpdateState_oneApp_showCorrectSummary() {
mPackageOpsList.add(mRestrictedPackageOps);
- doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any());
+ doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any(int[].class));
mRestrictAppPreferenceController.updateState(mPreference);
@@ -124,7 +124,7 @@
mPackageOpsList.add(mRestrictedPackageOps);
mPackageOpsList.add(mAllowedPackageOps);
mPackageOpsList.add(mOtherUserPackageOps);
- doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any());
+ doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any(int[].class));
mRestrictAppPreferenceController.updateState(mPreference);
@@ -137,7 +137,7 @@
// Two packageOps share same package name but different uid.
mPackageOpsList.add(mRestrictedPackageOps);
mPackageOpsList.add(mOtherUserPackageOps);
- doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any());
+ doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any(int[].class));
mRestrictAppPreferenceController.updateState(mPreference);
@@ -152,7 +152,7 @@
@Test
public void testUpdateState_zeroRestrictApp_inVisible() {
mPackageOpsList.add(mAllowedPackageOps);
- doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any());
+ doReturn(mPackageOpsList).when(mAppOpsManager).getPackagesForOps(any(int[].class));
mRestrictAppPreferenceController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/BatterySaverConditionControllerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/BatterySaverConditionControllerTest.java
new file mode 100644
index 0000000..e4ca6c0
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/BatterySaverConditionControllerTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ * 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.
+ */
+
+package com.android.settings.homepage.contextualcards.conditional;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import android.content.Context;
+import android.content.IntentFilter;
+import android.os.PowerManager;
+
+import com.android.settings.fuelgauge.BatterySaverReceiver;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.Shadows;
+import org.robolectric.shadows.ShadowPowerManager;
+
+@RunWith(RobolectricTestRunner.class)
+public class BatterySaverConditionControllerTest {
+ @Mock
+ private ConditionManager mConditionManager;
+
+ private ShadowPowerManager mPowerManager;
+ private Context mContext;
+ private BatterySaverConditionController mController;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+ mPowerManager = Shadows.shadowOf(mContext.getSystemService(PowerManager.class));
+ mController = new BatterySaverConditionController(mContext, mConditionManager);
+ }
+
+ @Test
+ public void startMonitor_shouldRegisterReceiver() {
+ mController.startMonitoringStateChange();
+
+ verify(mContext).registerReceiver(any(BatterySaverReceiver.class), any(IntentFilter.class));
+ }
+
+ @Test
+ public void stopMonitor_shouldUnregisterReceiver() {
+ mController.startMonitoringStateChange();
+ mController.stopMonitoringStateChange();
+
+ verify(mContext).unregisterReceiver(any(BatterySaverReceiver.class));
+ }
+
+ @Test
+ public void isDisplayable_PowerSaverOn_true() {
+ mPowerManager.setIsPowerSaveMode(true);
+
+ assertThat(mController.isDisplayable()).isTrue();
+ }
+
+ @Test
+ public void isDisplayable_PowerSaverOff_false() {
+ mPowerManager.setIsPowerSaveMode(false);
+
+ assertThat(mController.isDisplayable()).isFalse();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/BatterySliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/BatteryInfoSliceTest.java
similarity index 84%
rename from tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/BatterySliceTest.java
rename to tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/BatteryInfoSliceTest.java
index 289a57d..ff276d6 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/BatterySliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/BatteryInfoSliceTest.java
@@ -40,10 +40,10 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
-public class BatterySliceTest {
+public class BatteryInfoSliceTest {
private Context mContext;
- private BatterySlice mBatterySlice;
+ private BatteryInfoSlice mBatteryInfoSlice;
@Before
public void setUp() {
@@ -52,16 +52,16 @@
// Set-up specs for SliceMetadata.
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
- mBatterySlice = spy(new BatterySlice(mContext));
+ mBatteryInfoSlice = spy(new BatteryInfoSlice(mContext));
}
@Test
public void getSlice_shouldBeCorrectSliceContent() {
- doNothing().when(mBatterySlice).loadBatteryInfo();
- doReturn("10%").when(mBatterySlice).getBatteryPercentString();
- doReturn("test").when(mBatterySlice).getSummary();
+ doNothing().when(mBatteryInfoSlice).loadBatteryInfo();
+ doReturn("10%").when(mBatteryInfoSlice).getBatteryPercentString();
+ doReturn("test").when(mBatteryInfoSlice).getSummary();
- final Slice slice = mBatterySlice.getSlice();
+ final Slice slice = mBatteryInfoSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSliceTest.java
index ff08c6a..1c299cb 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BatteryFixSliceTest.java
@@ -26,6 +26,8 @@
import android.content.Context;
import android.content.SharedPreferences;
+import androidx.slice.Slice;
+import androidx.slice.SliceMetadata;
import androidx.slice.SliceProvider;
import androidx.slice.widget.SliceLiveData;
@@ -55,11 +57,13 @@
public class BatteryFixSliceTest {
private Context mContext;
+ private BatteryFixSlice mSlice;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
+ mSlice = new BatteryFixSlice(mContext);
// Set-up specs for SliceMetadata.
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
@@ -71,7 +75,7 @@
}
@Test
- public void readBatteryTipfromPref_readCorrectValue() {
+ public void readBatteryTipFromPref_readCorrectValue() {
int target = 111;
final SharedPreferences.Editor editor = mContext.getSharedPreferences(PREFS,
MODE_PRIVATE).edit();
@@ -90,7 +94,7 @@
public void updateBatteryTipAvailabilityCache_writeCorrectValue() {
final List<BatteryTip> tips = new ArrayList<>();
tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false, ""));
- tips.add(new EarlyWarningTip(BatteryTip.StateType.HANDLED, false));
+ tips.add(new EarlyWarningTip(BatteryTip.StateType.NEW, false));
ShadowBatteryTipLoader.setBatteryTips(tips);
BatteryFixSlice.updateBatteryTipAvailabilityCache(mContext);
@@ -99,6 +103,23 @@
BatteryTip.TipType.BATTERY_SAVER);
}
+ @Test
+ @Config(shadows = {
+ ShadowBatteryStatsHelperLoader.class,
+ ShadowBatteryTipLoader.class
+ })
+ public void getSlice_unimportantSlice_shouldSkip() {
+ final List<BatteryTip> tips = new ArrayList<>();
+ tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false, ""));
+ tips.add(new EarlyWarningTip(BatteryTip.StateType.NEW, false));
+ ShadowBatteryTipLoader.setBatteryTips(tips);
+
+ BatteryFixSlice.updateBatteryTipAvailabilityCache(mContext);
+ final Slice slice = mSlice.getSlice();
+
+ assertThat(SliceMetadata.from(mContext, slice).isErrorSlice()).isTrue();
+ }
+
@Implements(BatteryStatsHelperLoader.class)
public static class ShadowBatteryStatsHelperLoader {
diff --git a/tests/robotests/src/com/android/settings/notification/ChannelSummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/notification/ChannelSummaryPreferenceTest.java
new file mode 100644
index 0000000..408b2b6
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/ChannelSummaryPreferenceTest.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.settings.notification;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.LinearLayout;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceViewHolder;
+
+@RunWith(RobolectricTestRunner.class)
+public class ChannelSummaryPreferenceTest {
+
+ private Context mContext;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ }
+
+ @Test
+ public void createNewPreference_shouldSetLayout() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ assertThat(preference.getLayoutResource()).isEqualTo(
+ R.layout.preference_checkable_two_target);
+ assertThat(preference.getWidgetLayoutResource()).isEqualTo(
+ R.layout.zen_rule_widget);
+ }
+
+ @Test
+ public void setChecked_shouldUpdateButtonCheckedState() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ final LayoutInflater inflater = LayoutInflater.from(mContext);
+ final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+ inflater.inflate(R.layout.preference_checkable_two_target, null));
+ final LinearLayout widgetView = holder.itemView.findViewById(R.id.checkbox_container);
+ inflater.inflate(R.layout.preference_widget_checkbox, widgetView, true);
+ final CheckBox toggle = (CheckBox) holder.findViewById(com.android.internal.R.id.checkbox);
+ preference.onBindViewHolder(holder);
+
+ preference.setChecked(true);
+ assertThat(toggle.isChecked()).isTrue();
+
+ preference.setChecked(false);
+ assertThat(toggle.isChecked()).isFalse();
+ }
+
+ @Test
+ public void setCheckboxEnabled_shouldUpdateButtonEnabledState() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ final LayoutInflater inflater = LayoutInflater.from(mContext);
+ final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+ inflater.inflate(R.layout.preference_checkable_two_target, null));
+ final LinearLayout widgetView = holder.itemView.findViewById(R.id.checkbox_container);
+ inflater.inflate(R.layout.preference_widget_checkbox, widgetView, true);
+ final CheckBox toggle = (CheckBox) holder.findViewById(com.android.internal.R.id.checkbox);
+ preference.onBindViewHolder(holder);
+
+ preference.setCheckBoxEnabled(true);
+ assertThat(toggle.isEnabled()).isTrue();
+
+ preference.setCheckBoxEnabled(false);
+ assertThat(toggle.isEnabled()).isFalse();
+ }
+
+ @Test
+ public void setCheckBoxEnabled_shouldUpdateButtonEnabledState_beforeViewBound() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ final LayoutInflater inflater = LayoutInflater.from(mContext);
+ final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+ inflater.inflate(R.layout.preference_checkable_two_target, null));
+ final LinearLayout widgetView = holder.itemView.findViewById(R.id.checkbox_container);
+ inflater.inflate(R.layout.preference_widget_checkbox, widgetView, true);
+ final CheckBox toggle = (CheckBox) holder.findViewById(com.android.internal.R.id.checkbox);
+
+ preference.setCheckBoxEnabled(false);
+ preference.onBindViewHolder(holder);
+ assertThat(toggle.isEnabled()).isFalse();
+ }
+
+ @Test
+ public void clickWidgetView_shouldToggleButton() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ final LayoutInflater inflater = LayoutInflater.from(mContext);
+ final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+ inflater.inflate(R.layout.preference_checkable_two_target, null));
+ final LinearLayout widgetView = holder.itemView.findViewById(R.id.checkbox_container);
+ assertThat(widgetView).isNotNull();
+
+ inflater.inflate(R.layout.preference_widget_checkbox, widgetView, true);
+ final CheckBox toggle = (CheckBox) holder.findViewById(com.android.internal.R.id.checkbox);
+ preference.onBindViewHolder(holder);
+
+ widgetView.performClick();
+ assertThat(toggle.isChecked()).isTrue();
+
+ widgetView.performClick();
+ assertThat(toggle.isChecked()).isFalse();
+ }
+
+ @Test
+ public void clickWidgetView_shouldNotToggleButtonIfDisabled() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ final LayoutInflater inflater = LayoutInflater.from(mContext);
+ final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+ inflater.inflate(R.layout.preference_checkable_two_target, null));
+ final LinearLayout widgetView = holder.itemView.findViewById(R.id.checkbox_container);
+ assertThat(widgetView).isNotNull();
+
+ inflater.inflate(R.layout.preference_widget_checkbox, widgetView, true);
+ final CheckBox toggle = (CheckBox) holder.findViewById(com.android.internal.R.id.checkbox);
+ preference.onBindViewHolder(holder);
+ toggle.setEnabled(false);
+
+ widgetView.performClick();
+ assertThat(toggle.isChecked()).isFalse();
+ }
+
+ @Test
+ public void clickWidgetView_shouldNotifyPreferenceChanged() {
+ final ChannelSummaryPreference preference = new ChannelSummaryPreference(mContext);
+ final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+ LayoutInflater.from(mContext).inflate(
+ R.layout.preference_checkable_two_target, null));
+ final View widgetView = holder.findViewById(R.id.checkbox_container);
+ final Preference.OnPreferenceChangeListener
+ listener = mock(Preference.OnPreferenceChangeListener.class);
+ preference.setOnPreferenceChangeListener(listener);
+ preference.onBindViewHolder(holder);
+
+ preference.setChecked(false);
+ widgetView.performClick();
+ verify(listener).onPreferenceChange(preference, true);
+
+ preference.setChecked(true);
+ widgetView.performClick();
+ verify(listener).onPreferenceChange(preference, false);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
index a6a6355..6b1029c 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
@@ -107,7 +107,7 @@
ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
- View iconView = fragment.getView().findViewById(R.id.suw_layout_icon);
+ View iconView = fragment.getView().findViewById(R.id.suc_layout_icon);
assertThat(iconView.getVisibility()).isEqualTo(View.GONE);
}
diff --git a/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java b/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
index 0a08319..bee66cc 100644
--- a/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetupChooseLockPasswordTest.java
@@ -29,10 +29,13 @@
import com.android.settings.R;
import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
+import com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment.Stage;
import com.android.settings.password.ChooseLockPassword.IntentBuilder;
import com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import com.android.settings.testutils.shadow.ShadowUtils;
+import com.android.settings.widget.ScrollToParentEditText;
import org.junit.After;
import org.junit.Before;
@@ -51,7 +54,7 @@
import java.util.List;
@RunWith(RobolectricTestRunner.class)
-@Config(shadows = {SettingsShadowResources.class, ShadowUtils.class})
+@Config(shadows = {SettingsShadowResources.class, ShadowUtils.class, ShadowAlertDialogCompat.class})
public class SetupChooseLockPasswordTest {
@Before
@@ -130,6 +133,42 @@
.isEqualTo("bar");
}
+ @Test
+ public void createActivity_skipButtonInIntroductionStage_shouldBeVisible() {
+ SetupChooseLockPassword activity = createSetupChooseLockPassword();
+
+ Button skipButton = activity.findViewById(R.id.skip_button);
+ assertThat(skipButton).isNotNull();
+ assertThat(skipButton.getVisibility()).isEqualTo(View.VISIBLE);
+
+ skipButton.performClick();
+ AlertDialog chooserDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+ assertThat(chooserDialog).isNotNull();
+ }
+
+ @Test
+ public void createActivity_inputPasswordInConfirmStage_clearButtonShouldBeVisible() {
+ SetupChooseLockPassword activity = createSetupChooseLockPassword();
+
+ SetupChooseLockPasswordFragment fragment =
+ (SetupChooseLockPasswordFragment) activity.getSupportFragmentManager()
+ .findFragmentById(R.id.main_content);
+
+ ScrollToParentEditText passwordEntry = activity.findViewById(R.id.password_entry);
+ passwordEntry.setText("");
+ fragment.updateStage(Stage.NeedToConfirm);
+
+ Button skipButton = activity.findViewById(R.id.skip_button);
+ Button clearButton = activity.findViewById(R.id.clear_button);
+ assertThat(skipButton.getVisibility()).isEqualTo(View.GONE);
+ assertThat(clearButton.getVisibility()).isEqualTo(View.GONE);
+
+ passwordEntry.setText("1234");
+ fragment.updateUi();
+ assertThat(skipButton.getVisibility()).isEqualTo(View.GONE);
+ assertThat(clearButton.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
private SetupChooseLockPassword createSetupChooseLockPassword() {
final Intent intent =
SetupChooseLockPassword.modifyIntentForSetup(
diff --git a/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
index 649a1ba..6b6c60e 100644
--- a/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
@@ -164,6 +164,20 @@
assertThat(findFragment(mActivity).mChosenPattern).isNull();
}
+ @Test
+ public void createActivity_enterPattern_clearButtonShouldBeVisible() {
+ ChooseLockPatternFragment fragment = findFragment(mActivity);
+
+ Button skipButton = mActivity.findViewById(R.id.skip_button);
+ Button clearButton = mActivity.findViewById(R.id.footerLeftButton);
+ assertThat(skipButton.getVisibility()).isEqualTo(View.VISIBLE);
+ assertThat(clearButton.getVisibility()).isEqualTo(View.GONE);
+
+ enterPattern();
+ assertThat(skipButton.getVisibility()).isEqualTo(View.GONE);
+ assertThat(clearButton.getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
private ChooseLockPatternFragment findFragment(FragmentActivity activity) {
return (ChooseLockPatternFragment)
activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
diff --git a/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java b/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
index 2d893a6..c2d1e93 100644
--- a/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
@@ -449,7 +449,7 @@
R.drawable.ic_settings).toIcon().getResId();
final SliceData data = getDummyData(FakeUnavailablePreferenceController.class,
SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE, 0 /* icon */,
- IS_DYNAMIC_SUMMARY_ALLOWED);
+ IS_DYNAMIC_SUMMARY_ALLOWED, null /* unavailableSliceSubtitle */);
Settings.Global.putInt(mContext.getContentResolver(),
FakeUnavailablePreferenceController.AVAILABILITY_KEY,
BasePreferenceController.DISABLED_DEPENDENT_SETTING);
@@ -518,33 +518,65 @@
assertThat(actualIconResource).isEqualTo(settingsIcon);
}
+ @Test
+ public void buildUnavailableSlice_customizeSubtitle_returnsSliceWithCustomizedSubtitle() {
+ final String subtitleOfUnavailableSlice = "subtitleOfUnavailableSlice";
+ final SliceData data = getDummyData(FakeUnavailablePreferenceController.class,
+ SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE, 0 /* icon */,
+ IS_DYNAMIC_SUMMARY_ALLOWED, subtitleOfUnavailableSlice);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ FakeUnavailablePreferenceController.AVAILABILITY_KEY,
+ BasePreferenceController.DISABLED_DEPENDENT_SETTING);
+
+ final Slice slice = SliceBuilderUtils.buildSlice(mContext, data);
+
+ final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+ assertThat(metadata.getSubtitle()).isEqualTo(subtitleOfUnavailableSlice);
+ }
+
+ @Test
+ public void buildUnavailableSlice_notCustomizeSubtitle_returnsSliceWithDefaultSubtitle() {
+ final SliceData data = getDummyData(FakeUnavailablePreferenceController.class,
+ SliceData.SliceType.SWITCH);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ FakeUnavailablePreferenceController.AVAILABILITY_KEY,
+ BasePreferenceController.DISABLED_DEPENDENT_SETTING);
+
+ final Slice slice = SliceBuilderUtils.buildSlice(mContext, data);
+
+ final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
+ assertThat(metadata.getSubtitle()).isEqualTo(
+ mContext.getString(R.string.disabled_dependent_setting_summary));
+ }
+
private SliceData getDummyData() {
return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE,
- ICON, IS_DYNAMIC_SUMMARY_ALLOWED);
+ ICON, IS_DYNAMIC_SUMMARY_ALLOWED, null /* unavailableSliceSubtitle */);
}
private SliceData getDummyData(boolean isDynamicSummaryAllowed) {
return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE,
- ICON, isDynamicSummaryAllowed);
+ ICON, isDynamicSummaryAllowed, null /* unavailableSliceSubtitle */);
}
private SliceData getDummyData(Class prefController, int sliceType, int icon) {
- return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH, SCREEN_TITLE,
- icon, IS_DYNAMIC_SUMMARY_ALLOWED);
+ return getDummyData(prefController, SUMMARY, sliceType, SCREEN_TITLE,
+ icon, IS_DYNAMIC_SUMMARY_ALLOWED, null /* unavailableSliceSubtitle */);
}
private SliceData getDummyData(String summary, String screenTitle) {
return getDummyData(TOGGLE_CONTROLLER, summary, SliceData.SliceType.SWITCH, screenTitle,
- ICON, IS_DYNAMIC_SUMMARY_ALLOWED);
+ ICON, IS_DYNAMIC_SUMMARY_ALLOWED, null /* unavailableSliceSubtitle */);
}
private SliceData getDummyData(Class prefController, int sliceType) {
return getDummyData(prefController, SUMMARY, sliceType, SCREEN_TITLE, ICON,
- IS_DYNAMIC_SUMMARY_ALLOWED);
+ IS_DYNAMIC_SUMMARY_ALLOWED, null /* unavailableSliceSubtitle */);
}
private SliceData getDummyData(Class prefController, String summary, int sliceType,
- String screenTitle, int icon, boolean isDynamicSummaryAllowed) {
+ String screenTitle, int icon, boolean isDynamicSummaryAllowed,
+ String unavailableSliceSubtitle) {
return new SliceData.Builder()
.setKey(KEY)
.setTitle(TITLE)
@@ -557,6 +589,7 @@
.setPreferenceControllerClassName(prefController.getName())
.setSliceType(sliceType)
.setDynamicSummaryAllowed(isDynamicSummaryAllowed)
+ .setUnavailableSliceSubtitle(unavailableSliceSubtitle)
.build();
}
}
diff --git a/tests/robotests/src/com/android/settings/slices/SliceDataConverterTest.java b/tests/robotests/src/com/android/settings/slices/SliceDataConverterTest.java
index b935e76..7c1319c 100644
--- a/tests/robotests/src/com/android/settings/slices/SliceDataConverterTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SliceDataConverterTest.java
@@ -125,6 +125,8 @@
assertThat(fakeSlice.getSliceType()).isEqualTo(SliceData.SliceType.SLIDER);
assertThat(fakeSlice.isPlatformDefined()).isTrue(); // from XML
assertThat(fakeSlice.isDynamicSummaryAllowed()).isTrue(); // from XML
+ assertThat(fakeSlice.getUnavailableSliceSubtitle()).isEqualTo(
+ "subtitleOfUnavailableSlice"); // from XML
}
private void assertFakeA11ySlice(SliceData fakeSlice) {
diff --git a/tests/robotests/src/com/android/settings/slices/SliceDataTest.java b/tests/robotests/src/com/android/settings/slices/SliceDataTest.java
index 579af1f..b6c7af5 100644
--- a/tests/robotests/src/com/android/settings/slices/SliceDataTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SliceDataTest.java
@@ -39,6 +39,7 @@
private final int SLICE_TYPE = SliceData.SliceType.SWITCH;
private final boolean IS_PLATFORM_DEFINED = true;
private final boolean IS_DYNAMIC_SUMMARY_ALLOWED = true;
+ private final String UNAVAILABLE_SLICE_SUBTITLE = "subtitleOfUnavailableSlice";
@Test
public void testBuilder_buildsMatchingObject() {
@@ -54,7 +55,8 @@
.setPreferenceControllerClassName(PREF_CONTROLLER)
.setSliceType(SLICE_TYPE)
.setPlatformDefined(IS_PLATFORM_DEFINED)
- .setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED);
+ .setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED)
+ .setUnavailableSliceSubtitle(UNAVAILABLE_SLICE_SUBTITLE);
SliceData data = builder.build();
@@ -70,6 +72,7 @@
assertThat(data.getSliceType()).isEqualTo(SLICE_TYPE);
assertThat(data.isPlatformDefined()).isEqualTo(IS_PLATFORM_DEFINED);
assertThat(data.isDynamicSummaryAllowed()).isEqualTo(IS_DYNAMIC_SUMMARY_ALLOWED);
+ assertThat(data.getUnavailableSliceSubtitle()).isEqualTo(UNAVAILABLE_SLICE_SUBTITLE);
}
@Test(expected = SliceData.InvalidSliceDataException.class)
diff --git a/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java b/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java
index f4b68a5..a657ede 100644
--- a/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SlicesDatabaseAccessorTest.java
@@ -109,12 +109,14 @@
assertThat(data.getUri()).isNull();
assertThat(data.getPreferenceController()).isEqualTo(FAKE_CONTROLLER_NAME);
assertThat(data.isDynamicSummaryAllowed()).isFalse(); /* default value */
+ assertThat(data.getUnavailableSliceSubtitle()).isNull();
}
@Test
public void testGetSliceDataFromKey_allowDynamicSummary_validSliceReturned() {
String key = "key";
- insertSpecialCase(key, true /* isPlatformSlice */, true /* isDynamicSummaryAllowed */);
+ insertSpecialCase(key, true /* isPlatformSlice */, true /* isDynamicSummaryAllowed */,
+ null /* customizedUnavailableSliceSubtitle */);
SliceData data = mAccessor.getSliceDataFromKey(key);
@@ -133,7 +135,8 @@
@Test
public void testGetSliceDataFromKey_doNotAllowDynamicSummary_validSliceReturned() {
String key = "key";
- insertSpecialCase(key, true /* isPlatformSlice */, false /* isDynamicSummaryAllowed */);
+ insertSpecialCase(key, true /* isPlatformSlice */, false /* isDynamicSummaryAllowed */,
+ null /* customizedUnavailableSliceSubtitle */);
SliceData data = mAccessor.getSliceDataFromKey(key);
@@ -243,16 +246,58 @@
assertThat(keys).isNotEmpty();
}
+ @Test
+ public void testGetSliceDataFromKey_defaultUnavailableSlice_validSliceReturned() {
+ String key = "key";
+ insertSpecialCase(key, true /* isPlatformSlice */, true /* isDynamicSummaryAllowed */,
+ null /* customizedUnavailableSliceSubtitle */);
+
+ SliceData data = mAccessor.getSliceDataFromKey(key);
+
+ assertThat(data.getKey()).isEqualTo(key);
+ assertThat(data.getTitle()).isEqualTo(FAKE_TITLE);
+ assertThat(data.getSummary()).isEqualTo(FAKE_SUMMARY);
+ assertThat(data.getScreenTitle()).isEqualTo(FAKE_SCREEN_TITLE);
+ assertThat(data.getKeywords()).isEqualTo(FAKE_KEYWORDS);
+ assertThat(data.getIconResource()).isEqualTo(FAKE_ICON);
+ assertThat(data.getFragmentClassName()).isEqualTo(FAKE_FRAGMENT_NAME);
+ assertThat(data.getUri()).isNull();
+ assertThat(data.getPreferenceController()).isEqualTo(FAKE_CONTROLLER_NAME);
+ assertThat(data.getUnavailableSliceSubtitle()).isNull();
+ }
+
+ @Test
+ public void testGetSliceDataFromKey_customizeSubtitleOfUnavailableSlice_validSliceReturned() {
+ String key = "key";
+ String subtitle = "subtitle";
+ insertSpecialCase(key, true /* isPlatformSlice */, true /* isDynamicSummaryAllowed */,
+ subtitle);
+
+ SliceData data = mAccessor.getSliceDataFromKey(key);
+
+ assertThat(data.getKey()).isEqualTo(key);
+ assertThat(data.getTitle()).isEqualTo(FAKE_TITLE);
+ assertThat(data.getSummary()).isEqualTo(FAKE_SUMMARY);
+ assertThat(data.getScreenTitle()).isEqualTo(FAKE_SCREEN_TITLE);
+ assertThat(data.getKeywords()).isEqualTo(FAKE_KEYWORDS);
+ assertThat(data.getIconResource()).isEqualTo(FAKE_ICON);
+ assertThat(data.getFragmentClassName()).isEqualTo(FAKE_FRAGMENT_NAME);
+ assertThat(data.getUri()).isNull();
+ assertThat(data.getPreferenceController()).isEqualTo(FAKE_CONTROLLER_NAME);
+ assertThat(data.getUnavailableSliceSubtitle()).isEqualTo(subtitle);
+ }
+
private void insertSpecialCase(String key) {
insertSpecialCase(key, true);
}
private void insertSpecialCase(String key, boolean isPlatformSlice) {
- insertSpecialCase(key, isPlatformSlice, false /* isDynamicSummaryAllowed */);
+ insertSpecialCase(key, isPlatformSlice, false /* isDynamicSummaryAllowed */,
+ null /*customizedUnavailableSliceSubtitle*/);
}
private void insertSpecialCase(String key, boolean isPlatformSlice,
- boolean isDynamicSummaryAllowed) {
+ boolean isDynamicSummaryAllowed, String customizedUnavailableSliceSubtitle) {
ContentValues values = new ContentValues();
values.put(SlicesDatabaseHelper.IndexColumns.KEY, key);
values.put(SlicesDatabaseHelper.IndexColumns.TITLE, FAKE_TITLE);
@@ -266,6 +311,8 @@
values.put(SlicesDatabaseHelper.IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE,
isDynamicSummaryAllowed);
values.put(SlicesDatabaseHelper.IndexColumns.SLICE_TYPE, SliceData.SliceType.INTENT);
+ values.put(SlicesDatabaseHelper.IndexColumns.UNAVAILABLE_SLICE_SUBTITLE,
+ customizedUnavailableSliceSubtitle);
mDb.replaceOrThrow(SlicesDatabaseHelper.Tables.TABLE_SLICES_INDEX, null, values);
}
diff --git a/tests/robotests/src/com/android/settings/slices/SlicesDatabaseHelperTest.java b/tests/robotests/src/com/android/settings/slices/SlicesDatabaseHelperTest.java
index 2bc3443..0e92c05 100644
--- a/tests/robotests/src/com/android/settings/slices/SlicesDatabaseHelperTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SlicesDatabaseHelperTest.java
@@ -74,6 +74,7 @@
IndexColumns.PLATFORM_SLICE,
IndexColumns.SLICE_TYPE,
IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE,
+ IndexColumns.UNAVAILABLE_SLICE_SUBTITLE,
};
assertThat(columnNames).isEqualTo(expectedNames);
diff --git a/tests/robotests/src/com/android/settings/slices/SlicesIndexerTest.java b/tests/robotests/src/com/android/settings/slices/SlicesIndexerTest.java
index 827c3f6..b63dfd9 100644
--- a/tests/robotests/src/com/android/settings/slices/SlicesIndexerTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SlicesIndexerTest.java
@@ -55,6 +55,7 @@
private final boolean PLATFORM_DEFINED = true;
private final boolean IS_DYNAMIC_SUMMARY_ALLOWED = true;
private final int SLICE_TYPE = SliceData.SliceType.SLIDER;
+ private final String UNAVAILABLE_SLICE_SUBTITLE = "subtitleOfUnavailableSlice";
private Context mContext;
@@ -145,6 +146,9 @@
cursor.getColumnIndex(
IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE)))
.isEqualTo(1 /* true */);
+ assertThat(cursor.getString(
+ cursor.getColumnIndex(IndexColumns.UNAVAILABLE_SLICE_SUBTITLE)))
+ .isEqualTo(UNAVAILABLE_SLICE_SUBTITLE);
cursor.moveToNext();
}
} finally {
@@ -179,7 +183,8 @@
.setPreferenceControllerClassName(PREF_CONTROLLER)
.setPlatformDefined(PLATFORM_DEFINED)
.setSliceType(SLICE_TYPE)
- .setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED);
+ .setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED)
+ .setUnavailableSliceSubtitle(UNAVAILABLE_SLICE_SUBTITLE);
for (int i = 0; i < KEYS.length; i++) {
builder.setKey(KEYS[i]).setTitle(TITLES[i]);
diff --git a/tests/robotests/src/com/android/settings/widget/UpdatableListPreferenceDialogFragmentTest.java b/tests/robotests/src/com/android/settings/widget/UpdatableListPreferenceDialogFragmentTest.java
index 029de61..a2e9de7 100644
--- a/tests/robotests/src/com/android/settings/widget/UpdatableListPreferenceDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/widget/UpdatableListPreferenceDialogFragmentTest.java
@@ -18,7 +18,9 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
import android.content.Context;
import android.widget.ArrayAdapter;
@@ -31,6 +33,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@@ -42,9 +45,10 @@
@Config(shadows = ShadowBluetoothUtils.class)
public class UpdatableListPreferenceDialogFragmentTest {
- private Context mContext;
- private UpdatableListPreferenceDialogFragment mUpdatableListPrefDlgFragment;
private static final String KEY = "Test_Key";
+ @Mock
+ private UpdatableListPreferenceDialogFragment mUpdatableListPrefDlgFragment;
+ private Context mContext;
private ArrayAdapter mAdapter;
private ArrayList<CharSequence> mEntries;
@@ -53,8 +57,8 @@
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
- mUpdatableListPrefDlgFragment = UpdatableListPreferenceDialogFragment
- .newInstance(KEY, MetricsProto.MetricsEvent.DIALOG_SWITCH_A2DP_DEVICES);
+ mUpdatableListPrefDlgFragment = spy(UpdatableListPreferenceDialogFragment
+ .newInstance(KEY, MetricsProto.MetricsEvent.DIALOG_SWITCH_A2DP_DEVICES));
mEntries = spy(new ArrayList<>());
mUpdatableListPrefDlgFragment.setEntries(mEntries);
mUpdatableListPrefDlgFragment.
@@ -87,4 +91,11 @@
assertThat(mUpdatableListPrefDlgFragment.getAdapter().getCount()).isEqualTo(2);
}
+
+ @Test
+ public void onDialogClosed_emptyPreference() {
+ mUpdatableListPrefDlgFragment.onDialogClosed(false);
+
+ verify(mUpdatableListPrefDlgFragment, never()).getListPreference();
+ }
}
\ No newline at end of file
diff --git a/tests/uitests/src/com/android/settings/ui/StorageWizardTest.java b/tests/uitests/src/com/android/settings/ui/StorageWizardTest.java
index d47cd0d..eefd1eb 100644
--- a/tests/uitests/src/com/android/settings/ui/StorageWizardTest.java
+++ b/tests/uitests/src/com/android/settings/ui/StorageWizardTest.java
@@ -86,7 +86,7 @@
InstrumentationRegistry.getContext().startActivity(buildInitIntent());
// Activity: pick option to use as internal
- waitFor(By.res(PACKAGE, "suw_layout_title").text(containsIgnoringCase("How will you use")));
+ waitFor(By.res(PACKAGE, "suc_layout_title").text(containsIgnoringCase("How will you use")));
waitFor(By.res(PACKAGE, "storage_wizard_init_internal")).click();
// Dialog: acknowledge that we're formatting the card
@@ -94,15 +94,15 @@
waitFor(By.clickable(true).text(containsIgnoringCase("Format"))).click();
// Activity: ack storage device is slow
- waitForLong(By.res(PACKAGE, "suw_layout_title").textContains("Slow"));
+ waitForLong(By.res(PACKAGE, "suc_layout_title").textContains("Slow"));
waitFor(By.res(PACKAGE, "storage_next_button")).click();
// Activity: choose to move content
- waitForLong(By.res(PACKAGE, "suw_layout_title").textContains("Move content"));
+ waitForLong(By.res(PACKAGE, "suc_layout_title").textContains("Move content"));
waitFor(By.res(PACKAGE, "storage_next_button")).click();
// Activity: yay, we're done!
- waitForLong(By.res(PACKAGE, "suw_layout_title").textContains("ready to use"));
+ waitForLong(By.res(PACKAGE, "suc_layout_title").textContains("ready to use"));
waitFor(By.res(PACKAGE, "storage_next_button")).click();
}
@@ -114,11 +114,11 @@
InstrumentationRegistry.getContext().startActivity(buildInitIntent());
// Activity: pick option to use as external
- waitFor(By.res(PACKAGE, "suw_layout_title").textContains("How will you use"));
+ waitFor(By.res(PACKAGE, "suc_layout_title").textContains("How will you use"));
waitFor(By.res(PACKAGE, "storage_wizard_init_external")).click();
// Activity: yay, we're done!
- waitFor(By.res(PACKAGE, "suw_layout_title").textContains("ready to use"));
+ waitFor(By.res(PACKAGE, "suc_layout_title").textContains("ready to use"));
waitFor(By.res(PACKAGE, "storage_next_button")).click();
}
diff --git a/tests/unit/src/com/android/settings/dashboard/UiBlockerControllerTest.java b/tests/unit/src/com/android/settings/dashboard/UiBlockerControllerTest.java
new file mode 100644
index 0000000..c3a7a4e
--- /dev/null
+++ b/tests/unit/src/com/android/settings/dashboard/UiBlockerControllerTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ * 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.
+ */
+
+package com.android.settings.dashboard;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Instrumentation;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@RunWith(AndroidJUnit4.class)
+@MediumTest
+public class UiBlockerControllerTest {
+ private static final long TIMEOUT = 600;
+ private static final String KEY_1 = "key1";
+ private static final String KEY_2 = "key2";
+
+ private Instrumentation mInstrumentation;
+ private UiBlockerController mSyncableController;
+
+ @Before
+ public void setUp() throws Exception {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+
+ mSyncableController = new UiBlockerController(Arrays.asList(KEY_1, KEY_2));
+ }
+
+ @Test
+ public void start_isSyncedReturnFalseUntilAllWorkDone() throws InterruptedException {
+ final CountDownLatch latch = new CountDownLatch(1);
+ mSyncableController.start(() -> latch.countDown());
+
+ // Return false at first
+ assertThat(mSyncableController.isBlockerFinished()).isFalse();
+
+ // Return false if only one job is done
+ mSyncableController.countDown(KEY_1);
+ assertThat(mSyncableController.isBlockerFinished()).isFalse();
+
+ // Return true if all jobs done
+ mSyncableController.countDown(KEY_2);
+ assertThat(latch.await(TIMEOUT, TimeUnit.MILLISECONDS)).isTrue();
+ assertThat(mSyncableController.isBlockerFinished()).isTrue();
+ }
+}
diff --git a/tests/unit/src/com/android/settings/vpn2/AppSettingsTest.java b/tests/unit/src/com/android/settings/vpn2/AppSettingsTest.java
index 1a9701d..014d8ea 100644
--- a/tests/unit/src/com/android/settings/vpn2/AppSettingsTest.java
+++ b/tests/unit/src/com/android/settings/vpn2/AppSettingsTest.java
@@ -57,23 +57,24 @@
};
// List with one package op
- when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName), any()))
- .thenReturn(Arrays.asList(new AppOpsManager.PackageOps[] {blankOps[0]}));
+ when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName),
+ any(int[].class))).thenReturn(Arrays.asList(
+ new AppOpsManager.PackageOps[] {blankOps[0]}));
assertTrue(appHasVpnPermission(mContext, mockApp));
// List with more than one package op
- when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName), any()))
- .thenReturn(Arrays.asList(blankOps));
+ when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName),
+ any(int[].class))).thenReturn(Arrays.asList(blankOps));
assertTrue(appHasVpnPermission(mContext, mockApp));
// Empty list
- when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName), any()))
- .thenReturn(Collections.emptyList());
+ when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName),
+ any(int[].class))).thenReturn(Collections.emptyList());
assertFalse(appHasVpnPermission(mContext, mockApp));
// Null list (may be returned in place of an empty list)
- when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName), any()))
- .thenReturn(null);
+ when(mAppOps.getOpsForPackage(eq(mockApp.uid), eq(mockApp.packageName),
+ any(int[].class))).thenReturn(null);
assertFalse(appHasVpnPermission(mContext, mockApp));
}
diff --git a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
index 8e64f5f..215b7e2 100644
--- a/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
+++ b/tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java
@@ -19,6 +19,7 @@
import static com.google.common.truth.Truth.assertThat;
import android.content.Intent;
+import android.content.pm.ActivityInfo;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
@@ -29,6 +30,10 @@
@RunWith(AndroidJUnit4.class)
public class WifiDppConfiguratorActivityTest {
+ // Valid Wi-Fi DPP QR code & it's parameters
+ private static final String VALID_WIFI_DPP_QR_CODE = "DPP:I:SN=4774LH2b4044;M:010203040506;K:"
+ + "MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;";
+
@Rule
public final ActivityTestRule<WifiDppConfiguratorActivity> mActivityRule =
new ActivityTestRule<>(WifiDppConfiguratorActivity.class);
@@ -62,9 +67,7 @@
public void launchActivity_chooseSavedWifiNetwork_shouldNotAutoFinish() {
Intent intent = new Intent(
WifiDppConfiguratorActivity.ACTION_PROCESS_WIFI_DPP_QR_CODE);
- String qrCode = "DPP:I:SN=4774LH2b4044;M:010203040506;K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD"
- + "IgADURzxmttZoIRIPWGoQMV00XHWCAQIhXruVWOz0NjlkIA=;;";
- intent.putExtra(WifiDppUtils.EXTRA_QR_CODE, qrCode);
+ intent.putExtra(WifiDppUtils.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE);
mActivityRule.launchActivity(intent);
@@ -101,4 +104,59 @@
assertThat(activity instanceof WifiDppQrCodeScannerFragment
.OnScanZxingWifiFormatSuccessListener).isEqualTo(true);
}
+
+ @Test
+ public void testActivity_shouldImplementsOnClickChooseDifferentNetworkCallback() {
+ WifiDppConfiguratorActivity activity = mActivityRule.getActivity();
+
+ assertThat(activity instanceof WifiDppAddDeviceFragment
+ .OnClickChooseDifferentNetworkListener).isEqualTo(true);
+ }
+
+ @Test
+ public void rotateScreen_shouldGetCorrectWifiDppQrCode() {
+ WifiQrCode wifiQrCode = new WifiQrCode(VALID_WIFI_DPP_QR_CODE);
+ Intent intent = new Intent(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER);
+ intent.putExtra(WifiDppUtils.EXTRA_WIFI_SECURITY, "WEP");
+ intent.putExtra(WifiDppUtils.EXTRA_WIFI_SSID, "GoogleGuest");
+ intent.putExtra(WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY, "password");
+
+ // setWifiDppQrCode and check if getWifiDppQrCode correctly after rotation
+ mActivityRule.launchActivity(intent);
+ mActivityRule.getActivity().setWifiDppQrCode(wifiQrCode);
+ mActivityRule.getActivity().setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+ mActivityRule.getActivity().setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ WifiQrCode restoredWifiDppQrCode = mActivityRule.getActivity().getWifiDppQrCode();
+
+ assertThat(restoredWifiDppQrCode).isNotNull();
+ assertThat(restoredWifiDppQrCode.getQrCode()).isEqualTo(VALID_WIFI_DPP_QR_CODE);
+ }
+
+ @Test
+ public void rotateScreen_shouldGetCorrectWifiNetworkConfig() {
+ WifiNetworkConfig wifiNetworkConfig = new WifiNetworkConfig("WPA", "WifiSsid", "password",
+ /* hiddenSsid */ false, /* networkId */ 0);
+ Intent intent = new Intent(
+ WifiDppConfiguratorActivity.ACTION_PROCESS_WIFI_DPP_QR_CODE);
+ intent.putExtra(WifiDppUtils.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE);
+
+ // setWifiNetworkConfig and check if getWifiNetworkConfig correctly after rotation
+ mActivityRule.launchActivity(intent);
+ mActivityRule.getActivity().setWifiNetworkConfig(wifiNetworkConfig);
+ mActivityRule.getActivity().setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+ mActivityRule.getActivity().setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ WifiNetworkConfig restoredWifiNetworkConfig =
+ mActivityRule.getActivity().getWifiNetworkConfig();
+
+ assertThat(restoredWifiNetworkConfig).isNotNull();
+ assertThat(restoredWifiNetworkConfig.getSecurity()).isEqualTo("WPA");
+ assertThat(restoredWifiNetworkConfig.getSsid()).isEqualTo("WifiSsid");
+ assertThat(restoredWifiNetworkConfig.getPreSharedKey()).isEqualTo("password");
+ assertThat(restoredWifiNetworkConfig.getHiddenSsid()).isFalse();
+ assertThat(restoredWifiNetworkConfig.getNetworkId()).isEqualTo(0);
+ }
}