Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev
diff --git a/Android.bp b/Android.bp
index 2d4c42c..bb9db22 100644
--- a/Android.bp
+++ b/Android.bp
@@ -72,6 +72,7 @@
"zxing-core-1.7",
"android.hardware.dumpstate-V1.0-java",
"android.hardware.dumpstate-V1.1-java",
+ "lottie",
],
libs: [
diff --git a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
index 95fef90..7428749 100644
--- a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
@@ -17,9 +17,11 @@
<com.google.android.setupdesign.GlifLayout
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="match_parent"
- android:icon="@drawable/ic_scan_32dp">
+ android:icon="@drawable/ic_scan_32dp"
+ app:sudDescriptionText="@string/wifi_dpp_scan_qr_code_join_unknown_network">
<LinearLayout
style="@style/SudContentFrame"
@@ -28,15 +30,6 @@
android:gravity="center_horizontal"
android:orientation="vertical">
- <TextView
- android:id="@android:id/summary"
- style="@style/TextAppearance.SudGlifBody"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:textAlignment="center"/>
-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/layout/conversation_onboarding.xml b/res/layout/conversation_onboarding.xml
index 5de2166..5d727f6 100644
--- a/res/layout/conversation_onboarding.xml
+++ b/res/layout/conversation_onboarding.xml
@@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorSecondary"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
android:layout_marginTop="47dp"
android:text="@string/conversation_onboarding_title"/>
<TextView
@@ -41,5 +41,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="24dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
android:text="@string/conversation_onboarding_summary"/>
</LinearLayout>
diff --git a/res/layout/face_enroll_education.xml b/res/layout/face_enroll_education.xml
index 4ef32b7..646856f 100644
--- a/res/layout/face_enroll_education.xml
+++ b/res/layout/face_enroll_education.xml
@@ -41,12 +41,22 @@
android:layout_marginVertical="12dp">
<com.google.android.setupdesign.view.IllustrationVideoView
- android:id="@+id/illustration_normal"
+ android:id="@+id/illustration_default"
style="@style/SudContentIllustration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:sudVideo="@raw/face_education"/>
+ <com.airbnb.lottie.LottieAnimationView
+ android:id="@+id/illustration_lottie"
+ android:layout_width="match_parent"
+ android:layout_height="340dp"
+ android:scaleType="fitCenter"
+ android:visibility="invisible"
+ app:lottie_autoPlay="true"
+ app:lottie_loop="true"
+ app:lottie_rawRes="@raw/face_education_lottie" />
+
<ImageView
android:id="@+id/illustration_accessibility"
android:layout_width="wrap_content"
diff --git a/res/layout/face_enroll_introduction.xml b/res/layout/face_enroll_introduction.xml
index 22dba83..7783d72 100644
--- a/res/layout/face_enroll_introduction.xml
+++ b/res/layout/face_enroll_introduction.xml
@@ -21,7 +21,8 @@
style="?attr/face_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ app:sudDescriptionText="@string/security_settings_face_enroll_introduction_message">
<LinearLayout
style="@style/SudContentFrame"
@@ -74,6 +75,7 @@
android:paddingTop="24dp">
<ImageView
+ android:id="@+id/icon_glasses"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_face_enroll_introduction_glasses"/>
@@ -99,6 +101,7 @@
android:paddingTop="24dp">
<ImageView
+ android:id="@+id/icon_looking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_face_enroll_introduction_visibility"/>
@@ -124,6 +127,7 @@
android:paddingTop="24dp">
<ImageView
+ android:id="@+id/icon_security"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_face_enroll_introduction_shield"/>
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index f556f27..8e92bf4 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -17,10 +17,12 @@
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
style="?attr/fingerprint_layout_theme"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ app:sudDescriptionText="@string/security_settings_fingerprint_enroll_introduction_message">
<LinearLayout
style="@style/SudContentFrame"
@@ -71,6 +73,7 @@
android:paddingTop="12dp">
<ImageView
+ android:id="@+id/icon_fingerprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
@@ -91,6 +94,7 @@
android:paddingTop="12dp">
<ImageView
+ android:id="@+id/icon_locked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
@@ -120,6 +124,7 @@
android:paddingTop="12dp">
<ImageView
+ android:id="@+id/icon_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
@@ -151,6 +156,7 @@
android:paddingTop="12dp">
<ImageView
+ android:id="@+id/icon_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
@@ -171,6 +177,7 @@
android:paddingTop="12dp">
<ImageView
+ android:id="@+id/icon_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
diff --git a/res/layout/notification_history.xml b/res/layout/notification_history.xml
index 0b0e1d5..557f172 100644
--- a/res/layout/notification_history.xml
+++ b/res/layout/notification_history.xml
@@ -61,6 +61,7 @@
android:gravity="center"
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceMedium"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
android:text="@string/notification_history_off_title_extended" />
<TextView
@@ -74,6 +75,7 @@
android:textAlignment="center"
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
android:text="@string/notification_history_off_summary" />
</LinearLayout>
@@ -105,6 +107,7 @@
android:gravity="center"
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceMedium"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
android:text="@string/history_toggled_on_title" />
<TextView
@@ -119,6 +122,7 @@
android:textAlignment="center"
android:focusable="true"
android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
android:text="@string/history_toggled_on_summary" />
</LinearLayout>
diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
index 209619c..380fc8a 100644
--- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
@@ -17,9 +17,11 @@
<com.google.android.setupdesign.GlifLayout
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="match_parent"
- android:icon="@drawable/ic_scan_32dp">
+ android:icon="@drawable/ic_scan_32dp"
+ app:sudDescriptionText="@string/wifi_dpp_scan_qr_code_join_unknown_network">
<LinearLayout
style="@style/SudContentFrame"
@@ -28,16 +30,6 @@
android:orientation="vertical"
android:gravity="center_horizontal">
- <TextView
- android:id="@android:id/summary"
- style="@style/TextAppearance.SudGlifBody"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="?attr/sudMarginStart"
- android:layout_marginEnd="?attr/sudMarginEnd"
- android:textAlignment="center"
- android:accessibilityLiveRegion="polite"/>
-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/raw/face_education_lottie.json b/res/raw/face_education_lottie.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/face_education_lottie.json
diff --git a/res/values-mn/arrays.xml b/res/values-mn/arrays.xml
index f676c40..f42bd42 100644
--- a/res/values-mn/arrays.xml
+++ b/res/values-mn/arrays.xml
@@ -237,7 +237,7 @@
<item msgid="3858029424955955625">"харилцагчдыг өөрчлөх"</item>
<item msgid="3439658954936709507">"дуудлагын жагсаалтыг унших"</item>
<item msgid="1908944516631132130">"дуудлагын жагсаалтыг өөрчлөх"</item>
- <item msgid="9066115715905100138">"хуанли унших"</item>
+ <item msgid="9066115715905100138">"календарь унших"</item>
<item msgid="1664720478157892566">"календарийг өөрчлөх"</item>
<item msgid="5478277451617814822">"wi-fi скан"</item>
<item msgid="2429454210217003798">"мэдэгдэл"</item>
@@ -304,7 +304,7 @@
<item msgid="5060760609109972207">"Харилцагчдыг өөрчлөх"</item>
<item msgid="7451260062940797278">"Дуудлагын жагсаалтыг унших"</item>
<item msgid="2348589304974534308">"Дуудлагын жагсаалтыг өөрчлөх"</item>
- <item msgid="4089146706115315300">"Хуанли унших"</item>
+ <item msgid="4089146706115315300">"Календарь унших"</item>
<item msgid="1305780729690198918">"Календарийг өөрчлөх"</item>
<item msgid="3461096740171440592">"Байршил"</item>
<item msgid="6657539556093198883">"Пост мэдэгдэл"</item>
diff --git a/res/values-sq/arrays.xml b/res/values-sq/arrays.xml
index 80093c4..be79efa 100644
--- a/res/values-sq/arrays.xml
+++ b/res/values-sq/arrays.xml
@@ -64,7 +64,7 @@
</string-array>
<string-array name="entries_font_size">
<item msgid="4649244712522775149">"E vogël"</item>
- <item msgid="4350318459725129464">"I parazgjedhur"</item>
+ <item msgid="4350318459725129464">"E parazgjedhur"</item>
<item msgid="722959474722634030">"E madhe"</item>
<item msgid="5468692832610514379">"Më i madhi"</item>
</string-array>
diff --git a/res/values/config.xml b/res/values/config.xml
index 1e2855b..9cf48b1 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -269,6 +269,9 @@
<!-- ComponentName to launch a vendor-specific enrollment activity if available -->
<string name="config_face_enroll" translatable="false"></string>
+ <!-- Whether to use the Lottie animation for the face education enrollment screen -->
+ <bool name="config_face_education_use_lottie">false</bool>
+
<!-- App intent -->
<string name="config_account_intent_uri" translatable="false"></string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0b4b705..4dc3060 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1882,7 +1882,7 @@
<!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty [CHAR LIMIT=50]-->
<string name="bluetooth_empty_list_bluetooth_off">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.</string>
<!-- Bluetooth settings. Text displayed when Bluetooth is off and bluetooth scanning is turned on [CHAR LIMIT=NONE] -->
- <string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. you can change this in <annotation id="link">Bluetooth scanning settings</annotation>.</string>
+ <string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. You can change this in <annotation id="link">Bluetooth scanning settings</annotation>.</string>
<!-- Message to describe "BLE scan always available feature" when Bluetooth is off. The
place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring
the user to "scanning settings" screen. -->
@@ -11612,6 +11612,13 @@
<!-- Positive button for the alert dialog when gesture nav not supported by launcher [CHAR LIMIT=60] -->
<string name="gesture_not_supported_positive_button">Switch default home app</string>
+ <!-- Title for setting category that is shown to enable invoking digital assistant with swipe. [CHAR LIMIT=60] -->
+ <string name="assistant_gesture_category_title">Digital assistant</string>
+ <!-- Title text for swiping from bottom corners to invoke the digital assistant app. [CHAR LIMIT=60] -->
+ <string name="assistant_corner_gesture_title">Swipe to invoke assistant</string>
+ <!-- Summary text for swiping from bottom corners to invoke the digital assistant app. [CHAR LIMIT=NONE] -->
+ <string name="assistant_corner_gesture_summary">Swipe up from a bottom corner corner to invoke digital assistant app.</string>
+
<!-- Content description for the Information icon [CHAR LIMIT=30] -->
<string name="information_label">Information</string>
diff --git a/res/xml/adb_device_details_fragment.xml b/res/xml/adb_device_details_fragment.xml
index 2e149ed..a227f38 100644
--- a/res/xml/adb_device_details_fragment.xml
+++ b/res/xml/adb_device_details_fragment.xml
@@ -17,8 +17,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/device_details_title"
- settings:initialExpandedChildrenCount="3">
+ android:title="@string/device_details_title">
<com.android.settingslib.widget.LayoutPreference
android:key="adb_device_header"
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index edf8cb9..5270b09 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -80,8 +80,7 @@
<PreferenceCategory
android:key="app_advanced"
- android:order="1000"
- settings:initialExpandedChildrenCount="0">
+ android:order="1000">
<!-- Show badge -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="badge"
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index 8cd9304..ab22f73 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -18,48 +18,53 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/configure_notification_settings">
- <com.android.settings.widget.VideoPreference
- android:key="notification_model_illustration"
- android:title="@string/summary_placeholder"
- settings:animation="@raw/notification_interruption_model"
- settings:controller="com.android.settings.widget.VideoPreferenceController"
- android:persistent="false" />
-
- <Preference
- android:key="notification_history"
- android:title="@string/notification_history"
- android:summary="@string/notification_history_summary"
- settings:allowDividerAbove="true"
- settings:allowDividerBelow="false"
- android:order="2">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
- </Preference>
-
- <Preference
- android:key="notification_bubbles"
- android:title="@string/notification_bubbles_title"
- android:summary="@string/notifications_bubble_setting_on_summary"
- android:order="4"
- settings:controller="com.android.settings.notification.BubbleSummaryNotificationPreferenceController"
- android:fragment="com.android.settings.notification.BubbleNotificationSettings"
- />
+ <PreferenceCategory
+ android:key="conversation_category"
+ android:title="@string/conversation_notifs_category">
+ <Preference
+ android:key="conversations"
+ android:order="1"
+ android:title="@string/conversations_category_title"
+ android:summary=" "
+ settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
+ android:fragment="com.android.settings.notification.app.ConversationListSettings"
+ />
+ <Preference
+ android:key="notification_bubbles"
+ android:order="2"
+ android:title="@string/notification_bubbles_title"
+ android:summary="@string/notifications_bubble_setting_on_summary"
+ settings:controller="com.android.settings.notification.BubbleSummaryNotificationPreferenceController"
+ android:fragment="com.android.settings.notification.BubbleNotificationSettings"
+ />
+ </PreferenceCategory>
<PreferenceCategory
android:key="recent_notifications_category"
- android:title="@string/recent_notifications"
- settings:allowDividerAbove="true"
- android:order="5">
+ android:title="@string/recent_notifications">
<!-- Placeholder for a list of recent apps -->
+ <com.android.settings.widget.PrimarySwitchPreference
+ android:key="app1"
+ android:title=" "
+ android:summary=" "
+ android:order="5"/>
+ <com.android.settings.widget.PrimarySwitchPreference
+ android:key="app2"
+ android:title=" "
+ android:summary=" "
+ android:order="6"/>
+ <com.android.settings.widget.PrimarySwitchPreference
+ android:key="app3"
+ android:title=" "
+ android:summary=" "
+ android:order="7"/>
<!-- See all apps button -->
<Preference
android:key="all_notifications"
+ android:order="10"
android:title="@string/notifications_title"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
- android:order="6"
settings:searchable="false">
<extra
android:name="classname"
@@ -67,32 +72,51 @@
</Preference>
</PreferenceCategory>
-
<PreferenceCategory
android:key="configure_notifications_lock"
- android:title="@string/lock_screen_notifications_title"
- android:order="10">
+ android:title="@string/lock_screen_notifications_title">
+ <Preference
+ android:key="notification_history"
+ android:order="11"
+ android:title="@string/notification_history"
+ android:summary="@string/notification_history_summary">
+ <intent
+ android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.settings"
+ android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
+ </Preference>
+ <Preference
+ android:key="notification_access"
+ android:order="12"
+ android:title="@string/manage_notification_access_title"
+ android:summary="@string/manage_notification_access_summary"
+ android:fragment="com.android.settings.notification.NotificationAccessSettings"
+ settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
<!-- When device is locked -->
<com.android.settings.RestrictedListPreference
android:key="lock_screen_notifications"
+ android:order="13"
android:title="@string/lock_screen_notifs_title"
android:singleLineTitle="false"
android:summary="@string/summary_placeholder" />
<com.android.settingslib.RestrictedSwitchPreference
android:key="lock_screen_redact"
+ android:order="14"
android:title="@string/lock_screen_notifs_redact"
android:summary="@string/lock_screen_notifs_redact_summary"
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
<com.android.settingslib.RestrictedSwitchPreference
android:key="lock_screen_work_redact"
+ android:order="15"
android:title="@string/lock_screen_notifs_redact_work"
android:summary="@string/lock_screen_notifs_redact_work_summary"
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
<SwitchPreference
android:key="notification_lockscreen_bypass"
+ android:order="16"
android:title="@string/lockscreen_bypass_title"
android:summary="@string/lockscreen_bypass_summary"
settings:searchable="false"
@@ -101,58 +125,57 @@
</PreferenceCategory>
<PreferenceCategory
- android:key="configure_notifications_advanced"
- android:order="15"
- settings:initialExpandedChildrenCount="0">
-
- <SwitchPreference
- android:key="silent_icons"
- android:title="@string/silent_notifications_status_bar"
- settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
-
- <SwitchPreference
- android:key="show_snooze_options"
- android:title="@string/snooze_options_title"
- settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
-
- <SwitchPreference
- android:key="notification_assistant"
- android:title="@string/notification_assistant_title"
- android:summary="@string/notification_assistant_summary"/>
-
- <!-- Notification badging -->
- <SwitchPreference
- android:key="notification_badging"
- android:title="@string/notification_badging_title"
- settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
-
- <!-- Pulse notification light -->
- <SwitchPreference
- android:key="notification_pulse"
- android:title="@string/notification_pulse_title"
- settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
-
- <!-- Default notification ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="notification_default_ringtone"
- android:title="@string/notification_ringtone_title"
- android:dialogTitle="@string/notification_ringtone_title"
- android:summary="@string/summary_placeholder"
- android:ringtoneType="notification"
- settings:searchable="false"/>
-
- <Preference
- android:key="gesture_swipe_down_fingerprint_notifications"
- android:title="@string/fingerprint_swipe_for_notifications_title"
- android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
- settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController"/>
-
+ android:key="advanced_section_header"
+ android:title="@string/advanced_section_header">
<com.android.settingslib.RestrictedPreference
android:key="zen_mode_notifications"
+ android:order="17"
android:title="@string/zen_mode_settings_title"
settings:useAdminDisabledSummary="true"
android:fragment="com.android.settings.notification.zen.ZenModeSettings"
settings:controller="com.android.settings.notification.zen.ZenModePreferenceController"
- settings:allowDividerAbove="false"/>
+ />
+ <com.android.settingslib.RestrictedPreference
+ android:key="app_and_notif_cell_broadcast_settings"
+ android:order="18"
+ android:title="@string/cell_broadcast_settings"
+ settings:useAdminDisabledSummary="true">
+ <intent
+ android:action="android.intent.action.MAIN"
+ android:targetPackage="@string/config_cell_broadcast_receiver_package"
+ android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings"/>
+ </com.android.settingslib.RestrictedPreference>
+
+ <SwitchPreference
+ android:key="silent_icons"
+ android:order="19"
+ android:title="@string/silent_notifications_status_bar"
+ settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
+
+ <SwitchPreference
+ android:key="show_snooze_options"
+ android:order="20"
+ android:title="@string/snooze_options_title"
+ settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
+
+ <!-- Notification badging -->
+ <SwitchPreference
+ android:key="notification_badging"
+ android:order="21"
+ android:title="@string/notification_badging_title"
+ settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
+
+ <!-- Pulse notification light, on devices that support it -->
+ <SwitchPreference
+ android:key="notification_pulse"
+ android:order="22"
+ android:title="@string/notification_pulse_title"
+ settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
+
+ <SwitchPreference
+ android:key="notification_assistant"
+ android:order="23"
+ android:title="@string/notification_assistant_title"
+ android:summary="@string/notification_assistant_summary"/>
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/configure_notification_settings_v2.xml b/res/xml/configure_notification_settings_v2.xml
deleted file mode 100644
index 1703312..0000000
--- a/res/xml/configure_notification_settings_v2.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2021 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/configure_notification_settings">
-
- <PreferenceCategory
- android:key="conversation_category"
- android:title="@string/conversation_notifs_category">
- <Preference
- android:key="conversations"
- android:order="1"
- android:title="@string/conversations_category_title"
- android:summary=" "
- settings:controller="com.android.settings.notification.ConversationListSummaryPreferenceController"
- android:fragment="com.android.settings.notification.app.ConversationListSettings"
- />
- <Preference
- android:key="notification_bubbles"
- android:order="2"
- android:title="@string/notification_bubbles_title"
- android:summary="@string/notifications_bubble_setting_on_summary"
- settings:controller="com.android.settings.notification.BubbleSummaryNotificationPreferenceController"
- android:fragment="com.android.settings.notification.BubbleNotificationSettings"
- />
- </PreferenceCategory>
-
- <PreferenceCategory
- android:key="recent_notifications_category"
- android:title="@string/recent_notifications">
- <!-- Placeholder for a list of recent apps -->
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="app1"
- android:title=" "
- android:summary=" "
- android:order="5"/>
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="app2"
- android:title=" "
- android:summary=" "
- android:order="6"/>
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="app3"
- android:title=" "
- android:summary=" "
- android:order="7"/>
-
- <!-- See all apps button -->
- <Preference
- android:key="all_notifications"
- android:order="10"
- android:title="@string/notifications_title"
- android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
- settings:searchable="false">
- <extra
- android:name="classname"
- android:value="com.android.settings.Settings$NotificationAppListActivity"/>
- </Preference>
- </PreferenceCategory>
-
- <PreferenceCategory
- android:key="configure_notifications_lock"
- android:title="@string/lock_screen_notifications_title">
- <Preference
- android:key="notification_history"
- android:order="11"
- android:title="@string/notification_history"
- android:summary="@string/notification_history_summary">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.settings"
- android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
- </Preference>
- <Preference
- android:key="notification_access"
- android:order="12"
- android:title="@string/manage_notification_access_title"
- android:summary="@string/manage_notification_access_summary"
- android:fragment="com.android.settings.notification.NotificationAccessSettings"
- settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
- <!-- When device is locked -->
- <com.android.settings.RestrictedListPreference
- android:key="lock_screen_notifications"
- android:order="13"
- android:title="@string/lock_screen_notifs_title"
- android:singleLineTitle="false"
- android:summary="@string/summary_placeholder" />
-
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="lock_screen_redact"
- android:order="14"
- android:title="@string/lock_screen_notifs_redact"
- android:summary="@string/lock_screen_notifs_redact_summary"
- settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
-
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="lock_screen_work_redact"
- android:order="15"
- android:title="@string/lock_screen_notifs_redact_work"
- android:summary="@string/lock_screen_notifs_redact_work_summary"
- settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
-
- <SwitchPreference
- android:key="notification_lockscreen_bypass"
- android:order="16"
- android:title="@string/lockscreen_bypass_title"
- android:summary="@string/lockscreen_bypass_summary"
- settings:searchable="false"
- settings:controller="com.android.settings.biometrics.face.FaceSettingsLockscreenBypassPreferenceController" />
-
- </PreferenceCategory>
-
- <PreferenceCategory
- android:key="advanced_section_header"
- android:title="@string/advanced_section_header">
- <com.android.settingslib.RestrictedPreference
- android:key="zen_mode_notifications"
- android:order="17"
- android:title="@string/zen_mode_settings_title"
- settings:useAdminDisabledSummary="true"
- android:fragment="com.android.settings.notification.zen.ZenModeSettings"
- settings:controller="com.android.settings.notification.zen.ZenModePreferenceController"
- />
- <com.android.settingslib.RestrictedPreference
- android:key="app_and_notif_cell_broadcast_settings"
- android:order="18"
- android:title="@string/cell_broadcast_settings"
- settings:useAdminDisabledSummary="true">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="@string/config_cell_broadcast_receiver_package"
- android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings"/>
- </com.android.settingslib.RestrictedPreference>
-
- <SwitchPreference
- android:key="silent_icons"
- android:order="19"
- android:title="@string/silent_notifications_status_bar"
- settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
-
- <SwitchPreference
- android:key="show_snooze_options"
- android:order="20"
- android:title="@string/snooze_options_title"
- settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
-
- <!-- Notification badging -->
- <SwitchPreference
- android:key="notification_badging"
- android:order="21"
- android:title="@string/notification_badging_title"
- settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
-
- <!-- Pulse notification light, on devices that support it -->
- <SwitchPreference
- android:key="notification_pulse"
- android:order="22"
- android:title="@string/notification_pulse_title"
- settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
-
- <SwitchPreference
- android:key="notification_assistant"
- android:order="23"
- android:title="@string/notification_assistant_title"
- android:summary="@string/notification_assistant_summary"/>
- </PreferenceCategory>
-</PreferenceScreen>
diff --git a/res/xml/display_settings_v2.xml b/res/xml/display_settings_v2.xml
index e0eb9bb..2d6e3db 100644
--- a/res/xml/display_settings_v2.xml
+++ b/res/xml/display_settings_v2.xml
@@ -30,7 +30,6 @@
settings:keywords="@string/keywords_display_brightness_level"
settings:useAdminDisabledSummary="true"
settings:userRestriction="no_config_brightness">
- <intent android:action="com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"/>
</com.android.settingslib.RestrictedPreference>
<com.android.settings.widget.PrimarySwitchPreference
diff --git a/res/xml/gesture_navigation_settings.xml b/res/xml/gesture_navigation_settings.xml
index 0515d78..09bb870 100644
--- a/res/xml/gesture_navigation_settings.xml
+++ b/res/xml/gesture_navigation_settings.xml
@@ -24,6 +24,20 @@
settings:keywords="@string/keywords_gesture_navigation_settings">
<PreferenceCategory
+ android:key="assistant_gesture_category"
+ android:persistent="false"
+ android:title="@string/assistant_gesture_category_title">
+
+ <SwitchPreference
+ android:key="assistant_gesture_corner_swipe"
+ android:title="@string/assistant_corner_gesture_title"
+ android:summary="@string/assistant_corner_gesture_summary"
+ settings:controller="com.android.settings.gestures.GestureNavigationSettingsAssistController"
+ />
+
+ </PreferenceCategory>
+
+ <PreferenceCategory
android:key="back_sensitivity_category"
android:persistent="false"
android:title="@string/back_sensitivity_dialog_title">
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 880a326..cffab3e 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -37,8 +37,7 @@
<PreferenceCategory
android:key="location_advanced_settings"
- android:layout="@layout/preference_category_no_label"
- settings:initialExpandedChildrenCount="3">
+ android:layout="@layout/preference_category_no_label">
<!-- This preference gets removed if there is no managed profile -->
<com.android.settingslib.RestrictedSwitchPreference
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index 0cf5f77..7c4966b 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -19,8 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="privacy_dashboard_page"
- android:title="@string/privacy_dashboard_title"
- settings:initialExpandedChildrenCount="4">
+ android:title="@string/privacy_dashboard_title">
<!-- Work Policy info -->
diff --git a/res/xml/security_dashboard_settings.xml b/res/xml/security_dashboard_settings.xml
index be1f34c..edfe582 100644
--- a/res/xml/security_dashboard_settings.xml
+++ b/res/xml/security_dashboard_settings.xml
@@ -19,8 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="security_dashboard_page"
- android:title="@string/security_settings_title"
- settings:initialExpandedChildrenCount="9">
+ android:title="@string/security_settings_title">
<!-- security_settings_status.xml -->
<PreferenceCategory
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 31571f6..56632a5 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -19,8 +19,7 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/sound_settings"
android:key="sound_settings"
- settings:keywords="@string/keywords_sounds"
- settings:initialExpandedChildrenCount="9">
+ settings:keywords="@string/keywords_sounds">
<!-- Remote volume group -->
<PreferenceCategory
@@ -90,41 +89,17 @@
android:order="-140"
settings:controller="com.android.settings.notification.NotificationVolumePreferenceController"/>
- <!-- Also vibrate for calls -->
- <Preference
- android:fragment="com.android.settings.sound.VibrateForCallsPreferenceFragment"
- android:key="vibrate_for_calls"
- android:title="@string/vibrate_when_ringing_title"
- android:order="-130"
- settings:controller="com.android.settings.sound.VibrateForCallsPreferenceController"
- settings:keywords="@string/keywords_vibrate_for_calls"/>
-
+ <!-- TODO(b/174964721): make this a PrimarySwitchPreference -->
<!-- Interruptions -->
<com.android.settingslib.RestrictedPreference
android:key="zen_mode"
android:title="@string/zen_mode_settings_title"
android:fragment="com.android.settings.notification.zen.ZenModeSettings"
- android:order="-120"
+ android:order="-130"
settings:useAdminDisabledSummary="true"
settings:keywords="@string/keywords_sounds_and_notifications_interruptions"
- settings:allowDividerAbove="true"
settings:controller="com.android.settings.notification.zen.ZenModePreferenceController"/>
- <Preference
- android:key="media_controls_summary"
- android:title="@string/media_controls_title"
- android:fragment="com.android.settings.sound.MediaControlsSettings"
- android:order="-110"
- settings:controller="com.android.settings.sound.MediaControlsParentPreferenceController"
- settings:keywords="@string/keywords_media_controls"/>
-
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="gesture_prevent_ringing_sound"
- android:title="@string/gesture_prevent_ringing_sound_title"
- android:order="-107"
- android:fragment="com.android.settings.gestures.PreventRingingGestureSettings"
- settings:controller="com.android.settings.gestures.PreventRingingParentPreferenceController"/>
-
<!-- Phone ringtone -->
<com.android.settings.DefaultRingtonePreference
android:key="phone_ringtone"
@@ -132,9 +107,34 @@
android:dialogTitle="@string/ringtone_title"
android:summary="@string/summary_placeholder"
android:ringtoneType="ringtone"
- android:order="-100"
+ android:order="-120"
settings:keywords="@string/sound_settings"/>
+ <!-- Live Caption -110 and Now Playing -105-->
+ <Preference
+ android:key="media_controls_summary"
+ android:title="@string/media_controls_title"
+ android:fragment="com.android.settings.sound.MediaControlsSettings"
+ android:order="-100"
+ settings:controller="com.android.settings.sound.MediaControlsParentPreferenceController"
+ settings:keywords="@string/keywords_media_controls"/>
+
+ <!-- Also vibrate for calls -->
+ <Preference
+ android:fragment="com.android.settings.sound.VibrateForCallsPreferenceFragment"
+ android:key="vibrate_for_calls"
+ android:title="@string/vibrate_when_ringing_title"
+ android:order="-90"
+ settings:controller="com.android.settings.sound.VibrateForCallsPreferenceController"
+ settings:keywords="@string/keywords_vibrate_for_calls"/>
+
+ <com.android.settings.widget.PrimarySwitchPreference
+ android:key="gesture_prevent_ringing_sound"
+ android:title="@string/gesture_prevent_ringing_sound_title"
+ android:order="-80"
+ android:fragment="com.android.settings.gestures.PreventRingingGestureSettings"
+ settings:controller="com.android.settings.gestures.PreventRingingParentPreferenceController"/>
+
<!-- Default notification ringtone -->
<com.android.settings.DefaultRingtonePreference
android:key="notification_ringtone"
@@ -142,7 +142,7 @@
android:dialogTitle="@string/notification_ringtone_title"
android:summary="@string/summary_placeholder"
android:ringtoneType="notification"
- android:order="-90"/>
+ android:order="-70"/>
<!-- Default alarm ringtone -->
<com.android.settings.DefaultRingtonePreference
@@ -152,100 +152,70 @@
android:summary="@string/summary_placeholder"
android:persistent="false"
android:ringtoneType="alarm"
- android:order="-80"/>
+ android:order="-60"/>
- <!-- Other sounds -->
- <PreferenceCategory
- android:key="other_sounds_and_vibrations_category"
- android:title="@string/other_sound_category_preference_title"
- android:order="-50">
+ <!-- Dial pad tones -->
+ <SwitchPreference
+ android:key="dial_pad_tones"
+ android:title="@string/dial_pad_tones_title"
+ android:order="-50"/>
- <!-- Dial pad tones -->
- <SwitchPreference
- android:key="dial_pad_tones"
- android:title="@string/dial_pad_tones_title"/>
+ <!-- Screen locking sounds -->
+ <SwitchPreference
+ android:key="screen_locking_sounds"
+ android:title="@string/screen_locking_sounds_title"
+ android:order="-45"/>
- <!-- Screen locking sounds -->
- <SwitchPreference
- android:key="screen_locking_sounds"
- android:title="@string/screen_locking_sounds_title"/>
+ <!-- Charging sounds -->
+ <SwitchPreference
+ android:key="charging_sounds"
+ android:title="@string/charging_sounds_title"
+ android:order="-40"/>
- <!-- Charging sounds -->
- <SwitchPreference
- android:key="charging_sounds"
- android:title="@string/charging_sounds_title"/>
+ <!-- Docking sounds -->
+ <SwitchPreference
+ android:key="docking_sounds"
+ android:title="@string/docking_sounds_title"
+ android:order="-35"/>
- <!-- Docking sounds -->
- <SwitchPreference
- android:key="docking_sounds"
- android:title="@string/docking_sounds_title"/>
+ <!-- Touch sounds -->
+ <SwitchPreference
+ android:key="touch_sounds"
+ android:title="@string/touch_sounds_title"
+ android:order="-30"/>
- <!-- Touch sounds -->
- <SwitchPreference
- android:key="touch_sounds"
- android:title="@string/touch_sounds_title"/>
+ <!-- Vibrate on touch -->
+ <SwitchPreference
+ android:key="vibrate_on_touch"
+ android:title="@string/vibrate_on_touch_title"
+ android:summary="@string/vibrate_on_touch_summary"
+ settings:keywords="@string/keywords_vibrate_on_touch"
+ android:order="-25"/>
- <!-- Vibrate on touch -->
- <SwitchPreference
- android:key="vibrate_on_touch"
- android:title="@string/vibrate_on_touch_title"
- android:summary="@string/vibrate_on_touch_summary"
- settings:keywords="@string/keywords_vibrate_on_touch"/>
+ <!-- Dock speaker plays -->
+ <DropDownPreference
+ android:key="dock_audio_media"
+ android:title="@string/dock_audio_media_title"
+ android:summary="%s"
+ android:order="-20"/>
- <!-- Dock speaker plays -->
- <DropDownPreference
- android:key="dock_audio_media"
- android:title="@string/dock_audio_media_title"
- android:summary="%s"/>
+ <!-- Boot sounds -->
+ <SwitchPreference
+ android:key="boot_sounds"
+ android:title="@string/boot_sounds_title"
+ android:order="-15"/>
- <!-- Boot sounds -->
- <SwitchPreference
- android:key="boot_sounds"
- android:title="@string/boot_sounds_title"/>
+ <!-- Emergency tone -->
+ <DropDownPreference
+ android:key="emergency_tone"
+ android:title="@string/emergency_tone_title"
+ android:summary="%s"
+ android:order="-10"/>
- <!-- Emergency tone -->
- <DropDownPreference
- android:key="emergency_tone"
- android:title="@string/emergency_tone_title"
- android:summary="%s"/>
- </PreferenceCategory>
-
- <com.android.settings.widget.WorkOnlyCategory
- android:key="sound_work_settings_section"
+ <Preference
+ android:key="sound_work_settings"
android:title="@string/sound_work_settings"
- android:order="100">
-
- <!-- Use the same sounds of the work profile -->
- <SwitchPreference
- android:key="work_use_personal_sounds"
- android:title="@string/work_use_personal_sounds_title"
- android:summary="@string/work_use_personal_sounds_summary"
- android:disableDependentsState="true"/>
-
- <!-- Work phone ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="work_ringtone"
- android:title="@string/work_ringtone_title"
- android:dialogTitle="@string/work_alarm_ringtone_title"
- android:ringtoneType="ringtone"
- android:dependency="work_use_personal_sounds"/>
-
- <!-- Default work notification ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="work_notification_ringtone"
- android:title="@string/work_notification_ringtone_title"
- android:dialogTitle="@string/work_alarm_ringtone_title"
- android:ringtoneType="notification"
- android:dependency="work_use_personal_sounds"/>
-
- <!-- Default work alarm ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="work_alarm_ringtone"
- android:title="@string/work_alarm_ringtone_title"
- android:dialogTitle="@string/work_alarm_ringtone_title"
- android:persistent="false"
- android:ringtoneType="alarm"
- android:dependency="work_use_personal_sounds"/>
-
- </com.android.settings.widget.WorkOnlyCategory>
+ android:fragment="com.android.settings.notification.SoundWorkSettings"
+ android:order="100"
+ settings:controller="com.android.settings.notification.WorkSoundsPreferenceController"/>
</PreferenceScreen>
diff --git a/res/xml/sound_settings_v2.xml b/res/xml/sound_settings_v2.xml
deleted file mode 100644
index b45dd9b..0000000
--- a/res/xml/sound_settings_v2.xml
+++ /dev/null
@@ -1,221 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2021 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/sound_settings"
- android:key="sound_settings"
- settings:keywords="@string/keywords_sounds">
-
- <!-- Remote volume group -->
- <PreferenceCategory
- android:key="remote_media_group"
- android:title=""
- android:order="-185"
- settings:allowDividerBelow="true"
- settings:controller="com.android.settings.notification.RemoteVolumeGroupController">
- </PreferenceCategory>
-
- <!-- Media volume -->
- <com.android.settings.notification.VolumeSeekBarPreference
- android:key="media_volume"
- android:icon="@drawable/ic_media_stream"
- android:title="@string/media_volume_option_title"
- android:order="-180"
- settings:controller="com.android.settings.notification.MediaVolumePreferenceController"/>
-
- <!-- Media output switcher -->
- <Preference
- android:key="media_output"
- android:title="@string/media_output_title"
- android:dialogTitle="@string/media_output_title"
- android:order="-175"
- settings:searchable="false"
- settings:controller="com.android.settings.sound.MediaOutputPreferenceController"/>
-
- <!-- Call volume -->
- <com.android.settings.notification.VolumeSeekBarPreference
- android:key="call_volume"
- android:icon="@drawable/ic_local_phone_24_lib"
- android:title="@string/call_volume_option_title"
- android:order="-170"
- settings:controller="com.android.settings.notification.CallVolumePreferenceController"/>
-
- <!-- Hands free profile output switcher -->
- <ListPreference
- android:key="take_call_on_output"
- android:title="@string/take_call_on_title"
- android:dialogTitle="@string/take_call_on_title"
- android:order="-165"
- settings:searchable="false"
- settings:controller="com.android.settings.sound.HandsFreeProfileOutputPreferenceController"/>
-
- <!-- Ring volume -->
- <com.android.settings.notification.VolumeSeekBarPreference
- android:key="ring_volume"
- android:icon="@drawable/ic_notifications"
- android:title="@string/ring_volume_option_title"
- android:order="-160"
- settings:controller="com.android.settings.notification.RingVolumePreferenceController"/>
-
-
- <!-- Alarm volume -->
- <com.android.settings.notification.VolumeSeekBarPreference
- android:key="alarm_volume"
- android:icon="@*android:drawable/ic_audio_alarm"
- android:title="@string/alarm_volume_option_title"
- android:order="-150"
- settings:controller="com.android.settings.notification.AlarmVolumePreferenceController"/>
-
- <!-- Notification volume -->
- <com.android.settings.notification.VolumeSeekBarPreference
- android:key="notification_volume"
- android:icon="@drawable/ic_notifications"
- android:title="@string/notification_volume_option_title"
- android:order="-140"
- settings:controller="com.android.settings.notification.NotificationVolumePreferenceController"/>
-
- <!-- TODO(b/174964721): make this a PrimarySwitchPreference -->
- <!-- Interruptions -->
- <com.android.settingslib.RestrictedPreference
- android:key="zen_mode"
- android:title="@string/zen_mode_settings_title"
- android:fragment="com.android.settings.notification.zen.ZenModeSettings"
- android:order="-130"
- settings:useAdminDisabledSummary="true"
- settings:keywords="@string/keywords_sounds_and_notifications_interruptions"
- settings:controller="com.android.settings.notification.zen.ZenModePreferenceController"/>
-
- <!-- Phone ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="phone_ringtone"
- android:title="@string/ringtone_title"
- android:dialogTitle="@string/ringtone_title"
- android:summary="@string/summary_placeholder"
- android:ringtoneType="ringtone"
- android:order="-120"
- settings:keywords="@string/sound_settings"/>
-
- <!-- Live Caption -110 and Now Playing -105-->
- <Preference
- android:key="media_controls_summary"
- android:title="@string/media_controls_title"
- android:fragment="com.android.settings.sound.MediaControlsSettings"
- android:order="-100"
- settings:controller="com.android.settings.sound.MediaControlsParentPreferenceController"
- settings:keywords="@string/keywords_media_controls"/>
-
- <!-- Also vibrate for calls -->
- <Preference
- android:fragment="com.android.settings.sound.VibrateForCallsPreferenceFragment"
- android:key="vibrate_for_calls"
- android:title="@string/vibrate_when_ringing_title"
- android:order="-90"
- settings:controller="com.android.settings.sound.VibrateForCallsPreferenceController"
- settings:keywords="@string/keywords_vibrate_for_calls"/>
-
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="gesture_prevent_ringing_sound"
- android:title="@string/gesture_prevent_ringing_sound_title"
- android:order="-80"
- android:fragment="com.android.settings.gestures.PreventRingingGestureSettings"
- settings:controller="com.android.settings.gestures.PreventRingingParentPreferenceController"/>
-
- <!-- Default notification ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="notification_ringtone"
- android:title="@string/notification_ringtone_title"
- android:dialogTitle="@string/notification_ringtone_title"
- android:summary="@string/summary_placeholder"
- android:ringtoneType="notification"
- android:order="-70"/>
-
- <!-- Default alarm ringtone -->
- <com.android.settings.DefaultRingtonePreference
- android:key="alarm_ringtone"
- android:title="@string/alarm_ringtone_title"
- android:dialogTitle="@string/alarm_ringtone_title"
- android:summary="@string/summary_placeholder"
- android:persistent="false"
- android:ringtoneType="alarm"
- android:order="-60"/>
-
- <!-- Dial pad tones -->
- <SwitchPreference
- android:key="dial_pad_tones"
- android:title="@string/dial_pad_tones_title"
- android:order="-50"/>
-
- <!-- Screen locking sounds -->
- <SwitchPreference
- android:key="screen_locking_sounds"
- android:title="@string/screen_locking_sounds_title"
- android:order="-45"/>
-
- <!-- Charging sounds -->
- <SwitchPreference
- android:key="charging_sounds"
- android:title="@string/charging_sounds_title"
- android:order="-40"/>
-
- <!-- Docking sounds -->
- <SwitchPreference
- android:key="docking_sounds"
- android:title="@string/docking_sounds_title"
- android:order="-35"/>
-
- <!-- Touch sounds -->
- <SwitchPreference
- android:key="touch_sounds"
- android:title="@string/touch_sounds_title"
- android:order="-30"/>
-
- <!-- Vibrate on touch -->
- <SwitchPreference
- android:key="vibrate_on_touch"
- android:title="@string/vibrate_on_touch_title"
- android:summary="@string/vibrate_on_touch_summary"
- settings:keywords="@string/keywords_vibrate_on_touch"
- android:order="-25"/>
-
- <!-- Dock speaker plays -->
- <DropDownPreference
- android:key="dock_audio_media"
- android:title="@string/dock_audio_media_title"
- android:summary="%s"
- android:order="-20"/>
-
- <!-- Boot sounds -->
- <SwitchPreference
- android:key="boot_sounds"
- android:title="@string/boot_sounds_title"
- android:order="-15"/>
-
- <!-- Emergency tone -->
- <DropDownPreference
- android:key="emergency_tone"
- android:title="@string/emergency_tone_title"
- android:summary="%s"
- android:order="-10"/>
-
- <Preference
- android:key="sound_work_settings"
- android:title="@string/sound_work_settings"
- android:fragment="com.android.settings.notification.SoundWorkSettings"
- android:order="100"
- settings:controller="com.android.settings.notification.WorkSoundsPreferenceController"/>
-</PreferenceScreen>
diff --git a/res/xml/wifi_network_details_fragment2.xml b/res/xml/wifi_network_details_fragment2.xml
index cb24a8f..7847eba 100644
--- a/res/xml/wifi_network_details_fragment2.xml
+++ b/res/xml/wifi_network_details_fragment2.xml
@@ -16,8 +16,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- settings:initialExpandedChildrenCount="5">
+ xmlns:settings="http://schemas.android.com/apk/res-auto">
<com.android.settingslib.widget.LayoutPreference
android:key="connection_header"
diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
index 334d2db..09d8e71 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java
@@ -18,6 +18,8 @@
import android.app.admin.DevicePolicyManager;
import android.content.Intent;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
@@ -25,6 +27,9 @@
import android.view.View;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
@@ -34,6 +39,7 @@
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.span.LinkSpan;
+import com.google.android.setupdesign.util.DynamicColorPalette;
/**
* Abstract base class for the intro onboarding activity for biometric enrollment.
@@ -52,6 +58,8 @@
protected boolean mConfirmingCredentials;
protected boolean mNextClicked;
+ @Nullable private PorterDuffColorFilter mIconColorFilter;
+
/**
* @return true if the biometric is disabled by a device administrator
*/
@@ -317,4 +325,14 @@
setDescriptionText(getDescriptionResDisabledByAdmin());
}
}
+
+ @NonNull
+ protected PorterDuffColorFilter getIconColorFilter() {
+ if (mIconColorFilter == null) {
+ mIconColorFilter = new PorterDuffColorFilter(
+ DynamicColorPalette.getColor(this, DynamicColorPalette.ColorType.ACCENT),
+ PorterDuff.Mode.SRC_IN);
+ }
+ return mIconColorFilter;
+ }
}
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
index 2ad4070..49a4748 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java
@@ -37,6 +37,7 @@
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.password.ChooseLockSettingsHelper;
+import com.airbnb.lottie.LottieAnimationView;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -52,7 +53,9 @@
private FaceManager mFaceManager;
private FaceEnrollAccessibilityToggle mSwitchDiversity;
- private IllustrationVideoView mIllustrationNormal;
+ private boolean mIsUsingLottie;
+ private IllustrationVideoView mIllustrationDefault;
+ private LottieAnimationView mIllustrationLottie;
private View mIllustrationAccessibility;
private Handler mHandler;
private Intent mResultIntent;
@@ -78,12 +81,10 @@
updateHeaders(headerRes, descriptionRes);
if (isChecked) {
- mIllustrationNormal.stop();
- mIllustrationNormal.setVisibility(View.INVISIBLE);
+ hideDefaultIllustration();
mIllustrationAccessibility.setVisibility(View.VISIBLE);
} else {
- mIllustrationNormal.setVisibility(View.VISIBLE);
- mIllustrationNormal.start();
+ showDefaultIllustration();
mIllustrationAccessibility.setVisibility(View.INVISIBLE);
}
}
@@ -102,10 +103,19 @@
mFaceManager = Utils.getFaceManagerOrNull(this);
- mIllustrationNormal = findViewById(R.id.illustration_normal);
+ mIllustrationDefault = findViewById(R.id.illustration_default);
+ mIllustrationLottie = findViewById(R.id.illustration_lottie);
mIllustrationAccessibility = findViewById(R.id.illustration_accessibility);
mDescriptionText = findViewById(R.id.sud_layout_description);
+ mIsUsingLottie = getResources().getBoolean(R.bool.config_face_education_use_lottie);
+ if (mIsUsingLottie) {
+ mIllustrationDefault.stop();
+ mIllustrationDefault.setVisibility(View.INVISIBLE);
+ mIllustrationLottie.setVisibility(View.VISIBLE);
+ mIllustrationLottie.playAnimation();
+ }
+
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
if (WizardManagerHelper.isAnySetupWizard(getIntent())) {
@@ -256,4 +266,24 @@
layout.setHeaderText(headerText);
layout.setDescriptionText(descriptionRes);
}
+
+ private void hideDefaultIllustration() {
+ if (mIsUsingLottie) {
+ mIllustrationLottie.cancelAnimation();
+ mIllustrationLottie.setVisibility(View.INVISIBLE);
+ } else {
+ mIllustrationDefault.stop();
+ mIllustrationDefault.setVisibility(View.INVISIBLE);
+ }
+ }
+
+ private void showDefaultIllustration() {
+ if (mIsUsingLottie) {
+ mIllustrationLottie.setVisibility(View.VISIBLE);
+ mIllustrationLottie.playAnimation();
+ } else {
+ mIllustrationDefault.setVisibility(View.VISIBLE);
+ mIllustrationDefault.start();
+ }
+ }
}
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index d93eef7..d564547 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -23,6 +23,7 @@
import android.hardware.face.FaceSensorPropertiesInternal;
import android.os.Bundle;
import android.view.View;
+import android.widget.ImageView;
import android.widget.TextView;
import com.android.settings.R;
@@ -69,8 +70,12 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getLayout().setDescriptionText(getString(
- R.string.security_settings_face_enroll_introduction_message));
+ final ImageView iconGlasses = findViewById(R.id.icon_glasses);
+ final ImageView iconLooking = findViewById(R.id.icon_looking);
+ final ImageView iconSecurity = findViewById(R.id.icon_security);
+ iconGlasses.getBackground().setColorFilter(getIconColorFilter());
+ iconLooking.getBackground().setColorFilter(getIconColorFilter());
+ iconSecurity.getBackground().setColorFilter(getIconColorFilter());
mFaceManager = Utils.getFaceManagerOrNull(this);
mFaceFeatureProvider = FeatureFactory.getFactory(getApplicationContext())
@@ -81,10 +86,10 @@
new FooterButton.Builder(this)
.setText(R.string.security_settings_face_enroll_introduction_no_thanks)
.setListener(this::onSkipButtonClick)
- .setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SudGlifButton_Secondary)
- .build()
- );
+ .setButtonType(FooterButton.ButtonType.NEXT)
+ .setTheme(R.style.SudGlifButton_Primary)
+ .build(),
+ true /* usePrimaryStyle */);
FooterButton.Builder nextButtonBuilder = new FooterButton.Builder(this)
.setText(R.string.security_settings_face_enroll_introduction_agree)
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
index 738d324..18b1116 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
@@ -24,6 +24,7 @@
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.util.Log;
+import android.widget.ImageView;
import android.widget.TextView;
import com.android.settings.R;
@@ -58,22 +59,31 @@
super.onCreate(savedInstanceState);
- setDescriptionText(R.string.security_settings_fingerprint_enroll_introduction_message);
+ final ImageView iconFingerprint = findViewById(R.id.icon_fingerprint);
+ final ImageView iconLocked = findViewById(R.id.icon_locked);
+ final ImageView iconDelete = findViewById(R.id.icon_delete);
+ final ImageView iconInfo = findViewById(R.id.icon_info);
+ final ImageView iconLink = findViewById(R.id.icon_link);
+ iconFingerprint.getDrawable().setColorFilter(getIconColorFilter());
+ iconLocked.getDrawable().setColorFilter(getIconColorFilter());
+ iconDelete.getDrawable().setColorFilter(getIconColorFilter());
+ iconInfo.getDrawable().setColorFilter(getIconColorFilter());
+ iconLink.getDrawable().setColorFilter(getIconColorFilter());
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
new FooterButton.Builder(this)
.setText(getNegativeButtonTextId())
.setListener(this::onSkipButtonClick)
- .setButtonType(FooterButton.ButtonType.SKIP)
- .setTheme(R.style.SudGlifButton_Secondary)
- .build()
- );
+ .setButtonType(FooterButton.ButtonType.NEXT)
+ .setTheme(R.style.SudGlifButton_Primary)
+ .build(),
+ true /* usePrimaryStyle */);
final FooterButton nextButton = new FooterButton.Builder(this)
.setText(R.string.security_settings_fingerprint_enroll_introduction_agree)
.setListener(this::onNextButtonClick)
- .setButtonType(FooterButton.ButtonType.NEXT)
+ .setButtonType(FooterButton.ButtonType.OPT_IN)
.setTheme(R.style.SudGlifButton_Primary)
.build();
diff --git a/src/com/android/settings/core/SettingsBaseActivity.java b/src/com/android/settings/core/SettingsBaseActivity.java
index a032a8b..c2d3ad3 100644
--- a/src/com/android/settings/core/SettingsBaseActivity.java
+++ b/src/com/android/settings/core/SettingsBaseActivity.java
@@ -50,6 +50,7 @@
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
import com.android.settingslib.drawer.Tile;
import com.android.settingslib.transition.SettingsTransitionHelper;
+import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.resources.TextAppearanceConfig;
@@ -63,6 +64,11 @@
public class SettingsBaseActivity extends FragmentActivity {
+ /**
+ * What type of page transition should be apply.
+ */
+ public static final String EXTRA_PAGE_TRANSITION_TYPE = "extra_page_transition_type";
+
protected static final boolean DEBUG_TIMING = false;
private static final String TAG = "SettingsBaseActivity";
private static final String DATA_SCHEME_PKG = "package";
@@ -163,26 +169,53 @@
super.startActivity(intent);
return;
}
+
+ final int transitionType = getTransitionType(intent);
+ if (transitionType == TransitionType.TRANSITION_SLIDE) {
+ super.startActivity(intent, null);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+ return;
+ } else if (transitionType == TransitionType.TRANSITION_NONE) {
+ super.startActivity(intent, null);
+ return;
+ }
super.startActivity(intent, createActivityOptionsBundleForTransition(null));
}
@Override
public void startActivity(Intent intent, @androidx.annotation.Nullable Bundle options) {
- if (!Utils.isPageTransitionEnabled(this)) {
+ final int transitionType = getTransitionType(intent);
+ if (!Utils.isPageTransitionEnabled(this) ||
+ transitionType == TransitionType.TRANSITION_NONE) {
super.startActivity(intent, options);
return;
}
+
+ if (transitionType == TransitionType.TRANSITION_SLIDE) {
+ super.startActivity(intent, options);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+ return;
+ }
super.startActivity(intent, createActivityOptionsBundleForTransition(options));
}
@Override
public void startActivityForResult(Intent intent, int requestCode) {
+ final int transitionType = getTransitionType(intent);
// startActivity() will eventually calls startActivityForResult() with requestCode -1.
// Adding this condition to avoid multiple calls.
- if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST) {
+ if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST
+ || transitionType == TransitionType.TRANSITION_NONE) {
super.startActivityForResult(intent, requestCode);
return;
}
+
+ if (transitionType == TransitionType.TRANSITION_SLIDE) {
+ super.startActivityForResult(intent, requestCode, null);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+ return;
+ }
+
super.startActivityForResult(intent, requestCode,
createActivityOptionsBundleForTransition(null));
}
@@ -190,10 +223,19 @@
@Override
public void startActivityForResult(Intent intent, int requestCode,
@androidx.annotation.Nullable Bundle options) {
- if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST) {
+ final int transitionType = getTransitionType(intent);
+ if (!Utils.isPageTransitionEnabled(this) || requestCode == DEFAULT_REQUEST
+ || transitionType == TransitionType.TRANSITION_NONE) {
super.startActivityForResult(intent, requestCode, options);
return;
}
+
+ if (transitionType == TransitionType.TRANSITION_SLIDE) {
+ super.startActivityForResult(intent, requestCode, options);
+ overridePendingTransition(R.anim.sud_slide_next_in, R.anim.sud_slide_next_out);
+ return;
+ }
+
super.startActivityForResult(intent, requestCode,
createActivityOptionsBundleForTransition(options));
}
@@ -344,6 +386,11 @@
}
}
+ private int getTransitionType(Intent intent) {
+ return intent.getIntExtra(EXTRA_PAGE_TRANSITION_TYPE,
+ SettingsTransitionHelper.TransitionType.TRANSITION_SHARED_AXIS);
+ }
+
@androidx.annotation.Nullable
private Bundle createActivityOptionsBundleForTransition(
@androidx.annotation.Nullable Bundle options) {
diff --git a/src/com/android/settings/core/SubSettingLauncher.java b/src/com/android/settings/core/SubSettingLauncher.java
index 545fcda..2ee404b 100644
--- a/src/com/android/settings/core/SubSettingLauncher.java
+++ b/src/com/android/settings/core/SubSettingLauncher.java
@@ -34,6 +34,7 @@
import com.android.settings.SubSettings;
import com.android.settings.Utils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
public class SubSettingLauncher {
@@ -47,6 +48,7 @@
}
mContext = context;
mLaunchRequest = new LaunchRequest();
+ mLaunchRequest.transitionType = TransitionType.TRANSITION_SHARED_AXIS;
}
public SubSettingLauncher setDestination(String fragmentName) {
@@ -120,6 +122,11 @@
return this;
}
+ public SubSettingLauncher setTransitionType(int transitionType) {
+ mLaunchRequest.transitionType = transitionType;
+ return this;
+ }
+
public void launch() {
if (mLaunched) {
throw new IllegalStateException(
@@ -166,6 +173,9 @@
mLaunchRequest.titleResId);
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, mLaunchRequest.title);
intent.addFlags(mLaunchRequest.flags);
+ intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
+ mLaunchRequest.transitionType);
+
return intent;
}
@@ -219,6 +229,7 @@
Fragment mResultListener;
int mRequestCode;
UserHandle userHandle;
+ int transitionType;
Bundle arguments;
Bundle extras;
}
diff --git a/src/com/android/settings/display/BrightnessLevelPreferenceController.java b/src/com/android/settings/display/BrightnessLevelPreferenceController.java
index 7e0ce66..de4fe25 100644
--- a/src/com/android/settings/display/BrightnessLevelPreferenceController.java
+++ b/src/com/android/settings/display/BrightnessLevelPreferenceController.java
@@ -13,12 +13,15 @@
*/
package com.android.settings.display;
+import static android.content.Intent.ACTION_SHOW_BRIGHTNESS_DIALOG;
+
import static com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MAX;
import static com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MIN;
import static com.android.settingslib.display.BrightnessUtils.convertLinearToGammaFloat;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
import android.database.ContentObserver;
import android.hardware.display.BrightnessInfo;
import android.hardware.display.DisplayManager;
@@ -31,6 +34,7 @@
import android.os.ServiceManager;
import android.provider.Settings.System;
import android.service.vr.IVrManager;
+import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -38,11 +42,13 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.core.SettingsBaseActivity;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.transition.SettingsTransitionHelper;
import java.text.NumberFormat;
@@ -77,10 +83,12 @@
private final DisplayListener mDisplayListener = new DisplayListener() {
@Override
- public void onDisplayAdded(int displayId) {}
+ public void onDisplayAdded(int displayId) {
+ }
@Override
- public void onDisplayRemoved(int displayId) {}
+ public void onDisplayRemoved(int displayId) {
+ }
@Override
public void onDisplayChanged(int displayId) {
@@ -140,6 +148,18 @@
mDisplayManager.unregisterDisplayListener(mDisplayListener);
}
+ @Override
+ public boolean handlePreferenceTreeClick(Preference preference) {
+ if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+ return false;
+ }
+ final Intent intent = new Intent(ACTION_SHOW_BRIGHTNESS_DIALOG);
+ intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
+ SettingsTransitionHelper.TransitionType.TRANSITION_NONE);
+ mContext.startActivity(intent);
+ return true;
+ }
+
private void updatedSummary(Preference preference) {
if (preference != null) {
preference.setSummary(NumberFormat.getPercentInstance().format(getCurrentBrightness()));
diff --git a/src/com/android/settings/gestures/GestureNavigationSettingsAssistController.java b/src/com/android/settings/gestures/GestureNavigationSettingsAssistController.java
new file mode 100644
index 0000000..5c49538
--- /dev/null
+++ b/src/com/android/settings/gestures/GestureNavigationSettingsAssistController.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 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.gestures;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+/**
+ * Configures behaviour of corner swipe to invoke assistant app gesture.
+ */
+public class GestureNavigationSettingsAssistController extends TogglePreferenceController {
+
+ // This value is based on SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+ // behaviour. We assume that the gestures are enabled by default.
+ private static final int ASSIST_TOUCH_GESTURE_DEFAULT_VALUE = 1;
+
+ public GestureNavigationSettingsAssistController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, ASSIST_TOUCH_GESTURE_DEFAULT_VALUE)
+ == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ return Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, isChecked ? 1 : 0);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return SystemNavigationPreferenceController.isGestureAvailable(mContext) ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
+ }
+}
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index eff7930..4c5552d 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -1168,9 +1168,11 @@
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- MenuItem item = menu.add(0, MENU_FIX_CONNECTIVITY, 0, R.string.fix_connectivity);
- item.setIcon(R.drawable.ic_repair_24dp);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ if (!mAirplaneModeEnabler.isAirplaneModeOn()) {
+ MenuItem item = menu.add(0, MENU_FIX_CONNECTIVITY, 0, R.string.fix_connectivity);
+ item.setIcon(R.drawable.ic_repair_24dp);
+ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
+ }
super.onCreateOptionsMenu(menu, inflater);
}
diff --git a/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java b/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java
index c630cc7..f0eb96d 100644
--- a/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java
+++ b/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java
@@ -17,7 +17,6 @@
package com.android.settings.network;
import android.content.Context;
-import android.icu.text.ListFormatter;
import android.text.BidiFormatter;
import android.text.TextUtils;
@@ -75,6 +74,20 @@
&& !TextUtils.isEmpty(hotspotSummary)) {
summaries.add(hotspotSummary);
}
- return ListFormatter.getInstance().format(summaries);
+ return concatSummaries(summaries);
+ }
+
+ private CharSequence concatSummaries(List<String> summaries) {
+ if (summaries.isEmpty()) {
+ return mContext.getText(R.string.summary_placeholder);
+ }
+
+ String summary = summaries.get(0);
+ final int summary_size = summaries.size();
+ for (int i = 1; i < summary_size; i++) {
+ summary = mContext.getString(R.string.join_two_unrelated_items, summary,
+ summaries.get(i));
+ }
+ return summary;
}
}
diff --git a/src/com/android/settings/network/telephony/NetworkProviderWorker.java b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
index 464ee75..5205f52 100644
--- a/src/com/android/settings/network/telephony/NetworkProviderWorker.java
+++ b/src/com/android/settings/network/telephony/NetworkProviderWorker.java
@@ -97,6 +97,7 @@
@Override
protected void onSlicePinned() {
+ Log.d(TAG, "onSlicePinned");
mMobileDataObserver.register(mContext, mDefaultDataSubid);
mSubscriptionsListener.start();
mDataEnabledListener.start(mDefaultDataSubid);
@@ -108,6 +109,7 @@
@Override
protected void onSliceUnpinned() {
+ Log.d(TAG, "onSliceUnpinned");
mMobileDataObserver.unregister(mContext);
mSubscriptionsListener.stop();
mDataEnabledListener.stop();
@@ -138,10 +140,11 @@
@Override
public void onSubscriptionsChanged() {
int defaultDataSubId = getDefaultDataSubscriptionId();
- Log.d(TAG, "onSubscriptionsChanged: defaultDataSubId:" + defaultDataSubId);
if (mDefaultDataSubid == defaultDataSubId) {
+ Log.d(TAG, "onSubscriptionsChanged: no change");
return;
}
+ Log.d(TAG, "onSubscriptionsChanged: defaultDataSubId:" + defaultDataSubId);
if (SubscriptionManager.isUsableSubscriptionId(defaultDataSubId)) {
mTelephonyManager.unregisterTelephonyCallback(mTelephonyCallback);
mMobileDataObserver.unregister(mContext);
@@ -149,7 +152,7 @@
mSignalStrengthListener.updateSubscriptionIds(Collections.singleton(defaultDataSubId));
mTelephonyManager = mTelephonyManager.createForSubscriptionId(defaultDataSubId);
mTelephonyManager.registerTelephonyCallback(mHandler::post, mTelephonyCallback);
- mMobileDataObserver.register(mContext, mDefaultDataSubid);
+ mMobileDataObserver.register(mContext, defaultDataSubId);
mConfig = getConfig(mContext);
} else {
mSignalStrengthListener.updateSubscriptionIds(Collections.emptySet());
@@ -189,11 +192,13 @@
public DataContentObserver(Handler handler, NetworkProviderWorker backgroundWorker) {
super(handler);
+ Log.d(TAG, "DataContentObserver: init");
mNetworkProviderWorker = backgroundWorker;
}
@Override
public void onChange(boolean selfChange) {
+ Log.d(TAG, "DataContentObserver: onChange");
mNetworkProviderWorker.updateSlice();
}
@@ -205,6 +210,7 @@
*/
public void register(Context context, int subId) {
final Uri uri = MobileDataContentObserver.getObservableUri(context, subId);
+ Log.d(TAG, "DataContentObserver: register uri:" + uri);
context.getContentResolver().registerContentObserver(uri, false, this);
}
@@ -214,6 +220,7 @@
* @param context the Context object.
*/
public void unregister(Context context) {
+ Log.d(TAG, "DataContentObserver: unregister");
context.getContentResolver().unregisterContentObserver(this);
}
}
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index 22b4311..e3d0249 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.notification;
-import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
-
import android.app.Activity;
import android.app.Application;
import android.app.settings.SettingsEnums;
@@ -29,18 +27,14 @@
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
-import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.RingtonePreference;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.core.OnActivityResultListener;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -79,9 +73,6 @@
@Override
protected int getPreferenceScreenResId() {
- if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
- return R.xml.configure_notification_settings_v2;
- }
return R.xml.configure_notification_settings;
}
@@ -121,38 +112,13 @@
controllers.add(new NotificationAssistantPreferenceController(context,
new NotificationBackend(), host, KEY_NAS));
- if (FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)) {
- controllers.add(new EmergencyBroadcastPreferenceController(context,
- "app_and_notif_cell_broadcast_settings"));
- }
+ controllers.add(new EmergencyBroadcastPreferenceController(context,
+ "app_and_notif_cell_broadcast_settings"));
+
return controllers;
}
@Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- // TODO(b/182237530): This method should be removed when this flag is deprecated.
- if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
- final PreferenceScreen screen = getPreferenceScreen();
- final Bundle arguments = getArguments();
-
- if (screen == null) {
- return;
- }
- if (arguments != null) {
- final String highlightKey = arguments.getString(EXTRA_FRAGMENT_ARG_KEY);
- if (!TextUtils.isEmpty(highlightKey)) {
- final PreferenceCategory advancedCategory =
- screen.findPreference(KEY_ADVANCED_CATEGORY);
- // Has highlight row - expand everything
- advancedCategory.setInitialExpandedChildrenCount(Integer.MAX_VALUE);
- scrollToPreference(advancedCategory);
- }
- }
- }
- }
-
- @Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof RingtonePreference) {
writePreferenceClickMetric(preference);
diff --git a/src/com/android/settings/notification/SoundSettings.java b/src/com/android/settings/notification/SoundSettings.java
index 7c665d1..85623b8 100644
--- a/src/com/android/settings/notification/SoundSettings.java
+++ b/src/com/android/settings/notification/SoundSettings.java
@@ -25,9 +25,7 @@
import android.os.Message;
import android.os.UserHandle;
import android.preference.SeekBarVolumizer;
-import android.provider.SearchIndexableResource;
import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import androidx.annotation.VisibleForTesting;
import androidx.preference.ListPreference;
@@ -35,7 +33,6 @@
import com.android.settings.R;
import com.android.settings.RingtonePreference;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.core.OnActivityResultListener;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -155,9 +152,6 @@
@Override
protected int getPreferenceScreenResId() {
- if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
- return R.xml.sound_settings_v2;
- }
return R.xml.sound_settings;
}
@@ -251,12 +245,6 @@
controllers.add(new AlarmRingtonePreferenceController(context));
controllers.add(new NotificationRingtonePreferenceController(context));
- if (!FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)) {
- // TODO(b/174964721): This should be removed when the flag is deprecated.
- // === Work Sound Settings ===
- controllers.add(new WorkSoundPreferenceController(context, fragment, lifecycle));
- }
-
// === Other Sound Settings ===
final DialPadTonePreferenceController dialPadTonePreferenceController =
new DialPadTonePreferenceController(context, fragment, lifecycle);
@@ -312,30 +300,8 @@
return buildPreferenceControllers(context, null /* fragment */,
null /* lifecycle */);
}
-
- @Override
- public List<SearchIndexableResource> getXmlResourcesToIndex(
- Context context, boolean enabled) {
- final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)
- ? R.xml.sound_settings_v2 : R.xml.sound_settings;
- return Arrays.asList(sir);
- }
};
- // === Work Sound Settings ===
-
- void enableWorkSync() {
- // TODO(b/174964721): This should be refined when the flag is deprecated.
- if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
- final WorkSoundPreferenceController workSoundController =
- use(WorkSoundPreferenceController.class);
- if (workSoundController != null) {
- workSoundController.enableWorkSync();
- }
- }
- }
-
private void onPreferenceDataChanged(ListPreference preference) {
if (mDialogFragment != null) {
mDialogFragment.onListPreferenceUpdated(preference);
diff --git a/src/com/android/settings/notification/SoundWorkSettings.java b/src/com/android/settings/notification/SoundWorkSettings.java
index 9fae72d..d30c04f 100644
--- a/src/com/android/settings/notification/SoundWorkSettings.java
+++ b/src/com/android/settings/notification/SoundWorkSettings.java
@@ -23,13 +23,11 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.RingtonePreference;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.core.OnActivityResultListener;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -123,16 +121,12 @@
}
static final boolean isSupportWorkProfileSound(Context context) {
- // TODO(b/174964721): Feature flag should be removed when silky home launched.
- final boolean isSilkyEnabled = FeatureFlagUtils.isEnabled(context,
- FeatureFlags.SILKY_HOME);
-
final AudioHelper audioHelper = new AudioHelper(context);
final boolean hasWorkProfile = audioHelper.getManagedProfileId(
UserManager.get(context)) != UserHandle.USER_NULL;
final boolean shouldShowRingtoneSettings = !audioHelper.isSingleVolume();
- return isSilkyEnabled && hasWorkProfile && shouldShowRingtoneSettings;
+ return hasWorkProfile && shouldShowRingtoneSettings;
}
void enableWorkSync() {
diff --git a/src/com/android/settings/notification/WorkSoundPreferenceController.java b/src/com/android/settings/notification/WorkSoundPreferenceController.java
deleted file mode 100644
index e257fea..0000000
--- a/src/com/android/settings/notification/WorkSoundPreferenceController.java
+++ /dev/null
@@ -1,368 +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.annotation.UserIdInt;
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.FragmentManager;
-import androidx.preference.Preference;
-import androidx.preference.Preference.OnPreferenceChangeListener;
-import androidx.preference.PreferenceGroup;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.TwoStatePreference;
-
-import com.android.settings.DefaultRingtonePreference;
-import com.android.settings.R;
-import com.android.settings.Utils;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnPause;
-import com.android.settingslib.core.lifecycle.events.OnResume;
-
-import java.util.List;
-
-/**
- * TODO(b/183670633): Remove this file when silky flag deprecated.
- */
-public class WorkSoundPreferenceController extends AbstractPreferenceController
- implements PreferenceControllerMixin, OnPreferenceChangeListener, LifecycleObserver,
- OnResume, OnPause {
-
- private static final String TAG = "WorkSoundPrefController";
- private static final String KEY_WORK_CATEGORY = "sound_work_settings_section";
- private static final String KEY_WORK_USE_PERSONAL_SOUNDS = "work_use_personal_sounds";
- private static final String KEY_WORK_PHONE_RINGTONE = "work_ringtone";
- private static final String KEY_WORK_NOTIFICATION_RINGTONE = "work_notification_ringtone";
- private static final String KEY_WORK_ALARM_RINGTONE = "work_alarm_ringtone";
-
- private final boolean mVoiceCapable;
- private final UserManager mUserManager;
- private final SoundSettings mParent;
- private final AudioHelper mHelper;
-
- private PreferenceGroup mWorkPreferenceCategory;
- private TwoStatePreference mWorkUsePersonalSounds;
- private Preference mWorkPhoneRingtonePreference;
- private Preference mWorkNotificationRingtonePreference;
- private Preference mWorkAlarmRingtonePreference;
-
- @UserIdInt
- private int mManagedProfileId;
-
- public WorkSoundPreferenceController(Context context, SoundSettings parent,
- Lifecycle lifecycle) {
- this(context, parent, lifecycle, new AudioHelper(context));
- }
-
- @VisibleForTesting
- WorkSoundPreferenceController(Context context, SoundSettings parent, Lifecycle lifecycle,
- AudioHelper helper) {
- super(context);
- mUserManager = UserManager.get(context);
- mVoiceCapable = Utils.isVoiceCapable(mContext);
- mParent = parent;
- mHelper = helper;
- if (lifecycle != null) {
- lifecycle.addObserver(this);
- }
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- mWorkPreferenceCategory = screen.findPreference(KEY_WORK_CATEGORY);
- }
-
- @Override
- public void onResume() {
- IntentFilter managedProfileFilter = new IntentFilter();
- managedProfileFilter.addAction(Intent.ACTION_MANAGED_PROFILE_ADDED);
- managedProfileFilter.addAction(Intent.ACTION_MANAGED_PROFILE_REMOVED);
- mContext.registerReceiver(mManagedProfileReceiver, managedProfileFilter);
-
- mManagedProfileId = mHelper.getManagedProfileId(mUserManager);
- updateWorkPreferences();
- }
-
- @Override
- public void onPause() {
- mContext.unregisterReceiver(mManagedProfileReceiver);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_WORK_CATEGORY;
- }
-
- @Override
- public boolean isAvailable() {
- return mHelper.getManagedProfileId(mUserManager) != UserHandle.USER_NULL
- && shouldShowRingtoneSettings();
- }
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- return false;
- }
-
- /**
- * Updates the summary of work preferences
- *
- * This controller listens to changes on the work ringtone preferences, identified by keys
- * "work_ringtone", "work_notification_ringtone" and "work_alarm_ringtone".
- */
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- int ringtoneType;
- if (KEY_WORK_PHONE_RINGTONE.equals(preference.getKey())) {
- ringtoneType = RingtoneManager.TYPE_RINGTONE;
- } else if (KEY_WORK_NOTIFICATION_RINGTONE.equals(preference.getKey())) {
- ringtoneType = RingtoneManager.TYPE_NOTIFICATION;
- } else if (KEY_WORK_ALARM_RINGTONE.equals(preference.getKey())) {
- ringtoneType = RingtoneManager.TYPE_ALARM;
- } else {
- return true;
- }
-
- preference.setSummary(updateRingtoneName(getManagedProfileContext(), ringtoneType));
- return true;
- }
-
- @Override
- public void updateNonIndexableKeys(List<String> keys) {
- if (isAvailable()) {
- return;
- }
- keys.add(KEY_WORK_CATEGORY);
- keys.add(KEY_WORK_USE_PERSONAL_SOUNDS);
- keys.add(KEY_WORK_NOTIFICATION_RINGTONE);
- keys.add(KEY_WORK_PHONE_RINGTONE);
- keys.add(KEY_WORK_ALARM_RINGTONE);
- }
-
- // === Phone & notification ringtone ===
-
- private boolean shouldShowRingtoneSettings() {
- return !mHelper.isSingleVolume();
- }
-
- private CharSequence updateRingtoneName(Context context, int type) {
- if (context == null || !mHelper.isUserUnlocked(mUserManager, context.getUserId())) {
- return mContext.getString(R.string.managed_profile_not_available_label);
- }
- Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
- return Ringtone.getTitle(context, ringtoneUri, false /* followSettingsUri */,
- true /* allowRemote */);
- }
-
- private Context getManagedProfileContext() {
- if (mManagedProfileId == UserHandle.USER_NULL) {
- return null;
- }
- return mHelper.createPackageContextAsUser(mManagedProfileId);
- }
-
- private DefaultRingtonePreference initWorkPreference(PreferenceGroup root, String key) {
- DefaultRingtonePreference pref =
- (DefaultRingtonePreference) root.findPreference(key);
- pref.setOnPreferenceChangeListener(this);
-
- // Required so that RingtonePickerActivity lists the work profile ringtones
- pref.setUserId(mManagedProfileId);
- return pref;
- }
-
- private void updateWorkPreferences() {
- if (mWorkPreferenceCategory == null) {
- return;
- }
- final boolean isAvailable = isAvailable();
- mWorkPreferenceCategory.setVisible(isAvailable);
- if (!isAvailable) {
- return;
- }
- if (mWorkUsePersonalSounds == null) {
- mWorkUsePersonalSounds = (TwoStatePreference)
- mWorkPreferenceCategory.findPreference(KEY_WORK_USE_PERSONAL_SOUNDS);
- mWorkUsePersonalSounds.setOnPreferenceChangeListener((Preference p, Object value) -> {
- if ((boolean) value) {
- UnifyWorkDialogFragment.show(mParent);
- return false;
- } else {
- disableWorkSync();
- return true;
- }
- });
- }
- if (mWorkPhoneRingtonePreference == null) {
- mWorkPhoneRingtonePreference = initWorkPreference(mWorkPreferenceCategory,
- KEY_WORK_PHONE_RINGTONE);
- }
- if (mWorkNotificationRingtonePreference == null) {
- mWorkNotificationRingtonePreference = initWorkPreference(mWorkPreferenceCategory,
- KEY_WORK_NOTIFICATION_RINGTONE);
- }
- if (mWorkAlarmRingtonePreference == null) {
- mWorkAlarmRingtonePreference = initWorkPreference(mWorkPreferenceCategory,
- KEY_WORK_ALARM_RINGTONE);
- }
- if (!mVoiceCapable) {
- mWorkPhoneRingtonePreference.setVisible(false);
- mWorkPhoneRingtonePreference = null;
- }
-
- final Context managedProfileContext = getManagedProfileContext();
- if (Settings.Secure.getIntForUser(managedProfileContext.getContentResolver(),
- Settings.Secure.SYNC_PARENT_SOUNDS, 0, mManagedProfileId) == 1) {
- enableWorkSyncSettings();
- } else {
- disableWorkSyncSettings();
- }
- }
-
- void enableWorkSync() {
- RingtoneManager.enableSyncFromParent(getManagedProfileContext());
- enableWorkSyncSettings();
- }
-
- private void enableWorkSyncSettings() {
- mWorkUsePersonalSounds.setChecked(true);
-
- if (mWorkPhoneRingtonePreference != null) {
- mWorkPhoneRingtonePreference.setSummary(R.string.work_sound_same_as_personal);
- }
- mWorkNotificationRingtonePreference.setSummary(R.string.work_sound_same_as_personal);
- mWorkAlarmRingtonePreference.setSummary(R.string.work_sound_same_as_personal);
- }
-
- private void disableWorkSync() {
- RingtoneManager.disableSyncFromParent(getManagedProfileContext());
- disableWorkSyncSettings();
- }
-
- private void disableWorkSyncSettings() {
- if (mWorkPhoneRingtonePreference != null) {
- mWorkPhoneRingtonePreference.setEnabled(true);
- }
- mWorkNotificationRingtonePreference.setEnabled(true);
- mWorkAlarmRingtonePreference.setEnabled(true);
-
- updateWorkRingtoneSummaries();
- }
-
- private void updateWorkRingtoneSummaries() {
- Context managedProfileContext = getManagedProfileContext();
-
- if (mWorkPhoneRingtonePreference != null) {
- mWorkPhoneRingtonePreference.setSummary(
- updateRingtoneName(managedProfileContext, RingtoneManager.TYPE_RINGTONE));
- }
- mWorkNotificationRingtonePreference.setSummary(
- updateRingtoneName(managedProfileContext, RingtoneManager.TYPE_NOTIFICATION));
- mWorkAlarmRingtonePreference.setSummary(
- updateRingtoneName(managedProfileContext, RingtoneManager.TYPE_ALARM));
- }
-
- public void onManagedProfileAdded(@UserIdInt int profileId) {
- if (mManagedProfileId == UserHandle.USER_NULL) {
- mManagedProfileId = profileId;
- updateWorkPreferences();
- }
- }
-
- public void onManagedProfileRemoved(@UserIdInt int profileId) {
- if (mManagedProfileId == profileId) {
- mManagedProfileId = mHelper.getManagedProfileId(mUserManager);
- updateWorkPreferences();
- }
- }
-
- private final BroadcastReceiver mManagedProfileReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- final int userId = ((UserHandle) intent.getExtra(Intent.EXTRA_USER)).getIdentifier();
- switch (intent.getAction()) {
- case Intent.ACTION_MANAGED_PROFILE_ADDED: {
- onManagedProfileAdded(userId);
- return;
- }
- case Intent.ACTION_MANAGED_PROFILE_REMOVED: {
- onManagedProfileRemoved(userId);
- return;
- }
- }
- }
- };
-
- public static class UnifyWorkDialogFragment extends InstrumentedDialogFragment
- implements DialogInterface.OnClickListener {
- private static final String TAG = "UnifyWorkDialogFragment";
- private static final int REQUEST_CODE = 200;
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.DIALOG_UNIFY_SOUND_SETTINGS;
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- return new AlertDialog.Builder(getActivity())
- .setTitle(R.string.work_sync_dialog_title)
- .setMessage(R.string.work_sync_dialog_message)
- .setPositiveButton(R.string.work_sync_dialog_yes, UnifyWorkDialogFragment.this)
- .setNegativeButton(android.R.string.no, null)
- .create();
- }
-
- public static void show(SoundSettings parent) {
- FragmentManager fm = parent.getFragmentManager();
- if (fm.findFragmentByTag(TAG) == null) {
- UnifyWorkDialogFragment fragment = new UnifyWorkDialogFragment();
- fragment.setTargetFragment(parent, REQUEST_CODE);
- fragment.show(fm, TAG);
- }
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- SoundSettings soundSettings = (SoundSettings) getTargetFragment();
- if (soundSettings.isAdded()) {
- soundSettings.enableWorkSync();
- }
- }
- }
-
-}
diff --git a/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java b/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java
index 8fab3c9..964482e 100644
--- a/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java
+++ b/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java
@@ -27,8 +27,12 @@
public class TopLevelSecurityEntryPreferenceController extends BasePreferenceController {
+ private final SecuritySettingsFeatureProvider mSecuritySettingsFeatureProvider;
+
public TopLevelSecurityEntryPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
+ mSecuritySettingsFeatureProvider = FeatureFactory.getFactory(mContext)
+ .getSecuritySettingsFeatureProvider();
}
@Override
@@ -42,11 +46,9 @@
return super.handlePreferenceTreeClick(preference);
}
- SecuritySettingsFeatureProvider securitySettingsFeatureProvider =
- FeatureFactory.getFactory(mContext).getSecuritySettingsFeatureProvider();
- if (securitySettingsFeatureProvider.hasAlternativeSecuritySettingsFragment()) {
+ if (mSecuritySettingsFeatureProvider.hasAlternativeSecuritySettingsFragment()) {
String alternativeFragmentClassname =
- securitySettingsFeatureProvider
+ mSecuritySettingsFeatureProvider
.getAlternativeSecuritySettingsFragmentClassname();
if (alternativeFragmentClassname != null) {
new SubSettingLauncher(mContext)
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 5c80024..d8bdf32 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -411,6 +411,7 @@
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
+ mSummary = view.findViewById(R.id.sud_layout_subtitle);
mTextureView = view.findViewById(R.id.preview_view);
mTextureView.setSurfaceTextureListener(this);
diff --git a/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java b/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java
index 7a83cd0..a74c01e 100644
--- a/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java
+++ b/tests/robotests/src/com/android/settings/core/SubSettingLauncherTest.java
@@ -37,6 +37,7 @@
import com.android.settings.SettingsActivity;
import com.android.settings.testutils.shadow.ShadowUtils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.transition.SettingsTransitionHelper;
import org.junit.Before;
import org.junit.Test;
@@ -97,6 +98,7 @@
.setDestination(SubSettingLauncherTest.class.getName())
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setSourceMetricsCategory(123)
+ .setTransitionType(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE)
.launch();
doNothing().when(launcher).launch(any(Intent.class));
verify(launcher).launch(intentArgumentCaptor.capture());
@@ -109,6 +111,8 @@
assertThat(intent.getFlags()).isEqualTo(Intent.FLAG_ACTIVITY_NEW_TASK);
assertThat(intent.getIntExtra(MetricsFeatureProvider.EXTRA_SOURCE_METRICS_CATEGORY, -1))
.isEqualTo(123);
+ assertThat(intent.getIntExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE, -1))
+ .isEqualTo(SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
index 8fd847a..4948986 100644
--- a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
@@ -25,9 +25,12 @@
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.robolectric.Shadows.shadowOf;
+import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
+import android.content.Intent;
import android.hardware.display.BrightnessInfo;
import android.os.PowerManager;
import android.provider.Settings.System;
@@ -36,14 +39,19 @@
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
+import com.android.settings.core.SettingsBaseActivity;
+import com.android.settingslib.transition.SettingsTransitionHelper;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.shadows.ShadowContentResolver;
@@ -178,4 +186,20 @@
mController.updateState(mPreference);
verify(mPreference).setSummary("0%");
}
+
+ @Test
+ public void handlePreferenceTreeClick_transitionTypeNone_shouldPassToNextActivity() {
+ final Activity activity = Robolectric.setupActivity(Activity.class);
+ final BrightnessLevelPreferenceController controller =
+ new BrightnessLevelPreferenceController(activity, null);
+ final ShadowActivity shadowActivity = shadowOf(activity);
+ when(mPreference.getKey()).thenReturn("brightness");
+
+ controller.handlePreferenceTreeClick(mPreference);
+
+ final Intent intent = shadowActivity.getNextStartedActivity();
+ assertThat(intent.getIntExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE, 0))
+ .isEqualTo(SettingsTransitionHelper.TransitionType.TRANSITION_NONE);
+
+ }
}
diff --git a/tests/robotests/src/com/android/settings/gestures/GestureNavigationSettingsAssistControllerTest.java b/tests/robotests/src/com/android/settings/gestures/GestureNavigationSettingsAssistControllerTest.java
new file mode 100644
index 0000000..e0dadee
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/gestures/GestureNavigationSettingsAssistControllerTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2021 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.gestures;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.provider.Settings;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.internal.R;
+import com.android.settings.testutils.shadow.SettingsShadowResources;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.Shadows;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowPackageManager;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = SettingsShadowResources.class)
+public class GestureNavigationSettingsAssistControllerTest {
+
+ private static final String KEY_SWIPE_FOR_ASSIST = "assistant_gesture_corner_swipe";
+ private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
+ private GestureNavigationSettingsAssistController mController;
+
+ private Context mContext;
+
+ @Before
+ public void setUp() {
+ mContext = ApplicationProvider.getApplicationContext();
+
+ // This sets up SystemNavigationPreferenceController.isGestureAvailable() so it returns true
+ SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
+ true);
+ final String recentsComponentPackageName = "recents.component";
+ SettingsShadowResources.overrideResource(R.string.config_recentsComponentName,
+ recentsComponentPackageName + "/.ComponentName");
+ final Intent quickStepIntent = new Intent(ACTION_QUICKSTEP)
+ .setPackage(recentsComponentPackageName);
+ final ResolveInfo info = new ResolveInfo();
+ info.serviceInfo = new ServiceInfo();
+ info.resolvePackageName = recentsComponentPackageName;
+ info.serviceInfo.packageName = info.resolvePackageName;
+ info.serviceInfo.name = recentsComponentPackageName;
+ info.serviceInfo.applicationInfo = new ApplicationInfo();
+ info.serviceInfo.applicationInfo.flags = ApplicationInfo.FLAG_SYSTEM;
+ ShadowPackageManager shadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
+ shadowPackageManager.addResolveInfoForIntent(quickStepIntent, info);
+
+ mController = new GestureNavigationSettingsAssistController(mContext, KEY_SWIPE_FOR_ASSIST);
+ }
+
+ @Test
+ public void isAvailable_systemNavigationControllerReturnsTrue_shouldReturnTrue() {
+ assertThat(mController.isAvailable()).isTrue();
+ }
+
+ @Test
+ public void isAvailable_systemNavigationControllerReturnsFalse_shouldReturnFalse() {
+ SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
+ false);
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void isChecked_noDefault_true() {
+ assertThat(mController.isChecked()).isTrue();
+ }
+
+ @Test
+ public void isChecked_valueFalse_shouldReturnFalse() {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, 0);
+ assertThat(mController.isChecked()).isFalse();
+ }
+
+ @Test
+ public void isChecked_valueTrue_shouldReturnTrue() {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, 1);
+ assertThat(mController.isChecked()).isTrue();
+ }
+
+ @Test
+ public void onPreferenceChange_preferenceChecked_valueTrue() {
+ mController.onPreferenceChange(null, true);
+ assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, -1)).isEqualTo(1);
+ }
+
+ @Test
+ public void onPreferenceChange_preferenceUnchecked_valueFalse() {
+ mController.onPreferenceChange(null, false);
+ assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, -1)).isEqualTo(0);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
index f02a806..7affe68 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
@@ -46,6 +46,7 @@
import android.provider.Settings;
import android.util.FeatureFlagUtils;
import android.view.ContextMenu;
+import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -417,6 +418,27 @@
}
@Test
+ public void onCreateOptionsMenu_airplanModeOn_fixConnectivityMenuInvisible() {
+ doReturn(true).when(mAirplaneModeEnabler).isAirplaneModeOn();
+ final Menu menu = mock(Menu.class);
+ mNetworkProviderSettings.onCreateOptionsMenu(menu, null /* inflater */);
+
+ verify(menu, never()).add(anyInt(), eq(NetworkProviderSettings.MENU_FIX_CONNECTIVITY),
+ anyInt(), eq(R.string.fix_connectivity));
+ }
+
+ @Test
+ public void onCreateOptionsMenu_airplanModeOff_fixConnectivityMenuVisible() {
+ doReturn(false).when(mAirplaneModeEnabler).isAirplaneModeOn();
+ final Menu menu = mock(Menu.class);
+ when(menu.add(anyInt(), anyInt(), anyInt(), anyInt())).thenReturn(mock(MenuItem.class));
+ mNetworkProviderSettings.onCreateOptionsMenu(menu, null /* inflater */);
+
+ verify(menu).add(anyInt(), eq(NetworkProviderSettings.MENU_FIX_CONNECTIVITY),
+ anyInt(), eq(R.string.fix_connectivity));
+ }
+
+ @Test
public void onOptionsItemSelected_fixConnectivity_triggerSubsystemRestart() {
doReturn(true).when(mConnectivitySubsystemsRecoveryManager).isRecoveryAvailable();
mNetworkProviderSettings.mConnectivitySubsystemsRecoveryManager =
diff --git a/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
index a3f0c90..81092eb 100644
--- a/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
@@ -92,7 +92,7 @@
when(mTetherPreferenceController.isAvailable()).thenReturn(true);
assertThat(mController.getSummary())
- .isEqualTo("Wi\u2011Fi, mobile, data usage, and hotspot");
+ .isEqualTo("Wi\u2011Fi, mobile, data usage, hotspot");
}
@Test
@@ -101,6 +101,6 @@
when(mMobileNetworkPreferenceController.isAvailable()).thenReturn(false);
when(mTetherPreferenceController.isAvailable()).thenReturn(false);
- assertThat(mController.getSummary()).isEqualTo("Wi\u2011Fi and data usage");
+ assertThat(mController.getSummary()).isEqualTo("Wi\u2011Fi, data usage");
}
}
diff --git a/tests/robotests/src/com/android/settings/notification/WorkSoundPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/WorkSoundPreferenceControllerTest.java
deleted file mode 100644
index fb4747c..0000000
--- a/tests/robotests/src/com/android/settings/notification/WorkSoundPreferenceControllerTest.java
+++ /dev/null
@@ -1,274 +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 static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.telephony.TelephonyManager;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.TwoStatePreference;
-
-import com.android.settings.DefaultRingtonePreference;
-import com.android.settings.R;
-import com.android.settings.RingtonePreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-
-@RunWith(RobolectricTestRunner.class)
-public class WorkSoundPreferenceControllerTest {
-
- private static final String KEY_WORK_CATEGORY = "sound_work_settings_section";
- private static final String KEY_WORK_USE_PERSONAL_SOUNDS = "work_use_personal_sounds";
- private static final String KEY_WORK_PHONE_RINGTONE = "work_ringtone";
- private static final String KEY_WORK_NOTIFICATION_RINGTONE = "work_notification_ringtone";
- private static final String KEY_WORK_ALARM_RINGTONE = "work_alarm_ringtone";
-
- @Mock
- private Context mContext;
- @Mock
- private PreferenceScreen mScreen;
- @Mock
- private PreferenceCategory mWorkCategory;
- @Mock
- private TelephonyManager mTelephonyManager;
- @Mock
- private AudioHelper mAudioHelper;
- @Mock
- private SoundSettings mFragment;
-
- private WorkSoundPreferenceController mController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
- when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
- when(mScreen.findPreference(KEY_WORK_CATEGORY))
- .thenReturn(mWorkCategory);
- when(mWorkCategory.findPreference(KEY_WORK_USE_PERSONAL_SOUNDS))
- .thenReturn(mock(TwoStatePreference.class));
- when(mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
- .thenReturn(mock(DefaultRingtonePreference.class));
- when(mWorkCategory.findPreference(KEY_WORK_NOTIFICATION_RINGTONE))
- .thenReturn(mock(DefaultRingtonePreference.class));
- when(mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
- .thenReturn(mock(DefaultRingtonePreference.class));
-
- mController = new WorkSoundPreferenceController(mContext, mFragment, null, mAudioHelper);
- }
-
- @Test
- public void isAvailable_managedProfileAndNotSingleVolume_shouldReturnTrue() {
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
-
- assertThat(mController.isAvailable()).isTrue();
- }
-
- @Test
- public void isAvailable_noManagedProfile_shouldReturnFalse() {
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.USER_NULL);
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
-
- assertThat(mController.isAvailable()).isFalse();
- }
-
- @Test
- public void isAvailable_singleVolume_shouldReturnFalse() {
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
- when(mAudioHelper.isSingleVolume()).thenReturn(true);
-
- assertThat(mController.isAvailable()).isFalse();
- }
-
- @Test
- public void onManagedProfileAdded_shouldDisplayPreferenceCategory() {
- // Given a device without any managed profiles:
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.USER_NULL);
-
- // When the fragment first displays, the category should not appear.
- mController.displayPreference(mScreen);
- verify(mWorkCategory).setVisible(false);
-
- // However, when a managed profile is added later, the category should appear.
- mController.onResume();
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- mController.onManagedProfileAdded(UserHandle.myUserId());
-
- verify(mWorkCategory).setVisible(true);
- }
-
- @Test
- public void onManagedProfileRemoved_shouldHidePreferenceCategory() {
- // Given a device with a managed profile:
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
-
- // Which is in resumed state:
- mController.displayPreference(mScreen);
- mController.onResume();
-
- verify(mWorkCategory, times(2)).setVisible(true);
-
- // When a managed profile is removed, the category should be hidden.
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.USER_NULL);
- mController.onManagedProfileRemoved(UserHandle.myUserId());
-
- verify(mWorkCategory).setVisible(false);
- }
-
- @Test
- public void displayPreference_isAvailable_shouldShowPreferenceCategory() {
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
-
- mController.displayPreference(mScreen);
- verify(mWorkCategory).setVisible(true);
- }
-
- @Test
- public void displayPreference_notAvailable_shouldHidePreferenceCategory() {
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.USER_NULL);
- when(mAudioHelper.isSingleVolume()).thenReturn(true);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
-
- mController.displayPreference(mScreen);
- verify(mWorkCategory).setVisible(false);
- }
-
- @Test
- public void onPreferenceChange_shouldUpdateSummary() {
- final Preference preference = mock(Preference.class);
- when(preference.getKey()).thenReturn(KEY_WORK_PHONE_RINGTONE);
-
- mController.onPreferenceChange(preference, "hello");
-
- verify(preference).setSummary(nullable(String.class));
- }
-
- @Test
- public void onResume_noVoiceCapability_shouldHidePhoneRingtone() {
- when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
- mController = new WorkSoundPreferenceController(mContext, mFragment, null, mAudioHelper);
-
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
-
- // Precondition: work profile is available.
- assertThat(mController.isAvailable()).isTrue();
-
- mController.displayPreference(mScreen);
- mController.onResume();
-
- verify((Preference) mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
- .setVisible(false);
- }
-
- @Test
- public void onResume_availableButLocked_shouldRedactPreferences() {
- final String notAvailable = "(not available)";
- when(mContext.getString(R.string.managed_profile_not_available_label))
- .thenReturn(notAvailable);
-
- // Given a device with a managed profile:
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(UserHandle.myUserId());
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(false);
-
- // When resumed:
- mController.displayPreference(mScreen);
- mController.onResume();
-
- verify(mWorkCategory, times(2)).setVisible(true);
-
- // Sound preferences should explain that the profile isn't available yet.
- verify((Preference) mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
- .setSummary(eq(notAvailable));
- verify((Preference) mWorkCategory.findPreference(KEY_WORK_NOTIFICATION_RINGTONE))
- .setSummary(eq(notAvailable));
- verify((Preference) mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
- .setSummary(eq(notAvailable));
- }
-
- @Test
- public void onResume_shouldSetUserIdToPreference() {
- final int managedProfileUserId = 10;
- when(mAudioHelper.getManagedProfileId(nullable(UserManager.class)))
- .thenReturn(managedProfileUserId);
- when(mAudioHelper.isUserUnlocked(nullable(UserManager.class), anyInt())).thenReturn(true);
- when(mAudioHelper.isSingleVolume()).thenReturn(false);
- when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
- when(mAudioHelper.createPackageContextAsUser(anyInt())).thenReturn(mContext);
-
- mController.displayPreference(mScreen);
- mController.onResume();
-
- verify((RingtonePreference) mWorkCategory.findPreference(KEY_WORK_PHONE_RINGTONE))
- .setUserId(managedProfileUserId);
- verify((RingtonePreference) mWorkCategory.findPreference(KEY_WORK_NOTIFICATION_RINGTONE))
- .setUserId(managedProfileUserId);
- verify((RingtonePreference) mWorkCategory.findPreference(KEY_WORK_ALARM_RINGTONE))
- .setUserId(managedProfileUserId);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/notification/WorkSoundsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/WorkSoundsPreferenceControllerTest.java
index 2b38031..448dd5c 100644
--- a/tests/robotests/src/com/android/settings/notification/WorkSoundsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/WorkSoundsPreferenceControllerTest.java
@@ -23,9 +23,7 @@
import android.content.Context;
import android.os.UserHandle;
-import android.util.FeatureFlagUtils;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.testutils.shadow.ShadowAudioHelper;
import org.junit.After;
@@ -56,7 +54,6 @@
@Test
public void getAvailabilityStatus_supportWorkProfileSound_shouldReturnAvailable() {
- FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
ShadowAudioHelper.setIsSingleVolume(false);
ShadowAudioHelper.setManagedProfileId(UserHandle.USER_CURRENT);