Snap for 6383721 from 70c45ca6d6 to mainline-release

Change-Id: If0eeb43a383c4a77fb25e7d0ecc6f62172abc37e
This commit is contained in:
android-build-team Robot
2020-04-10 07:09:29 +00:00
39 changed files with 1047 additions and 140 deletions

View File

@@ -3314,7 +3314,7 @@
</activity>
<activity android:name="Settings$GlobalActionsPanelSettingsActivity"
android:label="@string/global_actions_panel_title">
android:label="@string/cards_passes_sentence">
<intent-filter>
<action android:name="com.android.settings.GLOBAL_ACTIONS_PANEL_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
@@ -3323,6 +3323,26 @@
android:value="com.android.settings.gestures.GlobalActionsPanelSettings" />
</activity>
<activity android:name="Settings$PowerMenuSettingsActivity"
android:label="@string/power_menu_setting_name">
<intent-filter>
<action android:name="android.settings.ACTION_POWER_MENU_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.gestures.PowerMenuSettings" />
</activity>
<activity android:name="Settings$DeviceControlsSettingsActivity"
android:label="@string/device_controls_sentence">
<intent-filter>
<action android:name="android.settings.ACTION_DEVICE_CONTROLS_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.gestures.DeviceControlsSettings" />
</activity>
<activity
android:name="Settings$GestureNavigationSettingsActivity"
android:label="@string/gesture_settings_activity_title"

View File

@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:orientation="vertical">
<fragment android:name="com.android.settings.users.AppRestrictionsFragment"
android:id="@+id/user_limits_fragment"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
/>
<RelativeLayout
android:id="@+id/button_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Button
android:id="@+id/back_button"
android:layout_width="150dip"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_margin="5dip"
android:text="@string/wizard_back"
android:visibility="invisible"/>
<Button
android:id="@+id/next_button"
android:layout_width="150dip"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_alignParentEnd="true"
android:text="@string/wizard_finish" />
</RelativeLayout>
</LinearLayout>

View File

@@ -21,5 +21,7 @@
<ImageView
android:id="@+id/zen_mode_settings_senders_image"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/zen_senders_image_margin_vertical"
android:layout_marginBottom="@dimen/zen_senders_image_margin_vertical"/>
</FrameLayout>

View File

@@ -20,6 +20,8 @@
android:id="@+id/zen_mode_settings_senders_overlay_view"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/zen_conversations_image_margin_vertical"
android:layout_marginBottom="@dimen/zen_conversations_image_margin_vertical">
</RelativeLayout>
</RelativeLayout>

View File

@@ -19,37 +19,36 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="@dimen/zen_mode_button_padding_vertical">
android:orientation="vertical">
<TextView
android:text="@string/zen_mode_settings_summary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/screen_margin_sides"
android:paddingTop="@dimen/zen_mode_button_padding_vertical"
android:paddingBottom="@dimen/zen_mode_button_padding_vertical"/>
android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"/>
<Button
android:id="@+id/zen_mode_settings_turn_on_button"
style="@style/ActionPrimaryButton"
android:focusableInTouchMode="true"
android:layout_marginStart="@dimen/screen_margin_sides"
android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"
android:layout_marginBottom="@dimen/zen_mode_settings_button_margin_vertical"
android:text="@string/zen_mode_button_turn_on"
android:focusableInTouchMode="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:gravity="center"
android:text="@string/zen_mode_button_turn_on"/>
android:layout_height="wrap_content"/>
<Button
android:id="@+id/zen_mode_settings_turn_off_button"
style="@style/ActionSecondaryButton"
android:focusableInTouchMode="true"
android:layout_marginStart="@dimen/screen_margin_sides"
android:layout_marginTop="@dimen/zen_mode_settings_button_margin_vertical"
android:layout_marginBottom="@dimen/zen_mode_settings_button_margin_vertical"
android:text="@string/zen_mode_button_turn_off"
android:focusableInTouchMode="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:gravity="center"
android:text="@string/zen_mode_button_turn_off" />
android:layout_height="wrap_content"/>
</LinearLayout>

View File

@@ -88,10 +88,15 @@
<dimen name="notification_history_header_drawable_start">26dp</dimen>
<dimen name="conversation_icon_size">48dp</dimen>
<dimen name="zen_mode_button_padding_vertical">16dp</dimen>
<dimen name="zen_mode_icon_size">36dp</dimen>
<dimen name="zen_mode_icon_margin">16dp</dimen>
<dimen name="zen_mode_settings_button_margin_vertical">24dp</dimen>
<dimen name="zen_senders_image_margin_vertical">16dp</dimen>
<dimen name="zen_conversations_image_margin_vertical">24dp</dimen>
<dimen name="zen_conversations_icon_offset">32dp</dimen>
<dimen name="zen_conversations_icon_size">50dp</dimen>
<dimen name="zen_schedule_rule_checkbox_padding">7dp</dimen>
<dimen name="zen_schedule_day_margin">17dp</dimen>
<dimen name="zen_conversations_icon_size">56dp</dimen>
<dimen name="rect_button_radius">8dp</dimen>

View File

@@ -7522,8 +7522,8 @@
<string name="keywords_profile_challenge">work challenge, work, profile</string>
<string name="keywords_unification">work profile, managed profile, unify, unification, work, profile</string>
<string name="keywords_gesture">gestures</string>
<!-- Search keywords for Global Actions Panel. [DO NOT TRANSLATE] -->
<string name="keywords_global_actions_panel" translatable="false">global actions</string>
<string name="keywords_cards_passes">cards, passes</string>
<string name="keywords_device_controls">device controls, controls</string>
<string name="keywords_payment_settings">pay, tap, payments</string>
<string name="keywords_backup">backup, back up</string>
<string name="keywords_assist_gesture_launch">gesture</string>
@@ -7956,7 +7956,7 @@
<string name="zen_category_schedule">Schedules</string>
<!-- Do not disturb settings, main screen, field, duration setting where user can specify how
long dnd will last when toggling dnd on from qs or settings) [CHAR LIMIT=100] -->
<string name="zen_category_duration">Set duration for Quick Settings</string>
<string name="zen_category_duration">Duration for Quick Settings</string>
<!-- Do not disturb settings, sound and vibrations screen footer [CHAR LIMIT=NONE]-->
<string name="zen_sound_footer">When Do Not Disturb is on, sound and vibration will be muted, except for the items you allow above.</string>
@@ -8879,7 +8879,7 @@
<!-- [CHAR LIMIT=120] Zen mode settings: Header for conversations settings page -->
<string name="zen_mode_conversations_section_title">Conversations that can interrupt</string>
<string name="zen_mode_from_all_conversations">All conversations</string>
<string name="zen_mode_from_important_conversations">Important conversations</string>
<string name="zen_mode_from_important_conversations">Priority conversations</string>
<string name="zen_mode_from_no_conversations">None</string>
<plurals name="zen_mode_conversations_count">
<item quantity="one">1 conversation</item>
@@ -8900,7 +8900,7 @@
<!-- [CHAR LIMIT=120] Zen mode settings: Calls settings header -->
<string name="zen_mode_calls_header">Calls that can interrupt</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Calls screen footer -->
<string name="zen_mode_calls_footer">To be sure allowed calls make sound, check whether your device is set to ring, vibrate, or silent.</string>
<string name="zen_mode_calls_footer">To make sure allowed calls make sound, check that device is set to ring</string>
<!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Calls screen footer -->
<string name="zen_mode_custom_calls_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
@@ -8917,11 +8917,11 @@
<!-- [CHAR LIMIT=40] Zen mode settings: Messages option -->
<string name="zen_mode_messages_list">messages</string>
<!-- [CHAR LIMIT=40] Zen mode settings: Allow messages to bypass DND title -->
<string name="zen_mode_messages_title">SMS, MMS, and messaging apps</string>
<string name="zen_mode_messages_title">Messages</string>
<!-- [CHAR LIMIT=120] Zen mode settings: Messages settings header -->
<string name="zen_mode_messages_header">Messages that can interrupt</string>
<!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
<string name="zen_mode_messages_footer">To be sure allowed messages make sound, check whether your device is set to ring, vibrate, or silent.</string>
<string name="zen_mode_messages_footer">To make sure allowed messages make sound, check that device is set to ring</string>
<!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Messages screen footer -->
<string name="zen_mode_custom_messages_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
@@ -8961,14 +8961,14 @@
<!-- [CHAR LIMIT=80] Zen mode settings: Allow media (sound from video) to bypass dnd -->
<string name="zen_mode_media">Media sounds</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Allow media (sound from video) to bypass dnd summary-->
<string name="zen_mode_media_summary">From videos, games, and other media</string>
<string name="zen_mode_media_summary">Sounds from videos, games, and other media</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) -->
<string name="zen_mode_media_list">media</string>
<!-- [CHAR LIMIT=80] Zen mode settings: allow touch sounds to bypass DND -->
<string name="zen_mode_system">Touch sounds</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: allow touch sounds to bypass DND summary -->
<string name="zen_mode_system_summary">From your keyboard and other buttons</string>
<string name="zen_mode_system_summary">Sounds from the keyboard and other buttons</string>
<!-- [CHAR LIMIT=50] Zen mode settings: System sounds (ie: touch sounds) -->
<string name="zen_mode_system_list">touch sounds</string>
@@ -8980,7 +8980,7 @@
<string name="zen_mode_reminders_list">reminders</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow event notifications/sounds to bypass DND -->
<string name="zen_mode_events">Events</string>
<string name="zen_mode_events">Calendar events</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Allow event notifications/sounds to bypass DND summary -->
<string name="zen_mode_events_summary">From upcoming calendar events</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) -->
@@ -9062,7 +9062,7 @@
<!-- [CHAR LIMIT=50] Zen mode settings: calls summary -->
<string name="zen_mode_calls_summary_two"><xliff:g id="caller type" example="starred contacts">%1$s</xliff:g> and <xliff:g id="caller type" example="repeat callers">%2$s</xliff:g></string>
<!-- [CHAR LIMIT=200] Zen mode settings: Repeat callers option summary -->
<string name="zen_mode_repeat_callers_summary">If the same person calls a second time within a <xliff:g id="minutes">%d</xliff:g> minute period</string>
<string name="zen_mode_repeat_callers_summary">If the same person calls a second time within a <xliff:g id="minutes">%d</xliff:g>-minute period</string>
<!-- [CHAR LIMIT=50] Zen mode settings dnd beahvior description: when a user has chosen custom sounds to bypass DND -->
<string name="zen_mode_behavior_summary_custom">Custom</string>
@@ -10725,13 +10725,6 @@
<!-- Summary text for ambient display tap [CHAR LIMIT=NONE]-->
<string name="ambient_display_tap_screen_summary">To check time, notifications, and other info, tap your screen.</string>
<!-- Summary text for global actions panel [CHAR LIMIT=NONE] [DO NOT TRANSLATE]-->
<string name="global_actions_panel_summary" translatable="false">To show the global actions panel, press &amp; hold Power button</string>
<!-- Preference and settings suggestion title text for global actions panel [CHAR LIMIT=60] [DO NOT TRANSLATE]-->
<string name="global_actions_panel_title" translatable="false">Show global actions</string>
<!-- Short title text for global actions panel [CHAR LIMIT=40] [DO NOT TRANSLATE]-->
<string name="global_actions_panel_short_title" translatable="false">Global actions</string>
<!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]-->
<string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string>
<!-- Title text for fingerprint gesture preference screen [CHAR LIMIT=25] -->
@@ -11854,11 +11847,11 @@
<!-- Developer settings: text for the bug report handler selection toast shown if an invalid bug report handler was chosen. [CHAR LIMIT=NONE] -->
<string name="select_invalid_bug_report_handler_toast_text">This choice is no longer valid. Try again.</string>
<!-- Quick controls name sentence case [CHAR LIMIT=40] -->
<string name="quick_controls_sentence">Quick controls</string>
<!-- Device controls name sentence case [CHAR LIMIT=40] -->
<string name="device_controls_sentence">Device controls</string>
<!-- Quick controls name lower case [CHAR LIMIT=40] -->
<string name="quick_controls_lower">quick controls</string>
<!-- Device controls name lower case [CHAR LIMIT=40] -->
<string name="quick_controls_lower">device controls</string>
<!-- Cards and passes name sentence case [CHAR LIMIT=40] -->
<string name="cards_passes_sentence">Cards &amp; passes</string>
@@ -11875,11 +11868,11 @@
<!-- Power menu setting option cards and passes [CHAR LIMIT=NONE] -->
<string name="power_menu_cards_passes">Show cards &amp; passes</string>
<!-- Power menu setting option quick controls [CHAR LIMIT=NONE] -->
<string name="power_menu_quick_controls">Show quick controls</string>
<!-- Power menu setting option device controls [CHAR LIMIT=NONE] -->
<string name="power_menu_device_controls">Show device controls</string>
<!-- Power menu setting option cards, passes, quick controls [CHAR LIMIT=NONE] -->
<string name="power_menu_cards_passes_quick_controls">Show cards, passes, and quick controls</string>
<!-- Power menu setting option cards, passes, device controls [CHAR LIMIT=NONE] -->
<string name="power_menu_cards_passes_device_controls">Show cards, passes, and device controls</string>
<!-- Power menu setting option none [CHAR LIMIT=NONE] -->
<string name="power_menu_none">Don\u2019t show any content</string>
@@ -11893,11 +11886,17 @@
<!-- Power menu setting privacy hide all [CHAR LIMIT=NONE] -->
<string name="power_menu_privacy_hide">Hide cards and controls when locked</string>
<!-- Quick controls toggle name [CHAR LIMIT=NONE] -->
<string name="quick_controls_setting_toggle">Show quick controls</string>
<!-- Device controls toggle name [CHAR LIMIT=60] -->
<string name="device_controls_setting_toggle">Show device controls</string>
<!-- Quick controls toggle subtitle [CHAR LIMIT=NONE] -->
<string name="quick_controls_setting_subtitle">To access controls for connected devices, hold the Power button</string>
<!-- Cards and passes toggle name [CHAR LIMIT=60] -->
<string name="cards_passes_setting_toggle">Show cards &amp; passes</string>
<!-- Device controls toggle subtitle [CHAR LIMIT=NONE] -->
<string name="device_controls_setting_subtitle">To access controls for connected devices, hold the Power button</string>
<!-- Cards and passes toggle subtitle [CHAR LIMIT=NONE] -->
<string name="cards_passes_setting_subtitle">To access things like your payment methods and boarding passes, press and hold the Power button.</string>
<!-- Title for RTT setting. [CHAR LIMIT=NONE] -->
<string name="rtt_settings_title"></string>

View File

@@ -275,6 +275,11 @@
android:title="@string/wifi_scan_throttling"
android:summary="@string/wifi_scan_throttling_summary" />
<SwitchPreference
android:key="wifi_enhanced_mac_randomization"
android:title="@string/wifi_enhanced_mac_randomization"
android:summary="@string/wifi_enhanced_mac_randomization_summary" />
<SwitchPreference
android:key="mobile_data_always_on"
android:title="@string/mobile_data_always_on"

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/device_controls_sentence">
<com.android.settings.widget.VideoPreference
android:key="device_controls_video"/>
<SwitchPreference
android:key="gesture_device_controls_switch"
android:title="@string/device_controls_setting_toggle"
android:summary="@string/device_controls_setting_subtitle"
app:keywords="@string/keywords_device_controls"
app:controller="com.android.settings.gestures.DeviceControlsPreferenceController"
app:allowDividerAbove="true" />
</PreferenceScreen>

View File

@@ -82,9 +82,8 @@
settings:controller="com.android.settings.gestures.PreventRingingParentPreferenceController" />
<Preference
android:key="gesture_global_actions_panel_summary"
android:title="@string/global_actions_panel_short_title"
android:fragment="com.android.settings.gestures.GlobalActionsPanelSettings"
settings:controller="com.android.settings.gestures.GlobalActionsPanelPreferenceController" />
android:key="gesture_power_menu_summary"
android:title="@string/power_menu_setting_name"
android:fragment="com.android.settings.gestures.PowerMenuSettings"
settings:controller="com.android.settings.gestures.PowerMenuPreferenceController" />
</PreferenceScreen>

View File

@@ -18,7 +18,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/global_actions_panel_title">
android:title="@string/cards_passes_sentence">
<com.android.settings.widget.VideoPreference
android:key="global_actions_panel_video"
@@ -26,9 +26,9 @@
<SwitchPreference
android:key="gesture_global_actions_panel_switch"
android:title="@string/global_actions_panel_title"
android:summary="@string/global_actions_panel_summary"
app:keywords="@string/keywords_global_actions_panel"
android:title="@string/cards_passes_setting_toggle"
android:summary="@string/cards_passes_setting_subtitle"
app:keywords="@string/keywords_cards_passes"
app:controller="com.android.settings.gestures.GlobalActionsPanelPreferenceController"
app:allowDividerAbove="true" />

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/power_menu_setting_name">
<Preference
android:key="gesture_global_actions_panel_summary"
android:title="@string/cards_passes_sentence"
android:fragment="com.android.settings.gestures.GlobalActionsPanelSettings"
settings:controller="com.android.settings.gestures.GlobalActionsPanelPreferenceController" />
<Preference
android:key="gesture_device_controls_summary"
android:title="@string/device_controls_sentence"
android:fragment="com.android.settings.gestures.DeviceControlsSettings"
settings:controller="com.android.settings.gestures.DeviceControlsPreferenceController" />
</PreferenceScreen>

View File

@@ -56,7 +56,6 @@
android:key="zen_mode_automation_settings"
android:title="@string/zen_category_schedule"
settings:allowDividerAbove="true"
settings:allowDividerBelow="true"
android:fragment="com.android.settings.notification.zen.ZenModeAutomationSettings"/>
<PreferenceCategory

View File

@@ -26,8 +26,7 @@
<!-- Alarms -->
<SwitchPreference
android:key="zen_mode_alarms"
android:title="@string/zen_mode_alarms"
android:summary="@string/zen_mode_alarms_summary"/>
android:title="@string/zen_mode_alarms"/>
<!-- Media -->
<SwitchPreference
@@ -44,17 +43,13 @@
<!-- Reminders -->
<SwitchPreference
android:key="zen_mode_reminders"
android:title="@string/zen_mode_reminders"
android:summary="@string/zen_mode_reminders_summary"/>
android:title="@string/zen_mode_reminders"/>
<!-- Events -->
<SwitchPreference
android:key="zen_mode_events"
android:title="@string/zen_mode_events"
android:summary="@string/zen_mode_events_summary"/>
android:title="@string/zen_mode_events"/>
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference/>
</PreferenceScreen>

View File

@@ -218,6 +218,8 @@ public class Settings extends SettingsActivity {
public static class WifiCallingDisclaimerActivity extends SettingsActivity { /* empty */ }
public static class MobileNetworkListActivity extends SettingsActivity {}
public static class GlobalActionsPanelSettingsActivity extends SettingsActivity {}
public static class PowerMenuSettingsActivity extends SettingsActivity {}
public static class QuickControlsSettingsActivity extends SettingsActivity {}
/**
* Activity for BugReportHandlerPicker.
*/

View File

@@ -17,11 +17,13 @@ package com.android.settings.applications.specialaccess.interactacrossprofiles;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.provider.Settings.ACTION_MANAGE_CROSS_PROFILE_ACCESS;
import android.Manifest;
import android.annotation.UserIdInt;
import android.app.ActionBar;
import android.app.AppOpsManager;
import android.app.admin.DevicePolicyEventLogger;
import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
@@ -37,6 +39,7 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.stats.devicepolicy.DevicePolicyEnums;
import android.util.IconDrawableFactory;
import android.view.View;
import android.widget.ImageView;
@@ -60,6 +63,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
"interact_across_profiles_settings_switch";
private static final String INTERACT_ACROSS_PROFILES_HEADER = "interact_across_profiles_header";
public static final String INSTALL_APP_BANNER_KEY = "install_app_banner";
public static final String EXTRA_SHOW_FRAGMENT_ARGS = ":settings:show_fragment_args";
public static final String INTENT_KEY = "intent";
private Context mContext;
private CrossProfileApps mCrossProfileApps;
@@ -108,6 +113,52 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
}
addAppTitleAndIcons(mPersonalProfile, mWorkProfile);
styleActionBar();
logPageLaunchMetrics();
}
private void logPageLaunchMetrics() {
if (!mCrossProfileApps.canConfigureInteractAcrossProfiles(mPackageName)) {
logNonConfigurableAppMetrics();
}
Bundle bundle = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGS);
if (bundle == null) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_SETTINGS);
return;
}
Intent intent = (Intent) bundle.get(INTENT_KEY);
if (intent == null) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_SETTINGS);
return;
}
if (ACTION_MANAGE_CROSS_PROFILE_ACCESS.equals(intent.getAction())) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_APP);
}
}
private void logNonConfigurableAppMetrics() {
if (!isCrossProfilePackageWhitelisted(mPackageName)) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_ADMIN_RESTRICTED);
return;
}
if (mInstallBanner == null) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_MISSING_INSTALL_BANNER_INTENT);
}
if (!mInstalledInPersonal) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_MISSING_PERSONAL_APP);
return;
}
if (!mInstalledInWork) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_MISSING_WORK_APP);
}
}
private void logEvent(int eventId) {
DevicePolicyEventLogger.createEvent(eventId)
.setStrings(mPackageName)
.setInt(UserHandle.myUserId())
.setAdmin(RestrictedLockUtils.getProfileOrDeviceOwner(
mContext, mWorkProfile).component)
.write();
}
private void addAppTitleAndIcons(UserHandle personalProfile, UserHandle workProfile) {
@@ -187,6 +238,7 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
private void handleSwitchPreferenceClick() {
if (isInteractAcrossProfilesEnabled()) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_PERMISSION_REVOKED);
enableInteractAcrossProfiles(false);
refreshUi();
} else {
@@ -220,12 +272,15 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
builder.setView(dialogView)
.setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_USER_CONSENTED);
enableInteractAcrossProfiles(true);
refreshUi();
}
})
.setNegativeButton(R.string.deny, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
logEvent(
DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_USER_DECLINED_CONSENT);
refreshUi();
}
})
@@ -277,13 +332,17 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
private void handleInstallBannerClick() {
if (mInstallAppIntent == null) {
logEvent(
DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_INSTALL_BANNER_NO_INTENT_CLICKED);
return;
}
if (!mInstalledInWork) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_INSTALL_BANNER_CLICKED);
mContext.startActivityAsUser(mInstallAppIntent, mWorkProfile);
return;
}
if (!mInstalledInPersonal) {
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_INSTALL_BANNER_CLICKED);
mContext.startActivityAsUser(mInstallAppIntent, mPersonalProfile);
}
}
@@ -333,8 +392,10 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
mInstallBanner.setTitle(getString(
R.string.interact_across_profiles_install_personal_app_title,
mAppLabel));
mInstallBanner.setSummary(
R.string.interact_across_profiles_install_app_summary);
if (mInstallAppIntent != null) {
mInstallBanner.setSummary(
R.string.interact_across_profiles_install_app_summary);
}
mInstallBanner.setVisible(true);
return true;
}
@@ -342,8 +403,10 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
mInstallBanner.setTitle(getString(
R.string.interact_across_profiles_install_work_app_title,
mAppLabel));
mInstallBanner.setSummary(
R.string.interact_across_profiles_install_app_summary);
if (mInstallAppIntent != null) {
mInstallBanner.setSummary(
R.string.interact_across_profiles_install_app_summary);
}
mInstallBanner.setVisible(true);
return true;
}

View File

@@ -88,12 +88,14 @@ import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleSettings;
import com.android.settings.fuelgauge.batterysaver.BatterySaverSettings;
import com.android.settings.gestures.AssistGestureSettings;
import com.android.settings.gestures.DeviceControlsSettings;
import com.android.settings.gestures.DoubleTapPowerSettings;
import com.android.settings.gestures.DoubleTapScreenSettings;
import com.android.settings.gestures.DoubleTwistGestureSettings;
import com.android.settings.gestures.GestureNavigationSettingsFragment;
import com.android.settings.gestures.GlobalActionsPanelSettings;
import com.android.settings.gestures.PickupGestureSettings;
import com.android.settings.gestures.PowerMenuSettings;
import com.android.settings.gestures.SwipeToNotificationSettings;
import com.android.settings.gestures.SystemNavigationGestureSettings;
import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
@@ -294,7 +296,9 @@ public class SettingsGateway {
PreviouslyConnectedDeviceDashboardFragment.class.getName(),
BatterySaverScheduleSettings.class.getName(),
MobileNetworkListFragment.class.getName(),
PowerMenuSettings.class.getName(),
GlobalActionsPanelSettings.class.getName(),
DeviceControlsSettings.class.getName(),
DarkModeSettingsFragment.class.getName(),
BugReportHandlerPicker.class.getName(),
GestureNavigationSettingsFragment.class.getName(),

View File

@@ -42,6 +42,8 @@ import android.telephony.SubscriptionManager;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.view.View.AccessibilityDelegate;
import android.view.accessibility.AccessibilityEvent;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ImageView;
@@ -180,6 +182,16 @@ public class DataUsageList extends DataUsageBaseFragment
mCycleSpinner.setSelection(position);
}
}, mCycleListener);
mCycleSpinner.setAccessibilityDelegate(new AccessibilityDelegate() {
@Override
public void sendAccessibilityEvent(View host, int eventType) {
if (eventType == AccessibilityEvent.TYPE_VIEW_SELECTED) {
// Ignore TYPE_VIEW_SELECTED or TalkBack will speak for it at onResume.
return;
}
super.sendAccessibilityEvent(host, eventType);
}
});
mLoadingViewController = new LoadingViewController(
getView().findViewById(R.id.loading_container), getListView());

View File

@@ -463,6 +463,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
controllers.add(new WifiDisplayCertificationPreferenceController(context));
controllers.add(new WifiVerboseLoggingPreferenceController(context));
controllers.add(new WifiScanThrottlingPreferenceController(context));
controllers.add(new WifiEnhancedMacRandomizationPreferenceController(context));
controllers.add(new MobileDataAlwaysOnPreferenceController(context));
controllers.add(new TetheringHardwareAccelPreferenceController(context));
controllers.add(new BluetoothDeviceNoNamePreferenceController(context));

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.development;
import android.content.Context;
import android.provider.Settings;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
/**
* Developer option controller for enhanced MAC randomization.
*/
public class WifiEnhancedMacRandomizationPreferenceController
extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String WIFI_ENHANCED_MAC_RANDOMIZATION_KEY =
"wifi_enhanced_mac_randomization";
private static final String ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG =
"enhanced_mac_randomization_force_enabled";
public WifiEnhancedMacRandomizationPreferenceController(Context context) {
super(context);
}
@Override
public String getPreferenceKey() {
return WIFI_ENHANCED_MAC_RANDOMIZATION_KEY;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int isEnabledInt = ((Boolean) newValue) ? 1 : 0;
Settings.Global.putInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, isEnabledInt);
return true;
}
@Override
public void updateState(Preference preference) {
boolean enabled = false;
if (Settings.Global.getInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
enabled = true;
}
((SwitchPreference) mPreference).setChecked(enabled);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
Settings.Global.putInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
((SwitchPreference) mPreference).setChecked(false);
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
public class DeviceControlsPreferenceController extends GesturePreferenceController {
private static final String PREF_KEY_VIDEO = "device_controls_video";
@VisibleForTesting
protected static final String ENABLED_SETTING = Settings.Secure.CONTROLS_ENABLED;
@VisibleForTesting
protected static final String TOGGLE_KEY = "gesture_device_controls_switch";
public DeviceControlsPreferenceController(Context context, String key) {
super(context, key);
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}
@Override
public boolean setChecked(boolean isChecked) {
return Settings.Secure.putInt(mContext.getContentResolver(), ENABLED_SETTING,
isChecked ? 1 : 0);
}
@Override
protected String getVideoPrefKey() {
return PREF_KEY_VIDEO;
}
@Override
public boolean isSliceable() {
return TextUtils.equals(getPreferenceKey(), TOGGLE_KEY);
}
@Override
public boolean isPublicSlice() {
return true;
}
@Override
public boolean isChecked() {
int enabled = Settings.Secure.getInt(mContext.getContentResolver(), ENABLED_SETTING, 1);
return enabled == 1;
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import android.app.settings.SettingsEnums;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
@SearchIndexable
public class DeviceControlsSettings extends DashboardFragment {
private static final String TAG = "QuickControlsSettings";
@Override
public int getMetricsCategory() {
return SettingsEnums.DEVICE_CONTROLS_SETTINGS;
}
@Override
protected String getLogTag() {
return TAG;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.device_controls_settings;
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.device_controls_settings);
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import android.content.Context;
import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
public class PowerMenuPreferenceController extends BasePreferenceController {
private static final String KEY = "gesture_power_menu_summary";
private static final String CONTROLS_ENABLED_SETTING = Settings.Secure.CONTROLS_ENABLED;
private static final String CARDS_ENABLED_SETTING =
Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED;
private static final String CARDS_AVAILABLE_SETTING =
Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE;
public PowerMenuPreferenceController(Context context, String key) {
super(context, key);
}
@Override
public CharSequence getSummary() {
boolean controlsEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
CONTROLS_ENABLED_SETTING, 1) == 1;
boolean cardsEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
CARDS_ENABLED_SETTING, 0) == 1;
boolean cardsVisible = cardsEnabled && Settings.Secure.getInt(mContext.getContentResolver(),
CARDS_AVAILABLE_SETTING, 0) == 1;
if (controlsEnabled && cardsVisible) {
return mContext.getText(R.string.power_menu_cards_passes_device_controls);
} else if (controlsEnabled) {
return mContext.getText(R.string.power_menu_device_controls);
} else if (cardsVisible) {
return mContext.getText(R.string.power_menu_cards_passes);
} else {
return mContext.getText(R.string.power_menu_none);
}
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import android.app.settings.SettingsEnums;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
public class PowerMenuSettings extends DashboardFragment {
private static final String TAG = "PowerMenuSettings";
@Override
protected int getPreferenceScreenResId() {
return R.xml.power_menu_settings;
}
@Override
protected String getLogTag() {
return TAG;
}
@Override
public int getMetricsCategory() {
return SettingsEnums.POWER_MENU_SETTINGS;
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.power_menu_settings);
}

View File

@@ -398,8 +398,13 @@ public class EnabledNetworkModePreferenceController extends
if (!mIsGlobalCdma) {
setSelectedEntry(
TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
setSummary(
mShow4gForLTE ? R.string.network_4G : R.string.network_lte);
if (is5gEntryDisplayed()) {
setSummary(mShow4gForLTE
? R.string.network_4G_pure : R.string.network_lte_pure);
} else {
setSummary(mShow4gForLTE
? R.string.network_4G : R.string.network_lte);
}
} else {
setSelectedEntry(
TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
@@ -542,6 +547,7 @@ public class EnabledNetworkModePreferenceController extends
mEntriesValue.add(value);
mIs5gEntryDisplayed = true;
} else {
mIs5gEntryDisplayed = false;
Log.d(LOG_TAG, "Hide 5G option. "
+ " supported5GRadioAccessFamily: " + mSupported5gRadioAccessFamily
+ " allowed5GNetworkType: " + mAllowed5gNetworkType

View File

@@ -322,7 +322,7 @@ public class ZenModeBackend {
return R.string.zen_mode_from_starred;
case ZenPolicy.PEOPLE_TYPE_NONE:
default:
return R.string.zen_mode_from_none_calls;
return R.string.zen_mode_from_none;
}
}
@@ -492,8 +492,12 @@ public class ZenModeBackend {
}
String getContactsNumberSummary(Context context) {
final int numContacts = queryAllContactsData().getCount();
if (numContacts == 0) {
return context.getResources().getString(R.string.zen_mode_from_none);
}
return context.getResources().getString(R.string.zen_mode_contacts_senders_summary,
queryAllContactsData().getCount());
numContacts);
}
private Cursor queryStarredContactsData() {

View File

@@ -81,10 +81,10 @@ public class ZenModeButtonPreferenceController extends AbstractZenModePreference
});
}
updateButtons(preference);
updatePreference(preference);
}
private void updateButtons(Preference preference) {
private void updatePreference(Preference preference) {
switch (getZenMode()) {
case Settings.Global.ZEN_MODE_ALARMS:
case Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:

View File

@@ -25,6 +25,7 @@ import android.content.pm.ParceledListSlice;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.service.notification.ConversationChannelWrapper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -60,7 +61,8 @@ public class ZenModeConversationsImagePreferenceController
mNotificationBackend = notificationBackend;
mIconSizePx =
mContext.getResources().getDimensionPixelSize(R.dimen.zen_conversations_icon_size);
mIconOffsetPx = mIconSizePx * 3 / 4;
mIconOffsetPx = mContext.getResources()
.getDimensionPixelSize(R.dimen.zen_conversations_icon_offset);
}
@Override
@@ -97,6 +99,8 @@ public class ZenModeConversationsImagePreferenceController
R.string.zen_mode_from_important_conversations));
} else {
mViewGroup.setContentDescription(null);
mViewGroup.setVisibility(View.GONE);
return;
}
final int numDrawablesToShow = Math.min(MAX_CONVERSATIONS_SHOWN,
@@ -111,6 +115,8 @@ public class ZenModeConversationsImagePreferenceController
fl.setPadding((numDrawablesToShow - i - 1) * mIconOffsetPx, 0, 0, 0);
mViewGroup.addView(fl);
}
mViewGroup.setVisibility(numDrawablesToShow > 0 ? View.VISIBLE : View.GONE);
}
private void loadConversations() {

View File

@@ -171,6 +171,10 @@ public class ZenModePrioritySendersPreferenceController
private RadioButtonPreferenceWithExtraWidget makeRadioPreference(String key, int titleId) {
RadioButtonPreferenceWithExtraWidget pref =
new RadioButtonPreferenceWithExtraWidget(mPreferenceCategory.getContext());
pref.setKey(key);
pref.setTitle(titleId);
pref.setOnClickListener(mRadioButtonClickListener);
View.OnClickListener widgetClickListener = getWidgetClickListener(key);
if (widgetClickListener != null) {
pref.setExtraWidgetOnClickListener(widgetClickListener);
@@ -179,9 +183,6 @@ public class ZenModePrioritySendersPreferenceController
pref.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE);
}
pref.setKey(key);
pref.setTitle(titleId);
pref.setOnClickListener(mRadioButtonClickListener);
mPreferenceCategory.addPreference(pref);
mRadioButtonPreferences.add(pref);
return pref;

View File

@@ -156,7 +156,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
|| PRIORITY_CATEGORY_REPEAT_CALLERS == category, true);
int numCategories = enabledCategories.size();
if (numCategories == 0) {
return mContext.getString(R.string.zen_mode_from_none_calls);
return mContext.getString(R.string.zen_mode_from_none);
} else if (numCategories == 1) {
return mContext.getString(R.string.zen_mode_calls_summary_one,
enabledCategories.get(0));
@@ -172,7 +172,7 @@ public class ZenModeSettings extends ZenModeSettingsBase {
category -> PRIORITY_CATEGORY_MESSAGES == category, false);
int numCategories = enabledCategories.size();
if (numCategories == 0) {
return mContext.getString(R.string.zen_mode_from_none_messages);
return mContext.getString(R.string.zen_mode_from_none);
} else {
return enabledCategories.get(0);
}

View File

@@ -49,8 +49,6 @@ public class ZenModeSoundVibrationSettings extends ZenModeSettingsBase implement
controllers.add(new ZenModeSystemPreferenceController(context, lifecycle));
controllers.add(new ZenModeRemindersPreferenceController(context, lifecycle));
controllers.add(new ZenModeEventsPreferenceController(context, lifecycle));
controllers.add(new ZenModeBehaviorFooterPreferenceController(context, lifecycle,
R.string.zen_sound_footer));
return controllers;
}

View File

@@ -173,6 +173,7 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
mProxySettings.setOnItemSelectedListener(this);
mProxyHost.addTextChangedListener(this);
mProxyPort.addTextChangedListener(this);
mIpsecIdentifier.addTextChangedListener(this);
mIpsecSecret.addTextChangedListener(this);
mIpsecUserCert.setOnItemSelectedListener(this);
mShowOptions.setOnClickListener(this);

View File

@@ -48,6 +48,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.View.AccessibilityDelegate;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.view.inputmethod.EditorInfo;
@@ -1020,6 +1021,8 @@ public class WifiConfigController implements TextWatcher,
mEapUserCertSpinner.setOnItemSelectedListener(this);
mEapIdentityView = (TextView) mView.findViewById(R.id.identity);
mEapAnonymousView = (TextView) mView.findViewById(R.id.anonymous);
setAccessibilityDelegateForSecuritySpinners();
}
if (refreshEapMethods) {
@@ -1148,6 +1151,26 @@ public class WifiConfigController implements TextWatcher,
}
}
private void setAccessibilityDelegateForSecuritySpinners() {
final AccessibilityDelegate selectedEventBlocker = new AccessibilityDelegate() {
@Override
public void sendAccessibilityEvent(View host, int eventType) {
if (eventType == AccessibilityEvent.TYPE_VIEW_SELECTED) {
// Ignore TYPE_VIEW_SELECTED or there will be multiple Spinner selected
// information for WifiController#showSecurityFields.
return;
}
super.sendAccessibilityEvent(host, eventType);
}
};
mEapMethodSpinner.setAccessibilityDelegate(selectedEventBlocker);
mPhase2Spinner.setAccessibilityDelegate(selectedEventBlocker);
mEapCaCertSpinner.setAccessibilityDelegate(selectedEventBlocker);
mEapOcspSpinner.setAccessibilityDelegate(selectedEventBlocker);
mEapUserCertSpinner.setAccessibilityDelegate(selectedEventBlocker);
}
/**
* EAP-PWD valid fields include
* identity

View File

@@ -46,6 +46,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.View.AccessibilityDelegate;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.view.inputmethod.EditorInfo;
@@ -1014,6 +1015,8 @@ public class WifiConfigController2 implements TextWatcher,
mEapUserCertSpinner.setOnItemSelectedListener(this);
mEapIdentityView = (TextView) mView.findViewById(R.id.identity);
mEapAnonymousView = (TextView) mView.findViewById(R.id.anonymous);
setAccessibilityDelegateForSecuritySpinners();
}
if (refreshEapMethods) {
@@ -1144,6 +1147,26 @@ public class WifiConfigController2 implements TextWatcher,
}
}
private void setAccessibilityDelegateForSecuritySpinners() {
final AccessibilityDelegate selectedEventBlocker = new AccessibilityDelegate() {
@Override
public void sendAccessibilityEvent(View host, int eventType) {
if (eventType == AccessibilityEvent.TYPE_VIEW_SELECTED) {
// Ignore TYPE_VIEW_SELECTED or there will be multiple Spinner selected
// information for WifiController2#showSecurityFields.
return;
}
super.sendAccessibilityEvent(host, eventType);
}
};
mEapMethodSpinner.setAccessibilityDelegate(selectedEventBlocker);
mPhase2Spinner.setAccessibilityDelegate(selectedEventBlocker);
mEapCaCertSpinner.setAccessibilityDelegate(selectedEventBlocker);
mEapOcspSpinner.setAccessibilityDelegate(selectedEventBlocker);
mEapUserCertSpinner.setAccessibilityDelegate(selectedEventBlocker);
}
/**
* EAP-PWD valid fields include
* identity

View File

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.development;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.provider.Settings;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class WifiEnhancedMacRandomizationPreferenceControllerTest {
private static final String ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG =
"enhanced_mac_randomization_force_enabled";
@Mock
private SwitchPreference mPreference;
@Mock
private PreferenceScreen mPreferenceScreen;
private Context mContext;
private WifiEnhancedMacRandomizationPreferenceController mController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mController = new WifiEnhancedMacRandomizationPreferenceController(mContext);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
.thenReturn(mPreference);
mController.displayPreference(mPreferenceScreen);
}
@Test
public void onPreferenceChanged_enabled_shouldTurnOnEnhancedRandomization() {
mController.onPreferenceChange(mPreference, true /* new value */);
int mode = Settings.Global.getInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
assertThat(mode).isEqualTo(1);
}
@Test
public void onPreferenceChanged_disabled_shouldTurnOffEnhancedRandomization() {
mController.onPreferenceChange(mPreference, false /* new value */);
int mode = Settings.Global.getInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
assertThat(mode).isEqualTo(0);
}
@Test
public void updateState_preferenceShouldBeChecked() {
Settings.Global.putInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 1);
mController.updateState(mPreference);
assertThat(mPreference.isChecked()).isTrue();
}
@Test
public void updateState_preferenceShouldNotBeChecked() {
Settings.Global.putInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
mController.updateState(mPreference);
assertThat(mPreference.isChecked()).isFalse();
}
@Test
public void onDeveloperOptionsDisabled_shouldDisablePreference() {
mController.onDeveloperOptionsSwitchDisabled();
int mode = Settings.Global.getInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, -1);
assertThat(mode).isEqualTo(0);
assertThat(mPreference.isChecked()).isFalse();
assertThat(mPreference.isEnabled()).isFalse();
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.provider.Settings;
import com.android.settings.core.BasePreferenceController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class DeviceControlsPreferenceControllerTest {
private Context mContext;
private DeviceControlsPreferenceController mController;
private static final String KEY_GESTURE_PANEL = "gesture_device_controls";
private static final String ENABLED_SETTING =
DeviceControlsPreferenceController.ENABLED_SETTING;
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mController = new DeviceControlsPreferenceController(mContext, KEY_GESTURE_PANEL);
}
@Test
public void testIsChecked_panelEnabled() {
Settings.Secure.putInt(
mContext.getContentResolver(), ENABLED_SETTING, 1);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void testIsChecked_panelDisabled() {
Settings.Secure.putInt(
mContext.getContentResolver(), ENABLED_SETTING, 0);
assertThat(mController.isChecked()).isFalse();
}
@Test
public void getAvailabilityStatus_panelAvailable() {
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE);
}
@Test
public void isSliceable_correctKey() {
final DeviceControlsPreferenceController controller =
new DeviceControlsPreferenceController(mContext,
DeviceControlsPreferenceController.TOGGLE_KEY);
assertThat(controller.isSliceable()).isTrue();
}
@Test
public void isSliceable_incorrectKey() {
final DeviceControlsPreferenceController controller =
new DeviceControlsPreferenceController(mContext, "bad_key");
assertThat(controller.isSliceable()).isFalse();
}
@Test
public void isPublicSlice_returnTrue() {
assertThat(mController.isPublicSlice()).isTrue();
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import android.provider.SearchIndexableResource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class DeviceControlsSettingsTest {
private DeviceControlsSettings mSettings;
@Before
public void setUp() {
mSettings = new DeviceControlsSettings();
}
@Test
public void testSearchIndexProvider_shouldIndexResource() {
final List<SearchIndexableResource> indexRes =
DeviceControlsSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
RuntimeEnvironment.application, true /* enabled */);
assertThat(indexRes).isNotNull();
assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
}
}

View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class PowerMenuPreferenceControllerTest {
private Context mContext;
private PowerMenuPreferenceController mController;
private static final String KEY_GESTURE_POWER_MENU = "gesture_power_menu";
private static final String CONTROLS_ENABLED = Settings.Secure.CONTROLS_ENABLED;
private static final String CARDS_ENABLED = Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED;
private static final String CARDS_AVAILABLE = Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mController = new PowerMenuPreferenceController(mContext, KEY_GESTURE_POWER_MENU);
}
@Test
public void getAvailabilityStatus_available() {
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.AVAILABLE);
}
@Test
public void getSummary_allDisabled() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_none));
}
@Test
public void getSummary_onlyControlsEnabled() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_device_controls));
}
@Test
public void getSummary_onlyCardsEnabled_notAvailable() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_none));
}
@Test
public void getSummary_cardsAvailable_notEnabled() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_none));
}
@Test
public void getSummary_allEnabled_cardsNotAvailable() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 0);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_device_controls));
}
@Test
public void getSummary_controlsEnabled_cardsDisabledAvailable() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_device_controls));
}
@Test
public void getSummary_controlsDisabled() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 0);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_cards_passes));
}
@Test
public void getSummary_allEnabled() {
Settings.Secure.putInt(mContext.getContentResolver(), CONTROLS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_ENABLED, 1);
Settings.Secure.putInt(mContext.getContentResolver(), CARDS_AVAILABLE, 1);
assertThat(mController.getSummary())
.isEqualTo(mContext.getText(R.string.power_menu_cards_passes_device_controls));
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import android.provider.SearchIndexableResource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class PowerMenuSettingsTest {
private PowerMenuSettings mSettings;
@Before
public void setUp() {
mSettings = new PowerMenuSettings();
}
@Test
public void testSearchIndexProvider_shouldIndexResource() {
final List<SearchIndexableResource> indexRes =
PowerMenuSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
RuntimeEnvironment.application, true /* enabled */);
assertThat(indexRes).isNotNull();
assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
}
}