Merge "Fix two intro strings for Magnification page during Suw" into tm-dev
diff --git a/Android.bp b/Android.bp
index fd66974..0940b0b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -75,6 +75,7 @@
"lottie",
"WifiTrackerLib",
"windowExtLib",
+ "SettingsLibActivityEmbedding",
],
libs: [
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 290f84e..0279eec 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4349,6 +4349,7 @@
android:exported="true">
<intent-filter>
<action android:name="android.safetycenter.action.REFRESH_SAFETY_SOURCES"/>
+ <action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 16658f8..ba4d2f6 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -3736,7 +3736,7 @@
errorLine1=" android:color="@color/accessibility_feature_background"/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
- file="res/drawable/ic_text_and_display.xml"
+ file="res/drawable/ic_color_and_motion.xml"
line="22"
column="13"/>
</issue>
diff --git a/res/color/dream_card_color_state_list.xml b/res/color/dream_card_color_state_list.xml
index b5de7b4..b0c86bb 100644
--- a/res/color/dream_card_color_state_list.xml
+++ b/res/color/dream_card_color_state_list.xml
@@ -17,6 +17,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:state_selected="true" android:color="?androidprv:attr/colorSurfaceVariant"/>
- <item android:color="?androidprv:attr/colorSurfaceHighlight"/>
+ <item android:state_selected="true" android:color="?androidprv:attr/colorAccentPrimary"/>
+ <item android:color="?androidprv:attr/colorSurface"/>
</selector>
\ No newline at end of file
diff --git a/res/color/dream_card_text_color_state_list.xml b/res/color/dream_card_text_color_state_list.xml
new file mode 100644
index 0000000..438855f
--- /dev/null
+++ b/res/color/dream_card_text_color_state_list.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2022 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.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:state_selected="true" android:color="?androidprv:attr/textColorOnAccent"/>
+ <item android:color="?android:attr/textColorPrimary"/>
+</selector>
\ No newline at end of file
diff --git a/res/drawable/dream_default_preview_icon.xml b/res/drawable/dream_default_preview_icon.xml
new file mode 100644
index 0000000..7d247bb
--- /dev/null
+++ b/res/drawable/dream_default_preview_icon.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Copyright (C) 2022 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"
+ android:viewportHeight="24">
+ <path android:fillColor="?android:attr/textColorSecondary"
+ android:pathData="M3,19Q2.175,19 1.588,18.413Q1,17.825 1,17V7Q1,6.175 1.588,5.588Q2.175,5 3,5H13Q13.825,5 14.413,5.588Q15,6.175 15,7V17Q15,17.825 14.413,18.413Q13.825,19 13,19ZM3,17H13Q13,17 13,17Q13,17 13,17V7Q13,7 13,7Q13,7 13,7H3Q3,7 3,7Q3,7 3,7V17Q3,17 3,17Q3,17 3,17ZM17,19V5H19V19ZM21,19V5H23V19ZM4,15H12L9.4,11.5L7.5,14L6.1,12.15ZM3,7Q3,7 3,7Q3,7 3,7V17Q3,17 3,17Q3,17 3,17Q3,17 3,17Q3,17 3,17V7Q3,7 3,7Q3,7 3,7Z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/dream_preview_rounded_bg.xml b/res/drawable/dream_preview_rounded_bg.xml
new file mode 100644
index 0000000..4da0c7c1
--- /dev/null
+++ b/res/drawable/dream_preview_rounded_bg.xml
@@ -0,0 +1,22 @@
+<!--
+ ~ Copyright (C) 2022 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.
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:shape="rectangle">
+ <solid android:color="?androidprv:attr/colorSurfaceHighlight" />
+ <corners android:radius="@dimen/dream_item_corner_radius"/>
+</shape>
\ No newline at end of file
diff --git a/res/drawable/ic_text_and_display.xml b/res/drawable/ic_color_and_motion.xml
similarity index 100%
rename from res/drawable/ic_text_and_display.xml
rename to res/drawable/ic_color_and_motion.xml
diff --git a/res/layout/accessibility_qs_tooltips.xml b/res/layout/accessibility_qs_tooltips.xml
index 85d9c52..2bc9f5f 100644
--- a/res/layout/accessibility_qs_tooltips.xml
+++ b/res/layout/accessibility_qs_tooltips.xml
@@ -23,10 +23,10 @@
android:background="@drawable/accessibility_qs_tooltips_background">
<ImageView
+ android:id="@+id/qs_illustration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/accessibility_qs_tooltips_margin_top"
- android:src="@drawable/accessibility_qs_tooltips_illustration"
android:layout_gravity="center_horizontal"
android:contentDescription="@null" />
diff --git a/res/layout/apps_filter_spinner.xml b/res/layout/apps_filter_spinner.xml
index 1de5705..fcdcb5e 100644
--- a/res/layout/apps_filter_spinner.xml
+++ b/res/layout/apps_filter_spinner.xml
@@ -21,13 +21,11 @@
android:layout_height="wrap_content"
android:background="@android:color/transparent">
- <com.android.settingslib.widget.settingsspinner.SettingsSpinner
+ <Spinner
android:id="@+id/filter_spinner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="8dp"
android:theme="@style/Widget.PopupWindow.Settings"/>
<ImageView
diff --git a/res/layout/data_usage_cycles.xml b/res/layout/data_usage_cycles.xml
index 05c38e0..c957f9c 100644
--- a/res/layout/data_usage_cycles.xml
+++ b/res/layout/data_usage_cycles.xml
@@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight">
- <com.android.settingslib.widget.settingsspinner.SettingsSpinner
+ <Spinner
android:id="@+id/cycles_spinner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
diff --git a/res/layout/dream_picker_layout.xml b/res/layout/dream_picker_layout.xml
index 6de7ff6..68e2051 100644
--- a/res/layout/dream_picker_layout.xml
+++ b/res/layout/dream_picker_layout.xml
@@ -15,32 +15,25 @@
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:layout_width="match_parent"
android:layout_height="wrap_content">
- <androidx.cardview.widget.CardView
- android:id="@+id/dream_picker_container"
- android:layout_width="match_parent"
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/dream_list"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- style="@style/DreamPickerBackgroundStyle">
+ android:clipToPadding="true"
+ android:nestedScrollingEnabled="false"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingBottom="@dimen/dream_preference_card_padding"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"/>
- <androidx.constraintlayout.widget.ConstraintLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/dream_list"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:clipToPadding="true"
- android:nestedScrollingEnabled="false"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent"/>
-
- </androidx.constraintlayout.widget.ConstraintLayout>
-
- </androidx.cardview.widget.CardView>
-</LinearLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/res/layout/dream_preference_layout.xml b/res/layout/dream_preference_layout.xml
index 2bc67ba..abb2a34 100644
--- a/res/layout/dream_preference_layout.xml
+++ b/res/layout/dream_preference_layout.xml
@@ -17,7 +17,6 @@
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
@@ -30,21 +29,28 @@
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight">
- <androidx.cardview.widget.CardView
- android:id="@+id/preview_container"
- android:layout_width="match_parent"
+ <ImageView
+ android:id="@+id/preview"
+ android:layout_width="0dp"
android:layout_height="0dp"
- app:cardCornerRadius="@dimen/dream_item_corner_radius"
- app:cardElevation="0dp"
+ android:background="@drawable/dream_preview_rounded_bg"
+ android:importantForAccessibility="no"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintStart_toStartOf="parent">
- <ImageView
- android:id="@+id/preview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scaleType="centerCrop"/>
- </androidx.cardview.widget.CardView>
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
+
+ <ImageView
+ android:id="@+id/preview_placeholder"
+ android:layout_width="@dimen/dream_preview_placeholder_width"
+ android:layout_height="0dp"
+ android:src="@drawable/dream_default_preview_icon"
+ android:importantForAccessibility="no"
+ app:layout_constraintDimensionRatio="1:1"
+ app:layout_constraintTop_toTopOf="@+id/preview"
+ app:layout_constraintBottom_toBottomOf="@+id/preview"
+ app:layout_constraintStart_toStartOf="@+id/preview"
+ app:layout_constraintEnd_toEndOf="@+id/preview"/>
<Button
android:id="@+id/customize_button"
@@ -53,10 +59,10 @@
android:layout_height="wrap_content"
android:visibility="gone"
android:text="@string/customize_button_title"
- app:layout_constraintTop_toTopOf="@+id/preview_container"
- app:layout_constraintBottom_toBottomOf="@+id/preview_container"
- app:layout_constraintStart_toStartOf="@+id/preview_container"
- app:layout_constraintEnd_toEndOf="@+id/preview_container"/>
+ app:layout_constraintTop_toTopOf="@+id/preview"
+ app:layout_constraintBottom_toBottomOf="@+id/preview"
+ app:layout_constraintStart_toStartOf="@+id/preview"
+ app:layout_constraintEnd_toEndOf="@+id/preview"/>
<ImageView
android:id="@+id/icon"
@@ -66,9 +72,10 @@
android:layout_marginStart="@dimen/dream_item_icon_margin_start"
android:layout_marginBottom="@dimen/dream_item_title_margin_bottom"
android:gravity="center_vertical"
+ android:importantForAccessibility="no"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_chainStyle="packed"
- app:layout_constraintTop_toBottomOf="@+id/preview_container"
+ app:layout_constraintTop_toBottomOf="@+id/preview"
app_layout_constraintEnd_toStartOf="@+id/title_text"
app:layout_constraintStart_toStartOf="parent"/>
@@ -82,8 +89,9 @@
android:gravity="center_vertical"
android:maxLines="1"
android:ellipsize="end"
- android:textAppearance="?android:attr/textAppearanceListItemSmall"
- app:layout_constraintTop_toBottomOf="@+id/preview_container"
+ android:textSize="16sp"
+ android:textColor="@color/dream_card_text_color_state_list"
+ app:layout_constraintTop_toBottomOf="@+id/preview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/icon"/>
diff --git a/res/layout/lockscreen_remote_input.xml b/res/layout/lockscreen_remote_input.xml
deleted file mode 100644
index 4fa44ce..0000000
--- a/res/layout/lockscreen_remote_input.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2016 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
- -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <CheckBox
- android:id="@+id/lockscreen_remote_input"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginStart="20dp"
- android:paddingStart="20dp"
- android:paddingEnd="?android:attr/dialogPreferredPadding"
- android:minHeight="?android:attr/listPreferredItemHeightSmall"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorAlertDialogListItem"
- android:gravity="center_vertical"
- android:text="@string/lockscreen_remote_input"
- />
-
- <ImageView
- android:id="@+id/restricted_lock_icon_remote_input"
- android:layout_width="@*android:dimen/config_restrictedIconSize"
- android:layout_height="@*android:dimen/config_restrictedIconSize"
- android:tint="?android:attr/colorAccent"
- android:src="@*android:drawable/ic_info"
- android:layout_marginEnd="?android:attr/dialogPreferredPadding"
- android:layout_gravity="center_vertical"
- android:scaleType="centerInside" />
-</LinearLayout>
diff --git a/res/layout/manage_apps_filter_spinner.xml b/res/layout/manage_apps_filter_spinner.xml
index 8283bb8..a2d0e12 100644
--- a/res/layout/manage_apps_filter_spinner.xml
+++ b/res/layout/manage_apps_filter_spinner.xml
@@ -21,12 +21,10 @@
android:layout_height="wrap_content"
android:background="@android:color/transparent">
- <com.android.settingslib.widget.settingsspinner.SettingsSpinner
+ <Spinner
android:id="@+id/filter_spinner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginStart="24dp"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="8dp"
android:theme="@style/Widget.PopupWindow.Settings"/>
</FrameLayout>
diff --git a/res/layout/restricted_dialog_singlechoice.xml b/res/layout/restricted_dialog_singlechoice.xml
index a9984a8..9b19884 100644
--- a/res/layout/restricted_dialog_singlechoice.xml
+++ b/res/layout/restricted_dialog_singlechoice.xml
@@ -35,14 +35,4 @@
android:drawableStart="?android:attr/listChoiceIndicatorSingle"
android:drawablePadding="20dp"
android:ellipsize="marquee" />
- <ImageView
- android:id="@+id/restricted_lock_icon"
- android:layout_width="@*android:dimen/config_restrictedIconSize"
- android:layout_height="@*android:dimen/config_restrictedIconSize"
- android:tint="?android:attr/colorAccent"
- android:src="@*android:drawable/ic_info"
- android:layout_marginLeft="@dimen/restricted_icon_padding"
- android:baselineAlignBottom="true"
- android:scaleType="centerInside"
- android:visibility="gone" />
</com.android.settings.CheckableLinearLayout>
diff --git a/res/layout/restricted_preference_dropdown.xml b/res/layout/restricted_preference_dropdown.xml
deleted file mode 100644
index 8930e24..0000000
--- a/res/layout/restricted_preference_dropdown.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2016 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
- -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <view android:id="@+id/spinner"
- class="com.android.settings.notification.RestrictedDropDownPreference$ReselectionSpinner"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:visibility="invisible"
- android:layout_marginStart="@dimen/preference_no_icon_padding_start"/>
-
- <include layout="@layout/settingslib_preference" />
-
-</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/restricted_radio_with_summary.xml b/res/layout/restricted_radio_with_summary.xml
deleted file mode 100644
index 5e7fcd8..0000000
--- a/res/layout/restricted_radio_with_summary.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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.
--->
-
-<com.android.settings.CheckableLinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:background="?android:attr/selectableItemBackground"
- android:minHeight="?android:attr/listPreferredItemHeightSmall">
-
- <com.android.settings.CheckableLinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingStart="20dp"
- android:paddingEnd="?android:attr/dialogPreferredPadding">
- <CheckedTextView
- android:id="@android:id/title"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorAlertDialogListItem"
- android:gravity="center_vertical"
- android:drawableStart="?android:attr/listChoiceIndicatorSingle"
- android:ellipsize="marquee" />
- <ImageView
- android:id="@+id/restricted_icon"
- android:layout_width="@*android:dimen/config_restrictedIconSize"
- android:layout_height="match_parent"
- android:scaleType="centerInside"
- android:tint="?android:attr/colorAccent"
- android:src="@*android:drawable/ic_info"
- android:layout_marginLeft="@dimen/restricted_icon_padding"
- android:visibility="gone" />
- </com.android.settings.CheckableLinearLayout>
-
-
- <TextView android:id="@android:id/summary"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="8dp"
- android:paddingStart="52dp"
- android:textAppearance="?android:attr/textAppearanceListItemSecondary"
- android:textColor="?android:attr/textColorSecondary"
- android:maxLines="10" />
-
-</com.android.settings.CheckableLinearLayout>
diff --git a/res/layout/spinner_dropdown_restricted_item.xml b/res/layout/spinner_dropdown_restricted_item.xml
deleted file mode 100644
index d95e4be..0000000
--- a/res/layout/spinner_dropdown_restricted_item.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:gravity="center_vertical">
- <TextView android:id="@android:id/text1"
- style="?android:attr/spinnerDropDownItemStyle"
- android:singleLine="true"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="?android:attr/listPreferredItemHeightSmall"
- android:ellipsize="marquee" />
- <ImageView android:id="@+id/restricted_icon"
- android:layout_width="@*android:dimen/config_restrictedIconSize"
- android:layout_height="@*android:dimen/config_restrictedIconSize"
- android:tint="?android:attr/colorAccent"
- android:src="@*android:drawable/ic_info"
- android:baselineAlignBottom="true"
- android:layout_marginEnd="@dimen/restricted_icon_padding"
- android:gravity="end|center_vertical"
- android:visibility="gone" />
-</LinearLayout>
diff --git a/res/layout/tare_dropdown_page.xml b/res/layout/tare_dropdown_page.xml
index 79931e8..674b189 100644
--- a/res/layout/tare_dropdown_page.xml
+++ b/res/layout/tare_dropdown_page.xml
@@ -6,15 +6,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".development.tare.DropdownActivity">
- <com.android.settingslib.widget.settingsspinner.SettingsSpinner
+ <Spinner
android:id="@+id/spinner"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- android:theme="@style/Widget.PopupWindow.Settings"
- android:padding="10dp" />
+ android:theme="@style/Widget.PopupWindow.Settings" />
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
diff --git a/res/layout/tare_homepage.xml b/res/layout/tare_homepage.xml
index 2c184d2..ddc9333 100644
--- a/res/layout/tare_homepage.xml
+++ b/res/layout/tare_homepage.xml
@@ -60,5 +60,6 @@
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:onClick="revertSettings"
- android:text="@string/tare_revert" />
+ android:text="@string/tare_revert"
+ style="@style/ActionPrimaryButton" />
</LinearLayout>
diff --git a/res/values/config.xml b/res/values/config.xml
index 6a7c15b..50eddb5 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -447,6 +447,9 @@
<!-- Whether top_level_battery should be shown or not. -->
<bool name="config_show_top_level_battery">true</bool>
+ <!-- Whether to use compact battery status string. -->
+ <bool name="config_use_compact_battery_status">false</bool>
+
<!-- Whether top_level_connected_devices should be shown or not. -->
<bool name="config_show_top_level_connected_devices">true</bool>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index be1ba5b..78dbcce 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -441,7 +441,7 @@
<dimen name="chartview_trapezoid_margin_bottom">2dp</dimen>
<!-- Dimensions for Dream settings cards -->
- <dimen name="dream_item_min_column_width">210dp</dimen>
+ <dimen name="dream_item_min_column_width">174dp</dimen>
<dimen name="dream_item_corner_radius">28dp</dimen>
<dimen name="dream_item_content_padding">8dp</dimen>
<dimen name="dream_item_icon_size">20dp</dimen>
@@ -449,9 +449,10 @@
<dimen name="dream_item_title_margin_bottom">8dp</dimen>
<dimen name="dream_item_title_margin_start">18dp</dimen>
<dimen name="dream_item_icon_margin_start">10dp</dimen>
- <dimen name="dream_preference_margin_horizontal">10dp</dimen>
+ <dimen name="dream_preference_card_padding">16dp</dimen>
<dimen name="dream_preference_margin_bottom">20dp</dimen>
<dimen name="dream_picker_margin_horizontal">48dp</dimen>
+ <dimen name="dream_preview_placeholder_width">52dp</dimen>
<!-- Sims/Data mobile/Calls/SMS select dialog-->
<dimen name="sims_select_margin_bottom">24dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5472a9d..9d868cb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5156,8 +5156,8 @@
<string name="general_category_title">General</string>
<!-- Title for the accessibility preference category of display services and settings. [CHAR LIMIT=50] -->
<string name="display_category_title">Display</string>
- <!-- Title for the accessibility text options page. [CHAR LIMIT=50] -->
- <string name="accessibility_text_and_display_title">Text and display</string>
+ <!-- Title for the accessibility color and motion page. [CHAR LIMIT=50] -->
+ <string name="accessibility_color_and_motion_title">Color and motion</string>
<!-- Title for the accessibility text options page. [CHAR LIMIT=50] -->
<string name="accessibility_turn_screen_darker_title">Turn screen darker</string>
<!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
@@ -5523,8 +5523,10 @@
<string name="accessibility_service_primary_switch_title">Use <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
<!-- Used in the accessibility service settings to open the activity. [CHAR LIMIT=NONE] -->
<string name="accessibility_service_primary_open_title">Open <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
+ <!-- Used in the accessibility service settings to show quick settings tooltips for auto-added feature. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_service_auto_added_qs_tooltips_content"><xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g> added to Quick Settings. Swipe down to turn it on or off anytime.</string>
<!-- Used in the accessibility service settings to show quick settings tooltips. [CHAR LIMIT=NONE] -->
- <string name="accessibility_service_quick_settings_tooltips_content"><xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g> added to Quick Settings. Swipe down to turn it on or off anytime.</string>
+ <string name="accessibility_service_qs_tooltips_content">You can add a shortcut to <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g> by editing quick settings</string>
<!-- Used in the accessibility action for accessibility quick settings tooltips to dismiss. [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_tooltips_dismiss">Dismiss</string>
<!-- Intro for color correction settings screen to control turning on/off the feature entirely. [CHAR LIMIT=NONE] -->
@@ -7675,8 +7677,8 @@
<string name="nfc_default_payment_workapp_confirmation_message_title">To make a payment using a work app:</string>
<!-- Text string in the dialog [CHAR LIMIT=60] -->
<string name="nfc_default_payment_workapp_confirmation_message_1">work profile must be turned on.</string>
- <!-- Text string in the dialog [CHAR LIMIT=60] -->
- <string name="nfc_default_payment_workapp_confirmation_message_2">you\u2019ll need to enter your work profile lock if you have one.</string>
+ <!-- Text string in the dialog [CHAR LIMIT=80] -->
+ <string name="nfc_default_payment_workapp_confirmation_message_2">you\u2019ll need to enter your work PIN, pattern, or password if you have one.</string>
<!-- Caption for button linking to a page explaining how Tap and Pay works-->
<string name="nfc_payment_how_it_works">How it works</string>
@@ -13330,7 +13332,7 @@
<!-- Wallet (formerly Cards and passes) toggle name [CHAR LIMIT=60] -->
<string name="lockscreen_privacy_wallet_setting_toggle">Show wallet</string>
<!-- Wallet (formerly Cards and passes) summary [CHAR LIMIT=NONE] -->
- <string name="lockscreen_privacy_wallet_summary">Allow access to wallet from lock screen and quick settings</string>
+ <string name="lockscreen_privacy_wallet_summary">Allow access to wallet from lock screen</string>
<!-- QR Code Scanner toggle name [CHAR LIMIT=60] -->
<string name="lockscreen_privacy_qr_code_scanner_setting_toggle">Show QR scanner</string>
@@ -13905,11 +13907,13 @@
<!-- TARE dialog button to proceed with a value change [CHAR LIMIT=none] -->
<string name="tare_dialog_confirm_button_title">Confirm</string>
<!-- Button to preview the selected screensaver in settings [CHAR LIMIT=40] -->
- <string name="dream_preview_button_title">Preview screensaver</string>
+ <string name="dream_preview_button_title">Preview</string>
<!-- The title of the category to show for the screensaver selector in settings [CHAR LIMIT=none] -->
- <string name="dream_picker_category">Choose an image</string>
- <!-- The title of the category to show for the screensaver overlay selector in settings [CHAR LIMIT=none] -->
- <string name="dream_complications_picker_category">Choose more options</string>
+ <string name="dream_picker_category">Choose a screen saver</string>
+ <!-- The title of the toggle which enables/disables overlays on top of the screen saver [CHAR LIMIT=none] -->
+ <string name="dream_complications_toggle_title">Show additional information</string>
+ <!-- The summary of what overlays this toggle controls [CHAR LIMIT=none] -->
+ <string name="dream_complications_toggle_summary">Display time, date and weather on the screen saver</string>
<!-- The title of the category to show for the screensaver miscellaneous settings [CHAR LIMIT=none] -->
<string name="dream_more_settings_category">More settings</string>
<!-- The title of the screen saver setup page [CHAR LIMIT=none] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index a64eb1f..ebaea6b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -944,23 +944,10 @@
</style>
<style name="DreamCardStyle">
- <item name="android:layout_marginBottom">@dimen/dream_preference_margin_bottom</item>
- <item name="android:layout_marginStart">@dimen/dream_preference_margin_horizontal</item>
- <item name="android:layout_marginEnd">@dimen/dream_preference_margin_horizontal</item>
<item name="cardBackgroundColor">@color/dream_card_color_state_list</item>
<item name="cardCornerRadius">@dimen/dream_item_corner_radius</item>
<item name="cardElevation">0dp</item>
<item name="rippleColor">?android:attr/colorControlHighlight</item>
<item name="contentPadding">@dimen/dream_item_content_padding</item>
</style>
-
- <style name="DreamPickerBackgroundStyle">
- <item name="android:layout_marginBottom">48dp</item>
- <item name="android:layout_marginStart">@dimen/dream_picker_margin_horizontal</item>
- <item name="android:layout_marginEnd">@dimen/dream_picker_margin_horizontal</item>
- <item name="cardBackgroundColor">?androidprv:attr/colorSurface</item>
- <item name="cardCornerRadius">24dp</item>
- <item name="cardElevation">0dp</item>
- <item name="contentPadding">32dp</item>
- </style>
</resources>
diff --git a/res/xml/accessibility_text_and_display.xml b/res/xml/accessibility_color_and_motion.xml
similarity index 62%
rename from res/xml/accessibility_text_and_display.xml
rename to res/xml/accessibility_color_and_motion.xml
index 659acab..f251d1e 100644
--- a/res/xml/accessibility_text_and_display.xml
+++ b/res/xml/accessibility_color_and_motion.xml
@@ -17,34 +17,9 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="accessibility_text_and_display"
+ android:key="accessibility_color_and_motion"
android:persistent="false"
- android:title="@string/accessibility_text_and_display_title">
-
- <Preference
- android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
- android:icon="@drawable/ic_font_size"
- android:key="font_size_preference_screen"
- android:persistent="false"
- android:title="@string/title_font_size"
- settings:controller="com.android.settings.display.FontSizePreferenceController"
- settings:searchable="false"/>
-
- <com.android.settings.display.ScreenZoomPreference
- android:fragment="com.android.settings.display.ScreenZoomSettings"
- android:icon="@drawable/ic_screen_zoom"
- android:key="accessibility_settings_screen_zoom"
- android:persistent="false"
- android:title="@string/screen_zoom_title"
- settings:searchable="false"/>
-
- <SwitchPreference
- android:key="toggle_force_bold_text"
- android:icon="@drawable/ic_force_bold"
- android:persistent="false"
- android:title="@string/force_bold_text"
- settings:keywords="@string/keywords_bold_text"
- settings:controller="com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"/>
+ android:title="@string/accessibility_color_and_motion_title">
<Preference
android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
@@ -76,12 +51,6 @@
android:title="@string/accessibility_toggle_large_pointer_icon_title"
settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/>
- <SwitchPreference
- android:key="toggle_high_text_contrast_preference"
- android:persistent="false"
- android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
- settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
-
<PreferenceCategory
android:key="experimental_category"
android:persistent="false"
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index fcdf47b..22226a1 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -36,21 +36,19 @@
android:persistent="false"
android:title="@string/display_category_title">
- <!-- After completely finishing the Text and reading options feature, it will be visible. -->
<Preference
android:fragment="com.android.settings.accessibility.TextReadingPreferenceFragment"
android:icon="@drawable/ic_adaptive_font_download"
android:key="text_reading_options"
android:persistent="false"
- android:title="@string/accessibility_text_reading_options_title"
- settings:isPreferenceVisible="false"/>
+ android:title="@string/accessibility_text_reading_options_title" />
<Preference
- android:fragment="com.android.settings.accessibility.TextAndDisplayFragment"
- android:key="text_and_display_preference_screen"
- android:icon="@drawable/ic_text_and_display"
+ android:fragment="com.android.settings.accessibility.ColorAndMotionFragment"
+ android:key="color_and_motion"
+ android:icon="@drawable/ic_color_and_motion"
android:persistent="false"
- android:title="@string/accessibility_text_and_display_title"
+ android:title="@string/accessibility_color_and_motion_title"
settings:searchable="true"/>
<com.android.settingslib.PrimarySwitchPreference
diff --git a/res/xml/accessibility_settings_for_setup_wizard.xml b/res/xml/accessibility_settings_for_setup_wizard.xml
index 3272ae5..78d8f72 100644
--- a/res/xml/accessibility_settings_for_setup_wizard.xml
+++ b/res/xml/accessibility_settings_for_setup_wizard.xml
@@ -26,24 +26,9 @@
android:key="text_reading_options"
android:persistent="false"
android:title="@string/accessibility_text_reading_options_title"
- settings:isPreferenceVisible="false"
settings:keywords="text_reading_options" />
<Preference
- android:key="font_size_preference"
- android:icon="@drawable/ic_font_size"
- android:summary="@string/short_summary_font_size"
- android:title="@string/title_font_size"
- settings:controller="com.android.settings.accessibility.FontSizePreferenceController" />
-
- <com.android.settings.display.ScreenZoomPreference
- android:key="force_density_preference"
- android:icon="@drawable/ic_screen_zoom"
- android:summary="@string/screen_zoom_short_summary"
- android:title="@string/screen_zoom_title"
- settings:controller="com.android.settings.accessibility.ScreenSizePreferenceController" />
-
- <Preference
android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragmentForSetupWizard"
android:key="screen_magnification_preference"
android:icon="@drawable/ic_accessibility_magnification"
diff --git a/res/xml/accessibility_text_reading_options.xml b/res/xml/accessibility_text_reading_options.xml
index d55882d..ad742c9 100644
--- a/res/xml/accessibility_text_reading_options.xml
+++ b/res/xml/accessibility_text_reading_options.xml
@@ -33,7 +33,8 @@
settings:iconEnd="@drawable/ic_add_24dp"
settings:iconEndContentDescription="@string/font_size_make_larger_desc"
settings:iconStart="@drawable/ic_remove_24dp"
- settings:iconStartContentDescription="@string/font_size_make_smaller_desc"/>
+ settings:iconStartContentDescription="@string/font_size_make_smaller_desc"
+ settings:keywords="@string/keywords_font_size" />
<com.android.settings.widget.LabeledSeekBarPreference
android:key="display_size"
@@ -43,7 +44,8 @@
settings:iconEnd="@drawable/ic_add_24dp"
settings:iconEndContentDescription="@string/screen_zoom_make_larger_desc"
settings:iconStart="@drawable/ic_remove_24dp"
- settings:iconStartContentDescription="@string/screen_zoom_make_smaller_desc"/>
+ settings:iconStartContentDescription="@string/screen_zoom_make_smaller_desc"
+ settings:keywords="@string/keywords_display_size" />
<SwitchPreference
android:key="toggle_force_bold_text"
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 328e15c..0724eea 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -69,17 +69,10 @@
settings:keywords="@string/keywords_dark_ui_mode"/>
<Preference
- android:key="font_size"
- android:title="@string/title_font_size"
- android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
- settings:controller="com.android.settings.display.FontSizePreferenceController"
- settings:keywords="@string/keywords_font_size"/>
-
- <com.android.settings.display.ScreenZoomPreference
- android:key="display_settings_screen_zoom"
- android:title="@string/screen_zoom_title"
- android:fragment="com.android.settings.display.ScreenZoomSettings"
- settings:keywords="@string/keywords_display_size"/>
+ android:fragment="com.android.settings.accessibility.TextReadingPreferenceFragment"
+ android:key="text_reading_options"
+ android:persistent="false"
+ android:title="@string/accessibility_text_reading_options_title" />
</PreferenceCategory>
<PreferenceCategory
diff --git a/res/xml/dream_fragment_overview.xml b/res/xml/dream_fragment_overview.xml
index 9dfa105..105cec4 100644
--- a/res/xml/dream_fragment_overview.xml
+++ b/res/xml/dream_fragment_overview.xml
@@ -29,18 +29,12 @@
</PreferenceCategory>
<PreferenceCategory
- android:key="dream_complication_category"
- android:title="@string/dream_complications_picker_category"
- settings:controller="com.android.settings.dream.DreamComplicationCategoryController">
- <com.android.settingslib.widget.LayoutPreference
- android:key="dream_complication_picker"
- android:selectable="false"
- android:layout="@layout/dream_picker_layout"
- settings:controller="com.android.settings.dream.DreamComplicationPickerController"/>
- </PreferenceCategory>
-
- <PreferenceCategory
android:title="@string/dream_more_settings_category">
+ <SwitchPreference
+ android:key="dream_complications_toggle"
+ android:title="@string/dream_complications_toggle_title"
+ android:summary="@string/dream_complications_toggle_summary"
+ settings:controller="com.android.settings.dream.DreamComplicationPreferenceController"/>
<Preference
android:key="when_to_start"
android:title="@string/screensaver_settings_when_to_dream"
diff --git a/src/com/android/settings/RestrictedListPreference.java b/src/com/android/settings/RestrictedListPreference.java
index bd3cd17..d75f1b8 100644
--- a/src/com/android/settings/RestrictedListPreference.java
+++ b/src/com/android/settings/RestrictedListPreference.java
@@ -30,7 +30,6 @@
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckedTextView;
-import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
@@ -53,7 +52,6 @@
public RestrictedListPreference(Context context, AttributeSet attrs) {
super(context, attrs);
- setWidgetLayoutResource(R.layout.restricted_icon);
mHelper = new RestrictedPreferenceHelper(context, this, attrs);
}
@@ -67,10 +65,6 @@
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
mHelper.onBindViewHolder(holder);
- final View restrictedIcon = holder.findViewById(R.id.restricted_icon);
- if (restrictedIcon != null) {
- restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE);
- }
}
@Override
@@ -187,11 +181,9 @@
View root = super.getView(position, convertView, parent);
CharSequence entry = getItem(position);
CheckedTextView text = (CheckedTextView) root.findViewById(R.id.text1);
- ImageView padlock = (ImageView) root.findViewById(R.id.restricted_lock_icon);
if (isRestrictedForEntry(entry)) {
text.setEnabled(false);
text.setChecked(false);
- padlock.setVisibility(View.VISIBLE);
} else {
if (mSelectedIndex != -1) {
text.setChecked(position == mSelectedIndex);
@@ -199,7 +191,6 @@
if (!text.isEnabled()) {
text.setEnabled(true);
}
- padlock.setVisibility(View.GONE);
}
return root;
}
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index d3d3604..d9dc590 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -143,6 +143,8 @@
public static final String EXTRA_SHOW_FRAGMENT_AS_SUBSETTING =
":settings:show_fragment_as_subsetting";
+ public static final String EXTRA_IS_SECONDARY_LAYER_PAGE =
+ ":settings:is_secondary_layer_page";
/**
* Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK.
@@ -301,12 +303,12 @@
launchSettingFragment(initialFragmentName, intent);
}
- final boolean isInSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
+ final boolean isActionBarButtonEnabled = isActionBarButtonEnabled(intent);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
- actionBar.setDisplayHomeAsUpEnabled(!isInSetupWizard);
- actionBar.setHomeButtonEnabled(!isInSetupWizard);
+ actionBar.setDisplayHomeAsUpEnabled(isActionBarButtonEnabled);
+ actionBar.setHomeButtonEnabled(isActionBarButtonEnabled);
actionBar.setDisplayShowTitleEnabled(true);
}
mMainSwitch = findViewById(R.id.switch_bar);
@@ -366,6 +368,18 @@
}
}
+ private boolean isActionBarButtonEnabled(Intent intent) {
+ if (WizardManagerHelper.isAnySetupWizard(intent)) {
+ return false;
+ }
+ final boolean isSecondaryLayerPage =
+ intent.getBooleanExtra(EXTRA_IS_SECONDARY_LAYER_PAGE, false);
+
+ // TODO: move Settings's ActivityEmbeddingUtils to SettingsLib.
+ return !com.android.settingslib.activityembedding.ActivityEmbeddingUtils
+ .shouldHideBackButton(this, isSecondaryLayerPage);
+ }
+
private boolean isSubSettings(Intent intent) {
return this instanceof SubSettings ||
intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, false);
diff --git a/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindow.java b/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindow.java
index f24934f..2c77102 100644
--- a/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindow.java
+++ b/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindow.java
@@ -27,10 +27,12 @@
import android.view.View.AccessibilityDelegate;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
+import androidx.annotation.DrawableRes;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
@@ -76,9 +78,10 @@
* Sets up {@link #AccessibilityQuickSettingsTooltipWindow}'s layout and content.
*
* @param text text to be displayed
+ * @param imageResId the resource ID of the image drawable
*/
- public void setup(String text) {
- this.setup(text, /* closeDelayTimeMillis= */ 0);
+ public void setup(String text, @DrawableRes int imageResId) {
+ this.setup(text, imageResId, /* closeDelayTimeMillis= */ 0);
}
/**
@@ -88,9 +91,10 @@
* close delay time is positive number. </p>
*
* @param text text to be displayed
+ * @param imageResId the resource ID of the image drawable
* @param closeDelayTimeMillis how long the popup window be auto-closed
*/
- public void setup(String text, long closeDelayTimeMillis) {
+ public void setup(String text, @DrawableRes int imageResId, long closeDelayTimeMillis) {
this.mCloseDelayTimeMillis = closeDelayTimeMillis;
setBackgroundDrawable(new ColorDrawable(mContext.getColor(android.R.color.transparent)));
@@ -101,6 +105,8 @@
popupView.setAccessibilityDelegate(mAccessibilityDelegate);
setContentView(popupView);
+ final ImageView imageView = getContentView().findViewById(R.id.qs_illustration);
+ imageView.setImageResource(imageResId);
final TextView textView = getContentView().findViewById(R.id.qs_content);
textView.setText(text);
setWidth(getWindowWidthWith(textView));
diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
index 2b9729e..5798723 100644
--- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
@@ -18,6 +18,7 @@
import static com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums;
import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_GENERAL_CATEGORY;
+import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_SAVED_QS_TOOLTIP_TYPE;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
@@ -41,6 +42,7 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
+import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.utils.LocaleUtils;
@@ -70,6 +72,7 @@
private CheckBox mHardwareTypeCheckBox;
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
private boolean mNeedsQSTooltipReshow = false;
+ private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
/** Returns the accessibility component name. */
protected abstract ComponentName getComponentName();
@@ -96,6 +99,9 @@
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
}
+ if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_TYPE)) {
+ mNeedsQSTooltipType = savedInstanceState.getInt(KEY_SAVED_QS_TOOLTIP_TYPE);
+ }
}
final int resId = getPreferenceScreenResId();
@@ -176,6 +182,7 @@
}
if (mTooltipWindow != null) {
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, mTooltipWindow.isShowing());
+ outState.putInt(KEY_SAVED_QS_TOOLTIP_TYPE, mNeedsQSTooltipType);
}
super.onSaveInstanceState(outState);
}
@@ -198,7 +205,7 @@
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
dialog = AccessibilityGestureNavigationTutorial
.createAccessibilityTutorialDialog(getPrefContext(),
- getUserShortcutTypes());
+ getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
dialog.setCanceledOnTouchOutside(false);
return dialog;
default:
@@ -297,6 +304,17 @@
};
/**
+ * This method will be invoked when a button in the tutorial dialog is clicked.
+ *
+ * @param dialog The dialog that received the click
+ * @param which The button that was clicked
+ */
+ private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ showQuickSettingsTooltipIfNeeded();
+ }
+
+ /**
* This method will be invoked when a button in the edit shortcut dialog is clicked.
*
* @param dialog The dialog that received the click
@@ -308,12 +326,17 @@
}
final int value = getShortcutTypeCheckBoxValue();
-
saveNonEmptyUserShortcutType(value);
AccessibilityUtil.optInAllValuesToSettings(getPrefContext(), value, getComponentName());
AccessibilityUtil.optOutAllValuesFromSettings(getPrefContext(), ~value, getComponentName());
- mShortcutPreference.setChecked(value != AccessibilityUtil.UserShortcutType.EMPTY);
+ final boolean shortcutAssigned = value != AccessibilityUtil.UserShortcutType.EMPTY;
+ mShortcutPreference.setChecked(shortcutAssigned);
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
+
+ // Show the quick setting tooltip if the shortcut assigned in the first time
+ if (shortcutAssigned) {
+ showQuickSettingsTooltipIfNeeded();
+ }
}
@VisibleForTesting
@@ -452,7 +475,18 @@
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
}
- protected void showQuickSettingsTooltipIfNeeded() {
+ /**
+ * Shows the quick settings tooltip if the quick settings feature is assigned. The tooltip only
+ * shows once.
+ *
+ * @param type The quick settings tooltip type
+ */
+ protected void showQuickSettingsTooltipIfNeeded(@QuickSettingsTooltipType int type) {
+ mNeedsQSTooltipType = type;
+ showQuickSettingsTooltipIfNeeded();
+ }
+
+ private void showQuickSettingsTooltipIfNeeded() {
final ComponentName tileComponentName = getTileComponentName();
if (tileComponentName == null) {
// Returns if no tile service assigned.
@@ -471,10 +505,13 @@
return;
}
- final String title =
- getString(R.string.accessibility_service_quick_settings_tooltips_content, tileName);
+ final int titleResId = mNeedsQSTooltipType == QuickSettingsTooltipType.GUIDE_TO_EDIT
+ ? R.string.accessibility_service_qs_tooltips_content
+ : R.string.accessibility_service_auto_added_qs_tooltips_content;
+ final String title = getString(titleResId, tileName);
+ final int imageResId = R.drawable.accessibility_qs_tooltips_illustration;
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext());
- mTooltipWindow.setup(title);
+ mTooltipWindow.setup(title, imageResId);
mTooltipWindow.showAtTopCenter(getView());
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(),
tileComponentName);
diff --git a/src/com/android/settings/accessibility/AccessibilityUtil.java b/src/com/android/settings/accessibility/AccessibilityUtil.java
index c935956..3e97edc 100644
--- a/src/com/android/settings/accessibility/AccessibilityUtil.java
+++ b/src/com/android/settings/accessibility/AccessibilityUtil.java
@@ -46,7 +46,7 @@
import java.util.StringJoiner;
/** Provides utility methods to accessibility settings only. */
-final class AccessibilityUtil {
+public final class AccessibilityUtil {
private AccessibilityUtil(){}
@@ -105,6 +105,17 @@
int TRIPLETAP = 4; // 1 << 2
}
+ /**
+ * Denotes the quick setting tooltip type.
+ *
+ * {@code GUIDE_TO_EDIT} for QS tiles that need to be added by editing.
+ * {@code GUIDE_TO_DIRECT_USE} for QS tiles that have been auto-added already.
+ */
+ public @interface QuickSettingsTooltipType {
+ int GUIDE_TO_EDIT = 0;
+ int GUIDE_TO_DIRECT_USE = 1;
+ }
+
/** Denotes the accessibility enabled status */
@Retention(RetentionPolicy.SOURCE)
public @interface State {
diff --git a/src/com/android/settings/accessibility/TextAndDisplayFragment.java b/src/com/android/settings/accessibility/ColorAndMotionFragment.java
similarity index 91%
rename from src/com/android/settings/accessibility/TextAndDisplayFragment.java
rename to src/com/android/settings/accessibility/ColorAndMotionFragment.java
index e81dded..7f55053 100644
--- a/src/com/android/settings/accessibility/TextAndDisplayFragment.java
+++ b/src/com/android/settings/accessibility/ColorAndMotionFragment.java
@@ -30,11 +30,11 @@
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
-/** Accessibility settings for text and display. */
+/** Accessibility settings for color and motion. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
-public class TextAndDisplayFragment extends DashboardFragment {
+public class ColorAndMotionFragment extends DashboardFragment {
- private static final String TAG = "TextAndDisplayFragment";
+ private static final String TAG = "ColorAndMotionFragment";
private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
@@ -49,7 +49,7 @@
@Override
public int getMetricsCategory() {
- return SettingsEnums.ACCESSIBILITY_TEXT_AND_DISPLAY;
+ return SettingsEnums.ACCESSIBILITY_COLOR_AND_MOTION;
}
@@ -62,7 +62,7 @@
@Override
protected int getPreferenceScreenResId() {
- return R.xml.accessibility_text_and_display;
+ return R.xml.accessibility_color_and_motion;
}
@Override
@@ -104,5 +104,5 @@
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider(R.xml.accessibility_text_and_display);
+ new BaseSearchIndexProvider(R.xml.accessibility_color_and_motion);
}
diff --git a/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java b/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java
index ce8db21..b04582f 100644
--- a/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java
@@ -20,11 +20,9 @@
import android.accessibilityservice.AccessibilityShortcutInfo;
import android.app.ActivityOptions;
-import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.ContentResolver;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
@@ -139,20 +137,6 @@
}
@Override
- public Dialog onCreateDialog(int dialogId) {
- switch (dialogId) {
- case AccessibilityDialogUtils.DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
- final Dialog dialog = AccessibilityGestureNavigationTutorial
- .createAccessibilityTutorialDialog(getPrefContext(),
- getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
- dialog.setCanceledOnTouchOutside(false);
- return dialog;
- default:
- return super.onCreateDialog(dialogId);
- }
- }
-
- @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Do not call super. We don't want to see the "Help & feedback" option on this page so as
// not to confuse users who think they might be able to send feedback about a specific
@@ -236,22 +220,4 @@
return settingsIntent;
}
-
- /**
- * This method will be invoked when a button in the tutorial dialog is clicked.
- *
- * @param dialog The dialog that received the click
- * @param which The button that was clicked
- */
- private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
- dialog.dismiss();
- showQuickSettingsTooltipIfNeeded();
- }
-
-
- @Override
- protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
- super.callOnAlertDialogCheckboxClicked(dialog, which);
- showQuickSettingsTooltipIfNeeded(getShortcutTypeCheckBoxValue());
- }
}
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index d7a506a..02da51e 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -206,12 +206,6 @@
.createDisableDialog(getPrefContext(), info,
this::onDialogButtonFromDisableToggleClicked);
return mWarningDialog;
- case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
- final Dialog dialog = AccessibilityGestureNavigationTutorial
- .createAccessibilityTutorialDialog(getPrefContext(),
- getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
- dialog.setCanceledOnTouchOutside(false);
- return dialog;
default:
return super.onCreateDialog(dialogId);
}
@@ -496,23 +490,6 @@
mWarningDialog.dismiss();
}
- /**
- * This method will be invoked when a button in the tutorial dialog is clicked.
- *
- * @param dialog The dialog that received the click
- * @param which The button that was clicked
- */
- private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
- dialog.dismiss();
- showQuickSettingsTooltipIfNeeded();
- }
-
- @Override
- protected void callOnAlertDialogCheckboxClicked(DialogInterface dialog, int which) {
- super.callOnAlertDialogCheckboxClicked(dialog, which);
- showQuickSettingsTooltipIfNeeded(getShortcutTypeCheckBoxValue());
- }
-
void onDialogButtonFromShortcutClicked(View view) {
final int viewId = view.getId();
if (viewId == R.id.permission_enable_allow_button) {
diff --git a/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java
index e421626..1f498d6 100644
--- a/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java
@@ -33,6 +33,7 @@
import android.view.ViewGroup;
import com.android.settings.R;
+import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import com.android.settings.widget.SettingsMainSwitchPreference;
import java.util.ArrayList;
@@ -50,7 +51,9 @@
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
- super.onPreferenceToggled(preferenceKey, enabled);
+ if (enabled) {
+ showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
+ }
logAccessibilityServiceEnabled(mComponentName, enabled);
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? ON : OFF);
}
diff --git a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
index b1b9f81..c4df5bf 100644
--- a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
@@ -35,6 +35,7 @@
import androidx.preference.Preference;
import com.android.settings.R;
+import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.widget.SettingsMainSwitchPreference;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -165,7 +166,9 @@
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
- super.onPreferenceToggled(preferenceKey, enabled);
+ if (enabled) {
+ showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
+ }
logAccessibilityServiceEnabled(mComponentName, enabled);
Settings.Secure.putInt(getContentResolver(), ENABLED, enabled ? ON : OFF);
}
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 8ee7c8d..05b21d8 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -56,6 +56,7 @@
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogType;
+import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
import com.android.settings.utils.LocaleUtils;
import com.android.settings.widget.SettingsMainSwitchBar;
@@ -104,6 +105,7 @@
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
protected static final String KEY_SAVED_USER_SHORTCUT_TYPE = "shortcut_type";
protected static final String KEY_SAVED_QS_TOOLTIP_RESHOW = "qs_tooltip_reshow";
+ protected static final String KEY_SAVED_QS_TOOLTIP_TYPE = "qs_tooltip_type";
protected static final String KEY_ANIMATED_IMAGE = "animated_image";
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
@@ -114,6 +116,7 @@
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
private boolean mNeedsQSTooltipReshow = false;
+ private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
public static final int NOT_SET = -1;
// Save user's shortcutType value when savedInstance has value (e.g. device rotated).
@@ -149,6 +152,9 @@
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
}
+ if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_TYPE)) {
+ mNeedsQSTooltipType = savedInstanceState.getInt(KEY_SAVED_QS_TOOLTIP_TYPE);
+ }
}
setupDefaultShortcutIfNecessary(getPrefContext());
@@ -255,6 +261,7 @@
}
if (mTooltipWindow != null) {
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, mTooltipWindow.isShowing());
+ outState.putInt(KEY_SAVED_QS_TOOLTIP_TYPE, mNeedsQSTooltipType);
}
super.onSaveInstanceState(outState);
}
@@ -275,7 +282,7 @@
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
mDialog = AccessibilityGestureNavigationTutorial
.createAccessibilityTutorialDialog(getPrefContext(),
- getUserShortcutTypes());
+ getUserShortcutTypes(), this::callOnTutorialDialogButtonClicked);
mDialog.setCanceledOnTouchOutside(false);
return mDialog;
default:
@@ -696,6 +703,17 @@
}
/**
+ * This method will be invoked when a button in the tutorial dialog is clicked.
+ *
+ * @param dialog The dialog that received the click
+ * @param which The button that was clicked
+ */
+ private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ showQuickSettingsTooltipIfNeeded();
+ }
+
+ /**
* This method will be invoked when a button in the edit shortcut dialog is clicked.
*
* @param dialog The dialog that received the click
@@ -707,12 +725,17 @@
}
final int value = getShortcutTypeCheckBoxValue();
-
saveNonEmptyUserShortcutType(value);
AccessibilityUtil.optInAllValuesToSettings(getPrefContext(), value, mComponentName);
AccessibilityUtil.optOutAllValuesFromSettings(getPrefContext(), ~value, mComponentName);
- mShortcutPreference.setChecked(value != UserShortcutType.EMPTY);
+ final boolean shortcutAssigned = value != UserShortcutType.EMPTY;
+ mShortcutPreference.setChecked(shortcutAssigned);
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
+
+ // Show the quick setting tooltip if the shortcut assigned in the first time
+ if (shortcutAssigned) {
+ showQuickSettingsTooltipIfNeeded();
+ }
}
protected void updateShortcutPreferenceData() {
@@ -824,23 +847,17 @@
}
/**
- * Shows the quick settings tooltip if the quick settings service and the shortcut are assigned.
- * The tooltip only shows once.
+ * Shows the quick settings tooltip if the quick settings feature is assigned. The tooltip only
+ * shows once.
*
- * @param shortcutType The shortcut type.
+ * @param type The quick settings tooltip type
*/
- protected void showQuickSettingsTooltipIfNeeded(@UserShortcutType int shortcutType) {
- if (shortcutType == AccessibilityUtil.UserShortcutType.EMPTY) {
- return;
- }
+ protected void showQuickSettingsTooltipIfNeeded(@QuickSettingsTooltipType int type) {
+ mNeedsQSTooltipType = type;
showQuickSettingsTooltipIfNeeded();
}
- /**
- * Shows the quick settings tooltip if the quick settings service is assigned. The tooltip only
- * shows once.
- */
- protected void showQuickSettingsTooltipIfNeeded() {
+ private void showQuickSettingsTooltipIfNeeded() {
final ComponentName tileComponentName = getTileComponentName();
if (tileComponentName == null) {
// Returns if no tile service assigned.
@@ -859,10 +876,13 @@
return;
}
- final String title =
- getString(R.string.accessibility_service_quick_settings_tooltips_content, tileName);
+ final int titleResId = mNeedsQSTooltipType == QuickSettingsTooltipType.GUIDE_TO_EDIT
+ ? R.string.accessibility_service_qs_tooltips_content
+ : R.string.accessibility_service_auto_added_qs_tooltips_content;
+ final String title = getString(titleResId, tileName);
+ final int imageResId = R.drawable.accessibility_qs_tooltips_illustration;
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(getContext());
- mTooltipWindow.setup(title);
+ mTooltipWindow.setup(title, imageResId);
mTooltipWindow.showAtTopCenter(getView());
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(getContext(),
tileComponentName);
diff --git a/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
index 1e2e9e5..fb9c4a8 100644
--- a/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
@@ -36,6 +36,7 @@
import androidx.preference.SwitchPreference;
import com.android.settings.R;
+import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.widget.SeekBarPreference;
import com.android.settings.widget.SettingsMainSwitchPreference;
@@ -147,7 +148,9 @@
@Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
- super.onPreferenceToggled(preferenceKey, enabled);
+ if (enabled) {
+ showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
+ }
logAccessibilityServiceEnabled(mComponentName, enabled);
mColorDisplayManager.setReduceBrightColorsActivated(enabled);
}
diff --git a/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java b/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
index a2dd4bf..dee24df 100644
--- a/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
+++ b/src/com/android/settings/activityembedding/ActivityEmbeddingRulesController.java
@@ -34,6 +34,7 @@
import androidx.window.embedding.SplitRule;
import com.android.settings.Settings;
+import com.android.settings.SettingsActivity;
import com.android.settings.SubSettings;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction;
@@ -196,6 +197,7 @@
addActivityFilter(activityFilters, Settings.class);
final Intent intent = new Intent(mContext, Settings.NetworkDashboardActivity.class);
+ intent.putExtra(SettingsActivity.EXTRA_IS_SECONDARY_LAYER_PAGE, true);
final SplitPlaceholderRule placeholderRule = new SplitPlaceholderRule(
activityFilters,
intent,
diff --git a/src/com/android/settings/applications/ProcessStatsBase.java b/src/com/android/settings/applications/ProcessStatsBase.java
index 67fc4c1..ce1453f 100644
--- a/src/com/android/settings/applications/ProcessStatsBase.java
+++ b/src/com/android/settings/applications/ProcessStatsBase.java
@@ -30,7 +30,7 @@
import com.android.settings.applications.ProcStatsData.MemInfo;
import com.android.settings.core.SubSettingLauncher;
import com.android.settingslib.core.instrumentation.Instrumentable;
-import com.android.settingslib.widget.settingsspinner.SettingsSpinnerAdapter;
+import com.android.settingslib.widget.SettingsSpinnerAdapter;
public abstract class ProcessStatsBase extends SettingsPreferenceFragment
implements OnItemSelectedListener {
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 0c12706..a6ce6fb 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -135,7 +135,7 @@
import com.android.settingslib.applications.ApplicationsState.VolumeFilter;
import com.android.settingslib.fuelgauge.PowerAllowlistBackend;
import com.android.settingslib.utils.ThreadUtils;
-import com.android.settingslib.widget.settingsspinner.SettingsSpinnerAdapter;
+import com.android.settingslib.widget.SettingsSpinnerAdapter;
import com.google.android.material.appbar.AppBarLayout;
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
index ec3e11f..d80512e 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
@@ -46,21 +46,22 @@
protected void init(PreferenceScreen screen) {
mFooterPreference = screen.findPreference(KEY_DEVICE_DETAILS_FOOTER);
mFooterPreference.setTitle(mContext.getString(
- R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
+ R.string.bluetooth_device_mac_address, mCachedDevice.getIdentityAddress()));
}
@Override
protected void refresh() {
if (mCachedDevice.getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
StringBuilder title = new StringBuilder(mContext.getString(
- R.string.bluetooth_multuple_devices_mac_address, mCachedDevice.getAddress()));
+ R.string.bluetooth_multuple_devices_mac_address,
+ mCachedDevice.getIdentityAddress()));
for (CachedBluetoothDevice member: mCachedDevice.getMemberDevice()) {
- title.append("\n").append(member.getAddress());
+ title.append("\n").append(member.getIdentityAddress());
}
mFooterPreference.setTitle(title);
} else {
mFooterPreference.setTitle(mContext.getString(
- R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
+ R.string.bluetooth_device_mac_address, mCachedDevice.getIdentityAddress()));
}
}
diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpController.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpController.java
index bbaaa31..c440499 100644
--- a/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpController.java
+++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpController.java
@@ -77,6 +77,12 @@
public boolean onPreferenceClick(Preference preference) {
SystemProperties.set(TRANSCODE_MTP_SYS_PROP_KEY,
Boolean.toString(mSwitchPreference.isChecked()));
+
+ final long previousFunctions = mUsbBackend.getCurrentFunctions();
+ // Toggle the MTP connection to reload file sizes for files shared via MTP clients
+ mUsbBackend.setCurrentFunctions(previousFunctions & ~UsbManager.FUNCTION_MTP);
+ mUsbBackend.setCurrentFunctions(previousFunctions);
+
return true;
}
diff --git a/src/com/android/settings/core/SubSettingLauncher.java b/src/com/android/settings/core/SubSettingLauncher.java
index 616d72f3..93a939f 100644
--- a/src/com/android/settings/core/SubSettingLauncher.java
+++ b/src/com/android/settings/core/SubSettingLauncher.java
@@ -43,11 +43,11 @@
}
mContext = context;
mLaunchRequest = new LaunchRequest();
- mLaunchRequest.transitionType = TransitionType.TRANSITION_SHARED_AXIS;
+ mLaunchRequest.mTransitionType = TransitionType.TRANSITION_SHARED_AXIS;
}
public SubSettingLauncher setDestination(String fragmentName) {
- mLaunchRequest.destinationName = fragmentName;
+ mLaunchRequest.mDestinationName = fragmentName;
return this;
}
@@ -67,9 +67,9 @@
* @param titleResId res id of string, will use package name to resolve
*/
public SubSettingLauncher setTitleRes(String titlePackageName, @StringRes int titleResId) {
- mLaunchRequest.titleResPackageName = titlePackageName;
- mLaunchRequest.titleResId = titleResId;
- mLaunchRequest.title = null;
+ mLaunchRequest.mTitleResPackageName = titlePackageName;
+ mLaunchRequest.mTitleResId = titleResId;
+ mLaunchRequest.mTitle = null;
return this;
}
@@ -82,22 +82,22 @@
* @param title text title
*/
public SubSettingLauncher setTitleText(CharSequence title) {
- mLaunchRequest.title = title;
+ mLaunchRequest.mTitle = title;
return this;
}
public SubSettingLauncher setArguments(Bundle arguments) {
- mLaunchRequest.arguments = arguments;
+ mLaunchRequest.mArguments = arguments;
return this;
}
public SubSettingLauncher setExtras(Bundle extras) {
- mLaunchRequest.extras = extras;
+ mLaunchRequest.mExtras = extras;
return this;
}
public SubSettingLauncher setSourceMetricsCategory(int sourceMetricsCategory) {
- mLaunchRequest.sourceMetricsCategory = sourceMetricsCategory;
+ mLaunchRequest.mSourceMetricsCategory = sourceMetricsCategory;
return this;
}
@@ -108,17 +108,23 @@
}
public SubSettingLauncher addFlags(int flags) {
- mLaunchRequest.flags |= flags;
+ mLaunchRequest.mFlags |= flags;
return this;
}
public SubSettingLauncher setUserHandle(UserHandle userHandle) {
- mLaunchRequest.userHandle = userHandle;
+ mLaunchRequest.mUserHandle = userHandle;
return this;
}
public SubSettingLauncher setTransitionType(int transitionType) {
- mLaunchRequest.transitionType = transitionType;
+ mLaunchRequest.mTransitionType = transitionType;
+ return this;
+ }
+
+ /** Decide whether the next page is secondary layer page or not. */
+ public SubSettingLauncher setIsSecondaryLayerPage(boolean isSecondaryLayerPage) {
+ mLaunchRequest.mIsSecondaryLayerPage = isSecondaryLayerPage;
return this;
}
@@ -131,14 +137,14 @@
final Intent intent = toIntent();
- boolean launchAsUser = mLaunchRequest.userHandle != null
- && mLaunchRequest.userHandle.getIdentifier() != UserHandle.myUserId();
+ boolean launchAsUser = mLaunchRequest.mUserHandle != null
+ && mLaunchRequest.mUserHandle.getIdentifier() != UserHandle.myUserId();
boolean launchForResult = mLaunchRequest.mResultListener != null;
if (launchAsUser && launchForResult) {
- launchForResultAsUser(intent, mLaunchRequest.userHandle, mLaunchRequest.mResultListener,
- mLaunchRequest.mRequestCode);
+ launchForResultAsUser(intent, mLaunchRequest.mUserHandle,
+ mLaunchRequest.mResultListener, mLaunchRequest.mRequestCode);
} else if (launchAsUser && !launchForResult) {
- launchAsUser(intent, mLaunchRequest.userHandle);
+ launchAsUser(intent, mLaunchRequest.mUserHandle);
} else if (!launchAsUser && launchForResult) {
launchForResult(mLaunchRequest.mResultListener, intent, mLaunchRequest.mRequestCode);
} else {
@@ -150,26 +156,28 @@
final Intent intent = new Intent(Intent.ACTION_MAIN);
copyExtras(intent);
intent.setClass(mContext, SubSettings.class);
- if (TextUtils.isEmpty(mLaunchRequest.destinationName)) {
+ if (TextUtils.isEmpty(mLaunchRequest.mDestinationName)) {
throw new IllegalArgumentException("Destination fragment must be set");
}
- intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, mLaunchRequest.destinationName);
+ intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, mLaunchRequest.mDestinationName);
- if (mLaunchRequest.sourceMetricsCategory < 0) {
+ if (mLaunchRequest.mSourceMetricsCategory < 0) {
throw new IllegalArgumentException("Source metrics category must be set");
}
intent.putExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY,
- mLaunchRequest.sourceMetricsCategory);
+ mLaunchRequest.mSourceMetricsCategory);
- intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, mLaunchRequest.arguments);
+ intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, mLaunchRequest.mArguments);
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RES_PACKAGE_NAME,
- mLaunchRequest.titleResPackageName);
+ mLaunchRequest.mTitleResPackageName);
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID,
- mLaunchRequest.titleResId);
- intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, mLaunchRequest.title);
- intent.addFlags(mLaunchRequest.flags);
+ mLaunchRequest.mTitleResId);
+ intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, mLaunchRequest.mTitle);
+ intent.addFlags(mLaunchRequest.mFlags);
intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
- mLaunchRequest.transitionType);
+ mLaunchRequest.mTransitionType);
+ intent.putExtra(SettingsActivity.EXTRA_IS_SECONDARY_LAYER_PAGE,
+ mLaunchRequest.mIsSecondaryLayerPage);
return intent;
}
@@ -196,8 +204,8 @@
}
private void copyExtras(Intent intent) {
- if (mLaunchRequest.extras != null) {
- intent.replaceExtras(mLaunchRequest.extras);
+ if (mLaunchRequest.mExtras != null) {
+ intent.replaceExtras(mLaunchRequest.mExtras);
}
}
@@ -205,17 +213,18 @@
* Simple container that has information about how to launch a subsetting.
*/
static class LaunchRequest {
- String destinationName;
- int titleResId;
- String titleResPackageName;
- CharSequence title;
- int sourceMetricsCategory = -100;
- int flags;
+ String mDestinationName;
+ int mTitleResId;
+ String mTitleResPackageName;
+ CharSequence mTitle;
+ int mSourceMetricsCategory = -100;
+ int mFlags;
Fragment mResultListener;
int mRequestCode;
- UserHandle userHandle;
- int transitionType;
- Bundle arguments;
- Bundle extras;
+ UserHandle mUserHandle;
+ int mTransitionType;
+ Bundle mArguments;
+ Bundle mExtras;
+ boolean mIsSecondaryLayerPage;
}
}
diff --git a/src/com/android/settings/dashboard/profileselector/UserAdapter.java b/src/com/android/settings/dashboard/profileselector/UserAdapter.java
index 7057961..abf22df 100644
--- a/src/com/android/settings/dashboard/profileselector/UserAdapter.java
+++ b/src/com/android/settings/dashboard/profileselector/UserAdapter.java
@@ -78,7 +78,7 @@
}
private static Drawable encircle(Context context, Drawable icon) {
- return new UserIconDrawable(UserIconDrawable.getSizeForList(context))
+ return new UserIconDrawable(UserIconDrawable.getDefaultSize(context))
.setIconDrawable(icon).bake();
}
}
diff --git a/src/com/android/settings/datausage/CycleAdapter.java b/src/com/android/settings/datausage/CycleAdapter.java
index 1292d00..2cabd8d 100644
--- a/src/com/android/settings/datausage/CycleAdapter.java
+++ b/src/com/android/settings/datausage/CycleAdapter.java
@@ -27,7 +27,7 @@
import com.android.settings.Utils;
import com.android.settingslib.net.ChartData;
import com.android.settingslib.net.NetworkCycleData;
-import com.android.settingslib.widget.settingsspinner.SettingsSpinnerAdapter;
+import com.android.settingslib.widget.SettingsSpinnerAdapter;
import java.time.ZonedDateTime;
import java.util.Iterator;
diff --git a/src/com/android/settings/datausage/SpinnerPreference.java b/src/com/android/settings/datausage/SpinnerPreference.java
index 67298a1..867930b 100644
--- a/src/com/android/settings/datausage/SpinnerPreference.java
+++ b/src/com/android/settings/datausage/SpinnerPreference.java
@@ -18,12 +18,12 @@
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
+import android.widget.Spinner;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
-import com.android.settingslib.widget.settingsspinner.SettingsSpinner;
public class SpinnerPreference extends Preference implements CycleAdapter.SpinnerInterface {
@@ -63,7 +63,7 @@
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
- SettingsSpinner spinner = (SettingsSpinner) holder.findViewById(R.id.cycles_spinner);
+ Spinner spinner = (Spinner) holder.findViewById(R.id.cycles_spinner);
spinner.setAdapter(mAdapter);
spinner.setSelection(mPosition);
spinner.setOnItemSelectedListener(mOnSelectedListener);
diff --git a/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java b/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java
index ceba8be..08e523c 100644
--- a/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java
+++ b/src/com/android/settings/datausage/UnrestrictedDataAccessPreference.java
@@ -48,7 +48,6 @@
ApplicationsState applicationsState, DataSaverBackend dataSaverBackend,
DashboardFragment parentFragment) {
super(context);
- setWidgetLayoutResource(R.layout.restricted_switch_widget);
mHelper = new RestrictedPreferenceHelper(context, this, null);
mEntry = entry;
mDataUsageState = (AppStateDataUsageBridge.DataUsageState) mEntry.extraInfo;
@@ -131,10 +130,6 @@
super.onBindViewHolder(holder);
mHelper.onBindViewHolder(holder);
- holder.findViewById(R.id.restricted_icon).setVisibility(
- disabledByAdmin ? View.VISIBLE : View.GONE);
- holder.findViewById(android.R.id.switch_widget).setVisibility(
- disabledByAdmin ? View.GONE : View.VISIBLE);
}
@Override
diff --git a/src/com/android/settings/development/featureflags/FeatureFlagPreference.java b/src/com/android/settings/development/featureflags/FeatureFlagPreference.java
index d6bdb77..992aa0f 100644
--- a/src/com/android/settings/development/featureflags/FeatureFlagPreference.java
+++ b/src/com/android/settings/development/featureflags/FeatureFlagPreference.java
@@ -17,6 +17,8 @@
package com.android.settings.development.featureflags;
import android.content.Context;
+import android.provider.Settings;
+import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import androidx.preference.SwitchPreference;
@@ -49,5 +51,13 @@
} else {
FeatureFlagUtils.setEnabled(getContext(), mKey, isChecked);
}
+
+ // A temporary logic for settings_hide_secondary_page_back_button_in_two_pane
+ // Remove it before Android T release.
+ if (TextUtils.equals(mKey,
+ FeatureFlagUtils.SETTINGS_HIDE_SECONDARY_PAGE_BACK_BUTTON_IN_TWO_PANE)) {
+ Settings.Global.putString(getContext().getContentResolver(),
+ mKey, String.valueOf(isChecked));
+ }
}
}
diff --git a/src/com/android/settings/development/tare/DropdownActivity.java b/src/com/android/settings/development/tare/DropdownActivity.java
index c1a11fa..55f1fec 100644
--- a/src/com/android/settings/development/tare/DropdownActivity.java
+++ b/src/com/android/settings/development/tare/DropdownActivity.java
@@ -26,6 +26,7 @@
import android.widget.Spinner;
import com.android.settings.R;
+import com.android.settingslib.widget.SettingsSpinnerAdapter;
/**
* Dropdown activity to allow for the user to easily switch between the different TARE
@@ -58,9 +59,8 @@
String[] policies = getResources().getStringArray(R.array.tare_policies);
- ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(DropdownActivity.this,
- android.R.layout.simple_list_item_1, policies);
- arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ ArrayAdapter<String> arrayAdapter = new SettingsSpinnerAdapter<String>(this);
+ arrayAdapter.addAll(policies);
mSpinner.setAdapter(arrayAdapter);
mSpinner.setSelection(policy);
diff --git a/src/com/android/settings/deviceinfo/storage/StorageSelectionPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageSelectionPreferenceController.java
index 5d5a2a5..d972575 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageSelectionPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageSelectionPreferenceController.java
@@ -26,8 +26,8 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.widget.SettingsSpinnerAdapter;
import com.android.settingslib.widget.SettingsSpinnerPreference;
-import com.android.settingslib.widget.settingsspinner.SettingsSpinnerAdapter;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/src/com/android/settings/dream/DreamAdapter.java b/src/com/android/settings/dream/DreamAdapter.java
index 8d0e9d5..4e16ccb 100644
--- a/src/com/android/settings/dream/DreamAdapter.java
+++ b/src/com/android/settings/dream/DreamAdapter.java
@@ -48,6 +48,7 @@
private final ImageView mIconView;
private final TextView mTitleView;
private final ImageView mPreviewView;
+ private final ImageView mPreviewPlaceholderView;
private final Button mCustomizeButton;
private final Context mContext;
@@ -55,6 +56,7 @@
super(view);
mContext = context;
mPreviewView = view.findViewById(R.id.preview);
+ mPreviewPlaceholderView = view.findViewById(R.id.preview_placeholder);
mIconView = view.findViewById(R.id.icon);
mTitleView = view.findViewById(R.id.title_text);
mCustomizeButton = view.findViewById(R.id.customize_button);
@@ -68,10 +70,9 @@
final Drawable previewImage = item.getPreviewImage();
if (previewImage != null) {
- mPreviewView.setVisibility(View.VISIBLE);
mPreviewView.setImageDrawable(previewImage);
- } else {
- mPreviewView.setVisibility(View.GONE);
+ mPreviewView.setClipToOutline(true);
+ mPreviewPlaceholderView.setVisibility(View.GONE);
}
final Drawable icon = item.isActive()
diff --git a/src/com/android/settings/dream/DreamComplicationPickerController.java b/src/com/android/settings/dream/DreamComplicationPickerController.java
deleted file mode 100644
index 09ed8da..0000000
--- a/src/com/android/settings/dream/DreamComplicationPickerController.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2022 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.dream;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-import androidx.preference.PreferenceScreen;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.widget.LayoutPreference;
-
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Controller for the component allowing a user to select overlays to show on top of dreams.
- */
-public class DreamComplicationPickerController extends BasePreferenceController {
- private static final String KEY = "dream_complication_picker";
-
- private final DreamBackend mBackend;
- private final Set<Integer> mSupportedComplications;
-
- private class ComplicationItem implements IDreamItem {
- private final int mComplicationType;
- private boolean mEnabled;
-
- ComplicationItem(@DreamBackend.ComplicationType int complicationType) {
- mComplicationType = complicationType;
- mEnabled = mBackend.isComplicationEnabled(mComplicationType);
- }
-
- @Override
- public CharSequence getTitle() {
- return mBackend.getComplicationTitle(mComplicationType);
- }
-
- @Override
- public Drawable getIcon() {
- // TODO(b/215703483): add icon for each complication
- return null;
- }
-
- @Override
- public void onItemClicked() {
- mEnabled = !mEnabled;
- mBackend.setComplicationEnabled(mComplicationType, mEnabled);
- }
-
- @Override
- public Drawable getPreviewImage() {
- // TODO(b/215703483): add preview image for each complication
- return null;
- }
-
- @Override
- public boolean isActive() {
- return mEnabled;
- }
- }
-
- public DreamComplicationPickerController(Context context) {
- super(context, KEY);
- mBackend = DreamBackend.getInstance(context);
- mSupportedComplications = mBackend.getSupportedComplications();
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY;
- }
-
- @Override
- public int getAvailabilityStatus() {
- return mSupportedComplications.size() > 0 ? AVAILABLE
- : CONDITIONALLY_UNAVAILABLE;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
-
- DreamAdapter adapter = new DreamAdapter(mSupportedComplications.stream()
- .map(ComplicationItem::new)
- .collect(Collectors.toList()));
-
- LayoutPreference pref = screen.findPreference(getPreferenceKey());
- if (pref != null) {
- final RecyclerView recyclerView = pref.findViewById(R.id.dream_list);
- recyclerView.setLayoutManager(new AutoFitGridLayoutManager(mContext));
- recyclerView.setHasFixedSize(true);
- recyclerView.setAdapter(adapter);
- }
- }
-}
diff --git a/src/com/android/settings/dream/DreamComplicationPreferenceController.java b/src/com/android/settings/dream/DreamComplicationPreferenceController.java
new file mode 100644
index 0000000..d9c4fb3
--- /dev/null
+++ b/src/com/android/settings/dream/DreamComplicationPreferenceController.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2022 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.dream;
+
+import android.content.Context;
+
+import com.android.settings.R;
+import com.android.settings.core.TogglePreferenceController;
+import com.android.settingslib.dream.DreamBackend;
+
+/**
+ * Controller for the {@link androidx.preference.SwitchPreference} which controls if dream
+ * overlays should be enabled.
+ */
+public class DreamComplicationPreferenceController extends TogglePreferenceController {
+ private final DreamBackend mBackend;
+
+ public DreamComplicationPreferenceController(Context context, String key) {
+ super(context, key);
+ mBackend = DreamBackend.getInstance(context);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return mBackend.getSupportedComplications().isEmpty() ? CONDITIONALLY_UNAVAILABLE
+ : AVAILABLE;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return mBackend.getEnabledComplications().containsAll(mBackend.getSupportedComplications());
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ for (int complication : mBackend.getSupportedComplications()) {
+ mBackend.setComplicationEnabled(complication, isChecked);
+ }
+ return true;
+ }
+
+ @Override
+ public int getSliceHighlightMenuRes() {
+ return R.string.menu_key_display;
+ }
+}
diff --git a/src/com/android/settings/dream/DreamPickerController.java b/src/com/android/settings/dream/DreamPickerController.java
index 6d5463c..b7ba614 100644
--- a/src/com/android/settings/dream/DreamPickerController.java
+++ b/src/com/android/settings/dream/DreamPickerController.java
@@ -21,7 +21,7 @@
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
-import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R;
@@ -71,16 +71,21 @@
}
@Override
- public void updateState(Preference preference) {
- super.updateState(preference);
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
mAdapter = new DreamAdapter(mDreamInfos.stream()
.map(DreamItem::new)
.collect(Collectors.toList()));
- final RecyclerView recyclerView =
- ((LayoutPreference) preference).findViewById(R.id.dream_list);
+ final LayoutPreference pref = screen.findPreference(getPreferenceKey());
+ if (pref == null) {
+ return;
+ }
+ final RecyclerView recyclerView = pref.findViewById(R.id.dream_list);
recyclerView.setLayoutManager(new AutoFitGridLayoutManager(mContext));
+ recyclerView.addItemDecoration(
+ new GridSpacingItemDecoration(mContext, R.dimen.dream_preference_card_padding));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(mAdapter);
}
diff --git a/src/com/android/settings/dream/DreamSettings.java b/src/com/android/settings/dream/DreamSettings.java
index 2acce07..bfa19a9 100644
--- a/src/com/android/settings/dream/DreamSettings.java
+++ b/src/com/android/settings/dream/DreamSettings.java
@@ -34,14 +34,12 @@
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.dream.DreamBackend;
import com.android.settingslib.dream.DreamBackend.WhenToDream;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
@SearchIndexable
@@ -52,7 +50,6 @@
static final String WHILE_DOCKED_ONLY = "while_docked_only";
static final String EITHER_CHARGING_OR_DOCKED = "either_charging_or_docked";
static final String NEVER_DREAM = "never";
- private static final String COMPLICATIONS_CATEGORY_KEY = "dream_complication_category";
@WhenToDream
static int getSettingFromPrefKey(String key) {
@@ -138,14 +135,8 @@
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
- final DreamComplicationPickerController complicationPickerController =
- new DreamComplicationPickerController(context);
-
- controllers.add(complicationPickerController);
- controllers.add(new WhenToDreamPreferenceController(context));
controllers.add(new DreamPickerController(context));
- controllers.add(new PreferenceCategoryController(context, COMPLICATIONS_CATEGORY_KEY)
- .setChildren(Collections.singletonList(complicationPickerController)));
+ controllers.add(new WhenToDreamPreferenceController(context));
return controllers;
}
diff --git a/src/com/android/settings/dream/GridSpacingItemDecoration.java b/src/com/android/settings/dream/GridSpacingItemDecoration.java
new file mode 100644
index 0000000..6e6a551
--- /dev/null
+++ b/src/com/android/settings/dream/GridSpacingItemDecoration.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2022 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.dream;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.view.View;
+
+import androidx.annotation.DimenRes;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * RecyclerView item decorator to be used with {@link GridLayoutManager} for applying padding to
+ * only the inner elements of the grid.
+ */
+public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
+ private final int mSpacing;
+ private final boolean mRtl;
+
+ public GridSpacingItemDecoration(Context context, @DimenRes int spacingId) {
+ mSpacing = context.getResources().getDimensionPixelSize(spacingId);
+ mRtl = context.getResources().getConfiguration().getLayoutDirection()
+ == View.LAYOUT_DIRECTION_RTL;
+ }
+
+ @Override
+ public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
+ RecyclerView.State state) {
+ final RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
+
+ if (!(layoutManager instanceof GridLayoutManager)) {
+ return;
+ }
+
+ final int spanCount = ((GridLayoutManager) layoutManager).getSpanCount();
+ final int position = parent.getChildAdapterPosition(view);
+ final int column = position % spanCount;
+
+ final int startPadding = column * mSpacing / spanCount;
+ final int endPadding = mSpacing - (column + 1) * mSpacing / spanCount;
+
+ outRect.left = mRtl ? endPadding : startPadding;
+ outRect.right = mRtl ? startPadding : endPadding;
+ if (position >= spanCount) {
+ outRect.top = mSpacing;
+ }
+ }
+}
diff --git a/packages/apps/Settings/src/com/android/settings/dream/OWNERS b/src/com/android/settings/dream/OWNERS
similarity index 100%
rename from packages/apps/Settings/src/com/android/settings/dream/OWNERS
rename to src/com/android/settings/dream/OWNERS
diff --git a/src/com/android/settings/fuelgauge/BatteryAppListPreferenceController.java b/src/com/android/settings/fuelgauge/BatteryAppListPreferenceController.java
index 815f2fd..8dbce79 100644
--- a/src/com/android/settings/fuelgauge/BatteryAppListPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/BatteryAppListPreferenceController.java
@@ -36,6 +36,7 @@
import android.text.format.DateUtils;
import android.util.ArrayMap;
import android.util.SparseArray;
+import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -64,6 +65,7 @@
*/
public class BatteryAppListPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, LifecycleObserver, OnPause, OnDestroy {
+ private static final String TAG = "BatteryAppListPreferenceController";
@VisibleForTesting
static final boolean USE_FAKE_DATA = false;
private static final int MAX_ITEMS_TO_LIST = USE_FAKE_DATA ? 30 : 20;
@@ -103,9 +105,14 @@
PowerProfile powerProfile = new PowerProfile(context);
// Cheap hack to try to figure out if the power_profile.xml was populated.
- return powerProfile.getAveragePowerForOrdinal(
- PowerProfile.POWER_GROUP_DISPLAY_SCREEN_FULL, 0)
- >= MIN_AVERAGE_POWER_THRESHOLD_MILLI_AMP;
+ final double averagePowerForOrdinal = powerProfile.getAveragePowerForOrdinal(
+ PowerProfile.POWER_GROUP_DISPLAY_SCREEN_FULL, 0);
+ final boolean shouldShowBatteryAttributionList =
+ averagePowerForOrdinal >= MIN_AVERAGE_POWER_THRESHOLD_MILLI_AMP;
+ if (!shouldShowBatteryAttributionList) {
+ Log.w(TAG, "shouldShowBatteryAttributionList(): " + averagePowerForOrdinal);
+ }
+ return shouldShowBatteryAttributionList;
}
};
diff --git a/src/com/android/settings/fuelgauge/BatteryInfo.java b/src/com/android/settings/fuelgauge/BatteryInfo.java
index efb58a5..4e90710 100644
--- a/src/com/android/settings/fuelgauge/BatteryInfo.java
+++ b/src/com/android/settings/fuelgauge/BatteryInfo.java
@@ -37,6 +37,7 @@
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.UsageView;
import com.android.settingslib.R;
+import com.android.settingslib.fuelgauge.BatteryStatus;
import com.android.settingslib.fuelgauge.Estimate;
import com.android.settingslib.fuelgauge.EstimateKt;
import com.android.settingslib.utils.PowerUtil;
@@ -253,7 +254,7 @@
BatteryManager.EXTRA_HEALTH, BatteryManager.BATTERY_HEALTH_UNKNOWN)
== BatteryManager.BATTERY_HEALTH_OVERHEAT;
- info.statusLabel = Utils.getBatteryStatus(context, batteryBroadcast);
+ info.statusLabel = getBatteryStatus(context, batteryBroadcast);
info.batteryStatus = batteryBroadcast.getIntExtra(
BatteryManager.EXTRA_STATUS, BatteryManager.BATTERY_STATUS_UNKNOWN);
if (!info.mCharging) {
@@ -291,7 +292,7 @@
R.string.power_remaining_charging_duration_only, timeString);
info.chargeLabel = context.getString(resId, info.batteryPercentString, timeString);
} else {
- final String chargeStatusLabel = Utils.getBatteryStatus(context, batteryBroadcast);
+ final String chargeStatusLabel = getBatteryStatus(context, batteryBroadcast);
info.remainingLabel = null;
info.chargeLabel = info.batteryLevel == 100 ? info.batteryPercentString :
resources.getString(R.string.power_charging, info.batteryPercentString,
@@ -325,6 +326,35 @@
}
}
+ private static String getBatteryStatus(Context context, Intent batteryChangedIntent) {
+ final Resources res = context.getResources();
+ final boolean isShortStatus =
+ res.getBoolean(com.android.settings.R.bool.config_use_compact_battery_status);
+
+ if (!isShortStatus) {
+ return Utils.getBatteryStatus(context, batteryChangedIntent);
+ }
+
+ final int status = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_STATUS,
+ BatteryManager.BATTERY_STATUS_UNKNOWN);
+ final BatteryStatus batteryStatus = new BatteryStatus(batteryChangedIntent);
+ String statusString = res.getString(R.string.battery_info_status_unknown);
+
+ if (batteryStatus.isCharged()) {
+ statusString = res.getString(R.string.battery_info_status_full);
+ } else {
+ if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
+ statusString = res.getString(R.string.battery_info_status_charging);
+ } else if (status == BatteryManager.BATTERY_STATUS_DISCHARGING) {
+ statusString = res.getString(R.string.battery_info_status_discharging);
+ } else if (status == BatteryManager.BATTERY_STATUS_NOT_CHARGING) {
+ statusString = res.getString(R.string.battery_info_status_not_charging);
+ }
+ }
+
+ return statusString;
+ }
+
public interface BatteryDataParser {
void onParsingStarted(long startTime, long endTime);
diff --git a/src/com/android/settings/gestures/OneHandedSettings.java b/src/com/android/settings/gestures/OneHandedSettings.java
index 3825896..0e6b402 100644
--- a/src/com/android/settings/gestures/OneHandedSettings.java
+++ b/src/com/android/settings/gestures/OneHandedSettings.java
@@ -26,6 +26,7 @@
import com.android.internal.accessibility.AccessibilityShortcutController;
import com.android.settings.R;
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
+import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import com.android.settings.accessibility.ShortcutPreference;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.widget.IllustrationPreference;
@@ -64,7 +65,7 @@
mainSwitchPreference.addOnSwitchChangeListener((switchView, isChecked) -> {
switchView.setChecked(isChecked);
if (isChecked) {
- showQuickSettingsTooltipIfNeeded();
+ showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_DIRECT_USE);
}
});
}
diff --git a/src/com/android/settings/homepage/TopLevelSettings.java b/src/com/android/settings/homepage/TopLevelSettings.java
index 7ce6730..734e079 100644
--- a/src/com/android/settings/homepage/TopLevelSettings.java
+++ b/src/com/android/settings/homepage/TopLevelSettings.java
@@ -119,6 +119,7 @@
? ((Instrumentable) caller).getMetricsCategory()
: Instrumentable.METRICS_CATEGORY_UNKNOWN)
.setTitleRes(-1)
+ .setIsSecondaryLayerPage(true)
.launch();
return true;
}
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
index 442af38..5c7c54e 100644
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
@@ -97,23 +97,19 @@
public PrivateDnsModeDialogPreference(Context context) {
super(context);
- initialize();
}
public PrivateDnsModeDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
- initialize();
}
public PrivateDnsModeDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- initialize();
}
public PrivateDnsModeDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- initialize();
}
private final AnnotationSpan.LinkInfo mUrlLinkInfo = new AnnotationSpan.LinkInfo(
@@ -131,12 +127,6 @@
}
});
- private void initialize() {
- // Add the "Restricted" icon resource so that if the preference is disabled by the
- // admin, an information button will be shown.
- setWidgetLayoutResource(R.layout.restricted_icon);
- }
-
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
@@ -146,13 +136,6 @@
// by the controller.
holder.itemView.setEnabled(true);
}
-
- final View restrictedIcon = holder.findViewById(R.id.restricted_icon);
- if (restrictedIcon != null) {
- // Show the "Restricted" icon if, and only if, the preference was disabled by
- // the admin.
- restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE);
- }
}
@Override
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index 0cfed20..021d673 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -133,7 +133,9 @@
appInfo.settingsComponent = null;
}
appInfo.description = service.getDescription();
- appInfo.icon = pm.getUserBadgedIcon(service.loadIcon(pm), appInfo.userHandle);
+ Drawable icon = (service.loadBanner(pm) != null)
+ ? service.loadBanner(pm) : service.loadIcon(pm);
+ appInfo.icon = pm.getUserBadgedIcon(icon, appInfo.userHandle);
appInfos.add(appInfo);
}
diff --git a/src/com/android/settings/notification/NotificationLockscreenPreference.java b/src/com/android/settings/notification/NotificationLockscreenPreference.java
deleted file mode 100644
index b236014..0000000
--- a/src/com/android/settings/notification/NotificationLockscreenPreference.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2016 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.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.provider.Settings;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.ListView;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AlertDialog.Builder;
-
-import com.android.settings.R;
-import com.android.settings.RestrictedListPreference;
-import com.android.settings.Utils;
-import com.android.settingslib.RestrictedLockUtils;
-
-public class NotificationLockscreenPreference extends RestrictedListPreference {
-
- private boolean mAllowRemoteInput;
- private Listener mListener;
- private boolean mShowRemoteInput;
- private boolean mRemoteInputCheckBoxEnabled = true;
- private int mUserId = UserHandle.myUserId();
- private RestrictedLockUtils.EnforcedAdmin mAdminRestrictingRemoteInput;
-
- public NotificationLockscreenPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public void setRemoteInputCheckBoxEnabled(boolean enabled) {
- mRemoteInputCheckBoxEnabled = enabled;
- }
-
- public void setRemoteInputRestricted(RestrictedLockUtils.EnforcedAdmin admin) {
- mAdminRestrictingRemoteInput = admin;
- }
-
- @Override
- protected void onClick() {
- final Context context = getContext();
- if (!Utils.startQuietModeDialogIfNecessary(context, UserManager.get(context), mUserId)) {
- // Call super to create preference dialog only when work mode is on
- // startQuietModeDialogIfNecessary will return false if mUserId is not a managed user
- super.onClick();
- }
- }
-
- public void setUserId(int userId) {
- mUserId = userId;
- }
-
- @Override
- protected void onPrepareDialogBuilder(Builder builder,
- DialogInterface.OnClickListener innerListener) {
-
- mListener = new Listener(innerListener);
- builder.setSingleChoiceItems(createListAdapter(builder.getContext()), getSelectedValuePos(),
- mListener);
- mShowRemoteInput = getEntryValues().length == 3;
- mAllowRemoteInput = Settings.Secure.getInt(getContext().getContentResolver(),
- Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0) != 0;
- builder.setView(R.layout.lockscreen_remote_input);
- }
-
- @Override
- protected void onDialogCreated(Dialog dialog) {
- super.onDialogCreated(dialog);
- dialog.create();
- CheckBox checkbox = (CheckBox) dialog.findViewById(R.id.lockscreen_remote_input);
- checkbox.setChecked(!mAllowRemoteInput);
- checkbox.setOnCheckedChangeListener(mListener);
- checkbox.setEnabled(mAdminRestrictingRemoteInput == null);
-
- View restricted = dialog.findViewById(R.id.restricted_lock_icon_remote_input);
- restricted.setVisibility(mAdminRestrictingRemoteInput == null ? View.GONE : View.VISIBLE);
-
- if (mAdminRestrictingRemoteInput != null) {
- checkbox.setClickable(false);
- dialog.findViewById(com.android.internal.R.id.customPanel)
- .setOnClickListener(mListener);
- }
- }
-
- @Override
- protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) {
- super.onDialogStateRestored(dialog, savedInstanceState);
- ListView listView = ((AlertDialog) dialog).getListView();
- int selectedPosition = listView.getCheckedItemPosition();
-
- View panel = dialog.findViewById(com.android.internal.R.id.customPanel);
- panel.setVisibility(checkboxVisibilityForSelectedIndex(selectedPosition,
- mShowRemoteInput));
- mListener.setView(panel);
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
- Settings.Secure.putInt(getContext().getContentResolver(),
- Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, mAllowRemoteInput ? 1 : 0);
- }
-
- @Override
- protected boolean isAutoClosePreference() {
- return false;
- }
-
- private int checkboxVisibilityForSelectedIndex(int selected,
- boolean showRemoteAtAll) {
- return selected == 1 && showRemoteAtAll && mRemoteInputCheckBoxEnabled ? View.VISIBLE
- : View.GONE;
- }
-
- private class Listener implements DialogInterface.OnClickListener,
- CompoundButton.OnCheckedChangeListener, View.OnClickListener {
-
- private final DialogInterface.OnClickListener mInner;
- private View mView;
-
- public Listener(DialogInterface.OnClickListener inner) {
- mInner = inner;
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- mInner.onClick(dialog, which);
- ListView listView = ((AlertDialog) dialog).getListView();
- int selectedPosition = listView.getCheckedItemPosition();
- if (mView != null) {
- mView.setVisibility(
- checkboxVisibilityForSelectedIndex(selectedPosition, mShowRemoteInput));
- }
- }
-
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- mAllowRemoteInput = !isChecked;
- }
-
- public void setView(View view) {
- mView = view;
- }
-
- @Override
- public void onClick(View v) {
- if (v.getId() == com.android.internal.R.id.customPanel) {
- RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(),
- mAdminRestrictingRemoteInput);
- }
- }
- }
-}
diff --git a/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiver.java b/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiver.java
index 55e8bba..bdc52ad 100644
--- a/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiver.java
+++ b/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiver.java
@@ -16,6 +16,8 @@
package com.android.settings.safetycenter;
+import static android.content.Intent.ACTION_BOOT_COMPLETED;
+import static android.safetycenter.SafetyCenterManager.ACTION_REFRESH_SAFETY_SOURCES;
import static android.safetycenter.SafetyCenterManager.EXTRA_REFRESH_SAFETY_SOURCE_IDS;
import android.content.BroadcastReceiver;
@@ -24,6 +26,8 @@
import com.google.common.collect.ImmutableList;
+import java.util.List;
+
/** Broadcast receiver for handling requests from Safety Center for fresh data. */
public class SafetySourceBroadcastReceiver extends BroadcastReceiver {
@@ -33,9 +37,22 @@
return;
}
- ImmutableList<String> sourceIds =
- ImmutableList.copyOf(intent.getStringArrayExtra(EXTRA_REFRESH_SAFETY_SOURCE_IDS));
+ if (ACTION_REFRESH_SAFETY_SOURCES.equals(intent.getAction())) {
+ String[] sourceIdsExtra =
+ intent.getStringArrayExtra(EXTRA_REFRESH_SAFETY_SOURCE_IDS);
+ if (sourceIdsExtra != null && sourceIdsExtra.length > 0) {
+ refreshSafetySources(context, ImmutableList.copyOf(sourceIdsExtra));
+ }
+ return;
+ }
+
+ if (ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+ refreshAllSafetySources(context);
+ }
+ }
+
+ private static void refreshSafetySources(Context context, List<String> sourceIds) {
if (sourceIds.contains(LockScreenSafetySource.SAFETY_SOURCE_ID)) {
LockScreenSafetySource.sendSafetyData(context);
}
@@ -44,4 +61,9 @@
BiometricsSafetySource.sendSafetyData(context);
}
}
+
+ private static void refreshAllSafetySources(Context context) {
+ LockScreenSafetySource.sendSafetyData(context);
+ BiometricsSafetySource.sendSafetyData(context);
+ }
}
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 3ea1502..9878b44 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -737,7 +737,8 @@
if (newUserIcon != userIcon) {
ThreadUtils.postOnBackgroundThread(() ->
mUserManager.setUserIcon(user.id,
- UserIcons.convertToBitmap(newUserIcon)));
+ UserIcons.convertToBitmapAtUserIconSize(
+ activity.getResources(), newUserIcon)));
mMePreference.setIcon(newUserIcon);
}
@@ -891,7 +892,9 @@
if (newUserIcon == null) {
newUserIcon = UserIcons.getDefaultUserIcon(getResources(), user.id, false);
}
- mUserManager.setUserIcon(user.id, UserIcons.convertToBitmap(newUserIcon));
+ mUserManager.setUserIcon(
+ user.id, UserIcons.convertToBitmapAtUserIconSize(
+ getResources(), newUserIcon));
if (mUserType == USER_TYPE_USER) {
mHandler.sendEmptyMessage(MESSAGE_UPDATE_LIST);
@@ -1315,7 +1318,7 @@
// Try finding the corresponding bitmap in the dark bitmap cache
bitmap = sDarkDefaultUserBitmapCache.get(userId);
if (bitmap == null) {
- bitmap = UserIcons.convertToBitmap(
+ bitmap = UserIcons.convertToBitmapAtUserIconSize(resources,
UserIcons.getDefaultUserIcon(resources, userId, false));
// Save it to cache
sDarkDefaultUserBitmapCache.put(userId, bitmap);
diff --git a/src/com/android/settings/widget/RestrictedAppPreference.java b/src/com/android/settings/widget/RestrictedAppPreference.java
index cd95357..f93b935 100644
--- a/src/com/android/settings/widget/RestrictedAppPreference.java
+++ b/src/com/android/settings/widget/RestrictedAppPreference.java
@@ -20,12 +20,10 @@
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.view.View;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceViewHolder;
-import com.android.settings.R;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedPreferenceHelper;
import com.android.settingslib.widget.AppPreference;
@@ -55,7 +53,6 @@
}
private void initialize(AttributeSet attrs, String userRestriction) {
- setWidgetLayoutResource(R.layout.restricted_icon);
mHelper = new RestrictedPreferenceHelper(getContext(), this, attrs);
this.userRestriction = userRestriction;
}
@@ -64,10 +61,6 @@
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
mHelper.onBindViewHolder(holder);
- final View restrictedIcon = holder.findViewById(R.id.restricted_icon);
- if (restrictedIcon != null) {
- restrictedIcon.setVisibility(isDisabledByAdmin() ? View.VISIBLE : View.GONE);
- }
}
@Override
diff --git a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
index dd0c20a..6f26826 100644
--- a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
+++ b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
@@ -100,7 +100,6 @@
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- setIfOnlyAvailableForAdmins(true);
mIsUiRestricted = isUiRestricted();
}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java
index f595452..a455648 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java
@@ -195,7 +195,7 @@
private void setupBluetoothEnvironment() {
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalBluetoothManager;
mLocalBluetoothManager = Utils.getLocalBtManager(mContext);
- mBluetoothManager = new BluetoothManager(mContext);
+ mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
mBluetoothAdapter = mBluetoothManager.getAdapter();
when(mLocalBluetoothManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
when(mLocalBluetoothManager.getProfileManager()).thenReturn(mLocalBluetoothProfileManager);
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindowTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindowTest.java
index be67977..3fec81a 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindowTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsTooltipWindowTest.java
@@ -53,6 +53,7 @@
private PopupWindow.OnDismissListener mMockOnDismissListener;
private static final String TEST_PACKAGE_NAME = "com.test.package";
+ private static final int TEST_RES_ID = 1234;
private final Context mContext = ApplicationProvider.getApplicationContext();
private AccessibilityQuickSettingsTooltipWindow mTooltipView;
private View mView;
@@ -66,8 +67,8 @@
@Test
public void initTooltipView_atMostAvailableTextWidth() {
final String quickSettingsTooltipsContent = mContext.getString(
- R.string.accessibility_service_quick_settings_tooltips_content, TEST_PACKAGE_NAME);
- mTooltipView.setup(quickSettingsTooltipsContent);
+ R.string.accessibility_service_qs_tooltips_content, TEST_PACKAGE_NAME);
+ mTooltipView.setup(quickSettingsTooltipsContent, TEST_RES_ID);
final int getMaxWidth = mTooltipView.getAvailableWindowWidth();
assertThat(mTooltipView.getWidth()).isAtMost(getMaxWidth);
@@ -75,7 +76,7 @@
@Test
public void showTooltipView_success() {
- mTooltipView.setup(TEST_PACKAGE_NAME);
+ mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID);
assertThat(getLatestPopupWindow()).isNull();
mTooltipView.showAtTopCenter(mView);
@@ -85,7 +86,7 @@
@Test
public void accessibilityClickActionOnTooltipViewShown_shouldInvokeCallbackAndNotShowing() {
- mTooltipView.setup(TEST_PACKAGE_NAME);
+ mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID);
mTooltipView.setOnDismissListener(mMockOnDismissListener);
mTooltipView.showAtTopCenter(mView);
@@ -101,7 +102,7 @@
@Test
public void dismiss_tooltipViewShown_shouldInvokeCallbackAndNotShowing() {
- mTooltipView.setup(TEST_PACKAGE_NAME);
+ mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID);
mTooltipView.setOnDismissListener(mMockOnDismissListener);
mTooltipView.showAtTopCenter(mView);
@@ -113,7 +114,7 @@
@Test
public void waitAutoCloseDelayTime_tooltipViewShown_shouldInvokeCallbackAndNotShowing() {
- mTooltipView.setup(TEST_PACKAGE_NAME, /* closeDelayTimeMillis= */ 1);
+ mTooltipView.setup(TEST_PACKAGE_NAME, TEST_RES_ID, /* closeDelayTimeMillis= */ 1);
mTooltipView.setOnDismissListener(mMockOnDismissListener);
mTooltipView.showAtTopCenter(mView);
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
index ea0f317..d05600a 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
@@ -18,6 +18,7 @@
import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_QS_TOOLTIP_RESHOW;
import static com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment.KEY_SAVED_USER_SHORTCUT_TYPE;
+import static com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
import static com.google.common.truth.Truth.assertThat;
@@ -204,7 +205,7 @@
@Config(shadows = ShadowFragment.class)
public void restoreValueFromSavedInstanceState_showTooltipView() {
mContext.setTheme(R.style.Theme_AppCompat);
- mFragment.showQuickSettingsTooltipIfNeeded();
+ mFragment.showQuickSettingsTooltipIfNeeded(QuickSettingsTooltipType.GUIDE_TO_EDIT);
assertThat(getLatestPopupWindow().isShowing()).isTrue();
final Bundle savedInstanceState = new Bundle();
diff --git a/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionFragmentTest.java
similarity index 89%
rename from tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java
rename to tests/robotests/src/com/android/settings/accessibility/ColorAndMotionFragmentTest.java
index 96756ecd..0bb227e 100644
--- a/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionFragmentTest.java
@@ -32,17 +32,17 @@
import java.util.List;
@RunWith(RobolectricTestRunner.class)
-public class TextAndDisplayFragmentTest {
+public class ColorAndMotionFragmentTest {
private Context mContext = ApplicationProvider.getApplicationContext();
@Test
public void getNonIndexableKeys_existInXmlLayout() {
- final List<String> niks = TextAndDisplayFragment.SEARCH_INDEX_DATA_PROVIDER
+ final List<String> niks = ColorAndMotionFragment.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(mContext);
final List<String> keys =
XmlTestUtils.getKeysFromPreferenceXml(mContext,
- R.xml.accessibility_text_and_display);
+ R.xml.accessibility_color_and_motion);
assertThat(keys).containsAtLeastElementsIn(niks);
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 31687c6..6087ef2 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -99,6 +99,7 @@
mController.mBluetoothAdapter = mBluetoothAdapter;
when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS);
+ when(mCachedDevice.getIdentityAddress()).thenReturn(MAC_ADDRESS);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
index 6401388..08f7084 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
@@ -76,7 +76,7 @@
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
mLifecycleOwner = () -> mLifecycle;
mLifecycle = spy(new Lifecycle(mLifecycleOwner));
- mBluetoothManager = new BluetoothManager(mContext);
+ mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
mBluetoothAdapter = mBluetoothManager.getAdapter();
}
@@ -155,6 +155,7 @@
mDevice = mBluetoothAdapter.getRemoteDevice(config.getAddress());
when(mCachedDevice.getDevice()).thenReturn(mDevice);
when(mCachedDevice.getAddress()).thenReturn(config.getAddress());
+ when(mCachedDevice.getIdentityAddress()).thenReturn(config.getAddress());
}
/**
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
index ce41a8d..fac8b58 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
@@ -89,6 +89,7 @@
when(fragmentManager.beginTransaction()).thenReturn(mFragmentTransaction);
when(mCachedDevice.getAddress()).thenReturn(TEST_ADDRESS);
+ when(mCachedDevice.getIdentityAddress()).thenReturn(TEST_ADDRESS);
Bundle args = new Bundle();
args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS, TEST_ADDRESS);
mFragment.setArguments(args);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingControllerTest.java
index 6da9bf4..88e15eb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingControllerTest.java
@@ -24,6 +24,7 @@
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.Intent;
+import android.os.Parcel;
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
@@ -40,12 +41,22 @@
@Config(shadows = {ShadowBluetoothAdapter.class})
public class BluetoothPairingControllerTest {
private final BluetoothClass mBluetoothClass =
- new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
+ createBtClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
@Mock
private BluetoothDevice mBluetoothDevice;
private Context mContext;
private BluetoothPairingController mBluetoothPairingController;
+ private BluetoothClass createBtClass(int deviceClass) {
+ Parcel p = Parcel.obtain();
+ p.writeInt(deviceClass);
+ p.setDataPosition(0); // reset position of parcel before passing to constructor
+
+ BluetoothClass bluetoothClass = BluetoothClass.CREATOR.createFromParcel(p);
+ p.recycle();
+ return bluetoothClass;
+ }
+
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
index ea841fa..bac868f 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
@@ -305,6 +305,7 @@
when(cachedDevice.isConnected()).thenReturn(true);
when(cachedDevice.getDevice()).thenReturn(device2);
when(cachedDevice.getAddress()).thenReturn(TEST_DEVICE_ADDRESS_B);
+ when(cachedDevice.getIdentityAddress()).thenReturn(TEST_DEVICE_ADDRESS_B);
mFragment.onProfileConnectionStateChanged(cachedDevice, BluetoothProfile.A2DP,
BluetoothAdapter.STATE_CONNECTED);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
index 5c23238..9c266c1 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
@@ -73,6 +73,7 @@
FakeFeatureFactory.setupForTest();
String deviceAddress = "55:66:77:88:99:AA";
when(mCachedDevice.getAddress()).thenReturn(deviceAddress);
+ when(mCachedDevice.getIdentityAddress()).thenReturn(deviceAddress);
when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
when(mCachedDevice.getName()).thenReturn(DEVICE_NAME);
mFragment = spy(ForgetDeviceDialogFragment.newInstance(deviceAddress));
diff --git a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
index c8467b2..ad5b70c 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
@@ -62,6 +62,7 @@
String deviceAddress = "55:66:77:88:99:AA";
when(mCachedDevice.getAddress()).thenReturn(deviceAddress);
+ when(mCachedDevice.getIdentityAddress()).thenReturn(deviceAddress);
mFragment = spy(RemoteDeviceNameDialogFragment.newInstance(mCachedDevice));
doReturn(mCachedDevice).when(mFragment).getDevice(any());
}
diff --git a/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java
index b73e1c9..b04a2cd 100644
--- a/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java
@@ -139,7 +139,7 @@
mPackageManager = Shadow.extract(mContext.getPackageManager());
mPackageManager.setSystemFeature(PackageManager.FEATURE_BLUETOOTH, true);
- mBluetoothManager = new BluetoothManager(mContext);
+ mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
mBluetoothAdapter = mBluetoothManager.getAdapter();
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_1));
diff --git a/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java
index 3910906..2580bfd 100644
--- a/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java
@@ -130,7 +130,7 @@
when(mLocalBluetoothProfileManager.getHeadsetProfile()).thenReturn(mHeadsetProfile);
when(mLocalBluetoothProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile);
- mBluetoothManager = new BluetoothManager(mContext);
+ mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
mBluetoothAdapter = mBluetoothManager.getAdapter();
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_1));
diff --git a/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java
index 306c4c1..10471cb 100644
--- a/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java
@@ -171,7 +171,7 @@
when(mLocalBluetoothProfileManager.getA2dpProfile()).thenReturn(mA2dpProfile);
when(mLocalBluetoothProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile);
- mBluetoothManager = new BluetoothManager(mContext);
+ mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
mBluetoothAdapter = mBluetoothManager.getAdapter();
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_1));
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index 2c694ac..0fa3d5c 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -194,6 +194,29 @@
}
@Test
+ public void testAssignDefaultPhoto_hasDefaultUserIconSize() {
+ doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
+ int size = 100;
+ try {
+ SettingsShadowResources.overrideResource(
+ com.android.internal.R.dimen.user_icon_size,
+ size);
+ assertThat(UserSettings.assignDefaultPhoto(mContext, ACTIVE_USER_ID)).isTrue();
+
+ int pxSize = mContext.getResources()
+ .getDimensionPixelSize(com.android.internal.R.dimen.user_icon_size);
+
+ ArgumentCaptor<Bitmap> captor = ArgumentCaptor.forClass(Bitmap.class);
+ verify(mUserManager).setUserIcon(eq(ACTIVE_USER_ID), captor.capture());
+ Bitmap bitmap = captor.getValue();
+ assertThat(bitmap.getWidth()).isEqualTo(pxSize);
+ assertThat(bitmap.getHeight()).isEqualTo(pxSize);
+ } finally {
+ SettingsShadowResources.reset();
+ }
+ }
+
+ @Test
public void testExitGuest_ShouldLogAction() {
mUserCapabilities.mIsGuest = true;
mFragment.exitGuest();
diff --git a/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java b/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java
index 581286b..6c9addd 100644
--- a/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java
+++ b/tests/unit/src/com/android/settings/safetycenter/SafetySourceBroadcastReceiverTest.java
@@ -16,6 +16,7 @@
package com.android.settings.safetycenter;
+import static android.safetycenter.SafetyCenterManager.ACTION_REFRESH_SAFETY_SOURCES;
import static android.safetycenter.SafetyCenterManager.EXTRA_REFRESH_SAFETY_SOURCE_IDS;
import static com.google.common.truth.Truth.assertThat;
@@ -67,12 +68,34 @@
}
@Test
+ public void sendSafetyData_whenSafetyCenterIsEnabled_withNoIntentAction_sendsNoData() {
+ when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
+ Intent intent = new Intent().putExtra(EXTRA_REFRESH_SAFETY_SOURCE_IDS, new String[]{});
+
+ new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
+
+ verify(mSafetyCenterManagerWrapper, never()).sendSafetyCenterUpdate(any(), any());
+ }
+
+ @Test
public void sendSafetyData_whenSafetyCenterIsDisabled_sendsNoData() {
when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(false);
Intent intent =
- new Intent().putExtra(
- EXTRA_REFRESH_SAFETY_SOURCE_IDS,
- new String[]{ LockScreenSafetySource.SAFETY_SOURCE_ID });
+ new Intent()
+ .setAction(ACTION_REFRESH_SAFETY_SOURCES)
+ .putExtra(
+ EXTRA_REFRESH_SAFETY_SOURCE_IDS,
+ new String[]{ LockScreenSafetySource.SAFETY_SOURCE_ID });
+
+ new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
+
+ verify(mSafetyCenterManagerWrapper, never()).sendSafetyCenterUpdate(any(), any());
+ }
+
+ @Test
+ public void sendSafetyData_whenSafetyCenterIsEnabled_withNullSourceIds_sendsNoData() {
+ when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
+ Intent intent = new Intent().setAction(ACTION_REFRESH_SAFETY_SOURCES);
new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
@@ -82,7 +105,10 @@
@Test
public void sendSafetyData_whenSafetyCenterIsEnabled_withNoSourceIds_sendsNoData() {
when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
- Intent intent = new Intent().putExtra(EXTRA_REFRESH_SAFETY_SOURCE_IDS, new String[]{});
+ Intent intent =
+ new Intent()
+ .setAction(ACTION_REFRESH_SAFETY_SOURCES)
+ .putExtra(EXTRA_REFRESH_SAFETY_SOURCE_IDS, new String[]{});
new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
@@ -93,9 +119,11 @@
public void sendSafetyData_withLockscreenSourceId_sendsLockscreenData() {
when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
Intent intent =
- new Intent().putExtra(
- EXTRA_REFRESH_SAFETY_SOURCE_IDS,
- new String[]{ LockScreenSafetySource.SAFETY_SOURCE_ID });
+ new Intent()
+ .setAction(ACTION_REFRESH_SAFETY_SOURCES)
+ .putExtra(
+ EXTRA_REFRESH_SAFETY_SOURCE_IDS,
+ new String[]{ LockScreenSafetySource.SAFETY_SOURCE_ID });
new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
@@ -110,13 +138,31 @@
public void sendSafetyData_withBiometricsSourceId_sendsBiometricData() {
when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
Intent intent =
- new Intent().putExtra(
- EXTRA_REFRESH_SAFETY_SOURCE_IDS,
- new String[]{ BiometricsSafetySource.SAFETY_SOURCE_ID });
+ new Intent()
+ .setAction(ACTION_REFRESH_SAFETY_SOURCES)
+ .putExtra(
+ EXTRA_REFRESH_SAFETY_SOURCE_IDS,
+ new String[]{ BiometricsSafetySource.SAFETY_SOURCE_ID });
new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
// TODO(b/215517420): Update this test when BiometricSafetySource is implemented.
verify(mSafetyCenterManagerWrapper, never()).sendSafetyCenterUpdate(any(), any());
}
+
+ @Test
+ public void sendSafetyData_onBootCompleted_sendsBiometricAndLockscreenData() {
+ when(mSafetyCenterStatusHolder.isEnabled(mApplicationContext)).thenReturn(true);
+ Intent intent = new Intent().setAction(Intent.ACTION_BOOT_COMPLETED);
+
+ // TODO(b/215517420): Update this test when BiometricSafetySource is implemented to test
+ // that biometrics data is also sent.
+ new SafetySourceBroadcastReceiver().onReceive(mApplicationContext, intent);
+ ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
+ verify(mSafetyCenterManagerWrapper, times(1))
+ .sendSafetyCenterUpdate(any(), captor.capture());
+ SafetySourceData safetySourceData = captor.getValue();
+
+ assertThat(safetySourceData.getId()).isEqualTo(LockScreenSafetySource.SAFETY_SOURCE_ID);
+ }
}