Snap for 12903105 from fc623f88e0 to 25Q2-release
Change-Id: I2651659d0a282052b893fe7e2fad33a01cd9819f
This commit is contained in:
@@ -21,8 +21,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginStart="24dp"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:layout_marginEnd="16dp"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:paddingTop="@dimen/notification_importance_toggle_marginTop"
|
android:paddingTop="@dimen/notification_importance_toggle_marginTop"
|
||||||
android:paddingBottom="@dimen/notification_importance_toggle_marginTop"
|
android:paddingBottom="@dimen/notification_importance_toggle_marginTop"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginStart="24dp"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:layout_marginEnd="16dp"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:paddingTop="@dimen/notification_importance_toggle_marginTop"
|
android:paddingTop="@dimen/notification_importance_toggle_marginTop"
|
||||||
android:paddingBottom="@dimen/notification_importance_toggle_marginTop"
|
android:paddingBottom="@dimen/notification_importance_toggle_marginTop"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|||||||
@@ -9003,9 +9003,12 @@
|
|||||||
<!-- [CHAR LIMIT=100] Title for switch that says whether this app can appear in the conversation notification section-->
|
<!-- [CHAR LIMIT=100] Title for switch that says whether this app can appear in the conversation notification section-->
|
||||||
<string name="conversation_section_switch_title">Conversation section</string>
|
<string name="conversation_section_switch_title">Conversation section</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=100] Summary for switch that says whether this app can appear in the conversation notification section-->
|
<!-- [CHAR LIMIT=100] Summary for switch that says whether this app can appear in the conversation notification section (old)-->
|
||||||
<string name="conversation_section_switch_summary">Allow app to use conversation section</string>
|
<string name="conversation_section_switch_summary">Allow app to use conversation section</string>
|
||||||
|
|
||||||
|
<!-- [CHAR LIMIT=100] Summary for switch that says whether this app can appear in the conversation notification section-->
|
||||||
|
<string name="conversation_section_switch_complete_summary">Allow app to use conversation section, although conversation features like prioritization and bubbles are not supported by this app.</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=NONE] Conversation preference summary, the parent channel this conversation was spawned from (separator) the parent channel group (e.g. an account name)-->
|
<!-- [CHAR LIMIT=NONE] Conversation preference summary, the parent channel this conversation was spawned from (separator) the parent channel group (e.g. an account name)-->
|
||||||
<string name="notification_conversation_summary" translatable="false">"<xliff:g id="parent_category_name">%1$s</xliff:g> • <xliff:g id="parent_category_group_name">%2$s</xliff:g>"</string>
|
<string name="notification_conversation_summary" translatable="false">"<xliff:g id="parent_category_name">%1$s</xliff:g> • <xliff:g id="parent_category_group_name">%2$s</xliff:g>"</string>
|
||||||
|
|
||||||
@@ -9398,8 +9401,11 @@
|
|||||||
<!-- [CHAR LIMIT=NONE] Text appearing when app does not send notifications -->
|
<!-- [CHAR LIMIT=NONE] Text appearing when app does not send notifications -->
|
||||||
<string name="app_notifications_not_send_desc">This app does not send notifications</string>
|
<string name="app_notifications_not_send_desc">This app does not send notifications</string>
|
||||||
|
|
||||||
|
<!-- [CHAR LIMIT=NONE] App notification settings: section header for app wide notif settings -->
|
||||||
|
<string name="app_notification_settings">App settings</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=NONE] App notification settings: channels title -->
|
<!-- [CHAR LIMIT=NONE] App notification settings: channels title -->
|
||||||
<string name="notification_channels">Categories</string>
|
<string name="notification_channels">Notification categories</string>
|
||||||
|
|
||||||
<!-- [CHAR LIMIT=NONE] App notification settings: non-grouped-channels title -->
|
<!-- [CHAR LIMIT=NONE] App notification settings: non-grouped-channels title -->
|
||||||
<string name="notification_channels_other">Other</string>
|
<string name="notification_channels_other">Other</string>
|
||||||
@@ -12441,9 +12447,9 @@
|
|||||||
<!-- Category name "About satellite messaging" [CHAR_LIMIT=NONE] -->
|
<!-- Category name "About satellite messaging" [CHAR_LIMIT=NONE] -->
|
||||||
<string name="category_name_about_satellite_messaging">About <xliff:g id="subject" example="satellite messaging">%1$s</xliff:g></string>
|
<string name="category_name_about_satellite_messaging">About <xliff:g id="subject" example="satellite messaging">%1$s</xliff:g></string>
|
||||||
<!-- Summary for category "About satellite messaging" [CHAR_LIMIT=NONE] -->
|
<!-- Summary for category "About satellite messaging" [CHAR_LIMIT=NONE] -->
|
||||||
<string name="title_about_satellite_setting">You can send and receive text messages by satellite as part of an eligible <xliff:g id="carrier_name" example="T-Mobile">%1$s</xliff:g> account</string>
|
<string name="title_about_satellite_setting">You can send and receive text messages by satellite with an eligible <xliff:g id="carrier_name" example="T-Mobile">%1$s</xliff:g> account</string>
|
||||||
<!-- Category title "Your mobile plan" [CHAR_LIMIT=NONE] -->
|
<!-- Category title "Your mobile plan" [CHAR_LIMIT=NONE] -->
|
||||||
<string name="category_title_your_satellite_plan">Your <xliff:g id="carrier_name" example="T-Mobile">%1$s</xliff:g> plan</string>
|
<string name="category_title_your_satellite_plan">Your <xliff:g id="carrier_name" example="T-Mobile">%1$s</xliff:g> account</string>
|
||||||
<!-- Title for category "Your mobile plan when satellite is included in plan" [CHAR_LIMIT=NONE] -->
|
<!-- Title for category "Your mobile plan when satellite is included in plan" [CHAR_LIMIT=NONE] -->
|
||||||
<string name="title_have_satellite_plan">Messaging is included with your account</string>
|
<string name="title_have_satellite_plan">Messaging is included with your account</string>
|
||||||
<!-- Title for category "Your mobile plan when satellite is not included in plan" [CHAR_LIMIT=NONE] -->
|
<!-- Title for category "Your mobile plan when satellite is not included in plan" [CHAR_LIMIT=NONE] -->
|
||||||
@@ -12461,7 +12467,7 @@
|
|||||||
<!-- Summary for satellite supported service [CHAR_LIMIT=NONE] -->
|
<!-- Summary for satellite supported service [CHAR_LIMIT=NONE] -->
|
||||||
<string name="summary_supported_service">You can text anyone, including emergency services. Your phone will reconnect to a mobile network when available.</string>
|
<string name="summary_supported_service">You can text anyone, including emergency services. Your phone will reconnect to a mobile network when available.</string>
|
||||||
<!-- learn more text - more about satellite messaging [CHAR_LIMIT=NONE] -->
|
<!-- learn more text - more about satellite messaging [CHAR_LIMIT=NONE] -->
|
||||||
<string name="satellite_setting_summary_more_information"><xliff:g id="subject" example="satellite messaging">%1$s</xliff:g> may take longer and is available only in some areas. Weather and certain structures may affect your satellite connection. Calling by satellite isn\u2019t available. Emergency calls may still connect.\n\nIt may take some time for account changes to show in Settings. Contact <xliff:g id="carrier_name" example="T-Mobile">%1$s</xliff:g> for details.</string>
|
<string name="satellite_setting_summary_more_information"><xliff:g id="subject" example="satellite messaging">%1$s</xliff:g> may take longer and is available only in some areas. Weather and certain structures may affect your satellite connection. Calling by satellite isn\u2019t available. Emergency calls may still connect.\n\nIt may take some time for account changes to show in Settings. Contact <xliff:g id="carrier_name" example="T-Mobile">%2$s</xliff:g> for details.</string>
|
||||||
<!-- more about satellite messaging [CHAR_LIMIT=NONE] -->
|
<!-- more about satellite messaging [CHAR_LIMIT=NONE] -->
|
||||||
<string name="more_about_satellite_messaging">More about <xliff:g id="subject" example="satellite messaging">%1$s</xliff:g></string>
|
<string name="more_about_satellite_messaging">More about <xliff:g id="subject" example="satellite messaging">%1$s</xliff:g></string>
|
||||||
<!-- Title for satellite warning dialog to avoid user using wifi/bluetooth/airplane mode [CHAR_LIMIT=NONE] -->
|
<!-- Title for satellite warning dialog to avoid user using wifi/bluetooth/airplane mode [CHAR_LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -80,7 +80,6 @@
|
|||||||
android:key="accessibility_control_autoclick_cursor_area_size"
|
android:key="accessibility_control_autoclick_cursor_area_size"
|
||||||
android:title="@string/autoclick_cursor_area_size_title"
|
android:title="@string/autoclick_cursor_area_size_title"
|
||||||
android:summary="@string/autoclick_cursor_area_size_summary"
|
android:summary="@string/autoclick_cursor_area_size_summary"
|
||||||
settings:seekBarIncrement="20"
|
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
settings:searchable="false"
|
settings:searchable="false"
|
||||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickCursorAreaSizeController"/>
|
settings:controller="com.android.settings.accessibility.ToggleAutoclickCursorAreaSizeController"/>
|
||||||
|
|||||||
@@ -30,49 +30,21 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="block_desc" />
|
android:key="block_desc" />
|
||||||
|
|
||||||
<!-- Whether the app can show promoted notifications -->
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/live_notifications"
|
|
||||||
android:key="promoted_category"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
|
||||||
android:key="promoted_switch"
|
|
||||||
android:title="@string/live_notifications_switch" />
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="promoted_desc"
|
|
||||||
android:summary="@string/live_notifications_desc"
|
|
||||||
android:selectable="false"/>
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<!-- Conversations added here -->
|
<!-- Conversations added here -->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/conversations_category_title"
|
android:title="@string/conversations_category_title"
|
||||||
android:key="conversations"
|
android:key="conversations"
|
||||||
android:visibility="gone">
|
android:visibility="gone"
|
||||||
|
android:layout="@layout/empty_view" >
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
|
||||||
android:key="invalid_conversation_switch"
|
|
||||||
android:title="@string/conversation_section_switch_title" />
|
|
||||||
<Preference
|
|
||||||
android:key="invalid_conversation_info"/>
|
|
||||||
|
|
||||||
<!--Bubbles -->
|
|
||||||
<Preference
|
|
||||||
android:key="bubble_pref_link"
|
|
||||||
android:title="@string/notification_bubbles_title"
|
|
||||||
android:icon="@drawable/ic_create_bubble"
|
|
||||||
settings:controller="com.android.settings.notification.app.BubbleSummaryPreferenceController">
|
|
||||||
</Preference>
|
|
||||||
|
|
||||||
<!-- Bundles added here -->
|
<!-- Bundles added here -->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="bundles"
|
android:key="bundles"
|
||||||
android:title="@string/notification_bundles"
|
android:title="@string/notification_bundles"
|
||||||
android:visibility="gone" />
|
android:visibility="gone"
|
||||||
|
android:layout="@layout/empty_view" />
|
||||||
|
|
||||||
<!-- Channels/Channel groups added here -->
|
<!-- Channels/Channel groups added here -->
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
@@ -84,61 +56,78 @@
|
|||||||
android:title="@string/no_recent_channels"
|
android:title="@string/no_recent_channels"
|
||||||
android:icon="@drawable/ic_expand"/>
|
android:icon="@drawable/ic_expand"/>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="pre_channels_fields"
|
||||||
|
android:layout="@layout/empty_view"
|
||||||
|
android:visibility="gone" >
|
||||||
<!-- Importance toggle -->
|
<!-- Importance toggle -->
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="allow_sound"
|
android:key="allow_sound"
|
||||||
android:title="@string/allow_interruption"
|
android:title="@string/allow_interruption"
|
||||||
android:summary="@string/allow_interruption_summary"
|
android:summary="@string/allow_interruption_summary" />
|
||||||
settings:allowDividerAbove="true"
|
|
||||||
settings:allowDividerBelow="false" />
|
|
||||||
|
|
||||||
<!-- Visibility Override -->
|
<!-- Visibility Override -->
|
||||||
<com.android.settings.RestrictedListPreference
|
<com.android.settings.RestrictedListPreference
|
||||||
android:key="visibility_override"
|
android:key="visibility_override"
|
||||||
android:title="@string/app_notification_visibility_override_title"
|
android:title="@string/app_notification_visibility_override_title" />
|
||||||
settings:allowDividerAbove="true"
|
|
||||||
settings:allowDividerBelow="false" />
|
|
||||||
|
|
||||||
<!-- Bypass DND -->
|
<!-- Bypass DND -->
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="bypass_dnd"
|
android:key="bypass_dnd"
|
||||||
android:title="@string/app_notification_override_dnd_title"
|
android:title="@string/app_notification_override_dnd_title"
|
||||||
android:summary="@string/app_notification_override_dnd_summary"
|
android:summary="@string/app_notification_override_dnd_summary"/>
|
||||||
settings:allowDividerAbove="true"
|
</PreferenceCategory>
|
||||||
settings:allowDividerBelow="false" />
|
|
||||||
|
|
||||||
<!-- Allow full-screen intents -->
|
<PreferenceCategory
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
android:key="app_wide"
|
||||||
android:key="fsi_permission"
|
android:title="@string/app_notification_settings"
|
||||||
android:title="@string/app_notification_fsi_permission_title"
|
settings:isPreferenceVisible="false">
|
||||||
android:summary="@string/app_notification_fsi_permission_summary"
|
|
||||||
settings:allowDividerAbove="true"
|
|
||||||
settings:allowDividerBelow="false" />
|
|
||||||
|
|
||||||
<!-- Show badge -->
|
<!-- Whether the app can show promoted notifications -->
|
||||||
<com.android.settingslib.RestrictedSwitchPreference
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="badge"
|
android:key="promoted_switch"
|
||||||
android:title="@string/notification_badge_title"
|
android:title="@string/live_notifications_switch"
|
||||||
android:icon="@drawable/ic_notification_dot"
|
android:summary="@string/live_notifications_desc" />
|
||||||
settings:useAdditionalSummary="true"
|
|
||||||
settings:restrictedSwitchSummary="@string/enabled_by_admin"
|
|
||||||
android:order="1001"
|
|
||||||
settings:allowDividerAbove="true"
|
|
||||||
settings:allowDividerBelow="false" />
|
|
||||||
|
|
||||||
<Preference
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
android:key="app_link"
|
android:key="invalid_conversation_switch"
|
||||||
android:icon="@drawable/ic_settings_24dp"
|
android:title="@string/conversation_section_switch_title" />
|
||||||
android:title="@string/app_settings_link"
|
<Preference
|
||||||
android:order="1003"
|
android:key="invalid_conversation_info"/>
|
||||||
settings:allowDividerAbove="true"
|
|
||||||
settings:allowDividerBelow="false" />
|
|
||||||
|
|
||||||
<com.android.settingslib.widget.FooterPreference
|
<!--Bubbles -->
|
||||||
android:key="deleted"
|
<Preference
|
||||||
android:icon="@drawable/ic_trash_can"
|
android:key="bubble_pref_link"
|
||||||
android:order="8000"
|
android:title="@string/notification_bubbles_title"
|
||||||
settings:allowDividerAbove="true"
|
android:icon="@drawable/ic_create_bubble"
|
||||||
settings:allowDividerBelow="false" />
|
settings:controller="com.android.settings.notification.app.BubbleSummaryPreferenceController">
|
||||||
|
</Preference>
|
||||||
|
|
||||||
|
<!-- Allow full-screen intents -->
|
||||||
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
|
android:key="fsi_permission"
|
||||||
|
android:title="@string/app_notification_fsi_permission_title"
|
||||||
|
android:summary="@string/app_notification_fsi_permission_summary"/>
|
||||||
|
|
||||||
|
<!-- Show badge -->
|
||||||
|
<com.android.settingslib.RestrictedSwitchPreference
|
||||||
|
android:key="badge"
|
||||||
|
android:title="@string/notification_badge_title"
|
||||||
|
android:icon="@drawable/ic_notification_dot"
|
||||||
|
settings:useAdditionalSummary="true"
|
||||||
|
settings:restrictedSwitchSummary="@string/enabled_by_admin"
|
||||||
|
android:order="1001"/>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="app_link"
|
||||||
|
android:icon="@drawable/ic_settings_24dp"
|
||||||
|
android:title="@string/app_settings_link"
|
||||||
|
android:order="1003"/>
|
||||||
|
|
||||||
|
<com.android.settingslib.widget.FooterPreference
|
||||||
|
android:key="deleted"
|
||||||
|
android:icon="@drawable/ic_trash_can"
|
||||||
|
android:order="8000"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -111,16 +111,18 @@
|
|||||||
android:title="@string/app_notification_override_dnd_title"
|
android:title="@string/app_notification_override_dnd_title"
|
||||||
android:summary="@string/app_notification_override_dnd_summary" />
|
android:summary="@string/app_notification_override_dnd_summary" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="app_link"
|
|
||||||
android:order="18"
|
|
||||||
android:title="@string/app_settings_link"
|
|
||||||
android:icon="@drawable/ic_settings_24dp"
|
|
||||||
settings:allowDividerAbove="true"/>
|
|
||||||
|
|
||||||
<com.android.settingslib.widget.FooterPreference
|
<com.android.settingslib.widget.FooterPreference
|
||||||
android:key="block_desc"
|
android:key="block_desc"
|
||||||
android:order="110"
|
android:order="110"/>
|
||||||
settings:allowDividerAbove="false"/>
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="external"
|
||||||
|
android:order="18"
|
||||||
|
android:layout="@layout/settingslib_preference_category_no_title">
|
||||||
|
<Preference
|
||||||
|
android:key="app_link"
|
||||||
|
android:title="@string/app_settings_link"
|
||||||
|
android:icon="@drawable/ic_settings_24dp"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -32,9 +32,11 @@
|
|||||||
android:layout_height="16dp"/>
|
android:layout_height="16dp"/>
|
||||||
|
|
||||||
<!-- Repeat callers -->
|
<!-- Repeat callers -->
|
||||||
<SwitchPreferenceCompat
|
<PreferenceCategory>
|
||||||
android:key="zen_mode_repeat_callers"
|
<SwitchPreferenceCompat
|
||||||
android:title="@string/zen_mode_repeat_callers_title" />
|
android:key="zen_mode_repeat_callers"
|
||||||
|
android:title="@string/zen_mode_repeat_callers_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<com.android.settingslib.widget.FooterPreference
|
<com.android.settingslib.widget.FooterPreference
|
||||||
android:key="info_footer"
|
android:key="info_footer"
|
||||||
|
|||||||
@@ -29,6 +29,14 @@
|
|||||||
android:title="@string/fingerprint_add_title"
|
android:title="@string/fingerprint_add_title"
|
||||||
android:icon="@drawable/ic_add_24dp"/>
|
android:icon="@drawable/ic_add_24dp"/>
|
||||||
|
|
||||||
|
<com.android.settingslib.widget.ButtonPreference
|
||||||
|
android:key="key_fingerprint_add_expressive"
|
||||||
|
android:title="@string/add"
|
||||||
|
settings:buttonPreferenceSize="large"
|
||||||
|
settings:buttonPreferenceType="tonal"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:icon="@drawable/ic_add_24dp"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="security_settings_fingerprint_unlock_category"
|
android:key="security_settings_fingerprint_unlock_category"
|
||||||
android:title="@string/security_settings_fingerprint_settings_preferences_category"
|
android:title="@string/security_settings_fingerprint_settings_preferences_category"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.accessibility;
|
package com.android.settings.accessibility;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_INCREMENT_SIZE;
|
||||||
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_MAX;
|
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_MAX;
|
||||||
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_MIN;
|
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_MIN;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ import androidx.preference.PreferenceScreen;
|
|||||||
|
|
||||||
import com.android.server.accessibility.Flags;
|
import com.android.server.accessibility.Flags;
|
||||||
import com.android.settings.core.SliderPreferenceController;
|
import com.android.settings.core.SliderPreferenceController;
|
||||||
|
import com.android.settingslib.widget.SliderPreference;
|
||||||
|
|
||||||
/** Controller class that controls accessibility autoclick cursor area size settings. */
|
/** Controller class that controls accessibility autoclick cursor area size settings. */
|
||||||
public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceController
|
public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceController
|
||||||
@@ -44,6 +46,7 @@ public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceCon
|
|||||||
|
|
||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private final SharedPreferences mSharedPreferences;
|
private final SharedPreferences mSharedPreferences;
|
||||||
|
private SliderPreference mPreference;
|
||||||
|
|
||||||
public ToggleAutoclickCursorAreaSizeController(@NonNull Context context,
|
public ToggleAutoclickCursorAreaSizeController(@NonNull Context context,
|
||||||
@NonNull String preferenceKey) {
|
@NonNull String preferenceKey) {
|
||||||
@@ -70,6 +73,13 @@ public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceCon
|
|||||||
@Override
|
@Override
|
||||||
public void displayPreference(@NonNull PreferenceScreen screen) {
|
public void displayPreference(@NonNull PreferenceScreen screen) {
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
|
mPreference = screen.findPreference(getPreferenceKey());
|
||||||
|
if (mPreference != null) {
|
||||||
|
mPreference.setMin(getMin());
|
||||||
|
mPreference.setMax(getMax());
|
||||||
|
mPreference.setSliderIncrement(AUTOCLICK_CURSOR_AREA_INCREMENT_SIZE);
|
||||||
|
mPreference.setValue(getSliderPosition());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,8 +95,9 @@ public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setSliderPosition(int position) {
|
public boolean setSliderPosition(int position) {
|
||||||
Settings.Secure.putInt(mContentResolver,
|
int size = validateSize(position);
|
||||||
Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE, position);
|
Settings.Secure.putInt(
|
||||||
|
mContentResolver, Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE, size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,10 +106,7 @@ public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceCon
|
|||||||
int size = Settings.Secure.getInt(mContentResolver,
|
int size = Settings.Secure.getInt(mContentResolver,
|
||||||
Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE,
|
Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE,
|
||||||
AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT);
|
AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT);
|
||||||
// Make sure the size is between min and max allowed value.
|
return validateSize(size);
|
||||||
size = Math.min(size, AUTOCLICK_CURSOR_AREA_SIZE_MAX);
|
|
||||||
size = Math.max(size, AUTOCLICK_CURSOR_AREA_SIZE_MIN);
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -110,4 +118,10 @@ public class ToggleAutoclickCursorAreaSizeController extends SliderPreferenceCon
|
|||||||
public int getMin() {
|
public int getMin() {
|
||||||
return AUTOCLICK_CURSOR_AREA_SIZE_MIN;
|
return AUTOCLICK_CURSOR_AREA_SIZE_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int validateSize(int size) {
|
||||||
|
size = Math.min(size, AUTOCLICK_CURSOR_AREA_SIZE_MAX);
|
||||||
|
size = Math.max(size, AUTOCLICK_CURSOR_AREA_SIZE_MIN);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.android.settingslib.metadata.MainSwitchPreference
|
|||||||
import com.android.settingslib.metadata.PreferenceLifecycleContext
|
import com.android.settingslib.metadata.PreferenceLifecycleContext
|
||||||
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
|
import com.android.settingslib.metadata.SensitivityLevel
|
||||||
|
|
||||||
/** Accessibility settings for vibration. */
|
/** Accessibility settings for vibration. */
|
||||||
// LINT.IfChange
|
// LINT.IfChange
|
||||||
@@ -62,6 +63,9 @@ class VibrationMainSwitchPreference :
|
|||||||
callingUid: Int,
|
callingUid: Int,
|
||||||
) = ReadWritePermit.ALLOW
|
) = ReadWritePermit.ALLOW
|
||||||
|
|
||||||
|
override val sensitivityLevel: Int
|
||||||
|
get() = SensitivityLevel.NO_SENSITIVITY
|
||||||
|
|
||||||
override fun onResume(context: PreferenceLifecycleContext) {
|
override fun onResume(context: PreferenceLifecycleContext) {
|
||||||
vibrator = context.getSystemService(Vibrator::class.java)
|
vibrator = context.getSystemService(Vibrator::class.java)
|
||||||
context
|
context
|
||||||
|
|||||||
@@ -99,7 +99,9 @@ import com.android.settingslib.RestrictedSwitchPreference;
|
|||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
import com.android.settingslib.transition.SettingsTransitionHelper;
|
import com.android.settingslib.transition.SettingsTransitionHelper;
|
||||||
|
import com.android.settingslib.widget.ButtonPreference;
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
import com.android.settingslib.widget.FooterPreference;
|
||||||
|
import com.android.settingslib.widget.SettingsThemeHelper;
|
||||||
import com.android.settingslib.widget.TwoTargetPreference;
|
import com.android.settingslib.widget.TwoTargetPreference;
|
||||||
|
|
||||||
import com.google.android.setupdesign.util.DeviceHelper;
|
import com.google.android.setupdesign.util.DeviceHelper;
|
||||||
@@ -250,6 +252,8 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
"key_fingerprint_check_enrolled";
|
"key_fingerprint_check_enrolled";
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final String KEY_FINGERPRINT_ADD = "key_fingerprint_add";
|
static final String KEY_FINGERPRINT_ADD = "key_fingerprint_add";
|
||||||
|
@VisibleForTesting
|
||||||
|
static final String KEY_FINGERPRINT_ADD_EXPRESSIVE = "key_fingerprint_add_expressive";
|
||||||
private static final String KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE =
|
private static final String KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE =
|
||||||
"fingerprint_enable_keyguard_toggle";
|
"fingerprint_enable_keyguard_toggle";
|
||||||
private static final String KEY_LAUNCHED_CONFIRM = "launched_confirm";
|
private static final String KEY_LAUNCHED_CONFIRM = "launched_confirm";
|
||||||
@@ -325,6 +329,8 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private UdfpsEnrollCalibrator mCalibrator;
|
private UdfpsEnrollCalibrator mCalibrator;
|
||||||
|
|
||||||
|
private boolean mIsExpressiveThemeStyle;
|
||||||
|
|
||||||
FingerprintAuthenticateSidecar.Listener mAuthenticateListener =
|
FingerprintAuthenticateSidecar.Listener mAuthenticateListener =
|
||||||
new FingerprintAuthenticateSidecar.Listener() {
|
new FingerprintAuthenticateSidecar.Listener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -471,6 +477,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
mIsExpressiveThemeStyle = SettingsThemeHelper.isExpressiveTheme(getPrefContext());
|
||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
mFingerprintManager = Utils.getFingerprintManagerOrNull(activity);
|
mFingerprintManager = Utils.getFingerprintManagerOrNull(activity);
|
||||||
@@ -679,7 +686,8 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
mFingerprintsEnrolledCategory.removeAll();
|
mFingerprintsEnrolledCategory.removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
String keyToReturn = KEY_FINGERPRINT_ADD;
|
String keyToReturn = mIsExpressiveThemeStyle
|
||||||
|
? KEY_FINGERPRINT_ADD_EXPRESSIVE : KEY_FINGERPRINT_ADD;
|
||||||
final List<Fingerprint> items = mFingerprintManager.getEnrolledFingerprints(mUserId);
|
final List<Fingerprint> items = mFingerprintManager.getEnrolledFingerprints(mUserId);
|
||||||
final int fingerprintCount = items.size();
|
final int fingerprintCount = items.size();
|
||||||
for (int i = 0; i < fingerprintCount; i++) {
|
for (int i = 0; i < fingerprintCount; i++) {
|
||||||
@@ -715,13 +723,30 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
mFingerprintsEnrolledCategory.addPreference(pref);
|
mFingerprintsEnrolledCategory.addPreference(pref);
|
||||||
pref.setOnPreferenceChangeListener(this);
|
pref.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
mAddFingerprintPreference = findPreference(KEY_FINGERPRINT_ADD);
|
mAddFingerprintPreference = findPreference(mIsExpressiveThemeStyle
|
||||||
|
? KEY_FINGERPRINT_ADD_EXPRESSIVE : KEY_FINGERPRINT_ADD);
|
||||||
setupAddFingerprintPreference();
|
setupAddFingerprintPreference();
|
||||||
return keyToReturn;
|
return keyToReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAddFingerprintPreference() {
|
private void setupAddFingerprintPreference() {
|
||||||
mAddFingerprintPreference.setOnPreferenceChangeListener(this);
|
mAddFingerprintPreference.setOnPreferenceChangeListener(this);
|
||||||
|
if (mIsExpressiveThemeStyle
|
||||||
|
&& (mAddFingerprintPreference instanceof ButtonPreference)) {
|
||||||
|
((ButtonPreference) mAddFingerprintPreference).setOnClickListener(view -> {
|
||||||
|
mIsEnrolling = true;
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||||
|
FingerprintEnroll.AddAdditionalFingerprint.class.getName());
|
||||||
|
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||||
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
||||||
|
if (mCalibrator != null) {
|
||||||
|
intent.putExtras(mCalibrator.getExtrasForNextIntent());
|
||||||
|
}
|
||||||
|
startActivityForResult(intent, ADD_FINGERPRINT_REQUEST);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
updateAddPreference();
|
updateAddPreference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,12 +828,15 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
return; // Activity went away
|
return; // Activity went away
|
||||||
}
|
}
|
||||||
|
|
||||||
mAddFingerprintPreference = findPreference(KEY_FINGERPRINT_ADD);
|
mAddFingerprintPreference = findPreference(
|
||||||
|
mIsExpressiveThemeStyle ? KEY_FINGERPRINT_ADD_EXPRESSIVE : KEY_FINGERPRINT_ADD);
|
||||||
|
|
||||||
if (mAddFingerprintPreference == null) {
|
if (mAddFingerprintPreference == null) {
|
||||||
return; // b/275519315 Skip if updateAddPreference() invoke before addPreference()
|
return; // b/275519315 Skip if updateAddPreference() invoke before addPreference()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateAddingButtonStyle();
|
||||||
|
|
||||||
/* Disable preference if too many fingerprints added */
|
/* Disable preference if too many fingerprints added */
|
||||||
final int max = getContext().getResources().getInteger(
|
final int max = getContext().getResources().getInteger(
|
||||||
com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
|
com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
|
||||||
@@ -828,6 +856,20 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
&& !tooMany && !removalInProgress && mToken != null);
|
&& !tooMany && !removalInProgress && mToken != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAddingButtonStyle() {
|
||||||
|
final Preference nonExpressiveBtnPreference = findPreference(KEY_FINGERPRINT_ADD);
|
||||||
|
final ButtonPreference expressiveBtnPreference =
|
||||||
|
findPreference(KEY_FINGERPRINT_ADD_EXPRESSIVE);
|
||||||
|
|
||||||
|
if (nonExpressiveBtnPreference != null) {
|
||||||
|
nonExpressiveBtnPreference.setVisible(!mIsExpressiveThemeStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expressiveBtnPreference != null) {
|
||||||
|
expressiveBtnPreference.setVisible(mIsExpressiveThemeStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createFooterPreference(PreferenceGroup root) {
|
private void createFooterPreference(PreferenceGroup root) {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
@@ -925,11 +967,11 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(Preference pref) {
|
public boolean onPreferenceTreeClick(Preference pref) {
|
||||||
final String key = pref.getKey();
|
final String key = pref.getKey();
|
||||||
if (KEY_FINGERPRINT_ADD.equals(key)) {
|
if (!mIsExpressiveThemeStyle && KEY_FINGERPRINT_ADD.equals(key)) {
|
||||||
mIsEnrolling = true;
|
mIsEnrolling = true;
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||||
FingerprintEnroll.AddAdditionalFingerprint.class.getName());
|
FingerprintEnroll.AddAdditionalFingerprint.class.getName());
|
||||||
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
||||||
if (mCalibrator != null) {
|
if (mCalibrator != null) {
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ import com.android.settings.network.SatelliteWarningDialogActivity
|
|||||||
import com.android.settings.widget.MainSwitchBarMetadata
|
import com.android.settings.widget.MainSwitchBarMetadata
|
||||||
import com.android.settingslib.WirelessUtils
|
import com.android.settingslib.WirelessUtils
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.Permissions
|
import com.android.settingslib.datastore.Permissions
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.PreferenceMetadata
|
import com.android.settingslib.metadata.PreferenceMetadata
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
import com.android.settingslib.metadata.SensitivityLevel
|
import com.android.settingslib.metadata.SensitivityLevel
|
||||||
@@ -152,7 +152,14 @@ class BluetoothPreference(private val bluetoothDataStore: BluetoothDataStore) :
|
|||||||
broadcastReceiver =
|
broadcastReceiver =
|
||||||
object : BroadcastReceiver() {
|
object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
val state =
|
||||||
|
intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR)
|
||||||
|
if (
|
||||||
|
state == BluetoothAdapter.STATE_ON ||
|
||||||
|
state == BluetoothAdapter.STATE_OFF
|
||||||
|
) {
|
||||||
|
notifyChange(KEY, PreferenceChangeReason.STATE)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.registerReceiver(
|
context.registerReceiver(
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothLeBroadcastAssistant;
|
|||||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||||
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
||||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
import com.android.settingslib.flags.Flags;
|
||||||
import com.android.settingslib.utils.ThreadUtils;
|
import com.android.settingslib.utils.ThreadUtils;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@@ -63,6 +64,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/** PreferenceController to control the dialog to choose the active device for calls and alarms */
|
/** PreferenceController to control the dialog to choose the active device for calls and alarms */
|
||||||
public class AudioSharingCallAudioPreferenceController extends AudioSharingBasePreferenceController
|
public class AudioSharingCallAudioPreferenceController extends AudioSharingBasePreferenceController
|
||||||
@@ -379,11 +381,21 @@ public class AudioSharingCallAudioPreferenceController extends AudioSharingBaseP
|
|||||||
|
|
||||||
private void updateDeviceItemsInSharingSession() {
|
private void updateDeviceItemsInSharingSession() {
|
||||||
mGroupedConnectedDevices = AudioSharingUtils.fetchConnectedDevicesByGroupId(mBtManager);
|
mGroupedConnectedDevices = AudioSharingUtils.fetchConnectedDevicesByGroupId(mBtManager);
|
||||||
|
if (Flags.enableTemporaryBondDevicesUi()) {
|
||||||
|
mGroupedConnectedDevices =
|
||||||
|
mGroupedConnectedDevices.entrySet().stream()
|
||||||
|
.filter(entry -> !anyTemporaryBondDevice(entry.getValue()))
|
||||||
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
|
}
|
||||||
mDeviceItemsInSharingSession =
|
mDeviceItemsInSharingSession =
|
||||||
AudioSharingUtils.buildOrderedConnectedLeadAudioSharingDeviceItem(
|
AudioSharingUtils.buildOrderedConnectedLeadAudioSharingDeviceItem(
|
||||||
mBtManager, mGroupedConnectedDevices, /* filterByInSharing= */ true);
|
mBtManager, mGroupedConnectedDevices, /* filterByInSharing= */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean anyTemporaryBondDevice(List<BluetoothDevice> connectedDevices) {
|
||||||
|
return connectedDevices.stream().anyMatch(BluetoothUtils::isTemporaryBondDevice);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Pair<Integer, AudioSharingDeviceItem> getActiveItemWithIndex() {
|
private Pair<Integer, AudioSharingDeviceItem> getActiveItemWithIndex() {
|
||||||
List<AudioSharingDeviceItem> deviceItems = new ArrayList<>(mDeviceItemsInSharingSession);
|
List<AudioSharingDeviceItem> deviceItems = new ArrayList<>(mDeviceItemsInSharingSession);
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import android.content.Context
|
|||||||
import com.android.settings.R
|
import com.android.settings.R
|
||||||
import com.android.settings.widget.MainSwitchBarMetadata
|
import com.android.settings.widget.MainSwitchBarMetadata
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.Permissions
|
import com.android.settingslib.datastore.Permissions
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
import com.android.settingslib.metadata.SensitivityLevel
|
import com.android.settingslib.metadata.SensitivityLevel
|
||||||
@@ -36,6 +36,9 @@ class DataSaverMainSwitchPreference : MainSwitchBarMetadata, PreferenceLifecycle
|
|||||||
override val title
|
override val title
|
||||||
get() = R.string.data_saver_switch_title
|
get() = R.string.data_saver_switch_title
|
||||||
|
|
||||||
|
override val disableWidgetOnCheckedChanged: Boolean
|
||||||
|
get() = false
|
||||||
|
|
||||||
override fun storage(context: Context) = createDataStore(context)
|
override fun storage(context: Context) = createDataStore(context)
|
||||||
|
|
||||||
override fun getReadPermissions(context: Context) =
|
override fun getReadPermissions(context: Context) =
|
||||||
@@ -75,7 +78,7 @@ class DataSaverMainSwitchPreference : MainSwitchBarMetadata, PreferenceLifecycle
|
|||||||
override fun onLastObserverRemoved() = dataSaverBackend.remListener(this)
|
override fun onLastObserverRemoved() = dataSaverBackend.remListener(this)
|
||||||
|
|
||||||
override fun onDataSaverChanged(isDataSaving: Boolean) =
|
override fun onDataSaverChanged(isDataSaving: Boolean) =
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.VALUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import com.android.settings.Utils
|
|||||||
import com.android.settings.core.SettingsBaseActivity
|
import com.android.settings.core.SettingsBaseActivity
|
||||||
import com.android.settingslib.RestrictedPreference
|
import com.android.settingslib.RestrictedPreference
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.HandlerExecutor
|
import com.android.settingslib.datastore.HandlerExecutor
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.KeyedObserver
|
import com.android.settingslib.datastore.KeyedObserver
|
||||||
@@ -43,6 +42,7 @@ import com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MAX
|
|||||||
import com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MIN
|
import com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MIN
|
||||||
import com.android.settingslib.display.BrightnessUtils.convertLinearToGammaFloat
|
import com.android.settingslib.display.BrightnessUtils.convertLinearToGammaFloat
|
||||||
import com.android.settingslib.metadata.PersistentPreference
|
import com.android.settingslib.metadata.PersistentPreference
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.PreferenceMetadata
|
import com.android.settingslib.metadata.PreferenceMetadata
|
||||||
import com.android.settingslib.metadata.PreferenceSummaryProvider
|
import com.android.settingslib.metadata.PreferenceSummaryProvider
|
||||||
import com.android.settingslib.metadata.RangeValue
|
import com.android.settingslib.metadata.RangeValue
|
||||||
@@ -155,7 +155,7 @@ class BrightnessLevelPreference :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onKeyChanged(key: String, reason: Int) {
|
override fun onKeyChanged(key: String, reason: Int) {
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDisplayAdded(displayId: Int) {}
|
override fun onDisplayAdded(displayId: Int) {}
|
||||||
@@ -163,7 +163,7 @@ class BrightnessLevelPreference :
|
|||||||
override fun onDisplayRemoved(displayId: Int) {}
|
override fun onDisplayRemoved(displayId: Int) {}
|
||||||
|
|
||||||
override fun onDisplayChanged(displayId: Int) {
|
override fun onDisplayChanged(displayId: Int) {
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.STATE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import android.content.IntentFilter
|
|||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract storage for dark mode settings.
|
* Abstract storage for dark mode settings.
|
||||||
@@ -54,7 +54,7 @@ internal class DarkModeStorage(private val context: Context) :
|
|||||||
broadcastReceiver =
|
broadcastReceiver =
|
||||||
object : BroadcastReceiver() {
|
object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
notifyChange(DataChangeReason.UPDATE)
|
notifyChange(PreferenceChangeReason.STATE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.registerReceiver(
|
context.registerReceiver(
|
||||||
@@ -63,7 +63,7 @@ internal class DarkModeStorage(private val context: Context) :
|
|||||||
)
|
)
|
||||||
|
|
||||||
darkModeObserver = DarkModeObserver(context)
|
darkModeObserver = DarkModeObserver(context)
|
||||||
darkModeObserver.subscribe { notifyChange(DataChangeReason.UPDATE) }
|
darkModeObserver.subscribe { notifyChange(PreferenceChangeReason.VALUE) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLastObserverRemoved() {
|
override fun onLastObserverRemoved() {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
|||||||
import com.android.settingslib.metadata.PreferenceMetadata
|
import com.android.settingslib.metadata.PreferenceMetadata
|
||||||
import com.android.settingslib.metadata.RangeValue
|
import com.android.settingslib.metadata.RangeValue
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
|
import com.android.settingslib.metadata.SensitivityLevel
|
||||||
import com.android.settingslib.preference.PreferenceBinding
|
import com.android.settingslib.preference.PreferenceBinding
|
||||||
import com.android.settingslib.widget.UsageProgressBarPreference
|
import com.android.settingslib.widget.UsageProgressBarPreference
|
||||||
|
|
||||||
@@ -113,6 +114,9 @@ class BatteryHeaderPreference :
|
|||||||
override fun getWritePermit(context: Context, value: Int?, callingPid: Int, callingUid: Int) =
|
override fun getWritePermit(context: Context, value: Int?, callingPid: Int, callingUid: Int) =
|
||||||
ReadWritePermit.DISALLOW
|
ReadWritePermit.DISALLOW
|
||||||
|
|
||||||
|
override val sensitivityLevel: Int
|
||||||
|
get() = SensitivityLevel.NO_SENSITIVITY
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val KEY = "battery_header"
|
private const val KEY = "battery_header"
|
||||||
private const val BATTERY_MAX_LEVEL: Long = 100L
|
private const val BATTERY_MAX_LEVEL: Long = 100L
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.android.settings.R
|
|||||||
import com.android.settings.fuelgauge.BatterySaverReceiver
|
import com.android.settings.fuelgauge.BatterySaverReceiver
|
||||||
import com.android.settings.fuelgauge.BatterySaverReceiver.BatterySaverListener
|
import com.android.settings.fuelgauge.BatterySaverReceiver.BatterySaverListener
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.Permissions
|
import com.android.settingslib.datastore.Permissions
|
||||||
import com.android.settingslib.fuelgauge.BatterySaverLogging.SAVER_ENABLED_SETTINGS
|
import com.android.settingslib.fuelgauge.BatterySaverLogging.SAVER_ENABLED_SETTINGS
|
||||||
@@ -30,6 +29,7 @@ import com.android.settingslib.fuelgauge.BatterySaverUtils
|
|||||||
import com.android.settingslib.fuelgauge.BatteryStatus
|
import com.android.settingslib.fuelgauge.BatteryStatus
|
||||||
import com.android.settingslib.fuelgauge.BatteryUtils
|
import com.android.settingslib.fuelgauge.BatteryUtils
|
||||||
import com.android.settingslib.metadata.MainSwitchPreference
|
import com.android.settingslib.metadata.MainSwitchPreference
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
import com.android.settingslib.metadata.SensitivityLevel
|
import com.android.settingslib.metadata.SensitivityLevel
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@@ -105,12 +105,12 @@ class BatterySaverPreference :
|
|||||||
override fun onPowerSaveModeChanged() {
|
override fun onPowerSaveModeChanged() {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
delay(SWITCH_ANIMATION_DURATION)
|
delay(SWITCH_ANIMATION_DURATION)
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.VALUE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBatteryChanged(pluggedIn: Boolean) =
|
override fun onBatteryChanged(pluggedIn: Boolean) =
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ import com.android.settings.network.SatelliteRepository.Companion.isSatelliteOn
|
|||||||
import com.android.settings.overlay.FeatureFactory.Companion.featureFactory
|
import com.android.settings.overlay.FeatureFactory.Companion.featureFactory
|
||||||
import com.android.settingslib.RestrictedSwitchPreference
|
import com.android.settingslib.RestrictedSwitchPreference
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.SettingsGlobalStore
|
import com.android.settingslib.datastore.SettingsGlobalStore
|
||||||
import com.android.settingslib.datastore.SettingsStore
|
import com.android.settingslib.datastore.SettingsStore
|
||||||
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
|
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.PreferenceLifecycleContext
|
import com.android.settingslib.metadata.PreferenceLifecycleContext
|
||||||
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
@@ -126,7 +126,7 @@ class AirplaneModePreference :
|
|||||||
phoneStateListener =
|
phoneStateListener =
|
||||||
object : PhoneStateListener(Looper.getMainLooper()) {
|
object : PhoneStateListener(Looper.getMainLooper()) {
|
||||||
override fun onRadioPowerStateChanged(state: Int) {
|
override fun onRadioPowerStateChanged(state: Int) {
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.VALUE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.listen(phoneStateListener, PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED)
|
it.listen(phoneStateListener, PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED)
|
||||||
|
|||||||
@@ -18,21 +18,13 @@ package com.android.settings.network.telephony;
|
|||||||
|
|
||||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
|
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
|
||||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ESOS_SUPPORTED_BOOL;
|
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ESOS_SUPPORTED_BOOL;
|
||||||
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
|
|
||||||
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
import android.telephony.TelephonyCallback;
|
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.telephony.satellite.NtnSignalStrength;
|
|
||||||
import android.telephony.satellite.SatelliteManager;
|
import android.telephony.satellite.SatelliteManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
|
||||||
import androidx.lifecycle.DefaultLifecycleObserver;
|
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
@@ -40,9 +32,6 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.flags.Flags;
|
import com.android.settings.flags.Flags;
|
||||||
import com.android.settings.network.CarrierConfigCache;
|
import com.android.settings.network.CarrierConfigCache;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/** Preference controller for Satellite functions in mobile network settings. */
|
/** Preference controller for Satellite functions in mobile network settings. */
|
||||||
public class SatelliteSettingsPreferenceCategoryController
|
public class SatelliteSettingsPreferenceCategoryController
|
||||||
extends TelephonyBasePreferenceController implements DefaultLifecycleObserver {
|
extends TelephonyBasePreferenceController implements DefaultLifecycleObserver {
|
||||||
@@ -51,17 +40,11 @@ public class SatelliteSettingsPreferenceCategoryController
|
|||||||
private CarrierConfigCache mCarrierConfigCache;
|
private CarrierConfigCache mCarrierConfigCache;
|
||||||
private SatelliteManager mSatelliteManager;
|
private SatelliteManager mSatelliteManager;
|
||||||
private PreferenceCategory mPreferenceCategory;
|
private PreferenceCategory mPreferenceCategory;
|
||||||
private TelephonyManager mTelephonyManager;
|
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
final CarrierRoamingNtnModeCallback mCarrierRoamingNtnModeCallback =
|
|
||||||
new CarrierRoamingNtnModeCallback();
|
|
||||||
|
|
||||||
public SatelliteSettingsPreferenceCategoryController(Context context, String key) {
|
public SatelliteSettingsPreferenceCategoryController(Context context, String key) {
|
||||||
super(context, key);
|
super(context, key);
|
||||||
mCarrierConfigCache = CarrierConfigCache.getInstance(context);
|
mCarrierConfigCache = CarrierConfigCache.getInstance(context);
|
||||||
mSatelliteManager = context.getSystemService(SatelliteManager.class);
|
mSatelliteManager = context.getSystemService(SatelliteManager.class);
|
||||||
mTelephonyManager = context.getSystemService(TelephonyManager.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,13 +55,13 @@ public class SatelliteSettingsPreferenceCategoryController
|
|||||||
public void init(int subId) {
|
public void init(int subId) {
|
||||||
Log.d(TAG, "init(), subId=" + subId);
|
Log.d(TAG, "init(), subId=" + subId);
|
||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayPreference(PreferenceScreen screen) {
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
mPreferenceCategory = screen.findPreference(getPreferenceKey());
|
mPreferenceCategory = screen.findPreference(getPreferenceKey());
|
||||||
|
mPreferenceCategory.setTitle(R.string.category_title_satellite_connectivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,58 +86,4 @@ public class SatelliteSettingsPreferenceCategoryController
|
|||||||
return (isSatelliteAttachSupported || isSatelliteSosSupported)
|
return (isSatelliteAttachSupported || isSatelliteSosSupported)
|
||||||
? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
|
? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume(@NonNull LifecycleOwner owner) {
|
|
||||||
if (Flags.satelliteOemSettingsUxMigration()) {
|
|
||||||
mTelephonyManager.registerTelephonyCallback(mContext.getMainExecutor(),
|
|
||||||
mCarrierRoamingNtnModeCallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause(@NonNull LifecycleOwner owner) {
|
|
||||||
if (Flags.satelliteOemSettingsUxMigration()) {
|
|
||||||
mTelephonyManager.unregisterTelephonyCallback(mCarrierRoamingNtnModeCallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
class CarrierRoamingNtnModeCallback extends TelephonyCallback implements
|
|
||||||
TelephonyCallback.CarrierRoamingNtnListener {
|
|
||||||
@Override
|
|
||||||
public void onCarrierRoamingNtnAvailableServicesChanged(int[] availableServices) {
|
|
||||||
CarrierRoamingNtnListener.super.onCarrierRoamingNtnAvailableServicesChanged(
|
|
||||||
availableServices);
|
|
||||||
List<Integer> availableServicesList = Arrays.stream(availableServices).boxed().toList();
|
|
||||||
boolean isSmsAvailable = availableServicesList.contains(SERVICE_TYPE_SMS);
|
|
||||||
boolean isDataAvailable = availableServicesList.contains(SERVICE_TYPE_DATA);
|
|
||||||
Log.i(TAG, "isSmsAvailable : " + isSmsAvailable
|
|
||||||
+ " / isDataAvailable " + isDataAvailable);
|
|
||||||
if (mPreferenceCategory == null) {
|
|
||||||
Log.d(TAG, "Satellite preference category is not initialized yet");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isDataAvailable) {
|
|
||||||
mPreferenceCategory.setTitle(R.string.category_title_satellite_connectivity);
|
|
||||||
} else if (isSmsAvailable) {
|
|
||||||
mPreferenceCategory.setTitle(R.string.satellite_setting_title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCarrierRoamingNtnModeChanged(boolean active) {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCarrierRoamingNtnSignalStrengthChanged(NtnSignalStrength ntnSignalStrength) {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import androidx.preference.Preference;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
|
import com.android.settingslib.widget.TopIntroPreference;
|
||||||
|
|
||||||
public class AllConversationsPreferenceController extends ConversationListPreferenceController {
|
public class AllConversationsPreferenceController extends ConversationListPreferenceController {
|
||||||
|
|
||||||
@@ -39,9 +40,9 @@ public class AllConversationsPreferenceController extends ConversationListPrefer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
Preference getSummaryPreference() {
|
Preference getSummaryPreference() {
|
||||||
Preference pref = new Preference(mContext);
|
Preference pref = new TopIntroPreference(mContext);
|
||||||
pref.setOrder(1);
|
pref.setOrder(1);
|
||||||
pref.setSummary(R.string.other_conversations_summary);
|
pref.setTitle(R.string.other_conversations_summary);
|
||||||
pref.setSelectable(false);
|
pref.setSelectable(false);
|
||||||
return pref;
|
return pref;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public class AllowSoundPreferenceController extends NotificationPreferenceContro
|
|||||||
pref.setEnabled(!pref.isDisabledByAdmin());
|
pref.setEnabled(!pref.isDisabledByAdmin());
|
||||||
pref.setChecked(mChannel.getImportance() >= IMPORTANCE_DEFAULT
|
pref.setChecked(mChannel.getImportance() >= IMPORTANCE_DEFAULT
|
||||||
|| mChannel.getImportance() == IMPORTANCE_UNSPECIFIED);
|
|| mChannel.getImportance() == IMPORTANCE_UNSPECIFIED);
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
} else { Log.i(TAG, "tried to updatestate on a null channel?!"); }
|
} else { Log.i(TAG, "tried to updatestate on a null channel?!"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ public class AppLinkPreferenceController extends NotificationPreferenceControlle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
if (mAppRow != null) {
|
if (mAppRow != null) {
|
||||||
preference.setIntent(mAppRow.settingsIntent);
|
preference.setIntent(mAppRow.settingsIntent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public class BadgePreferenceController extends NotificationPreferenceController
|
|||||||
|
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
if (mAppRow != null) {
|
if (mAppRow != null) {
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
|
RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
|
||||||
pref.setDisabledByAdmin(mAdmin);
|
pref.setDisabledByAdmin(mAdmin);
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public class BubbleSummaryPreferenceController extends NotificationPreferenceCon
|
|||||||
intent.putExtra(Settings.EXTRA_APP_UID, mAppRow.uid);
|
intent.putExtra(Settings.EXTRA_APP_UID, mAppRow.uid);
|
||||||
preference.setIntent(intent);
|
preference.setIntent(intent);
|
||||||
}
|
}
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
|
|||||||
|
|
||||||
private List<NotificationChannelGroup> mChannelGroupList;
|
private List<NotificationChannelGroup> mChannelGroupList;
|
||||||
private PreferenceCategory mPreference;
|
private PreferenceCategory mPreference;
|
||||||
|
int mChannelCount;
|
||||||
|
|
||||||
public ChannelListPreferenceController(Context context, NotificationBackend backend) {
|
public ChannelListPreferenceController(Context context, NotificationBackend backend) {
|
||||||
super(context, backend);
|
super(context, backend);
|
||||||
@@ -107,6 +108,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
|
|||||||
} else {
|
} else {
|
||||||
mChannelGroupList = mBackend.getGroups(mAppRow.pkg, mAppRow.uid).getList();
|
mChannelGroupList = mBackend.getGroups(mAppRow.pkg, mAppRow.uid).getList();
|
||||||
}
|
}
|
||||||
|
mChannelCount = mBackend.getChannelCount(mAppRow.pkg, mAppRow.uid);
|
||||||
Collections.sort(mChannelGroupList, CHANNEL_GROUP_COMPARATOR);
|
Collections.sort(mChannelGroupList, CHANNEL_GROUP_COMPARATOR);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -116,6 +118,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
|
|||||||
if (mContext == null) {
|
if (mContext == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFullList(mPreference, mChannelGroupList);
|
updateFullList(mPreference, mChannelGroupList);
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
@@ -129,25 +132,30 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
|
|||||||
void updateFullList(@NonNull PreferenceCategory groupPrefsList,
|
void updateFullList(@NonNull PreferenceCategory groupPrefsList,
|
||||||
@NonNull List<NotificationChannelGroup> channelGroups) {
|
@NonNull List<NotificationChannelGroup> channelGroups) {
|
||||||
if (channelGroups.isEmpty()) {
|
if (channelGroups.isEmpty()) {
|
||||||
if (groupPrefsList.getPreferenceCount() == 1
|
if (mChannelCount > 0) {
|
||||||
&& KEY_ZERO_CATEGORIES.equals(groupPrefsList.getPreference(0).getKey())) {
|
|
||||||
// Ensure the titles are correct for the current language, but otherwise leave alone
|
|
||||||
PreferenceGroup groupCategory = (PreferenceGroup) groupPrefsList.getPreference(0);
|
|
||||||
groupCategory.setTitle(R.string.notification_channels);
|
|
||||||
groupCategory.getPreference(0).setTitle(R.string.no_channels);
|
|
||||||
} else {
|
|
||||||
// Clear any contents and create the 'zero-categories' group.
|
|
||||||
groupPrefsList.removeAll();
|
groupPrefsList.removeAll();
|
||||||
|
} else {
|
||||||
|
if (groupPrefsList.getPreferenceCount() == 1
|
||||||
|
&& KEY_ZERO_CATEGORIES.equals(groupPrefsList.getPreference(0).getKey())) {
|
||||||
|
// Ensure the titles are correct for the current language, but otherwise leave alone
|
||||||
|
PreferenceGroup groupCategory = (PreferenceGroup) groupPrefsList.getPreference(
|
||||||
|
0);
|
||||||
|
groupCategory.setTitle(R.string.notification_channels);
|
||||||
|
groupCategory.getPreference(0).setTitle(R.string.no_channels);
|
||||||
|
} else {
|
||||||
|
// Clear any contents and create the 'zero-categories' group.
|
||||||
|
groupPrefsList.removeAll();
|
||||||
|
|
||||||
PreferenceCategory groupCategory = new PreferenceCategory(mContext);
|
PreferenceCategory groupCategory = new PreferenceCategory(mContext);
|
||||||
groupCategory.setTitle(R.string.notification_channels);
|
groupCategory.setTitle(R.string.notification_channels);
|
||||||
groupCategory.setKey(KEY_ZERO_CATEGORIES);
|
groupCategory.setKey(KEY_ZERO_CATEGORIES);
|
||||||
groupPrefsList.addPreference(groupCategory);
|
groupPrefsList.addPreference(groupCategory);
|
||||||
|
|
||||||
Preference empty = new Preference(mContext);
|
Preference empty = new Preference(mContext);
|
||||||
empty.setTitle(R.string.no_channels);
|
empty.setTitle(R.string.no_channels);
|
||||||
empty.setEnabled(false);
|
empty.setEnabled(false);
|
||||||
groupCategory.addPreference(empty);
|
groupCategory.addPreference(empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateGroupList(groupPrefsList, channelGroups);
|
updateGroupList(groupPrefsList, channelGroups);
|
||||||
@@ -211,6 +219,11 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
|
|||||||
groupPrefsList.addPreference(group);
|
groupPrefsList.addPreference(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Preference otherGroup = groupPrefsList.findPreference(KEY_GENERAL_CATEGORY);
|
||||||
|
if (otherGroup != null) {
|
||||||
|
otherGroup.setTitle(numFinalGroups == 1
|
||||||
|
? R.string.notification_channels : R.string.notification_channels_other);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,8 +261,7 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
|
|||||||
List<Preference> finalOrderedPrefs = new ArrayList<>();
|
List<Preference> finalOrderedPrefs = new ArrayList<>();
|
||||||
Preference appDefinedGroupToggle;
|
Preference appDefinedGroupToggle;
|
||||||
if (group.getId() == null) {
|
if (group.getId() == null) {
|
||||||
// For the 'null' group, set the "Other" title.
|
groupPrefGroup.setTitle(R.string.notification_channels);
|
||||||
groupPrefGroup.setTitle(R.string.notification_channels_other);
|
|
||||||
appDefinedGroupToggle = null;
|
appDefinedGroupToggle = null;
|
||||||
} else {
|
} else {
|
||||||
// For an app-defined group, set their name and create a row to toggle 'isBlocked'.
|
// For an app-defined group, set their name and create a row to toggle 'isBlocked'.
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public class DeletedChannelsPreferenceController extends NotificationPreferenceC
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
if (mAppRow != null) {
|
if (mAppRow != null) {
|
||||||
int deletedChannelCount = mBackend.getDeletedChannelCount(mAppRow.pkg, mAppRow.uid);
|
int deletedChannelCount = mBackend.getDeletedChannelCount(mAppRow.pkg, mAppRow.uid);
|
||||||
preference.setTitle(StringUtil.getIcuPluralsString(mContext, deletedChannelCount,
|
preference.setTitle(StringUtil.getIcuPluralsString(mContext, deletedChannelCount,
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ public class DndPreferenceController extends NotificationPreferenceController
|
|||||||
|
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
|
RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
|
||||||
pref.setDisabledByAdmin(mAdmin);
|
pref.setDisabledByAdmin(mAdmin);
|
||||||
pref.setEnabled(!pref.isDisabledByAdmin());
|
pref.setEnabled(!pref.isDisabledByAdmin());
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ import android.app.AppOpsManager
|
|||||||
import android.app.AppOpsManager.OP_USE_FULL_SCREEN_INTENT
|
import android.app.AppOpsManager.OP_USE_FULL_SCREEN_INTENT
|
||||||
import android.content.AttributionSource
|
import android.content.AttributionSource
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.PackageManager.NameNotFoundException
|
|
||||||
import android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET
|
import android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET
|
||||||
import android.content.pm.PackageManager.GET_PERMISSIONS
|
import android.content.pm.PackageManager.GET_PERMISSIONS
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.permission.PermissionManager
|
import android.permission.PermissionManager
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
@@ -65,6 +65,7 @@ class FullScreenIntentPermissionPreferenceController(
|
|||||||
preference.setDisabledByAdmin(mAdmin)
|
preference.setDisabledByAdmin(mAdmin)
|
||||||
preference.isEnabled = !preference.isDisabledByAdmin
|
preference.isEnabled = !preference.isDisabledByAdmin
|
||||||
preference.isChecked = isPermissionGranted()
|
preference.isChecked = isPermissionGranted()
|
||||||
|
preference.parent?.isVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreferenceChange(preference: Preference, value: Any): Boolean {
|
override fun onPreferenceChange(preference: Preference, value: Any): Boolean {
|
||||||
|
|||||||
@@ -81,9 +81,8 @@ public class HeaderPreferenceController extends NotificationPreferenceController
|
|||||||
mHeaderController = EntityHeaderController.newInstance(
|
mHeaderController = EntityHeaderController.newInstance(
|
||||||
activity, mFragment, pref.findViewById(R.id.entity_header));
|
activity, mFragment, pref.findViewById(R.id.entity_header));
|
||||||
pref = mHeaderController.setIcon(mAppRow.icon)
|
pref = mHeaderController.setIcon(mAppRow.icon)
|
||||||
.setLabel(getLabel())
|
.setLabel(getSummary())
|
||||||
.setSummary(getSummary())
|
.setSummary(getSecondSummary())
|
||||||
.setSecondSummary(getSecondSummary())
|
|
||||||
.setPackageName(mAppRow.pkg)
|
.setPackageName(mAppRow.pkg)
|
||||||
.setUid(mAppRow.uid)
|
.setUid(mAppRow.uid)
|
||||||
.setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
|
.setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
|
||||||
@@ -95,14 +94,6 @@ public class HeaderPreferenceController extends NotificationPreferenceController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getLabel() {
|
|
||||||
if (mChannel != null && !isDefaultChannel()) {
|
|
||||||
return mChannel.getName();
|
|
||||||
} else {
|
|
||||||
return mAppRow.label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
mStarted = true;
|
mStarted = true;
|
||||||
@@ -113,15 +104,7 @@ public class HeaderPreferenceController extends NotificationPreferenceController
|
|||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
if (mChannelGroup != null
|
if (mChannelGroup != null
|
||||||
&& !TextUtils.isEmpty(mChannelGroup.getName())) {
|
&& !TextUtils.isEmpty(mChannelGroup.getName())) {
|
||||||
final SpannableStringBuilder summary = new SpannableStringBuilder();
|
return mChannelGroup.getName().toString();
|
||||||
BidiFormatter bidi = BidiFormatter.getInstance();
|
|
||||||
summary.append(bidi.unicodeWrap(mAppRow.label));
|
|
||||||
summary.append(bidi.unicodeWrap(mContext.getText(
|
|
||||||
R.string.notification_header_divider_symbol_with_spaces)));
|
|
||||||
summary.append(bidi.unicodeWrap(mChannelGroup.getName().toString()));
|
|
||||||
return summary.toString();
|
|
||||||
} else {
|
|
||||||
return mAppRow.label.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import androidx.preference.Preference;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
|
import com.android.settingslib.widget.SettingsThemeHelper;
|
||||||
|
|
||||||
public class InvalidConversationInfoPreferenceController extends NotificationPreferenceController {
|
public class InvalidConversationInfoPreferenceController extends NotificationPreferenceController {
|
||||||
|
|
||||||
@@ -49,6 +50,9 @@ public class InvalidConversationInfoPreferenceController extends NotificationPre
|
|||||||
if (mPreferenceFilter != null && !isIncludedInFilter()) {
|
if (mPreferenceFilter != null && !isIncludedInFilter()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (SettingsThemeHelper.isExpressiveTheme(mContext)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return mBackend.isInInvalidMsgState(mAppRow.pkg, mAppRow.uid);
|
return mBackend.isInInvalidMsgState(mAppRow.pkg, mAppRow.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import androidx.preference.Preference;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
import com.android.settingslib.RestrictedSwitchPreference;
|
import com.android.settingslib.RestrictedSwitchPreference;
|
||||||
|
import com.android.settingslib.widget.SettingsThemeHelper;
|
||||||
|
|
||||||
public class InvalidConversationPreferenceController extends NotificationPreferenceController
|
public class InvalidConversationPreferenceController extends NotificationPreferenceController
|
||||||
implements Preference.OnPreferenceChangeListener {
|
implements Preference.OnPreferenceChangeListener {
|
||||||
@@ -67,7 +68,15 @@ public class InvalidConversationPreferenceController extends NotificationPrefere
|
|||||||
pref.setDisabledByAdmin(mAdmin);
|
pref.setDisabledByAdmin(mAdmin);
|
||||||
pref.setEnabled(!pref.isDisabledByAdmin());
|
pref.setEnabled(!pref.isDisabledByAdmin());
|
||||||
pref.setChecked(!mBackend.hasUserDemotedInvalidMsgApp(mAppRow.pkg, mAppRow.uid));
|
pref.setChecked(!mBackend.hasUserDemotedInvalidMsgApp(mAppRow.pkg, mAppRow.uid));
|
||||||
preference.setSummary(mContext.getString(R.string.conversation_section_switch_summary));
|
if (SettingsThemeHelper.isExpressiveTheme(mContext)) {
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
|
preference.setSummary(mContext.getString(
|
||||||
|
R.string.conversation_section_switch_complete_summary));
|
||||||
|
} else {
|
||||||
|
preference.setSummary(mContext.getString(R.string.conversation_section_switch_summary));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import androidx.preference.Preference;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
|
import com.android.settingslib.widget.TopIntroPreference;
|
||||||
|
|
||||||
public class PriorityConversationsPreferenceController extends
|
public class PriorityConversationsPreferenceController extends
|
||||||
ConversationListPreferenceController {
|
ConversationListPreferenceController {
|
||||||
@@ -40,9 +41,9 @@ public class PriorityConversationsPreferenceController extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
Preference getSummaryPreference() {
|
Preference getSummaryPreference() {
|
||||||
Preference pref = new Preference(mContext);
|
Preference pref = new TopIntroPreference(mContext);
|
||||||
pref.setOrder(1);
|
pref.setOrder(1);
|
||||||
pref.setSummary(R.string.important_conversations_summary_bubbles);
|
pref.setTitle(R.string.important_conversations_summary_bubbles);
|
||||||
pref.setSelectable(false);
|
pref.setSelectable(false);
|
||||||
return pref;
|
return pref;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,12 @@ import android.content.Context;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceCategory;
|
|
||||||
|
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
import com.android.settingslib.RestrictedSwitchPreference;
|
import com.android.settingslib.RestrictedSwitchPreference;
|
||||||
|
|
||||||
public class PromotedNotificationsPreferenceController extends
|
public class PromotedNotificationsPreferenceController extends
|
||||||
NotificationPreferenceController implements Preference.OnPreferenceChangeListener {
|
NotificationPreferenceController implements Preference.OnPreferenceChangeListener {
|
||||||
private static final String KEY_PROMOTED_CATEGORY = "promoted_category";
|
|
||||||
protected static final String KEY_PROMOTED_SWITCH = "promoted_switch";
|
protected static final String KEY_PROMOTED_SWITCH = "promoted_switch";
|
||||||
|
|
||||||
public PromotedNotificationsPreferenceController(@NonNull Context context,
|
public PromotedNotificationsPreferenceController(@NonNull Context context,
|
||||||
@@ -38,7 +36,7 @@ public class PromotedNotificationsPreferenceController extends
|
|||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return KEY_PROMOTED_CATEGORY;
|
return KEY_PROMOTED_SWITCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,12 +54,13 @@ public class PromotedNotificationsPreferenceController extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the state of the promoted notifications switch. Because this controller governs
|
* Updates the state of the promoted notifications switch.
|
||||||
* the full PreferenceCategory, we must find the switch preference within the category first.
|
|
||||||
*/
|
*/
|
||||||
public void updateState(@NonNull Preference preference) {
|
public void updateState(@NonNull Preference preference) {
|
||||||
PreferenceCategory category = (PreferenceCategory) preference;
|
RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference;
|
||||||
RestrictedSwitchPreference pref = category.findPreference(KEY_PROMOTED_SWITCH);
|
if (pref.getParent() != null) {
|
||||||
|
pref.getParent().setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (pref != null && mAppRow != null) {
|
if (pref != null && mAppRow != null) {
|
||||||
pref.setDisabledByAdmin(mAdmin);
|
pref.setDisabledByAdmin(mAdmin);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import com.android.settings.applications.AppInfoBase;
|
|||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
import com.android.settingslib.widget.ButtonPreference;
|
||||||
import com.android.settingslib.widget.LayoutPreference;
|
import com.android.settingslib.widget.LayoutPreference;
|
||||||
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
@@ -75,14 +76,12 @@ public class RecentConversationsPreferenceController extends AbstractPreferenceC
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(b/233325816): Use ButtonPreference instead.
|
ButtonPreference getClearAll(PreferenceGroup parent) {
|
||||||
LayoutPreference getClearAll(PreferenceGroup parent) {
|
ButtonPreference pref = new ButtonPreference(mContext);
|
||||||
LayoutPreference pref = new LayoutPreference(
|
pref.setTitle(R.string.conversation_settings_clear_recents);
|
||||||
mContext, R.layout.conversations_clear_recents);
|
|
||||||
pref.setKey(getPreferenceKey() + CLEAR_ALL_KEY_SUFFIX);
|
pref.setKey(getPreferenceKey() + CLEAR_ALL_KEY_SUFFIX);
|
||||||
pref.setOrder(1);
|
pref.setOrder(1);
|
||||||
Button button = pref.findViewById(R.id.conversation_settings_clear_recents);
|
pref.setOnClickListener(v -> {
|
||||||
button.setOnClickListener(v -> {
|
|
||||||
try {
|
try {
|
||||||
mPs.removeAllRecentConversations();
|
mPs.removeAllRecentConversations();
|
||||||
// Removing recents is asynchronous, so we can't immediately reload the list from
|
// Removing recents is asynchronous, so we can't immediately reload the list from
|
||||||
@@ -97,7 +96,8 @@ public class RecentConversationsPreferenceController extends AbstractPreferenceC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
button.announceForAccessibility(mContext.getString(R.string.recent_convos_removed));
|
pref.getButton().announceForAccessibility(
|
||||||
|
mContext.getString(R.string.recent_convos_removed));
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Could not clear recents", e);
|
Slog.w(TAG, "Could not clear recents", e);
|
||||||
}
|
}
|
||||||
@@ -160,25 +160,27 @@ public class RecentConversationsPreferenceController extends AbstractPreferenceC
|
|||||||
.forEachOrdered(pref -> {
|
.forEachOrdered(pref -> {
|
||||||
pref.setOrder(order.getAndIncrement());
|
pref.setOrder(order.getAndIncrement());
|
||||||
mPreferenceGroup.addPreference(pref);
|
mPreferenceGroup.addPreference(pref);
|
||||||
if (pref.hasClearListener()) {
|
if (pref instanceof RecentConversationPreference
|
||||||
|
&& ((RecentConversationPreference) pref).hasClearListener()) {
|
||||||
hasClearable.set(true);
|
hasClearable.set(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return hasClearable.get();
|
return hasClearable.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RecentConversationPreference createConversationPref(
|
protected Preference createConversationPref(
|
||||||
final ConversationChannel conversation) {
|
final ConversationChannel conversation) {
|
||||||
final String pkg = conversation.getShortcutInfo().getPackage();
|
final String pkg = conversation.getShortcutInfo().getPackage();
|
||||||
final int uid = conversation.getUid();
|
final int uid = conversation.getUid();
|
||||||
final String conversationId = conversation.getShortcutInfo().getId();
|
final String conversationId = conversation.getShortcutInfo().getId();
|
||||||
RecentConversationPreference pref = new RecentConversationPreference(mContext);
|
Preference pref = conversation.hasActiveNotifications() ? new Preference(mContext)
|
||||||
|
: new RecentConversationPreference(mContext);
|
||||||
|
|
||||||
if (!conversation.hasActiveNotifications()) {
|
if (!conversation.hasActiveNotifications()) {
|
||||||
pref.setOnClearClickListener(() -> {
|
((RecentConversationPreference) pref).setOnClearClickListener(() -> {
|
||||||
try {
|
try {
|
||||||
mPs.removeRecentConversation(pkg, UserHandle.getUserId(uid), conversationId);
|
mPs.removeRecentConversation(pkg, UserHandle.getUserId(uid), conversationId);
|
||||||
pref.getClearView().announceForAccessibility(
|
((RecentConversationPreference) pref).getClearView().announceForAccessibility(
|
||||||
mContext.getString(R.string.recent_convo_removed));
|
mContext.getString(R.string.recent_convo_removed));
|
||||||
mPreferenceGroup.removePreference(pref);
|
mPreferenceGroup.removePreference(pref);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public class ShowMorePreferenceController extends NotificationPreferenceControll
|
|||||||
if (mAppRow.banned || mAppRow.showAllChannels) {
|
if (mAppRow.banned || mAppRow.showAllChannels) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (mBackend.getChannelCount(mAppRow.pkg, mAppRow.uid) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ public class VisibilityPreferenceController extends NotificationPreferenceContro
|
|||||||
|
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
if (mChannel != null && mAppRow != null) {
|
if (mChannel != null && mAppRow != null) {
|
||||||
|
if (preference.getParent() != null) {
|
||||||
|
preference.getParent().setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
RestrictedListPreference pref = (RestrictedListPreference) preference;
|
RestrictedListPreference pref = (RestrictedListPreference) preference;
|
||||||
ArrayList<CharSequence> entries = new ArrayList<>();
|
ArrayList<CharSequence> entries = new ArrayList<>();
|
||||||
ArrayList<CharSequence> values = new ArrayList<>();
|
ArrayList<CharSequence> values = new ArrayList<>();
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import android.content.Context
|
|||||||
import com.android.settings.PreferenceRestrictionMixin
|
import com.android.settings.PreferenceRestrictionMixin
|
||||||
import com.android.settingslib.datastore.HandlerExecutor
|
import com.android.settingslib.datastore.HandlerExecutor
|
||||||
import com.android.settingslib.datastore.KeyedObserver
|
import com.android.settingslib.datastore.KeyedObserver
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.preference.PreferenceScreenBindingHelper
|
import com.android.settingslib.preference.PreferenceScreenBindingHelper
|
||||||
import com.android.settingslib.preference.PreferenceScreenBindingHelper.Companion.CHANGE_REASON_STATE
|
|
||||||
|
|
||||||
/** Helper to rebind preference immediately when user restriction is changed. */
|
/** Helper to rebind preference immediately when user restriction is changed. */
|
||||||
class UserRestrictionBindingHelper(
|
class UserRestrictionBindingHelper(
|
||||||
@@ -55,7 +55,7 @@ class UserRestrictionBindingHelper(
|
|||||||
|
|
||||||
override fun onKeyChanged(restrictionKey: String, reason: Int) {
|
override fun onKeyChanged(restrictionKey: String, reason: Int) {
|
||||||
val keys = restrictionKeysToPreferenceKeys[restrictionKey] ?: return
|
val keys = restrictionKeysToPreferenceKeys[restrictionKey] ?: return
|
||||||
for (key in keys) screenBindingHelper.notifyChange(key, CHANGE_REASON_STATE)
|
for (key in keys) screenBindingHelper.notifyChange(key, PreferenceChangeReason.STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.os.UserManager
|
|||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
import com.android.settingslib.datastore.DataChangeReason
|
||||||
import com.android.settingslib.datastore.KeyedObserver
|
import com.android.settingslib.datastore.KeyedObserver
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
/** Helper class to monitor user restriction changes. */
|
/** Helper class to monitor user restriction changes. */
|
||||||
@@ -46,7 +47,7 @@ class UserRestrictions private constructor(private val applicationContext: Conte
|
|||||||
object : BroadcastReceiver() {
|
object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
// there is no way to get the changed keys, just notify all observers
|
// there is no way to get the changed keys, just notify all observers
|
||||||
observable.notifyChange(DataChangeReason.UPDATE)
|
observable.notifyChange(PreferenceChangeReason.STATE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
# People who can approve changes for submission.
|
# People who can approve changes for submission.
|
||||||
jchalard@google.com
|
file:platform/packages/modules/Connectivity:main:/OWNERS_core_networking_xts
|
||||||
lorenzo@google.com
|
|
||||||
maze@google.com
|
|
||||||
reminv@google.com
|
|
||||||
xiaom@google.com
|
xiaom@google.com
|
||||||
hughchen@google.com
|
hughchen@google.com
|
||||||
robertluo@google.com
|
robertluo@google.com
|
||||||
timhypeng@google.com
|
timhypeng@google.com
|
||||||
vincentwei@google.com
|
vincentwei@google.com
|
||||||
|
|
||||||
# Emergency approvers in case the above are not available
|
|
||||||
satk@google.com
|
|
||||||
|
|||||||
@@ -27,6 +27,16 @@ import com.android.settingslib.preference.TwoStatePreferenceBinding
|
|||||||
interface MainSwitchBarMetadata :
|
interface MainSwitchBarMetadata :
|
||||||
TwoStatePreference, TwoStatePreferenceBinding, PreferenceBindingPlaceholder {
|
TwoStatePreference, TwoStatePreferenceBinding, PreferenceBindingPlaceholder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable main switch bar when user toggles the switch. By this way, user cannot toggle again
|
||||||
|
* before last operation is done.
|
||||||
|
*
|
||||||
|
* Side-effect: If the underlying operation is completed quickly, this will causes UI flicker.
|
||||||
|
* Override and return `false` to get rid of the flicker.
|
||||||
|
*/
|
||||||
|
val disableWidgetOnCheckedChanged: Boolean
|
||||||
|
get() = true
|
||||||
|
|
||||||
override fun createWidget(context: Context) = MainSwitchBarPreference(context, this)
|
override fun createWidget(context: Context) = MainSwitchBarPreference(context, this)
|
||||||
|
|
||||||
override fun bind(preference: Preference, metadata: PreferenceMetadata) {
|
override fun bind(preference: Preference, metadata: PreferenceMetadata) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class MainSwitchBarPreference(context: Context, private val metadata: MainSwitch
|
|||||||
|
|
||||||
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
|
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
|
||||||
// prevent user from toggling the switch before data store operation is done
|
// prevent user from toggling the switch before data store operation is done
|
||||||
isEnabled = false
|
if (metadata.disableWidgetOnCheckedChanged) isEnabled = false
|
||||||
// once data store is updated, isEnabled will be reset due to rebind
|
// once data store is updated, isEnabled will be reset due to rebind
|
||||||
persistBoolean(isChecked)
|
persistBoolean(isChecked)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ import com.android.settings.wifi.utils.wifiManager
|
|||||||
import com.android.settingslib.RestrictedSwitchPreference
|
import com.android.settingslib.RestrictedSwitchPreference
|
||||||
import com.android.settingslib.WirelessUtils
|
import com.android.settingslib.WirelessUtils
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.Permissions
|
import com.android.settingslib.datastore.Permissions
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
import com.android.settingslib.metadata.PreferenceLifecycleProvider
|
||||||
import com.android.settingslib.metadata.PreferenceMetadata
|
import com.android.settingslib.metadata.PreferenceMetadata
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
@@ -163,7 +163,7 @@ class WifiSwitchPreference :
|
|||||||
wifiState == WifiManager.WIFI_STATE_ENABLED ||
|
wifiState == WifiManager.WIFI_STATE_ENABLED ||
|
||||||
wifiState == WifiManager.WIFI_STATE_DISABLED
|
wifiState == WifiManager.WIFI_STATE_DISABLED
|
||||||
) {
|
) {
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.VALUE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import com.android.settings.PreferenceRestrictionMixin
|
|||||||
import com.android.settings.R
|
import com.android.settings.R
|
||||||
import com.android.settings.Utils
|
import com.android.settings.Utils
|
||||||
import com.android.settings.core.SubSettingLauncher
|
import com.android.settings.core.SubSettingLauncher
|
||||||
import com.android.settings.datausage.DataSaverMainSwitchPreference.Companion.KEY as DATA_SAVER_KEY
|
|
||||||
import com.android.settings.wifi.WifiUtils.canShowWifiHotspot
|
import com.android.settings.wifi.WifiUtils.canShowWifiHotspot
|
||||||
import com.android.settings.wifi.utils.tetheringManager
|
import com.android.settings.wifi.utils.tetheringManager
|
||||||
import com.android.settings.wifi.utils.wifiApState
|
import com.android.settings.wifi.utils.wifiApState
|
||||||
@@ -41,12 +40,12 @@ import com.android.settings.wifi.utils.wifiSoftApSsid
|
|||||||
import com.android.settingslib.PrimarySwitchPreference
|
import com.android.settingslib.PrimarySwitchPreference
|
||||||
import com.android.settingslib.TetherUtil
|
import com.android.settingslib.TetherUtil
|
||||||
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
import com.android.settingslib.datastore.AbstractKeyedDataObservable
|
||||||
import com.android.settingslib.datastore.DataChangeReason
|
|
||||||
import com.android.settingslib.datastore.HandlerExecutor
|
import com.android.settingslib.datastore.HandlerExecutor
|
||||||
import com.android.settingslib.datastore.KeyValueStore
|
import com.android.settingslib.datastore.KeyValueStore
|
||||||
import com.android.settingslib.datastore.KeyedObserver
|
import com.android.settingslib.datastore.KeyedObserver
|
||||||
import com.android.settingslib.datastore.Permissions
|
import com.android.settingslib.datastore.Permissions
|
||||||
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
|
import com.android.settingslib.metadata.PreferenceAvailabilityProvider
|
||||||
|
import com.android.settingslib.metadata.PreferenceChangeReason
|
||||||
import com.android.settingslib.metadata.PreferenceMetadata
|
import com.android.settingslib.metadata.PreferenceMetadata
|
||||||
import com.android.settingslib.metadata.PreferenceSummaryProvider
|
import com.android.settingslib.metadata.PreferenceSummaryProvider
|
||||||
import com.android.settingslib.metadata.ReadWritePermit
|
import com.android.settingslib.metadata.ReadWritePermit
|
||||||
@@ -54,6 +53,7 @@ import com.android.settingslib.metadata.SensitivityLevel
|
|||||||
import com.android.settingslib.metadata.SwitchPreference
|
import com.android.settingslib.metadata.SwitchPreference
|
||||||
import com.android.settingslib.preference.PreferenceBinding
|
import com.android.settingslib.preference.PreferenceBinding
|
||||||
import com.android.settingslib.wifi.WifiUtils.Companion.getWifiTetherSummaryForConnectedDevices
|
import com.android.settingslib.wifi.WifiUtils.Companion.getWifiTetherSummaryForConnectedDevices
|
||||||
|
import com.android.settings.datausage.DataSaverMainSwitchPreference.Companion.KEY as DATA_SAVER_KEY
|
||||||
|
|
||||||
// LINT.IfChange
|
// LINT.IfChange
|
||||||
class WifiHotspotSwitchPreference(context: Context, dataSaverStore: KeyValueStore) :
|
class WifiHotspotSwitchPreference(context: Context, dataSaverStore: KeyValueStore) :
|
||||||
@@ -186,13 +186,13 @@ class WifiHotspotSwitchPreference(context: Context, dataSaverStore: KeyValueStor
|
|||||||
Log.d(TAG, "onStateChanged(),state=$state,failureReason=$failureReason")
|
Log.d(TAG, "onStateChanged(),state=$state,failureReason=$failureReason")
|
||||||
sapFailureReason = failureReason
|
sapFailureReason = failureReason
|
||||||
if (state == WifiManager.WIFI_AP_STATE_DISABLED) sapClientsSize = null
|
if (state == WifiManager.WIFI_AP_STATE_DISABLED) sapClientsSize = null
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.VALUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConnectedClientsChanged(clients: List<WifiClient>?) {
|
override fun onConnectedClientsChanged(clients: List<WifiClient>?) {
|
||||||
sapClientsSize = clients?.size ?: 0
|
sapClientsSize = clients?.size ?: 0
|
||||||
Log.d(TAG, "onConnectedClientsChanged(),sapClientsSize=$sapClientsSize")
|
Log.d(TAG, "onConnectedClientsChanged(),sapClientsSize=$sapClientsSize")
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, PreferenceChangeReason.STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTetheringStarted() {}
|
override fun onTetheringStarted() {}
|
||||||
@@ -202,7 +202,7 @@ class WifiHotspotSwitchPreference(context: Context, dataSaverStore: KeyValueStor
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onKeyChanged(key: String, reason: Int) =
|
override fun onKeyChanged(key: String, reason: Int) =
|
||||||
notifyChange(KEY, DataChangeReason.UPDATE)
|
notifyChange(KEY, reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bind(preference: Preference, metadata: PreferenceMetadata) {
|
override fun bind(preference: Preference, metadata: PreferenceMetadata) {
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.accessibility;
|
package com.android.settings.accessibility;
|
||||||
|
|
||||||
|
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_MAX;
|
||||||
|
import static android.view.accessibility.AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_MIN;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
@@ -32,9 +35,11 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
|
import com.android.settingslib.widget.SliderPreference;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
@@ -106,21 +111,74 @@ public class ToggleAutoclickCursorAreaSizeControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getProgress_matchesSetting() {
|
public void getProgress_matchesSetting_inRangeValue() {
|
||||||
assertThat(mController.getSliderPosition()).isEqualTo(readSetting());
|
// TODO(388844952): Use parameter testing.
|
||||||
|
for (int size : ImmutableList.of(20, 40, 60, 80, 100)) {
|
||||||
|
updateSetting(size);
|
||||||
|
|
||||||
|
assertThat(mController.getSliderPosition()).isEqualTo(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setProgress_updatesSetting() {
|
public void getProgress_matchesSetting_aboveMaxValue() {
|
||||||
for (int size : ImmutableList.of(20, 40, 60, 80, 100)) {
|
updateSetting(120);
|
||||||
mController.setSliderPosition(size);
|
|
||||||
assertThat(readSetting()).isEqualTo(size);
|
assertThat(mController.getSliderPosition()).isEqualTo(AUTOCLICK_CURSOR_AREA_SIZE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getProgress_matchesSetting_belowMinValue() {
|
||||||
|
updateSetting(0);
|
||||||
|
|
||||||
|
assertThat(mController.getSliderPosition()).isEqualTo(AUTOCLICK_CURSOR_AREA_SIZE_MIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setProgress_updatesSetting_inRangeValue() {
|
||||||
|
// TODO(388844952): Use parameter testing.
|
||||||
|
for (int position : ImmutableList.of(20, 40, 60, 80, 100)) {
|
||||||
|
mController.setSliderPosition(position);
|
||||||
|
|
||||||
|
assertThat(readSetting()).isEqualTo(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setProgress_updatesSetting_aboveMaxValue() {
|
||||||
|
mController.setSliderPosition(120);
|
||||||
|
|
||||||
|
assertThat(readSetting()).isEqualTo(AUTOCLICK_CURSOR_AREA_SIZE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setProgress_updatesSetting_belowMinValue() {
|
||||||
|
mController.setSliderPosition(0);
|
||||||
|
|
||||||
|
assertThat(readSetting()).isEqualTo(AUTOCLICK_CURSOR_AREA_SIZE_MIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sliderPreference_setCorrectInitialValue() {
|
||||||
|
SliderPreference preference = mock(SliderPreference.class);
|
||||||
|
PreferenceScreen screen = mock(PreferenceScreen.class);
|
||||||
|
doReturn(preference).when(screen).findPreference(anyString());
|
||||||
|
|
||||||
|
mController.displayPreference(screen);
|
||||||
|
|
||||||
|
verify(preference).setValue(mController.getSliderPosition());
|
||||||
|
}
|
||||||
|
|
||||||
private int readSetting() {
|
private int readSetting() {
|
||||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
return Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE,
|
Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE,
|
||||||
AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT);
|
AccessibilityManager.AUTOCLICK_CURSOR_AREA_SIZE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSetting(int value) {
|
||||||
|
Settings.Secure.putInt(
|
||||||
|
mContext.getContentResolver(),
|
||||||
|
Settings.Secure.ACCESSIBILITY_AUTOCLICK_CURSOR_AREA_SIZE,
|
||||||
|
value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.platform.test.annotations.EnableFlags;
|
||||||
import android.platform.test.flag.junit.SetFlagsRule;
|
import android.platform.test.flag.junit.SetFlagsRule;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -107,8 +108,11 @@ public class AudioSharingCallAudioPreferenceControllerTest {
|
|||||||
private static final String PREF_KEY = "calls_and_alarms";
|
private static final String PREF_KEY = "calls_and_alarms";
|
||||||
private static final String TEST_DEVICE_NAME1 = "test1";
|
private static final String TEST_DEVICE_NAME1 = "test1";
|
||||||
private static final String TEST_DEVICE_NAME2 = "test2";
|
private static final String TEST_DEVICE_NAME2 = "test2";
|
||||||
|
private static final String TEMP_BOND_METADATA =
|
||||||
|
"<TEMP_BOND_TYPE>le_audio_sharing</TEMP_BOND_TYPE>";
|
||||||
private static final int TEST_DEVICE_GROUP_ID1 = 1;
|
private static final int TEST_DEVICE_GROUP_ID1 = 1;
|
||||||
private static final int TEST_DEVICE_GROUP_ID2 = 2;
|
private static final int TEST_DEVICE_GROUP_ID2 = 2;
|
||||||
|
private static final int METADATA_FAST_PAIR_CUSTOMIZED_FIELDS = 25;
|
||||||
|
|
||||||
private static final String TEST_SETTINGS_KEY =
|
private static final String TEST_SETTINGS_KEY =
|
||||||
"bluetooth_le_broadcast_fallback_active_group_id";
|
"bluetooth_le_broadcast_fallback_active_group_id";
|
||||||
@@ -440,6 +444,23 @@ public class AudioSharingCallAudioPreferenceControllerTest {
|
|||||||
assertThat(mPreference.getSummary().toString()).isEmpty();
|
assertThat(mPreference.getSummary().toString()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnableFlags(Flags.FLAG_ENABLE_TEMPORARY_BOND_DEVICES_UI)
|
||||||
|
public void displayPreference_hasTemporaryBondDevice_doNotShow() {
|
||||||
|
Settings.Secure.putInt(mContentResolver, TEST_SETTINGS_KEY, TEST_DEVICE_GROUP_ID1);
|
||||||
|
when(mCachedDevice1.isActiveDevice(BluetoothProfile.LE_AUDIO)).thenReturn(true);
|
||||||
|
when(mBroadcast.isEnabled(any())).thenReturn(true);
|
||||||
|
when(mAssistant.getAllConnectedDevices()).thenReturn(ImmutableList.of(mDevice1, mDevice2));
|
||||||
|
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of(mState));
|
||||||
|
when(mDevice2.getMetadata(METADATA_FAST_PAIR_CUSTOMIZED_FIELDS)).thenReturn(
|
||||||
|
TEMP_BOND_METADATA.getBytes());
|
||||||
|
|
||||||
|
mController.displayPreference(mScreen);
|
||||||
|
shadowOf(Looper.getMainLooper()).idle();
|
||||||
|
|
||||||
|
assertThat(mController.mGroupedConnectedDevices).hasSize(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPreference_clickToShowCorrectDialog() {
|
public void displayPreference_clickToShowCorrectDialog() {
|
||||||
AlertDialog latestAlertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
AlertDialog latestAlertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import android.content.Context;
|
|||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceCategory;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
@@ -68,7 +70,6 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
private NotificationManager mNm;
|
private NotificationManager mNm;
|
||||||
@Mock
|
@Mock
|
||||||
private UserManager mUm;
|
private UserManager mUm;
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
|
||||||
private PreferenceScreen mScreen;
|
private PreferenceScreen mScreen;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@@ -83,6 +84,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
|
shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
|
||||||
shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
|
shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
|
||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
|
mScreen = new PreferenceManager(mContext).createPreferenceScreen(mContext);
|
||||||
mController =
|
mController =
|
||||||
spy(new AllowSoundPreferenceController(mContext, mDependentFieldListener, mBackend));
|
spy(new AllowSoundPreferenceController(mContext, mDependentFieldListener, mBackend));
|
||||||
}
|
}
|
||||||
@@ -160,6 +162,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
RestrictedLockUtils.EnforcedAdmin.class), null);
|
RestrictedLockUtils.EnforcedAdmin.class), null);
|
||||||
|
|
||||||
Preference pref = new RestrictedSwitchPreference(mContext);
|
Preference pref = new RestrictedSwitchPreference(mContext);
|
||||||
|
mScreen.addPreference(pref);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
|
|
||||||
assertFalse(pref.isEnabled());
|
assertFalse(pref.isEnabled());
|
||||||
@@ -173,6 +176,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||||
|
|
||||||
Preference pref = new RestrictedSwitchPreference(mContext);
|
Preference pref = new RestrictedSwitchPreference(mContext);
|
||||||
|
mScreen.addPreference(pref);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
|
|
||||||
assertTrue(pref.isEnabled());
|
assertTrue(pref.isEnabled());
|
||||||
@@ -186,6 +190,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
||||||
|
mScreen.addPreference(pref);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
assertTrue(pref.isChecked());
|
assertTrue(pref.isChecked());
|
||||||
}
|
}
|
||||||
@@ -198,6 +203,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
||||||
|
mScreen.addPreference(pref);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
assertTrue(pref.isChecked());
|
assertTrue(pref.isChecked());
|
||||||
}
|
}
|
||||||
@@ -210,6 +216,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
||||||
|
mScreen.addPreference(pref);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
assertFalse(pref.isChecked());
|
assertFalse(pref.isChecked());
|
||||||
}
|
}
|
||||||
@@ -222,7 +229,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
||||||
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
|
mScreen.addPreference(pref);
|
||||||
mController.displayPreference(mScreen);
|
mController.displayPreference(mScreen);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
pref.setChecked(true);
|
pref.setChecked(true);
|
||||||
@@ -240,7 +247,7 @@ public class AllowSoundPreferenceControllerTest {
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
RestrictedSwitchPreference pref = new RestrictedSwitchPreference(mContext);
|
||||||
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(pref);
|
mScreen.addPreference(pref);
|
||||||
mController.displayPreference(mScreen);
|
mController.displayPreference(mScreen);
|
||||||
mController.updateState(pref);
|
mController.updateState(pref);
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import android.permission.PermissionManager.PERMISSION_HARD_DENIED
|
|||||||
import android.permission.PermissionManager.PERMISSION_SOFT_DENIED
|
import android.permission.PermissionManager.PERMISSION_SOFT_DENIED
|
||||||
import android.permission.PermissionManager.PermissionResult
|
import android.permission.PermissionManager.PermissionResult
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import androidx.test.core.app.ApplicationProvider
|
import androidx.test.core.app.ApplicationProvider
|
||||||
import com.android.settings.notification.NotificationBackend
|
import com.android.settings.notification.NotificationBackend
|
||||||
@@ -80,7 +81,6 @@ class FullScreenIntentPermissionPreferenceControllerTest {
|
|||||||
|
|
||||||
private lateinit var preference: RestrictedSwitchPreference
|
private lateinit var preference: RestrictedSwitchPreference
|
||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
|
||||||
private lateinit var screen: PreferenceScreen
|
private lateinit var screen: PreferenceScreen
|
||||||
|
|
||||||
private lateinit var controller: FullScreenIntentPermissionPreferenceController
|
private lateinit var controller: FullScreenIntentPermissionPreferenceController
|
||||||
@@ -94,7 +94,8 @@ class FullScreenIntentPermissionPreferenceControllerTest {
|
|||||||
|
|
||||||
preference = RestrictedSwitchPreference(context).apply { key = KEY_FSI_PERMISSION }
|
preference = RestrictedSwitchPreference(context).apply { key = KEY_FSI_PERMISSION }
|
||||||
|
|
||||||
whenever(screen.findPreference<Preference>(KEY_FSI_PERMISSION)).thenReturn(preference)
|
screen = PreferenceManager(context).createPreferenceScreen(context)
|
||||||
|
screen.addPreference(preference)
|
||||||
|
|
||||||
controller = FullScreenIntentPermissionPreferenceController(
|
controller = FullScreenIntentPermissionPreferenceController(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -113,27 +113,6 @@ public class HeaderPreferenceControllerTest {
|
|||||||
assertTrue(mController.isAvailable());
|
assertTrue(mController.isAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetLabel() {
|
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
|
||||||
appRow.label = "bananas";
|
|
||||||
mController.onResume(appRow, null, null, null, null, null, null);
|
|
||||||
assertEquals(appRow.label, mController.getLabel());
|
|
||||||
|
|
||||||
NotificationChannelGroup group = new NotificationChannelGroup("id", "name");
|
|
||||||
mController.onResume(appRow, null, group, null, null, null, null);
|
|
||||||
assertEquals(appRow.label, mController.getLabel());
|
|
||||||
|
|
||||||
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
|
|
||||||
mController.onResume(appRow, channel, group, null, null, null, null);
|
|
||||||
assertEquals(channel.getName(), mController.getLabel());
|
|
||||||
|
|
||||||
NotificationChannel defaultChannel = new NotificationChannel(
|
|
||||||
NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
|
|
||||||
mController.onResume(appRow, defaultChannel, null, null, null, null, null);
|
|
||||||
assertEquals(appRow.label, mController.getLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSummary() {
|
public void testGetSummary() {
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
@@ -146,16 +125,14 @@ public class HeaderPreferenceControllerTest {
|
|||||||
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
|
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
|
||||||
mController.onResume(appRow, channel, group, null, null, null, null);
|
mController.onResume(appRow, channel, group, null, null, null, null);
|
||||||
assertTrue(mController.getSummary().toString().contains(group.getName()));
|
assertTrue(mController.getSummary().toString().contains(group.getName()));
|
||||||
assertTrue(mController.getSummary().toString().contains(appRow.label));
|
|
||||||
|
|
||||||
mController.onResume(appRow, channel, null, null, null, null, null);
|
mController.onResume(appRow, channel, null, null, null, null, null);
|
||||||
assertFalse(mController.getSummary().toString().contains(group.getName()));
|
assertFalse(mController.getSummary().toString().contains(group.getName()));
|
||||||
assertTrue(mController.getSummary().toString().contains(appRow.label));
|
|
||||||
|
|
||||||
NotificationChannel defaultChannel = new NotificationChannel(
|
NotificationChannel defaultChannel = new NotificationChannel(
|
||||||
NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
|
NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
|
||||||
mController.onResume(appRow, defaultChannel, null, null, null, null, null);
|
mController.onResume(appRow, defaultChannel, null, null, null, null, null);
|
||||||
assertEquals(appRow.label, mController.getSummary());
|
assertEquals("", mController.getSummary());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import androidx.preference.PreferenceScreen;
|
|||||||
|
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
|
import com.android.settingslib.widget.SettingsThemeHelper;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
@@ -88,6 +89,18 @@ public class InvalidConversationInfoPreferenceControllerTest {
|
|||||||
mController.updateState(mock(Preference.class));
|
mController.updateState(mock(Preference.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsAvailable_notIfExpressiveTheme() {
|
||||||
|
if (SettingsThemeHelper.isExpressiveTheme(mContext)) {
|
||||||
|
when(mBackend.isInInvalidMsgState(anyString(), anyInt())).thenReturn(true);
|
||||||
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
|
appRow.pkg = "hi";
|
||||||
|
appRow.uid = 0;
|
||||||
|
mController.onResume(appRow, null, null, null, null, null, null);
|
||||||
|
assertFalse(mController.isAvailable());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable_notIfAppBlocked() {
|
public void testIsAvailable_notIfAppBlocked() {
|
||||||
when(mBackend.isInInvalidMsgState(anyString(), anyInt())).thenReturn(true);
|
when(mBackend.isInInvalidMsgState(anyString(), anyInt())).thenReturn(true);
|
||||||
@@ -111,6 +124,9 @@ public class InvalidConversationInfoPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable() {
|
public void testIsAvailable() {
|
||||||
|
if (SettingsThemeHelper.isExpressiveTheme(mContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
when(mBackend.isInInvalidMsgState(anyString(), anyInt())).thenReturn(true);
|
when(mBackend.isInInvalidMsgState(anyString(), anyInt())).thenReturn(true);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.pkg = "hi";
|
appRow.pkg = "hi";
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ package com.android.settings.notification.app;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
|
||||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import android.app.Flags;
|
import android.app.Flags;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -32,7 +31,7 @@ import android.platform.test.annotations.DisableFlags;
|
|||||||
import android.platform.test.annotations.EnableFlags;
|
import android.platform.test.annotations.EnableFlags;
|
||||||
import android.platform.test.flag.junit.SetFlagsRule;
|
import android.platform.test.flag.junit.SetFlagsRule;
|
||||||
|
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
@@ -55,8 +54,6 @@ public class PromotedNotificationsPreferenceControllerTest {
|
|||||||
private NotificationBackend.AppRow mAppRow;
|
private NotificationBackend.AppRow mAppRow;
|
||||||
@Mock
|
@Mock
|
||||||
private NotificationBackend mBackend;
|
private NotificationBackend mBackend;
|
||||||
@Mock
|
|
||||||
private PreferenceCategory mPrefCategory;
|
|
||||||
private RestrictedSwitchPreference mSwitch;
|
private RestrictedSwitchPreference mSwitch;
|
||||||
|
|
||||||
private PromotedNotificationsPreferenceController mPrefController;
|
private PromotedNotificationsPreferenceController mPrefController;
|
||||||
@@ -66,7 +63,7 @@ public class PromotedNotificationsPreferenceControllerTest {
|
|||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mContext = ApplicationProvider.getApplicationContext();
|
mContext = ApplicationProvider.getApplicationContext();
|
||||||
mSwitch = new RestrictedSwitchPreference(mContext);
|
mSwitch = new RestrictedSwitchPreference(mContext);
|
||||||
when(mPrefCategory.findPreference("promoted_switch")).thenReturn(mSwitch);
|
new PreferenceManager(mContext).createPreferenceScreen(mContext).addPreference(mSwitch);
|
||||||
mPrefController = new PromotedNotificationsPreferenceController(mContext, mBackend);
|
mPrefController = new PromotedNotificationsPreferenceController(mContext, mBackend);
|
||||||
|
|
||||||
mAppRow = new NotificationBackend.AppRow();
|
mAppRow = new NotificationBackend.AppRow();
|
||||||
@@ -93,12 +90,12 @@ public class PromotedNotificationsPreferenceControllerTest {
|
|||||||
mAppRow.canBePromoted = true;
|
mAppRow.canBePromoted = true;
|
||||||
mPrefController.onResume(mAppRow, null, null, null, null, null, null);
|
mPrefController.onResume(mAppRow, null, null, null, null, null, null);
|
||||||
|
|
||||||
mPrefController.updateState(mPrefCategory);
|
mPrefController.updateState(mSwitch);
|
||||||
assertThat(mSwitch.isChecked()).isTrue();
|
assertThat(mSwitch.isChecked()).isTrue();
|
||||||
|
|
||||||
mAppRow.canBePromoted = false;
|
mAppRow.canBePromoted = false;
|
||||||
mPrefController.onResume(mAppRow, null, null, null, null, null, null);
|
mPrefController.onResume(mAppRow, null, null, null, null, null, null);
|
||||||
mPrefController.updateState(mPrefCategory);
|
mPrefController.updateState(mSwitch);
|
||||||
assertThat(mSwitch.isChecked()).isFalse();
|
assertThat(mSwitch.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import androidx.test.core.app.ApplicationProvider;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.applications.AppInfoBase;
|
import com.android.settings.applications.AppInfoBase;
|
||||||
import com.android.settings.notification.NotificationBackend;
|
import com.android.settings.notification.NotificationBackend;
|
||||||
|
import com.android.settingslib.widget.ButtonPreference;
|
||||||
import com.android.settingslib.widget.LayoutPreference;
|
import com.android.settingslib.widget.LayoutPreference;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@@ -232,14 +233,16 @@ public class RecentConversationsPreferenceControllerTest {
|
|||||||
new NotificationChannelGroup("hi", "group"), 7,
|
new NotificationChannelGroup("hi", "group"), 7,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
RecentConversationPreference pref = mController.createConversationPref(ccw);
|
Preference pref = mController.createConversationPref(ccw);
|
||||||
final View view = View.inflate(mContext, pref.getLayoutResource(), null);
|
final View view = View.inflate(mContext, pref.getLayoutResource(), null);
|
||||||
PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
|
PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
|
||||||
View delete = View.inflate(mContext, pref.getSecondTargetResId(), null);
|
View delete = View.inflate(mContext, ((RecentConversationPreference) pref)
|
||||||
when(holder.findViewById(pref.getClearId())).thenReturn(delete);
|
.getSecondTargetResId(), null);
|
||||||
|
when(holder.findViewById(((RecentConversationPreference) pref).getClearId()))
|
||||||
|
.thenReturn(delete);
|
||||||
|
|
||||||
pref.onBindViewHolder(holder);
|
pref.onBindViewHolder(holder);
|
||||||
pref.getClearView().performClick();
|
((RecentConversationPreference) pref).getClearView().performClick();
|
||||||
|
|
||||||
verify(mPs).removeRecentConversation(
|
verify(mPs).removeRecentConversation(
|
||||||
si.getPackage(), UserHandle.getUserId(ccw.getUid()), si.getId());
|
si.getPackage(), UserHandle.getUserId(ccw.getUid()), si.getId());
|
||||||
@@ -260,24 +263,24 @@ public class RecentConversationsPreferenceControllerTest {
|
|||||||
new NotificationChannelGroup("hi", "group"), 7,
|
new NotificationChannelGroup("hi", "group"), 7,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
RecentConversationPreference pref = mController.createConversationPref(ccw);
|
Preference pref = mController.createConversationPref(ccw);
|
||||||
final View view = View.inflate(mContext, pref.getLayoutResource(), null);
|
final View view = View.inflate(mContext, pref.getLayoutResource(), null);
|
||||||
PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
|
PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
|
||||||
View delete = View.inflate(mContext, pref.getSecondTargetResId(), null);
|
View delete = View.inflate(mContext, ((RecentConversationPreference) pref).
|
||||||
when(holder.findViewById(pref.getClearId())).thenReturn(delete);
|
getSecondTargetResId(), null);
|
||||||
|
when(holder.findViewById(((RecentConversationPreference) pref).getClearId()))
|
||||||
|
.thenReturn(delete);
|
||||||
mPreferenceGroup.addPreference(pref);
|
mPreferenceGroup.addPreference(pref);
|
||||||
|
|
||||||
RecentConversationPreference pref2 = mController.createConversationPref(ccw2);
|
Preference pref2 = mController.createConversationPref(ccw2);
|
||||||
final View view2 = View.inflate(mContext, pref2.getLayoutResource(), null);
|
|
||||||
PreferenceViewHolder holder2 = spy(PreferenceViewHolder.createInstanceForTests(view2));
|
|
||||||
View delete2 = View.inflate(mContext, pref2.getSecondTargetResId(), null);
|
|
||||||
when(holder2.findViewById(pref.getClearId())).thenReturn(delete2);
|
|
||||||
mPreferenceGroup.addPreference(pref2);
|
mPreferenceGroup.addPreference(pref2);
|
||||||
|
|
||||||
LayoutPreference clearAll = mController.getClearAll(mPreferenceGroup);
|
ButtonPreference clearAll = mController.getClearAll(mPreferenceGroup);
|
||||||
|
final View rootView = View.inflate(mContext, clearAll.getLayoutResource(), null);
|
||||||
|
clearAll.onBindViewHolder(PreferenceViewHolder.createInstanceForTests(rootView));
|
||||||
mPreferenceGroup.addPreference(clearAll);
|
mPreferenceGroup.addPreference(clearAll);
|
||||||
|
|
||||||
clearAll.findViewById(R.id.conversation_settings_clear_recents).performClick();
|
clearAll.getButton().performClick();
|
||||||
|
|
||||||
verify(mPs).removeAllRecentConversations();
|
verify(mPs).removeAllRecentConversations();
|
||||||
assertThat((Preference) mPreferenceGroup.findPreference("hi:person")).isNull();
|
assertThat((Preference) mPreferenceGroup.findPreference("hi:person")).isNull();
|
||||||
@@ -294,9 +297,9 @@ public class RecentConversationsPreferenceControllerTest {
|
|||||||
new NotificationChannelGroup("hi", "group"), 7,
|
new NotificationChannelGroup("hi", "group"), 7,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
RecentConversationPreference pref = mController.createConversationPref(ccw);
|
Preference pref = mController.createConversationPref(ccw);
|
||||||
|
|
||||||
assertThat(pref.hasClearListener()).isFalse();
|
assertThat(pref instanceof RecentConversationPreference).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -16,13 +16,12 @@
|
|||||||
|
|
||||||
package com.android.settings.network.telephony;
|
package com.android.settings.network.telephony;
|
||||||
|
|
||||||
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
|
|
||||||
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
|
|
||||||
|
|
||||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertEquals;
|
||||||
|
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -35,8 +34,6 @@ import androidx.preference.PreferenceScreen;
|
|||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.settings.R;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -72,24 +69,6 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
|
|||||||
assertThat(result).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
assertThat(result).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@Ignore("b/382664790")
|
|
||||||
public void setPreferenceTitle_hasDataService_showConnectivity() {
|
|
||||||
PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
|
||||||
PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
|
|
||||||
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
|
|
||||||
preferenceCategory.setKey(KEY);
|
|
||||||
preferenceCategory.addPreference(new Preference(mContext));
|
|
||||||
preferenceScreen.addPreference(preferenceCategory);
|
|
||||||
mController.displayPreference(preferenceScreen);
|
|
||||||
|
|
||||||
mController.mCarrierRoamingNtnModeCallback.onCarrierRoamingNtnAvailableServicesChanged(
|
|
||||||
new int[]{SERVICE_TYPE_DATA});
|
|
||||||
|
|
||||||
assertThat(preferenceCategory.getTitle()).isEqualTo(
|
|
||||||
mContext.getString(R.string.title_satellite_setting_connectivity));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("b/382664790")
|
@Ignore("b/382664790")
|
||||||
public void setPreferenceTitle_hasSmsService_showMessaging() {
|
public void setPreferenceTitle_hasSmsService_showMessaging() {
|
||||||
@@ -101,10 +80,6 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
|
|||||||
preferenceCategory.addPreference(new Preference(mContext));
|
preferenceCategory.addPreference(new Preference(mContext));
|
||||||
mController.displayPreference(preferenceScreen);
|
mController.displayPreference(preferenceScreen);
|
||||||
|
|
||||||
mController.mCarrierRoamingNtnModeCallback.onCarrierRoamingNtnAvailableServicesChanged(
|
assertEquals(preferenceCategory.getTitle(), "Satellite connectivity");
|
||||||
new int[]{SERVICE_TYPE_SMS});
|
|
||||||
|
|
||||||
assertThat(preferenceCategory.getTitle()).isEqualTo(
|
|
||||||
mContext.getString(R.string.satellite_setting_title));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,14 @@ public class ChannelListPreferenceControllerTest {
|
|||||||
assertEquals("zeroCategories", mGroupList.getPreference(0).getKey());
|
assertEquals("zeroCategories", mGroupList.getPreference(0).getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test the case with no groups but hidden channels
|
||||||
|
inGroups = new ArrayList<>();
|
||||||
|
mController.mChannelCount = 1;
|
||||||
|
mController.updateFullList(mGroupList, inGroups);
|
||||||
|
{
|
||||||
|
assertEquals(0, mGroupList.getPreferenceCount());
|
||||||
|
}
|
||||||
|
|
||||||
// Test that adding a group clears the zero category and adds everything
|
// Test that adding a group clears the zero category and adds everything
|
||||||
NotificationChannelGroup inGroup1 = new NotificationChannelGroup("group1", "Group 1");
|
NotificationChannelGroup inGroup1 = new NotificationChannelGroup("group1", "Group 1");
|
||||||
inGroup1.addChannel(new NotificationChannel("ch1a", "Channel 1A", IMPORTANCE_DEFAULT));
|
inGroup1.addChannel(new NotificationChannel("ch1a", "Channel 1A", IMPORTANCE_DEFAULT));
|
||||||
@@ -250,6 +258,7 @@ public class ChannelListPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test that we go back to the empty state when clearing all groups and channels.
|
// Test that we go back to the empty state when clearing all groups and channels.
|
||||||
|
mController.mChannelCount = 0;
|
||||||
inGroups.clear();
|
inGroups.clear();
|
||||||
mController.updateFullList(mGroupList, inGroups);
|
mController.updateFullList(mGroupList, inGroups);
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user