Merge "Add a help URI for each ManageApplications subclass"
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 521d709..b8bd424 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1378,6 +1378,26 @@
<item>@string/wifi_calling_mode_cellular_preferred_summary</item>
</string-array>
+ <!-- Carrier variant of Enhaced 4G LTE Mode title. [CHAR LIMIT=NONE] -->
+ <string-array name="enhanced_4g_lte_mode_title_variant">
+ <!-- 0: Default -->
+ <item>@string/enhanced_4g_lte_mode_title</item>
+ <!-- 1: Verizon -->
+ <item>@string/enhanced_4g_lte_mode_title_advanced_calling</item>
+ <!-- 2: All carriers who want 4G -->
+ <item>@string/enhanced_4g_lte_mode_title_4g_calling</item>
+ </string-array>
+
+ <!-- Carrier variant of Enhaced 4G LTE Mode summary. [CHAR LIMIT=NONE] -->
+ <string-array name="enhanced_4g_lte_mode_sumary_variant">
+ <!-- 0: Default -->
+ <item>@string/enhanced_4g_lte_mode_summary</item>
+ <!-- 1: Verizon -->
+ <item>@string/enhanced_4g_lte_mode_summary</item>
+ <!-- 2: All carriers who want 4G -->
+ <item>@string/enhanced_4g_lte_mode_summary_4g_calling</item>
+ </string-array>
+
<!-- Bluetooth icon foreground colors -->
<integer-array name="bt_icon_fg_colors">
<item>@color/bt_color_icon_1</item>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index c333edb..ff040ee 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -100,7 +100,7 @@
<color name="homepage_privacy_background">#5E97F6</color>
<color name="homepage_card_stroke_color">#1f000000</color>
- <color name="homepage_card_dismissal_background">@*android:color/material_grey_50</color>
+ <color name="homepage_card_dismissal_background">@*android:color/material_grey_100</color>
<color name="contextual_card_background">@*android:color/background_device_default_light</color>
<!-- End of dashboard/homepage icon background colors -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1c8df93..25a85e8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2620,8 +2620,6 @@
<string name="sound_effects_enable_title">Tap sounds</string>
<!-- Sound settings screen, setting check box label -->
<string name="lock_sounds_enable_title">Screen lock sound</string>
- <!-- Sound settings screen, setting check box label -->
- <string name="haptic_feedback_enable_title">Vibrate on tap</string>
<!-- Sound settings screen, setting option name checkbox to enable/disable audio recording features that improve audio recording in noisy environments -->
<string name="audio_record_proc_title">Noise cancellation</string>
<!-- Volume description for media volume -->
@@ -5662,12 +5660,6 @@
<string name="battery_saver_schedule_settings_title">Set a schedule</string>
<!-- Battery Saver: Title for sticky battery saver preference [CHAR_LIMIT=60] -->
- <string name="battery_saver_sticky_title">Keep battery saver on</string>
-
- <!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
- <string name="battery_saver_sticky_description">Battery saver will stay on even after device is fully charged</string>
-
- <!-- Battery Saver: Title for sticky battery saver preference [CHAR_LIMIT=60] -->
<string name="battery_saver_sticky_title_new">Turn off when fully charged</string>
<!-- Battery Saver: Description for sticky battery saver preference [CHAR_LIMIT=NONE] -->
@@ -6939,9 +6931,15 @@
<!-- Access point names title. [CHAR LIMIT=50] -->
<string name="access_point_names">Access point names</string>
<!-- Enhaced 4G LTE Mode title. [CHAR LIMIT=50] -->
- <string name="enhanced_4g_lte_mode_title">Enhanced 4G LTE Mode</string>
+ <string name="enhanced_4g_lte_mode_title">VoLTE</string>
+ <!-- Enhaced 4G LTE Mode title for carriers who want to show Advanced Calling. [CHAR LIMIT=50] -->
+ <string name="enhanced_4g_lte_mode_title_advanced_calling">Advanced Calling</string>
+ <!-- Enhaced 4G LTE Mode title for carriers who want to show 4G Calling. [CHAR LIMIT=50] -->
+ <string name="enhanced_4g_lte_mode_title_4g_calling">4G Calling</string>
<!-- Enhaced 4G LTE Mode summary. [CHAR LIMIT=100] -->
- <string name="enhanced_4g_lte_mode_summary">Use LTE data to enhance voice and communications (Recommended)</string>
+ <string name="enhanced_4g_lte_mode_summary">Use LTE services to improve voice and other communications (recommended)</string>
+ <!-- Enhaced 4G LTE Mode summary for 4g calling. [CHAR LIMIT=100] -->
+ <string name="enhanced_4g_lte_mode_summary_4g_calling">Use 4G services to improve voice and other communications (recommended)</string>
<!-- Preferred network type title. [CHAR LIMIT=50] -->
<string name="preferred_network_type_title">Preferred network type</string>
<!-- Preferred network type summary. [CHAR LIMIT=100] -->
@@ -7136,6 +7134,24 @@
<!--Search Keywords [CHAR LIMIT=NONE]-->
<string name="keywords_wifi">wifi, wi-fi, network connection, internet, wireless, data, wi fi</string>
+ <!-- Search keyword for "Open Network Notification" settings. [CHAR_LIMIT=NONE]-->
+ <string name="keywords_wifi_notify_open_networks">Wi\u2011Fi notification, wifi notification</string>
+ <!-- Search keyword for "Adaptive brightness" settings. [CHAR_LIMIT=NONE]-->
+ <string name="keywords_auto_brightness">Auto brightness</string>
+ <!-- Search keyword for "Vibrate on touch" settings. [CHAR_LIMIT=NONE]-->
+ <string name="keywords_vibrate_on_touch">Stop vibration, tap, keyboard</string>
+ <!-- Search keyword for "Time format" settings. [CHAR_LIMIT=NONE]-->
+ <string name="keywords_time_format">Use 24-hour format</string>
+ <!-- Search keyword for "Files" settings under Settings > Storage. [CHAR_LIMIT=NONE]-->
+ <string name="keywords_storage_files">Download</string>
+ <!-- Search keyword for "Default Apps" settings [CHAR_LIMIT=NONE]-->
+ <string name="keywords_app_default">Open with</string>
+ <!-- Search keyword for "App info" settings [CHAR_LIMIT=NONE]-->
+ <string name="keywords_applications_settings">Applications</string>
+ <!-- Search keyword for "Time zone" settings [CHAR_LIMIT=NONE]-->
+ <string name="keywords_time_zone">timezone</string>
+ <!-- Search keyword for "Display over other apps" settings [CHAR_LIMIT=NONE]-->
+ <string name="keywords_draw_overlay">Chat head</string>
<string name="keywords_change_wifi_state">wifi, wi-fi, toggle, control</string>
<string name="keywords_more_default_sms_app">text message, texting, messages, messaging, default</string>
<string name="keywords_more_mobile_networks">cellular, mobile, cell carrier, wireless, data, 4g,3g, 2g, lte</string>
@@ -7146,7 +7162,8 @@
<string name="keywords_display_night_display">dim screen, night, tint, night shift, brightness, screen color, colour, color</string>
<string name="keywords_display_wallpaper">background, personalize, customize display</string>
<string name="keywords_display_font_size">text size</string>
- <string name="keywords_display_cast_screen">project, cast</string>
+ <!-- Search keyword for "Cast" settings [CHAR_LIMIT=NONE]-->
+ <string name="keywords_display_cast_screen">project, cast, Screen mirroring, Screen sharing, mirroring, share screen, screen casting</string>
<string name="keywords_storage">space, disk, hard drive, device usage</string>
<string name="keywords_battery">power usage, charge</string>
<string name="keywords_spell_checker">spelling, dictionary, spellcheck, auto-correct</string>
@@ -7199,7 +7216,7 @@
<string name="keywords_ambient_display_screen">Ambient display, Lock screen display</string>
<!-- Search keyword for lock screen notification setting [CHAR_LIMIT=NONE] -->
- <string name="keywords_lock_screen_notif">lock screen notification</string>
+ <string name="keywords_lock_screen_notif">lock screen notification, notifications</string>
<!-- Search keyword for face settings. -->
<string name="keywords_face_settings">face</string>
@@ -7386,6 +7403,12 @@
<!-- Sound: Other sounds: Title for the option enabling boot sounds. [CHAR LIMIT=30] -->
<string name="boot_sounds_title">Power on sounds</string>
+ <!-- Setting title for controlling how caption text display in real time [CHAR LIMIT=40]-->
+ <string name="live_caption_title">Live Caption</string>
+
+ <!-- Setting summary for controlling how caption text display in real time [CHAR LIMIT=NONE]-->
+ <string name="live_caption_summary">Automatically caption media</string>
+
<!-- Sound: Summary for the Do not Disturb option when there is no automatic rules turned on. [CHAR LIMIT=NONE]-->
<string name="zen_mode_settings_summary_off">Never</string>
@@ -10552,8 +10575,6 @@
<!-- Message informs the user that has no SIM card in personalized Settings [CHAR LIMIT=30] -->
<string name="no_sim_card">No SIM card</string>
- <!-- Carrier variant of Enhaced 4G LTE Mode title. [CHAR LIMIT=50] -->
- <string name="enhanced_4g_lte_mode_title_variant">Advanced Calling</string>
<!-- The following strings are summaries for preferred network modes in Mobile network settings,
and have a character limit of 100 -->
<!-- WCDMA preferred [CHAR LIMIT=NONE] -->
@@ -10645,8 +10666,14 @@
<string name="cdma_lte_data_service">Set up data service</string>
<!-- Mobile network settings screen, title of Mobile Data switch preference [CHAR LIMIT=NONE] -->
<string name="mobile_data_settings_title">Mobile data</string>
- <!-- Mobile network settings screen, title of Mobile data switch preference [CHAR LIMIT=NONE] -->
+ <!-- Mobile network settings screen, summary of Mobile data switch preference [CHAR LIMIT=NONE] -->
<string name="mobile_data_settings_summary">Access data using mobile network</string>
+ <!-- Mobile network settings screen, summary of Mobile data switch preference when the network
+ is opportunistic and will always be used when it is in range. [CHAR LIMIT=NONE] -->
+ <string name="mobile_data_settings_summary_auto_switch">
+ Phone will automatically switch to this carrier when in range
+ </string>
+
<!-- Mobile network settings screen, title of item showing the name of the default subscription
that will be used for calls. This only appears in multi-SIM mode. [CHAR LIMIT=NONE] -->
<string name="calls_preference">Calls preference</string>
@@ -10694,6 +10721,14 @@
such as calls, SMS, or data when multiple SIMs are present, but is not currently the
default SIM for any of those services. [CHAR LIMIT=50] -->
<string name="subscription_available">Available</string>
+ <!-- Network & internet page. Summary indicating that a SIM is configured and may be used for
+ some services, and that network is currently in range but not being used. For instance, it
+ may be able to provide a mobile data connection that we aren't using because we're already
+ connected to wifi. [CHAR LIMIT=50] -->
+ <string name="mobile_network_in_range">In range</string>
+ <!-- Network & internet page. Summary indicating that a SIM is configured and may be used for
+ some services, but the network not currently in range. [CHAR LIMIT=50] -->
+ <string name="mobile_network_not_in_range">Not in range</string>
<!-- Title of item shown at the bottom of the page listing multiple mobile service
subscriptions; tapping it leads to a UI to add more [CHAR LIMIT=40] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index da103c5..1efe2c2 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -132,6 +132,12 @@
android:key="audio_and_captions_category"
android:title="@string/audio_and_captions_category_title">
+ <Preference
+ android:key="live_caption"
+ android:title="@string/live_caption_title"
+ android:summary="@string/live_caption_summary"
+ settings:controller="com.android.settings.accessibility.LiveCaptionPreferenceController"/>
+
<SwitchPreference
android:key="toggle_master_mono"
android:title="@string/accessibility_toggle_master_mono_title"
diff --git a/res/xml/app_and_notification.xml b/res/xml/app_and_notification.xml
index 9dd5fea..2996afa 100644
--- a/res/xml/app_and_notification.xml
+++ b/res/xml/app_and_notification.xml
@@ -28,7 +28,8 @@
android:title="@string/applications_settings"
android:order="-999"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
- settings:controller="com.android.settings.applications.AllAppsInfoPreferenceController"/>
+ settings:controller="com.android.settings.applications.AllAppsInfoPreferenceController"
+ settings:keywords="@string/keywords_applications_settings"/>
<com.android.settingslib.widget.LayoutPreference
android:key="recent_open_apps"
diff --git a/res/xml/app_default_settings.xml b/res/xml/app_default_settings.xml
index c26c069..1f1b24a 100644
--- a/res/xml/app_default_settings.xml
+++ b/res/xml/app_default_settings.xml
@@ -19,7 +19,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="app_default_settings_screen"
- android:title="@string/app_default_dashboard_title">
+ android:title="@string/app_default_dashboard_title"
+ settings:keywords="@string/keywords_app_default">
<com.android.settingslib.widget.apppreference.AppPreference
android:key="assist_and_voice_input"
diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml
index ae9d14d..c8d1d63 100644
--- a/res/xml/battery_saver_settings.xml
+++ b/res/xml/battery_saver_settings.xml
@@ -28,8 +28,8 @@
<SwitchPreference
android:key="battery_saver_sticky"
- android:title="@string/battery_saver_sticky_title"
- android:summary="@string/battery_saver_sticky_description"
+ android:title="@string/battery_saver_sticky_title_new"
+ android:summary="@string/summary_placeholder"
settings:keywords="@string/keywords_battery_saver_sticky"
settings:controller="com.android.settings.fuelgauge.batterysaver.BatterySaverStickyPreferenceController"/>
diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml
index f98ce3d..2d5b24d 100644
--- a/res/xml/date_time_prefs.xml
+++ b/res/xml/date_time_prefs.xml
@@ -56,12 +56,14 @@
android:title="@string/date_time_set_timezone_title"
android:summary="@string/summary_placeholder"
android:fragment="com.android.settings.datetime.timezone.TimeZoneSettings"
- settings:userRestriction="no_config_date_time" />
+ settings:userRestriction="no_config_date_time"
+ settings:keywords="@string/keywords_time_zone"/>
</PreferenceCategory>
<PreferenceCategory
android:key="time_format_preference_category"
- android:title="@string/time_format_category_title">
+ android:title="@string/time_format_category_title"
+ settings:keywords="@string/keywords_time_format">
<SwitchPreference
android:key="auto_24hour"
android:title="@string/date_time_24hour_auto"/>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 91fe656..c4c39e2 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -44,7 +44,8 @@
android:title="@string/auto_brightness_title"
android:summary="@string/summary_placeholder"
android:fragment="com.android.settings.display.AutoBrightnessSettings"
- settings:controller="com.android.settings.display.AutoBrightnessPreferenceController" />
+ settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
+ settings:keywords="@string/keywords_auto_brightness"/>
<com.android.settingslib.RestrictedPreference
android:key="wallpaper"
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 57bee1f..c3161d5 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -124,7 +124,8 @@
android:dialogTitle="@string/ringtone_title"
android:summary="@string/summary_placeholder"
android:ringtoneType="ringtone"
- android:order="-100"/>
+ android:order="-100"
+ settings:keywords="@string/sound_settings"/>
<!-- Default notification ringtone -->
<com.android.settings.DefaultRingtonePreference
@@ -180,7 +181,8 @@
<SwitchPreference
android:key="vibrate_on_touch"
android:title="@string/vibrate_on_touch_title"
- android:summary="@string/vibrate_on_touch_summary" />
+ android:summary="@string/vibrate_on_touch_summary"
+ settings:keywords="@string/keywords_vibrate_on_touch"/>
<!-- Dock speaker plays -->
<DropDownPreference
diff --git a/res/xml/storage_dashboard_fragment.xml b/res/xml/storage_dashboard_fragment.xml
index c4bd11d..63ce90b 100644
--- a/res/xml/storage_dashboard_fragment.xml
+++ b/res/xml/storage_dashboard_fragment.xml
@@ -62,7 +62,8 @@
android:key="pref_files"
android:title="@string/storage_files"
android:icon="@drawable/ic_folder_vd_theme_24"
- android:order="7" />
+ android:order="7"
+ settings:keywords="@string/keywords_storage_files"/>
<com.android.settings.deviceinfo.StorageItemPreference
android:key="pref_system"
android:title="@string/storage_detail_system"
diff --git a/res/xml/wifi_configure_settings.xml b/res/xml/wifi_configure_settings.xml
index 15ab1aa..c621466 100644
--- a/res/xml/wifi_configure_settings.xml
+++ b/res/xml/wifi_configure_settings.xml
@@ -36,7 +36,8 @@
android:key="notify_open_networks"
android:title="@string/wifi_notify_open_networks"
android:icon="@drawable/ic_open_wifi_notifications"
- android:summary="@string/wifi_notify_open_networks_summary" />
+ android:summary="@string/wifi_notify_open_networks_summary"
+ settings:keywords="@string/keywords_wifi_notify_open_networks"/>
<SwitchPreference
android:key="wifi_cellular_data_fallback"
diff --git a/res/xml/wifi_display_settings.xml b/res/xml/wifi_display_settings.xml
index 7ad214e..769e9ce 100644
--- a/res/xml/wifi_display_settings.xml
+++ b/res/xml/wifi_display_settings.xml
@@ -16,7 +16,9 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="wifi_display_settings_screen"
- android:title="@string/wifi_display_settings_title">
+ android:title="@string/wifi_display_settings_title"
+ settings:keywords="@string/keywords_display_cast_screen">
</PreferenceScreen>
diff --git a/res/xml/wifi_network_details_fragment.xml b/res/xml/wifi_network_details_fragment.xml
index 8979efc..782a7cf 100644
--- a/res/xml/wifi_network_details_fragment.xml
+++ b/res/xml/wifi_network_details_fragment.xml
@@ -71,6 +71,15 @@
android:entryValues="@array/wifi_privacy_values"/>
</PreferenceCategory>
+ <!-- Add device Category -->
+ <PreferenceCategory
+ android:key="add_device_category" >
+ <Preference
+ android:key="add_device_to_network"
+ android:title="@string/wifi_dpp_add_device"
+ android:summary="@string/wifi_dpp_connect_network_using_qr_code"/>
+ </PreferenceCategory>
+
<!-- Network Details -->
<PreferenceCategory
android:key="ip_details_category"
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 921af04..b9b9538 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -136,6 +136,8 @@
"accessibility_control_timeout_preference_fragment";
private static final String DARK_UI_MODE_PREFERENCE =
"dark_ui_mode_accessibility";
+ private static final String LIVE_CAPTION_PREFERENCE_KEY =
+ "live_caption";
// Extras passed to sub-fragments.
@@ -236,11 +238,13 @@
private Preference mDisplayDaltonizerPreferenceScreen;
private Preference mHearingAidPreference;
private Preference mVibrationPreferenceScreen;
+ private Preference mLiveCaptionPreference;
private SwitchPreference mToggleInversionPreference;
private ColorInversionPreferenceController mInversionPreferenceController;
private AccessibilityHearingAidPreferenceController mHearingAidPreferenceController;
private ListPreference mDarkUIModePreference;
private DarkUIPreferenceController mDarkUIPreferenceController;
+ private LiveCaptionPreferenceController mLiveCaptionPreferenceController;
private int mLongPressTimeoutDefault;
@@ -299,6 +303,9 @@
(context, HEARING_AID_PREFERENCE);
mHearingAidPreferenceController.setFragmentManager(getFragmentManager());
getLifecycle().addObserver(mHearingAidPreferenceController);
+
+ mLiveCaptionPreferenceController = new LiveCaptionPreferenceController(context,
+ LIVE_CAPTION_PREFERENCE_KEY);
}
@Override
@@ -487,6 +494,10 @@
// Captioning.
mCaptioningPreferenceScreen = findPreference(CAPTIONING_PREFERENCE_SCREEN);
+ // Live caption
+ mLiveCaptionPreference = findPreference(LIVE_CAPTION_PREFERENCE_KEY);
+ mLiveCaptionPreferenceController.displayPreference(getPreferenceScreen());
+
// Display magnification.
mDisplayMagnificationPreferenceScreen = findPreference(
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
@@ -732,6 +743,8 @@
mHearingAidPreferenceController.updateState(mHearingAidPreference);
+ mLiveCaptionPreferenceController.updateState(mLiveCaptionPreference);
+
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED,
mCaptioningPreferenceScreen);
updateFeatureSummary(Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
@@ -752,7 +765,6 @@
}
void updateAccessibilityTimeoutSummary(ContentResolver resolver, Preference pref) {
-
String[] timeoutSummarys = getResources().getStringArray(
R.array.accessibility_timeout_summaries);
int[] timeoutValues = getResources().getIntArray(
@@ -821,7 +833,7 @@
pref.setSummary(entries[index]);
}
- @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ @VisibleForTesting
void updateVibrationSummary(Preference pref) {
final Context context = getContext();
final Vibrator vibrator = context.getSystemService(Vibrator.class);
diff --git a/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java b/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java
new file mode 100644
index 0000000..2d12f67
--- /dev/null
+++ b/src/com/android/settings/accessibility/LiveCaptionPreferenceController.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+
+import java.util.List;
+
+public class LiveCaptionPreferenceController extends BasePreferenceController {
+
+ @VisibleForTesting
+ static final Intent LIVE_CAPTION_INTENT = new Intent(
+ "com.android.settings.action.live_caption");
+
+ private final PackageManager mPackageManager;
+
+ public LiveCaptionPreferenceController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ mPackageManager = context.getPackageManager();
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ final List<ResolveInfo> resolved =
+ mPackageManager.queryIntentActivities(LIVE_CAPTION_INTENT, 0 /* flags */);
+ return resolved != null && !resolved.isEmpty()
+ ? AVAILABLE
+ : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ super.updateState(preference);
+ preference.setIntent(LIVE_CAPTION_INTENT);
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java
index 7a1f7f5..7d4bdac 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceController.java
@@ -1,37 +1,58 @@
package com.android.settings.fuelgauge.batterysaver;
import android.content.Context;
+import android.icu.text.NumberFormat;
import android.provider.Settings;
+import android.provider.Settings.Global;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
-import com.android.settings.core.BasePreferenceController;
+import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.core.TogglePreferenceController;
-public class BatterySaverStickyPreferenceController extends BasePreferenceController implements
+public class BatterySaverStickyPreferenceController extends TogglePreferenceController implements
PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
- public static final String LOW_POWER_STICKY_AUTO_DISABLE_ENABLED =
- "low_power_sticky_auto_disable_enabled";
+ private Context mContext;
public BatterySaverStickyPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
+ mContext = context;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED, 1) == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED,
+ isChecked ? 1 : 0);
+ return true;
+ }
+
+ @Override
+ protected void refreshSummary(Preference preference) {
+ super.refreshSummary(preference);
+ final double stickyShutoffLevel = Settings.Global.getInt(
+ mContext.getContentResolver(), Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL, 90);
+ final String percentage = NumberFormat
+ .getPercentInstance()
+ .format(stickyShutoffLevel / 100.0);
+ preference.setSummary(
+ mContext.getString(R.string.battery_saver_sticky_description_new, percentage));
}
@Override
public void updateState(Preference preference) {
int setting = Settings.Global.getInt(mContext.getContentResolver(),
- LOW_POWER_STICKY_AUTO_DISABLE_ENABLED, 1);
+ Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED, 1);
- ((SwitchPreference) preference).setChecked(setting == 0);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- boolean keepActive = (Boolean) newValue;
- Settings.Global.putInt(mContext.getContentResolver(),
- LOW_POWER_STICKY_AUTO_DISABLE_ENABLED,
- keepActive ? 0 : 1);
- return true;
+ ((SwitchPreference) preference).setChecked(setting == 1);
+ refreshSummary(preference);
}
@Override
diff --git a/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceController.java b/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceController.java
index 129cf90..11ff094 100644
--- a/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceController.java
+++ b/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceController.java
@@ -16,9 +16,15 @@
package com.android.settings.gestures;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
+
import android.content.Context;
+import android.content.om.IOverlayManager;
+import android.os.ServiceManager;
import android.text.TextUtils;
+import androidx.annotation.VisibleForTesting;
+
import com.android.settings.widget.RadioButtonPreference;
public class SystemNavigationEdgeToEdgePreferenceController extends
@@ -26,7 +32,14 @@
static final String PREF_KEY_EDGE_TO_EDGE = "gesture_edge_to_edge";
public SystemNavigationEdgeToEdgePreferenceController(Context context, String key) {
- super(context, key);
+ this(context, IOverlayManager.Stub.asInterface(ServiceManager.getService(
+ Context.OVERLAY_SERVICE)), key);
+ }
+
+ @VisibleForTesting
+ public SystemNavigationEdgeToEdgePreferenceController(Context context,
+ IOverlayManager overlayManager, String key) {
+ super(context, overlayManager, key);
}
@Override
@@ -36,8 +49,7 @@
@Override
public void onRadioButtonClicked(RadioButtonPreference preference) {
- setSwipeUpEnabled(mContext, true);
- setEdgeToEdgeGestureEnabled(mContext, true);
+ setNavBarInteractionMode(mOverlayManager, NAV_BAR_MODE_GESTURAL_OVERLAY);
selectRadioButtonInGroup(PREF_KEY_EDGE_TO_EDGE, mPreferenceScreen);
}
diff --git a/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceController.java
index f9c95a8..0b19784 100644
--- a/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceController.java
+++ b/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceController.java
@@ -16,9 +16,15 @@
package com.android.settings.gestures;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
+
import android.content.Context;
+import android.content.om.IOverlayManager;
+import android.os.ServiceManager;
import android.text.TextUtils;
+import androidx.annotation.VisibleForTesting;
+
import com.android.settings.widget.RadioButtonPreference;
public class SystemNavigationLegacyPreferenceController extends
@@ -26,7 +32,14 @@
static final String PREF_KEY_LEGACY = "gesture_legacy";
public SystemNavigationLegacyPreferenceController(Context context, String key) {
- super(context, key);
+ this(context, IOverlayManager.Stub.asInterface(ServiceManager.getService(
+ Context.OVERLAY_SERVICE)), key);
+ }
+
+ @VisibleForTesting
+ public SystemNavigationLegacyPreferenceController(Context context,
+ IOverlayManager overlayManager, String key) {
+ super(context, overlayManager, key);
}
@Override
@@ -36,8 +49,7 @@
@Override
public void onRadioButtonClicked(RadioButtonPreference preference) {
- setEdgeToEdgeGestureEnabled(mContext, false);
- setSwipeUpEnabled(mContext, false);
+ setNavBarInteractionMode(mOverlayManager, NAV_BAR_MODE_3BUTTON_OVERLAY);
selectRadioButtonInGroup(PREF_KEY_LEGACY, mPreferenceScreen);
}
diff --git a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
index e1be9d4..5f58fcf 100644
--- a/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
+++ b/src/com/android/settings/gestures/SystemNavigationPreferenceController.java
@@ -16,7 +16,12 @@
package com.android.settings.gestures;
-import static android.os.UserHandle.USER_SYSTEM;
+import static android.os.UserHandle.USER_CURRENT;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
import android.content.ComponentName;
import android.content.Context;
@@ -24,8 +29,6 @@
import android.content.om.IOverlayManager;
import android.content.pm.PackageManager;
import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.provider.Settings;
import android.text.TextUtils;
import android.view.View;
@@ -38,33 +41,6 @@
public abstract class SystemNavigationPreferenceController extends GesturePreferenceController
implements RadioButtonPreference.OnClickListener {
- private static final int OFF = 0;
- private static final int ON = 1;
-
- private static final String HIDE_BACK_BUTTON = "quickstepcontroller_hideback";
- private static final String HIDE_HOME_BUTTON = "quickstepcontroller_hidehome";
- private static final String HIDE_NAVBAR_DIVIDER = "hide_navigationbar_divider";
- private static final String SHOW_HANDLE = "quickstepcontroller_showhandle";
- private static final String ENABLE_CLICK_THROUGH = "quickstepcontroller_clickthrough";
- private static final String ENABLE_LAUNCHER_SWIPE_TO_HOME = "SWIPE_HOME";
- private static final String ENABLE_COLOR_ADAPT_FOR_HANDLE = "navbar_color_adapt_enable";
- private static final String ENABLE_ASSISTANT_GESTURE = "ENABLE_ASSISTANT_GESTURE";
- private static final String PROTOTYPE_ENABLED = "prototype_enabled";
-
- private static final int EDGE_SENSITIVITY_WIDTH = 48;
- private static final String EDGE_SENSITIVITY_KEY = "quickstepcontroller_edge_width_sensitivity";
-
- private static final String GESTURES_MATCH_MAP_OFF = "000000";
- private static final String GESTURES_MATCH_MAP_ON = "071133";
- private static final String GESTURES_MATCH_MAP_KEY = "quickstepcontroller_gesture_match_map";
-
- private static final String OVERLAY_NAVBAR_KEY =
- "com.android.internal.experiment.navbar.default";
- private static final String OVERLAY_NAVBAR_TYPE_INSET =
- "com.android.internal.experiment.navbar.type.inset";
- private static final String OVERLAY_NAVBAR_TYPE_FLOATING =
- "com.android.internal.experiment.navbar.type.floating";
-
private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
private static final String PREF_KEY_VIDEO = "gesture_swipe_up_video";
@@ -74,10 +50,13 @@
SystemNavigationEdgeToEdgePreferenceController.PREF_KEY_EDGE_TO_EDGE,
};
+ protected final IOverlayManager mOverlayManager;
protected PreferenceScreen mPreferenceScreen;
- public SystemNavigationPreferenceController(Context context, String key) {
+ public SystemNavigationPreferenceController(Context context, IOverlayManager overlayManager,
+ String key) {
super(context, key);
+ mOverlayManager = overlayManager;
}
@Override
@@ -156,55 +135,36 @@
}
}
- static void setEdgeToEdgeGestureEnabled(Context context, boolean enable) {
- // TODO(b/127366543): replace all of this with a single switch
- setBooleanGlobalSetting(context, HIDE_BACK_BUTTON, enable);
- setBooleanGlobalSetting(context, HIDE_HOME_BUTTON, enable);
- setBooleanGlobalSetting(context, HIDE_NAVBAR_DIVIDER, enable);
- setBooleanGlobalSetting(context, SHOW_HANDLE, enable);
- setBooleanGlobalSetting(context, ENABLE_CLICK_THROUGH, enable);
- setBooleanGlobalSetting(context, ENABLE_LAUNCHER_SWIPE_TO_HOME, enable);
- setBooleanGlobalSetting(context, ENABLE_COLOR_ADAPT_FOR_HANDLE, enable);
- setBooleanGlobalSetting(context, ENABLE_ASSISTANT_GESTURE, enable);
- setBooleanGlobalSetting(context, PROTOTYPE_ENABLED, enable);
- Settings.Global.putInt(context.getContentResolver(), EDGE_SENSITIVITY_KEY,
- EDGE_SENSITIVITY_WIDTH);
- Settings.Global.putString(context.getContentResolver(), GESTURES_MATCH_MAP_KEY,
- enable ? GESTURES_MATCH_MAP_ON : GESTURES_MATCH_MAP_OFF);
-
- IOverlayManager overlayManager = IOverlayManager.Stub
- .asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
- if (overlayManager != null) {
- try {
- overlayManager.setEnabled(OVERLAY_NAVBAR_KEY, true, USER_SYSTEM);
- overlayManager.setEnabled(OVERLAY_NAVBAR_TYPE_FLOATING, false, USER_SYSTEM);
- overlayManager.setEnabled(OVERLAY_NAVBAR_TYPE_INSET, enable, USER_SYSTEM);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
- }
-
- static void setBooleanGlobalSetting(Context context, String name, boolean flag) {
- Settings.Global.putInt(context.getContentResolver(), name, flag ? ON : OFF);
- }
-
- static void setSwipeUpEnabled(Context context, boolean enabled) {
- Settings.Secure.putInt(context.getContentResolver(),
- Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, enabled ? ON : OFF);
+ /**
+ * Enables the specified overlay package.
+ */
+ static void setNavBarInteractionMode(IOverlayManager overlayManager, String overlayPackage) {
+ setOverlayEnabled(overlayManager, NAV_BAR_MODE_3BUTTON_OVERLAY,
+ overlayPackage == NAV_BAR_MODE_3BUTTON_OVERLAY);
+ setOverlayEnabled(overlayManager, NAV_BAR_MODE_2BUTTON_OVERLAY,
+ overlayPackage == NAV_BAR_MODE_2BUTTON_OVERLAY);
+ setOverlayEnabled(overlayManager, NAV_BAR_MODE_GESTURAL_OVERLAY,
+ overlayPackage == NAV_BAR_MODE_GESTURAL_OVERLAY);
}
static boolean isSwipeUpEnabled(Context context) {
if (isEdgeToEdgeEnabled(context)) {
return false;
}
- final int defaultSwipeUpValue = context.getResources()
- .getBoolean(com.android.internal.R.bool.config_swipe_up_gesture_default) ? ON : OFF;
- return Settings.Secure.getInt(context.getContentResolver(),
- Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, defaultSwipeUpValue) == ON;
+ return NAV_BAR_MODE_2BUTTON == context.getResources().getInteger(
+ com.android.internal.R.integer.config_navBarInteractionMode);
}
static boolean isEdgeToEdgeEnabled(Context context) {
- return Settings.Global.getInt(context.getContentResolver(), PROTOTYPE_ENABLED, OFF) == ON;
+ return NAV_BAR_MODE_GESTURAL == context.getResources().getInteger(
+ com.android.internal.R.integer.config_navBarInteractionMode);
+ }
+
+ static void setOverlayEnabled(IOverlayManager overlayManager, String pkg, boolean enabled) {
+ try {
+ overlayManager.setEnabled(pkg, enabled, USER_CURRENT);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
}
diff --git a/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceController.java b/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceController.java
index 25fafdb..26c2201 100644
--- a/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceController.java
+++ b/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceController.java
@@ -16,9 +16,15 @@
package com.android.settings.gestures;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY;
+
import android.content.Context;
+import android.content.om.IOverlayManager;
+import android.os.ServiceManager;
import android.text.TextUtils;
+import androidx.annotation.VisibleForTesting;
+
import com.android.settings.widget.RadioButtonPreference;
public class SystemNavigationSwipeUpPreferenceController extends
@@ -26,7 +32,14 @@
static final String PREF_KEY_SWIPE_UP = "gesture_swipe_up";
public SystemNavigationSwipeUpPreferenceController(Context context, String key) {
- super(context, key);
+ this(context, IOverlayManager.Stub.asInterface(ServiceManager.getService(
+ Context.OVERLAY_SERVICE)), key);
+ }
+
+ @VisibleForTesting
+ public SystemNavigationSwipeUpPreferenceController(Context context,
+ IOverlayManager overlayManager, String key) {
+ super(context, overlayManager, key);
}
@Override
@@ -36,8 +49,7 @@
@Override
public void onRadioButtonClicked(RadioButtonPreference preference) {
- setEdgeToEdgeGestureEnabled(mContext, false);
- setSwipeUpEnabled(mContext, true);
+ setNavBarInteractionMode(mOverlayManager, NAV_BAR_MODE_2BUTTON_OVERLAY);
selectRadioButtonInGroup(PREF_KEY_SWIPE_UP, mPreferenceScreen);
}
diff --git a/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java b/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java
index b9170a9..006734f 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java
@@ -98,8 +98,6 @@
@Override
public void bindView(RecyclerView.ViewHolder holder, ContextualCard card) {
final Uri uri = card.getSliceUri();
- //TODO(b/120629936): Take this out once blank card issue is fixed.
- Log.d(TAG, "bindView - uri = " + uri);
if (!ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
Log.w(TAG, "Invalid uri, skipping slice: " + uri);
@@ -121,10 +119,8 @@
mContext.getContentResolver().notifyChange(CardContentProvider.REFRESH_CARD_URI,
null);
return;
- } else {
- //TODO(b/120629936): Take this out once blank card issue is fixed.
- Log.d(TAG, "Slice callback - uri = " + slice.getUri());
}
+
switch (holder.getItemViewType()) {
case VIEW_TYPE_DEFERRED_SETUP:
mDeferredSetupCardHelper.bindView(holder, card, slice);
diff --git a/src/com/android/settings/location/LocationFooterPreferenceController.java b/src/com/android/settings/location/LocationFooterPreferenceController.java
index 3431aa2..55fea9f 100644
--- a/src/com/android/settings/location/LocationFooterPreferenceController.java
+++ b/src/com/android/settings/location/LocationFooterPreferenceController.java
@@ -86,12 +86,10 @@
.getResourcesForApplication(data.applicationInfo)
.getString(data.footerStringRes);
} catch (NameNotFoundException exception) {
- if (Log.isLoggable(TAG, Log.WARN)) {
- Log.w(
- TAG,
- "Resources not found for application "
- + data.applicationInfo.packageName);
- }
+ Log.w(
+ TAG,
+ "Resources not found for application "
+ + data.applicationInfo.packageName);
continue;
}
footerPreference.setTitle(footerString);
@@ -152,11 +150,11 @@
mPackageManager.queryBroadcastReceivers(
INJECT_INTENT, PackageManager.GET_META_DATA);
if (resolveInfos == null) {
- if (Log.isLoggable(TAG, Log.ERROR)) {
- Log.e(TAG, "Unable to resolve intent " + INJECT_INTENT);
- return Collections.emptyList();
- }
- } else if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.e(TAG, "Unable to resolve intent " + INJECT_INTENT);
+ return Collections.emptyList();
+ }
+
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Found broadcast receivers: " + resolveInfos);
}
@@ -167,30 +165,26 @@
// If a non-system app tries to inject footer, ignore it
if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
- if (Log.isLoggable(TAG, Log.WARN)) {
- Log.w(TAG, "Ignoring attempt to inject footer from app not in system image: "
- + resolveInfo);
- continue;
- }
+ Log.w(TAG, "Ignoring attempt to inject footer from app not in system image: "
+ + resolveInfo);
+ continue;
}
// Get the footer text resource id from broadcast receiver's metadata
if (activityInfo.metaData == null) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "No METADATA in broadcast receiver " + activityInfo.name);
- continue;
}
+ continue;
}
final int footerTextRes =
activityInfo.metaData.getInt(LocationManager.METADATA_SETTINGS_FOOTER_STRING);
if (footerTextRes == 0) {
- if (Log.isLoggable(TAG, Log.WARN)) {
- Log.w(
- TAG,
- "No mapping of integer exists for "
- + LocationManager.METADATA_SETTINGS_FOOTER_STRING);
- }
+ Log.w(
+ TAG,
+ "No mapping of integer exists for "
+ + LocationManager.METADATA_SETTINGS_FOOTER_STRING);
continue;
}
footerDataList.add(
diff --git a/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java b/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
index c510294..161c218 100644
--- a/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
+++ b/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
@@ -17,6 +17,7 @@
package com.android.settings.network.telephony;
import android.content.Context;
+import android.content.res.Resources;
import android.os.Looper;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
@@ -52,12 +53,18 @@
ImsManager mImsManager;
private PhoneCallStateListener mPhoneStateListener;
private final List<On4gLteUpdateListener> m4gLteListeners;
+ private final CharSequence[] mVariantTitles;
+ private final CharSequence[] mVariantSumaries;
public Enhanced4gLtePreferenceController(Context context, String key) {
super(context, key);
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
m4gLteListeners = new ArrayList<>();
mPhoneStateListener = new PhoneCallStateListener(Looper.getMainLooper());
+ mVariantTitles = context.getResources()
+ .getTextArray(R.array.enhanced_4g_lte_mode_title_variant);
+ mVariantSumaries = context.getResources()
+ .getTextArray(R.array.enhanced_4g_lte_mode_sumary_variant);
}
@Override
@@ -94,12 +101,20 @@
public void updateState(Preference preference) {
super.updateState(preference);
final SwitchPreference switchPreference = (SwitchPreference) preference;
- final boolean useVariant4glteTitle = mCarrierConfig.getInt(
- CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT) != 0;
- int enhanced4glteModeTitleId = useVariant4glteTitle ?
- R.string.enhanced_4g_lte_mode_title_variant :
- R.string.enhanced_4g_lte_mode_title;
- switchPreference.setTitle(enhanced4glteModeTitleId);
+ final int variant4glteTitleIndex = mCarrierConfig.getInt(
+ CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT);
+
+ // Default index 0 indicates the default title/sumary string
+ CharSequence enhanced4glteModeTitle = mVariantTitles[0];
+ CharSequence enhanced4glteModeSummary = mVariantSumaries[0];
+ if (variant4glteTitleIndex >= 0 && variant4glteTitleIndex < mVariantTitles.length) {
+ enhanced4glteModeTitle = mVariantTitles[variant4glteTitleIndex];
+ }
+ if (variant4glteTitleIndex >= 0 && variant4glteTitleIndex < mVariantSumaries.length) {
+ enhanced4glteModeSummary = mVariantSumaries[variant4glteTitleIndex];
+ }
+ switchPreference.setTitle(enhanced4glteModeTitle);
+ switchPreference.setSummary(enhanced4glteModeSummary);
switchPreference.setEnabled(is4gLtePrefEnabled());
switchPreference.setChecked(mImsManager.isEnhanced4gLteModeSettingEnabledByUser()
&& mImsManager.isNonTtyOrTtyOnVolteEnabled());
diff --git a/src/com/android/settings/sim/SimSelectNotification.java b/src/com/android/settings/sim/SimSelectNotification.java
index 891d171..4f3b9bc 100644
--- a/src/com/android/settings/sim/SimSelectNotification.java
+++ b/src/com/android/settings/sim/SimSelectNotification.java
@@ -16,11 +16,11 @@
package com.android.settings.sim;
-import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_ID;
-import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE;
+import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA;
import static android.telephony.TelephonyManager.EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE;
+import static android.telephony.TelephonyManager.EXTRA_SUBSCRIPTION_ID;
import android.app.NotificationChannel;
import android.app.NotificationManager;
@@ -52,8 +52,8 @@
int dialogType = intent.getIntExtra(EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE,
EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE);
- if (dialogType == EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES) {
- int subId = intent.getIntExtra(EXTRA_DEFAULT_SUBSCRIPTION_ID,
+ if (dialogType == EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_ALL) {
+ int subId = intent.getIntExtra(EXTRA_SUBSCRIPTION_ID,
SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
int slotIndex = SubscriptionManager.getSlotIndex(subId);
// If there is only one subscription, ask if user wants to use if for everything
diff --git a/src/com/android/settings/wifi/AddWifiNetworkPreference.java b/src/com/android/settings/wifi/AddWifiNetworkPreference.java
index cd2e4a8..e49f2ab 100644
--- a/src/com/android/settings/wifi/AddWifiNetworkPreference.java
+++ b/src/com/android/settings/wifi/AddWifiNetworkPreference.java
@@ -20,7 +20,6 @@
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.Log;
-import android.view.View;
import android.widget.ImageButton;
import androidx.annotation.DrawableRes;
@@ -63,10 +62,6 @@
getContext().startActivity(
WifiDppUtils.getEnrolleeQrCodeScannerIntent(/* ssid */ null));
});
-
- final View divider = (View) holder.findViewById(
- com.android.settingslib.R.id.two_target_divider);
- divider.setVisibility(View.INVISIBLE);
}
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 0adbd8d..0887fc5 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -637,7 +637,7 @@
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
config.allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher
.BIP_GMAC_256);
- config.allowedSuiteBCiphers.set(WifiConfiguration.SuiteBCipher.ECDHE_RSA);
+ // allowedSuiteBCiphers will be set according to certificate type
}
config.enterpriseConfig = new WifiEnterpriseConfig();
int eapMethod = mEapMethodSpinner.getSelectedItemPosition();
diff --git a/src/com/android/settings/wifi/WifiUtils.java b/src/com/android/settings/wifi/WifiUtils.java
index a22bdba..9b3c1b3 100644
--- a/src/com/android/settings/wifi/WifiUtils.java
+++ b/src/com/android/settings/wifi/WifiUtils.java
@@ -198,7 +198,7 @@
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
config.allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher
.BIP_GMAC_256);
- config.allowedSuiteBCiphers.set(WifiConfiguration.SuiteBCipher.ECDHE_RSA);
+ // allowedSuiteBCiphers will be set according to certificate type
}
if (!TextUtils.isEmpty(password)) {
diff --git a/src/com/android/settings/wifi/details/AddDevicePreferenceController.java b/src/com/android/settings/wifi/details/AddDevicePreferenceController.java
new file mode 100644
index 0000000..61804a2
--- /dev/null
+++ b/src/com/android/settings/wifi/details/AddDevicePreferenceController.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.wifi.details;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.wifi.WifiManager;
+import android.util.Log;
+
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.wifi.dpp.WifiDppUtils;
+
+import com.android.settingslib.wifi.AccessPoint;
+
+/**
+ * {@link AbstractPreferenceController} that launches Wi-Fi Easy Connect configurator flow
+ */
+public class AddDevicePreferenceController extends BasePreferenceController {
+
+ private static final String TAG = "AddDevicePreferenceController";
+
+ private static final String KEY_ADD_DEVICE_CATEGORY = "add_device_category";
+ private static final String KEY_ADD_DEVICE = "add_device_to_network";
+
+ private AccessPoint mAccessPoint;
+ private WifiManager mWifiManager;
+
+ public AddDevicePreferenceController(Context context) {
+ super(context, KEY_ADD_DEVICE_CATEGORY);
+
+ mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ }
+
+ public AddDevicePreferenceController init(AccessPoint accessPoint) {
+ mAccessPoint = accessPoint;
+
+ return this;
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ if (WifiDppUtils.isSupportConfiguratorQrCodeScanner(mContext, mAccessPoint)) {
+ return AVAILABLE;
+ } else {
+ return CONDITIONALLY_UNAVAILABLE;
+ }
+ }
+
+ @Override
+ public boolean handlePreferenceTreeClick(Preference preference) {
+ if (KEY_ADD_DEVICE.equals(preference.getKey())) {
+ WifiDppUtils.showLockScreen(mContext, () -> launchWifiDppConfiguratorQrCodeScanner());
+ return true; /* click is handled */
+ }
+
+ return false; /* click is not handled */
+ }
+
+ private void launchWifiDppConfiguratorQrCodeScanner() {
+ final Intent intent = WifiDppUtils.getConfiguratorQrCodeScannerIntentOrNull(mContext,
+ mWifiManager, mAccessPoint);
+
+ if (intent == null) {
+ Log.e(TAG, "Launch Wi-Fi QR code scanner with a wrong Wi-Fi network!");
+ } else {
+ mContext.startActivity(intent);
+ }
+ }
+}
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index cf59dbd..5fc350b 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -342,7 +342,7 @@
.setButton3Text(R.string.share)
.setButton3Icon(R.drawable.ic_qrcode_24dp)
.setButton3OnClickListener(view -> shareNetwork())
- .setButton3Visible(WifiDppUtils.isSuportConfigurator(mContext, mAccessPoint));
+ .setButton3Visible(WifiDppUtils.isSupportConfiguratorQrCodeGenerator(mAccessPoint));
mSignalStrengthPref = screen.findPreference(KEY_SIGNAL_STRENGTH_PREF);
mTxLinkSpeedPref = screen.findPreference(KEY_TX_LINK_SPEED);
@@ -757,11 +757,11 @@
* Show QR code to share the network represented by this preference.
*/
public void launchWifiDppConfiguratorActivity() {
- final Intent intent = WifiDppUtils.getConfiguratorIntentOrNull(mContext, mWifiManager,
- mAccessPoint);
+ final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(mContext,
+ mWifiManager, mAccessPoint);
if (intent == null) {
- Log.e(TAG, "Launch Wi-Fi DPP configurator with a wrong Wi-Fi network!");
+ Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
} else {
mContext.startActivity(intent);
}
diff --git a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
index 66587ed..ee4cc29 100644
--- a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
+++ b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
@@ -134,6 +134,7 @@
mMetricsFeatureProvider);
controllers.add(mWifiDetailPreferenceController);
+ controllers.add(new AddDevicePreferenceController(context).init(mAccessPoint));
controllers.add(new WifiMeteredPreferenceController(context, mAccessPoint.getConfig()));
WifiPrivacyPreferenceController privacyController = new WifiPrivacyPreferenceController(
context);
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
index 4e6a0d6..d388931 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeGeneratorFragment.java
@@ -95,35 +95,15 @@
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
- MenuItem menuItem;
- if (!wifiNetworkConfig.isHotspot() &&
- wifiNetworkConfig.isSupportWifiDpp(getActivity())) {
- menuItem = menu.add(0, Menu.FIRST, 0, R.string.next_label);
- menuItem.setIcon(R.drawable.ic_scan_24dp);
- menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
- } else {
- menuItem = menu.findItem(Menu.FIRST);
- if (menuItem != null) {
- menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
- }
+ final MenuItem menuItem = menu.findItem(Menu.FIRST);
+ if (menuItem != null) {
+ menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}
super.onCreateOptionsMenu(menu, inflater);
}
@Override
- public boolean onOptionsItemSelected(MenuItem menuItem) {
- switch (menuItem.getItemId()) {
- case Menu.FIRST:
- mListener.onQrCodeGeneratorFragmentAddButtonClicked();
- return true;
- default:
- return super.onOptionsItemSelected(menuItem);
- }
- }
-
- @Override
public final View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.wifi_dpp_qrcode_generator_fragment, container,
diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
index bf78b3f..6c6444c 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java
@@ -165,9 +165,8 @@
}
/**
- * Returns an intent to launch QR code generator or scanner according to the Wi-Fi network
- * security. It may return null if the security is not supported by QR code generator nor
- * scanner.
+ * Returns an intent to launch QR code generator. It may return null if the security is not
+ * supported by QR code generator.
*
* Do not use this method for Wi-Fi hotspot network, use
* {@code getHotspotConfiguratorIntentOrNull} instead.
@@ -177,12 +176,34 @@
* @param accessPoint An instance of {@link AccessPoint}
* @return Intent for launching QR code generator
*/
- public static Intent getConfiguratorIntentOrNull(Context context,
+ public static Intent getConfiguratorQrCodeGeneratorIntentOrNull(Context context,
WifiManager wifiManager, AccessPoint accessPoint) {
final Intent intent = new Intent(context, WifiDppConfiguratorActivity.class);
if (isSupportConfiguratorQrCodeGenerator(accessPoint)) {
intent.setAction(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_GENERATOR);
- } else if (isSupportConfiguratorQrCodeScanner(context, accessPoint)) {
+ } else {
+ return null;
+ }
+
+ final WifiConfiguration wifiConfiguration = accessPoint.getConfig();
+ setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration);
+
+ return intent;
+ }
+
+ /**
+ * Returns an intent to launch QR code scanner. It may return null if the security is not
+ * supported by QR code scanner.
+ *
+ * @param context The context to use for the content resolver
+ * @param wifiManager An instance of {@link WifiManager}
+ * @param accessPoint An instance of {@link AccessPoint}
+ * @return Intent for launching QR code scanner
+ */
+ public static Intent getConfiguratorQrCodeScannerIntentOrNull(Context context,
+ WifiManager wifiManager, AccessPoint accessPoint) {
+ final Intent intent = new Intent(context, WifiDppConfiguratorActivity.class);
+ if (isSupportConfiguratorQrCodeScanner(context, accessPoint)) {
intent.setAction(WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER);
} else {
return null;
@@ -259,18 +280,6 @@
}
/**
- * Android Q supports Wi-Fi configurator by:
- *
- * 1. QR code generator of ZXing's Wi-Fi network config format.
- * and
- * 2. QR code scanner of Wi-Fi DPP QR code format.
- */
- public static boolean isSuportConfigurator(Context context, AccessPoint accessPoint) {
- return isSupportConfiguratorQrCodeScanner(context, accessPoint) ||
- isSupportConfiguratorQrCodeGenerator(accessPoint);
- }
-
- /**
* Shows authentication screen to confirm credentials (pin, pattern or password) for the current
* user of the device.
*
@@ -314,7 +323,7 @@
}
}
- private static boolean isSupportConfiguratorQrCodeScanner(Context context,
+ public static boolean isSupportConfiguratorQrCodeScanner(Context context,
AccessPoint accessPoint) {
if (!isWifiDppEnabled(context)) {
return false;
@@ -329,7 +338,7 @@
return false;
}
- private static boolean isSupportConfiguratorQrCodeGenerator(AccessPoint accessPoint) {
+ public static boolean isSupportConfiguratorQrCodeGenerator(AccessPoint accessPoint) {
// QR code generator produces QR code with ZXing's Wi-Fi network config format,
// it supports PSK and WEP and non security
final int security = accessPoint.getSecurity();
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java b/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java
index 64014d9..7d4ebec 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSsidPreference.java
@@ -39,6 +39,7 @@
private ImageButton mImageButton;
private Drawable mButtonIcon;
+ private View mDivider;
private View.OnClickListener mClickListener;
private boolean mVisible;
@@ -68,6 +69,8 @@
}
private void initialize() {
+ // TODO(b/129019971): use methods of divider line in parent object
+ setLayoutResource(com.android.settingslib.R.layout.preference_two_target);
setWidgetLayoutResource(R.layout.wifi_button_preference_widget);
}
@@ -82,13 +85,17 @@
getContext().getString(R.string.wifi_dpp_share_hotspot));
setButtonIcon(R.drawable.ic_qrcode_24dp);
mImageButton.setImageDrawable(mButtonIcon);
+
+ mDivider = holder.findViewById(R.id.two_target_divider);
}
if (mVisible) {
mImageButton.setOnClickListener(mClickListener);
mImageButton.setVisibility(View.VISIBLE);
+ mDivider.setVisibility(View.VISIBLE);
} else {
mImageButton.setVisibility(View.GONE);
+ mDivider.setVisibility(View.GONE);
}
}
diff --git a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
index 675108d..a723842 100644
--- a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
+++ b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
@@ -10,5 +10,8 @@
com.android.settings.fuelgauge.RestrictAppPreferenceController
com.android.settings.fuelgauge.batterysaver.BatterySaverButtonPreferenceController
com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController
+com.android.settings.gestures.SystemNavigationEdgeToEdgePreferenceController
+com.android.settings.gestures.SystemNavigationLegacyPreferenceController
+com.android.settings.gestures.SystemNavigationSwipeUpPreferenceController
com.android.settings.security.VisiblePatternProfilePreferenceController
com.android.settings.wifi.details.WifiMeteredPreferenceController
\ No newline at end of file
diff --git a/tests/robotests/assets/grandfather_not_implementing_index_provider b/tests/robotests/assets/grandfather_not_implementing_index_provider
index 015502b..8ca65ff 100644
--- a/tests/robotests/assets/grandfather_not_implementing_index_provider
+++ b/tests/robotests/assets/grandfather_not_implementing_index_provider
@@ -19,6 +19,7 @@
com.android.settings.applications.ProcessStatsUi
com.android.settings.applications.RunningServices
com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetails
+com.android.settings.applications.specialaccess.zenaccess.ZenAccessDetails
com.android.settings.applications.UsageAccessDetails
com.android.settings.backup.ToggleBackupSettingFragment
com.android.settings.biometrics.fingerprint.FingerprintSettings$FingerprintSettingsFragment
diff --git a/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java
new file mode 100644
index 0000000..9e0ce9c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/LiveCaptionPreferenceControllerTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.pm.ResolveInfo;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.Shadows;
+import org.robolectric.shadows.ShadowPackageManager;
+
+import java.util.Collections;
+
+@RunWith(RobolectricTestRunner.class)
+public class LiveCaptionPreferenceControllerTest {
+
+ private LiveCaptionPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mController = new LiveCaptionPreferenceController(RuntimeEnvironment.application,
+ "test_key");
+ }
+
+ @Test
+ public void getAvailabilityStatus_canResolveIntent_shouldReturnAvailable() {
+ final ShadowPackageManager pm = Shadows.shadowOf(
+ RuntimeEnvironment.application.getPackageManager());
+ pm.addResolveInfoForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT,
+ new ResolveInfo());
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_noResolveIntent_shouldReturnUnavailable() {
+ final ShadowPackageManager pm = Shadows.shadowOf(
+ RuntimeEnvironment.application.getPackageManager());
+ pm.setResolveInfosForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT,
+ Collections.emptyList());
+
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
index f3d85d3..59aea3d 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
@@ -324,7 +324,7 @@
final boolean controllable = mController.handleDisableable();
- verify(mButtonPrefs).setButton2Text(R.string.uninstall_text);
+ verify(mButtonPrefs).setButton2Text(R.string.disable_text);
assertThat(controllable).isFalse();
}
@@ -336,7 +336,7 @@
final boolean controllable = mController.handleDisableable();
- verify(mButtonPrefs).setButton2Text(R.string.uninstall_text);
+ verify(mButtonPrefs).setButton2Text(R.string.disable_text);
assertThat(controllable).isTrue();
}
@@ -348,7 +348,7 @@
final boolean controllable = mController.handleDisableable();
- verify(mButtonPrefs).setButton2Text(R.string.install_text);
+ verify(mButtonPrefs).setButton2Text(R.string.enable_text);
assertThat(controllable).isTrue();
}
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/DrawOverlayDetailsTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/DrawOverlayDetailsTest.java
index ca99361..fdbf8b9 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/DrawOverlayDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/DrawOverlayDetailsTest.java
@@ -16,43 +16,26 @@
package com.android.settings.applications.appinfo;
-import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
-
-import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.settings.SettingsEnums;
-import android.view.Window;
import android.view.WindowManager.LayoutParams;
-import androidx.fragment.app.FragmentActivity;
-
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settings.testutils.shadow.ShadowAppInfoBase;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
public class DrawOverlayDetailsTest {
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private FragmentActivity mActivity;
-
- @Mock
- private Window mWindow;
-
private LayoutParams layoutParams;
private FakeFeatureFactory mFeatureFactory;
@@ -82,23 +65,4 @@
MetricsProto.MetricsEvent.APP_SPECIAL_PERMISSION_APPDRAW_DENY,
mFragment.getMetricsCategory(), "app", 0);
}
-
- @Test
- @Config(shadows = {ShadowAppInfoBase.class})
- public void hideNonSystemOverlaysWhenResumed() {
- when(mFragment.getActivity()).thenReturn(mActivity);
- when(mActivity.getWindow()).thenReturn(mWindow);
- when(mWindow.getAttributes()).thenReturn(layoutParams);
-
- mFragment.onResume();
- verify(mWindow).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
-
- mFragment.onPause();
-
- // There's no Window.clearPrivateFlags() method, so the Window.attributes are updated.
- ArgumentCaptor<LayoutParams> paramCaptor = ArgumentCaptor.forClass(LayoutParams.class);
- verify(mWindow).setAttributes(paramCaptor.capture());
- assertEquals(0,
- paramCaptor.getValue().privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
- }
}
diff --git a/tests/robotests/src/com/android/settings/applications/managedomainurls/DomainAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/managedomainurls/DomainAppPreferenceControllerTest.java
index 5f2a514..5e5239d 100644
--- a/tests/robotests/src/com/android/settings/applications/managedomainurls/DomainAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/managedomainurls/DomainAppPreferenceControllerTest.java
@@ -18,17 +18,9 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.util.IconDrawableFactory;
-import android.view.View;
-import android.widget.ProgressBar;
-
-import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
import com.android.settingslib.applications.ApplicationsState;
@@ -64,21 +56,6 @@
assertThat(pref.getLayoutResource()).isEqualTo(R.layout.preference_app);
}
- @Test
- public void onBindViewHolder_shouldSetAppendixViewToGone() {
- final DomainAppPreference pref = new DomainAppPreference(
- mContext, mIconDrawableFactory, mAppEntry);
- final View holderView = mock(View.class);
- final View appendixView = mock(View.class);
- when(holderView.findViewById(R.id.summary_container)).thenReturn(mock(View.class));
- when(holderView.findViewById(android.R.id.progress)).thenReturn(mock(ProgressBar.class));
- when(holderView.findViewById(R.id.appendix)).thenReturn(appendixView);
-
- pref.onBindViewHolder(PreferenceViewHolder.createInstanceForTests(holderView));
-
- verify(appendixView).setVisibility(View.GONE);
- }
-
private ApplicationInfo createApplicationInfo(String packageName) {
ApplicationInfo appInfo = new ApplicationInfo();
appInfo.sourceDir = "foo";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 139ef41..5538155 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -55,6 +55,7 @@
private static final int BATTERY_LEVEL_LEFT = 25;
private static final int BATTERY_LEVEL_RIGHT = 45;
private static final String ICON_URI = "content://test.provider/icon.png";
+ private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
private Context mContext;
@@ -83,6 +84,7 @@
mController.mLayoutPreference = mLayoutPreference;
mController.mBluetoothAdapter = mBluetoothAdapter;
when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
+ when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java
index e57d5aa..29640d6 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java
@@ -52,6 +52,8 @@
@Config(shadows = {ShadowAudioManager.class, ShadowBluetoothAdapter.class,
ShadowCachedBluetoothDeviceManager.class})
public class AvailableMediaBluetoothDeviceUpdaterTest {
+ private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+
@Mock
private DashboardFragment mDashboardFragment;
@Mock
@@ -84,6 +86,7 @@
doReturn(mContext).when(mDashboardFragment).getContext();
when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
+ when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
mBluetoothDeviceUpdater = spy(new AvailableMediaBluetoothDeviceUpdater(mContext,
mDashboardFragment, mDevicePreferenceCallback));
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
index f6969ec..56d17f4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
@@ -52,6 +52,7 @@
@Config(shadows = {ShadowAlertDialogCompat.class})
public class BluetoothDevicePreferenceTest {
private static final boolean SHOW_DEVICES_WITHOUT_NAMES = true;
+ private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
private Context mContext;
@Mock
@@ -68,6 +69,7 @@
mContext = new ContextThemeWrapper(context, R.style.Theme_Settings);
mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
mMetricsFeatureProvider = mFakeFeatureFactory.getMetricsFeatureProvider();
+ when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice,
SHOW_DEVICES_WITHOUT_NAMES);
}
@@ -164,18 +166,6 @@
}
@Test
- public void imagingDeviceIcon_isICSettingsPrint() {
- when(mCachedBluetoothDevice.getBatteryLevel())
- .thenReturn(BluetoothDevice.BATTERY_LEVEL_UNKNOWN);
- when(mCachedBluetoothDevice.getBtClass())
- .thenReturn(new BluetoothClass(BluetoothClass.Device.Major.IMAGING));
-
- mPreference.onDeviceAttributesChanged();
- DrawableTestHelper.assertDrawableResId(mPreference.getIcon(),
- com.android.internal.R.drawable.ic_settings_print);
- }
-
- @Test
public void testVisible_showDeviceWithoutNames_visible() {
doReturn(false).when(mCachedBluetoothDevice).hasHumanReadableName();
BluetoothDevicePreference preference =
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
index b320500..24aae85 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
@@ -56,6 +56,9 @@
@Config(shadows = {ShadowBluetoothAdapter.class})
public class BluetoothDeviceUpdaterTest {
+ private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+ private static final String SUB_MAC_ADDRESS = "05:52:C7:0B:D8:3C";
+
@Mock
private DashboardFragment mDashboardFragment;
@Mock
@@ -93,6 +96,8 @@
when(mSubCachedBluetoothDevice.getDevice()).thenReturn(mSubBluetoothDevice);
when(mLocalManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
when(mCachedDeviceManager.getCachedDevicesCopy()).thenReturn(mCachedDevices);
+ when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
+ when(mSubBluetoothDevice.getAddress()).thenReturn(SUB_MAC_ADDRESS);
mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false);
mBluetoothDeviceUpdater =
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
index db4da4f..615f67a 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java
@@ -54,6 +54,9 @@
@Config(shadows = {ShadowAudioManager.class, ShadowBluetoothAdapter.class,
ShadowCachedBluetoothDeviceManager.class})
public class ConnectedBluetoothDeviceUpdaterTest {
+
+ private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+
@Mock
private DashboardFragment mDashboardFragment;
@Mock
@@ -84,6 +87,7 @@
mCachedDevices = new ArrayList<>();
when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
+ when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
mShadowCachedBluetoothDeviceManager.setCachedDevicesCopy(mCachedDevices);
mBluetoothDeviceUpdater = spy(new ConnectedBluetoothDeviceUpdater(mContext,
mDashboardFragment, mDevicePreferenceCallback));
diff --git a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
index 03c7136..ac7692d 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java
@@ -44,6 +44,8 @@
@Config(shadows = {ShadowBluetoothAdapter.class})
public class SavedBluetoothDeviceUpdaterTest {
+ private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+
@Mock
private DashboardFragment mDashboardFragment;
@Mock
@@ -64,6 +66,7 @@
mContext = RuntimeEnvironment.application;
doReturn(mContext).when(mDashboardFragment).getContext();
when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
+ when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS);
when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED);
mBluetoothDeviceUpdater = spy(new SavedBluetoothDeviceUpdater(mContext, mDashboardFragment,
diff --git a/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
index 579cba0..3f10479 100644
--- a/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
+++ b/tests/robotests/src/com/android/settings/core/HideNonSystemOverlayMixinTest.java
@@ -43,7 +43,6 @@
@Before
public void setUp() {
- RuntimeEnvironment.application.setTheme(R.style.Theme_AppCompat);
mActivityController = Robolectric.buildActivity(TestActivity.class);
}
@@ -72,6 +71,7 @@
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setTheme(R.style.Theme_AppCompat);
getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
}
}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java
index 0ee9cfc..0e7c312 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverStickyPreferenceControllerTest.java
@@ -16,11 +16,11 @@
package com.android.settings.fuelgauge.batterysaver;
-import static com.android.settings.fuelgauge.batterysaver.BatterySaverStickyPreferenceController.LOW_POWER_STICKY_AUTO_DISABLE_ENABLED;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.provider.Settings;
+import android.provider.Settings.Global;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -43,21 +43,21 @@
private int getAutoDisableSetting() {
return Settings.Global.getInt(mContext.getContentResolver(),
- LOW_POWER_STICKY_AUTO_DISABLE_ENABLED,
+ Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED,
1);
}
@Test
- public void testOnPreferenceChange_turnOnKeepActive_autoDisableOff() {
- mController.onPreferenceChange(null, true);
+ public void testOnPreferenceChange_turnOnAutoOff_autoDisableOn() {
+ mController.setChecked(true);
final int isOn = getAutoDisableSetting();
- assertThat(isOn).isEqualTo(0);
+ assertThat(isOn).isEqualTo(1);
}
@Test
- public void testOnPreferenceChange_TurnOffKeepActive_autoDisableOff() {
- mController.onPreferenceChange(null, false);
+ public void testOnPreferenceChange_TurnOffAutoOff_autoDisableOff() {
+ mController.setChecked(false);
final int isOn = getAutoDisableSetting();
- assertThat(isOn).isEqualTo(1);
+ assertThat(isOn).isEqualTo(0);
}
}
diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceControllerTest.java
index 5e6cd55..740ff2c 100644
--- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationEdgeToEdgePreferenceControllerTest.java
@@ -16,6 +16,10 @@
package com.android.settings.gestures;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+
import static com.android.settings.gestures.SystemNavigationEdgeToEdgePreferenceController.PREF_KEY_EDGE_TO_EDGE;
import static com.android.settings.gestures.SystemNavigationLegacyPreferenceController.PREF_KEY_LEGACY;
import static com.android.settings.gestures.SystemNavigationSwipeUpPreferenceController.PREF_KEY_SWIPE_UP;
@@ -24,18 +28,17 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.om.IOverlayManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
-import android.provider.Settings;
-import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.internal.R;
@@ -46,6 +49,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;
@@ -59,22 +64,24 @@
private Context mContext;
private ShadowPackageManager mPackageManager;
+ @Mock
+ private IOverlayManager mOverlayManager;
+
private SystemNavigationEdgeToEdgePreferenceController mController;
private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
@Before
public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
true);
- SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, true);
mContext = RuntimeEnvironment.application;
- Settings.Global.putInt(mContext.getContentResolver(), "prototype_enabled", 1);
-
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
- mController = new SystemNavigationEdgeToEdgePreferenceController(mContext,
+ mController = new SystemNavigationEdgeToEdgePreferenceController(mContext, mOverlayManager,
PREF_KEY_EDGE_TO_EDGE);
}
@@ -124,18 +131,30 @@
}
@Test
- public void testIsChecked_defaultIsTrue_shouldReturnTrue() {
+ public void testIsChecked_defaultIsEdgeToEdge_shouldReturnTrue() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_GESTURAL);
assertThat(mController.isChecked()).isTrue();
}
@Test
- public void testIsChecked_defaultIsFalse_shouldReturnFalse() {
- Settings.Global.putInt(mContext.getContentResolver(), "prototype_enabled", 0);
+ public void testIsChecked_defaultIsLegacy_shouldReturnFalse() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_3BUTTON);
+ assertThat(mController.isChecked()).isFalse();
+ }
+
+ @Test
+ public void testIsChecked_defaultIsSwipeUp_shouldReturnFalse() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_2BUTTON);
assertThat(mController.isChecked()).isFalse();
}
@Test
public void testIsChecked_radioButtonClicked_shouldReturnTrue() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_GESTURAL);
// Set the setting to be enabled.
mController.onRadioButtonClicked(null);
assertThat(mController.isChecked()).isTrue();
diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceControllerTest.java
index fe0a061..2c4f88a 100644
--- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationLegacyPreferenceControllerTest.java
@@ -16,6 +16,10 @@
package com.android.settings.gestures;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+
import static com.android.settings.gestures.SystemNavigationEdgeToEdgePreferenceController.PREF_KEY_EDGE_TO_EDGE;
import static com.android.settings.gestures.SystemNavigationLegacyPreferenceController.PREF_KEY_LEGACY;
import static com.android.settings.gestures.SystemNavigationSwipeUpPreferenceController.PREF_KEY_SWIPE_UP;
@@ -24,17 +28,17 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.om.IOverlayManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
-import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.internal.R;
@@ -45,6 +49,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;
@@ -58,20 +64,25 @@
private Context mContext;
private ShadowPackageManager mPackageManager;
+ @Mock
+ private IOverlayManager mOverlayManager;
+
private SystemNavigationLegacyPreferenceController mController;
private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
@Before
public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
true);
- SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, false);
mContext = RuntimeEnvironment.application;
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
- mController = new SystemNavigationLegacyPreferenceController(mContext, PREF_KEY_LEGACY);
+ mController = new SystemNavigationLegacyPreferenceController(mContext, mOverlayManager,
+ PREF_KEY_LEGACY);
}
@After
@@ -120,19 +131,32 @@
}
@Test
- public void testIsChecked_defaultIsTrue_shouldReturnTrue() {
+ public void testIsChecked_defaultIsLegacy_shouldReturnTrue() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_3BUTTON);
assertThat(mController.isChecked()).isTrue();
}
@Test
- public void testIsChecked_defaultIsFalse_shouldReturnFalse() {
+ public void testIsChecked_defaultIsSwipeUp_shouldReturnFalse() {
// Turn on the Swipe Up mode (2-buttons)
- SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, true);
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_2BUTTON);
+ assertThat(mController.isChecked()).isFalse();
+ }
+
+ @Test
+ public void testIsChecked_defaultIsEdgeToEdge_shouldReturnFalse() {
+ // Turn on the Edge to Edge
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_GESTURAL);
assertThat(mController.isChecked()).isFalse();
}
@Test
public void testIsChecked_radioButtonClicked_shouldReturnTrue() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_3BUTTON);
// Set the setting to be enabled.
mController.onRadioButtonClicked(null);
assertThat(mController.isChecked()).isTrue();
diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceControllerTest.java
index 97b4762..177d498 100644
--- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationSwipeUpPreferenceControllerTest.java
@@ -16,6 +16,10 @@
package com.android.settings.gestures;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
+import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
+
import static com.android.settings.gestures.SystemNavigationEdgeToEdgePreferenceController.PREF_KEY_EDGE_TO_EDGE;
import static com.android.settings.gestures.SystemNavigationLegacyPreferenceController.PREF_KEY_LEGACY;
import static com.android.settings.gestures.SystemNavigationSwipeUpPreferenceController.PREF_KEY_SWIPE_UP;
@@ -24,17 +28,17 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.om.IOverlayManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
-import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.internal.R;
@@ -45,6 +49,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;
@@ -58,20 +64,25 @@
private Context mContext;
private ShadowPackageManager mPackageManager;
+ @Mock
+ private IOverlayManager mOverlayManager;
+
private SystemNavigationSwipeUpPreferenceController mController;
private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
@Before
public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
true);
- SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, true);
mContext = RuntimeEnvironment.application;
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
- mController = new SystemNavigationSwipeUpPreferenceController(mContext, PREF_KEY_SWIPE_UP);
+ mController = new SystemNavigationSwipeUpPreferenceController(mContext, mOverlayManager,
+ PREF_KEY_SWIPE_UP);
}
@After
@@ -120,18 +131,30 @@
}
@Test
- public void testIsChecked_defaultIsTrue_shouldReturnTrue() {
+ public void testIsChecked_defaultIsSwipeUp_shouldReturnTrue() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_2BUTTON);
assertThat(mController.isChecked()).isTrue();
}
@Test
- public void testIsChecked_defaultIsFalse_shouldReturnFalse() {
- SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, false);
+ public void testIsChecked_defaultIsLegacy_shouldReturnFalse() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_3BUTTON);
+ assertThat(mController.isChecked()).isFalse();
+ }
+
+ @Test
+ public void testIsChecked_defaultIsEdgeToEdge_shouldReturnFalse() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_GESTURAL);
assertThat(mController.isChecked()).isFalse();
}
@Test
public void testIsChecked_radioButtonClicked_shouldReturnTrue() {
+ SettingsShadowResources.overrideResource(R.integer.config_navBarInteractionMode,
+ NAV_BAR_MODE_2BUTTON);
// Set the setting to be enabled.
mController.onRadioButtonClicked(null);
assertThat(mController.isChecked()).isTrue();
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
index ab3f4de..c551960 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
@@ -45,6 +45,7 @@
import com.android.settingslib.media.MediaOutputSliceConstants;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -59,6 +60,7 @@
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowBluetoothAdapter.class})
+@Ignore("b/129292771")
public class MediaOutputIndicatorSliceTest {
private static final String TEST_DEVICE_NAME = "test_device_name";
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorWorkerTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorWorkerTest.java
index 4a5662e..ed93258 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorWorkerTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorWorkerTest.java
@@ -37,6 +37,7 @@
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -52,6 +53,7 @@
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowBluetoothUtils.class,
ShadowBluetoothDevice.class})
+@Ignore("b/129292771")
public class MediaOutputIndicatorWorkerTest {
private static final String TEST_A2DP_DEVICE_NAME = "Test_A2DP_BT_Device_NAME";
diff --git a/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceControllerTest.java
index 78ed4b5..9957cde 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceControllerTest.java
@@ -102,13 +102,27 @@
}
@Test
- public void updateState_variant4gLte_useVariantTitle() {
- mCarrierConfig.putInt(CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT, 1);
-
+ public void updateState_variant4gLte_useVariantTitleAndSummary() {
+ mCarrierConfig.putInt(CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT, 0);
mController.updateState(mPreference);
-
assertThat(mPreference.getTitle()).isEqualTo(
- mContext.getString(R.string.enhanced_4g_lte_mode_title_variant));
+ mContext.getString(R.string.enhanced_4g_lte_mode_title));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.enhanced_4g_lte_mode_summary));
+
+ mCarrierConfig.putInt(CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT, 1);
+ mController.updateState(mPreference);
+ assertThat(mPreference.getTitle()).isEqualTo(
+ mContext.getString(R.string.enhanced_4g_lte_mode_title_advanced_calling));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.enhanced_4g_lte_mode_summary));
+
+ mCarrierConfig.putInt(CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT, 2);
+ mController.updateState(mPreference);
+ assertThat(mPreference.getTitle()).isEqualTo(
+ mContext.getString(R.string.enhanced_4g_lte_mode_title_4g_calling));
+ assertThat(mPreference.getSummary()).isEqualTo(
+ mContext.getString(R.string.enhanced_4g_lte_mode_summary_4g_calling));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/notification/AppNotificationSettingsTest.java b/tests/robotests/src/com/android/settings/notification/AppNotificationSettingsTest.java
deleted file mode 100644
index 9555a56..0000000
--- a/tests/robotests/src/com/android/settings/notification/AppNotificationSettingsTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.android.settings.notification;
-
-import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.view.Window;
-import android.view.WindowManager;
-
-import androidx.fragment.app.FragmentActivity;
-import androidx.fragment.app.FragmentManager;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-
-@RunWith(RobolectricTestRunner.class)
-public class AppNotificationSettingsTest {
-
- private WindowManager.LayoutParams mLayoutParams;
- private AppNotificationSettings mFragment;
- private FragmentActivity mActivity;
- @Mock
- private Window mWindow;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mLayoutParams = new WindowManager.LayoutParams();
- mActivity = spy(Robolectric.setupActivity(FragmentActivity.class));
- mFragment = spy(new AppNotificationSettings());
- when(mFragment.getActivity()).thenReturn(mActivity);
- when(mFragment.getFragmentManager()).thenReturn(mock(FragmentManager.class));
- when(mActivity.getWindow()).thenReturn(mWindow);
- when(mWindow.getAttributes()).thenReturn(mLayoutParams);
- }
-
- @Test
- @Config(shadows = {ShadowNotificationSettingsBase.class})
- public void onResume_shouldHideSystemOverlay() {
- mFragment.onResume();
-
- verify(mWindow).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
- }
-
- @Test
- @Config(shadows = {ShadowNotificationSettingsBase.class})
- public void onPause_shouldRemoveHideSystemOverlay() {
- mFragment.onResume();
-
- verify(mWindow).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
-
- mFragment.onPause();
-
- // There's no Window.clearPrivateFlags() method, so the Window.attributes are updated.
- ArgumentCaptor<WindowManager.LayoutParams> paramCaptor = ArgumentCaptor.forClass(
- WindowManager.LayoutParams.class);
- verify(mWindow).setAttributes(paramCaptor.capture());
- assertEquals(0,
- paramCaptor.getValue().privateFlags
- & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
- }
-
- @Implements(NotificationSettingsBase.class)
- public static class ShadowNotificationSettingsBase {
-
- protected void __constructor__() {
- // Do nothing
- }
-
- @Implementation
- protected void onResume() {
- // No-op.
- }
-
- @Implementation
- protected void onPause() {
- // No-op.
- }
- }
-}
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
index 3509d75..4bc8374 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
@@ -32,6 +32,7 @@
import com.google.android.setupdesign.GlifLayout;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
@@ -92,6 +93,7 @@
@Config(qualifiers = "sw400dp")
@Test
+ @Ignore("b/129342100")
public void fingerprintExtraSet_shouldDisplayFingerprintIcon() {
ChooseLockPattern activity = createActivity(true);
ChooseLockPatternFragment fragment = (ChooseLockPatternFragment)
diff --git a/tests/robotests/src/com/android/settings/widget/AppCheckBoxPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/AppCheckBoxPreferenceTest.java
index 57c6e01..6340b16 100644
--- a/tests/robotests/src/com/android/settings/widget/AppCheckBoxPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/AppCheckBoxPreferenceTest.java
@@ -35,8 +35,6 @@
@RunWith(RobolectricTestRunner.class)
public class AppCheckBoxPreferenceTest {
- private static final String SUMMARY = "summary info";
-
private Context mContext;
private AppCheckBoxPreference mPreference;
private AppCheckBoxPreference mAttrPreference;
@@ -58,26 +56,6 @@
}
@Test
- public void onBindViewHolder_noSummary_layoutGone() {
- mPreference.setSummary("");
-
- mPreference.onBindViewHolder(mPreferenceViewHolder);
-
- assertThat(mPreferenceViewHolder.findViewById(R.id.summary_container).getVisibility())
- .isEqualTo(View.GONE);
- }
-
- @Test
- public void onBindViewHolder_hasSummary_layoutVisible() {
- mPreference.setSummary(SUMMARY);
-
- mPreference.onBindViewHolder(mPreferenceViewHolder);
-
- assertThat(mPreferenceViewHolder.findViewById(R.id.summary_container).getVisibility())
- .isEqualTo(View.VISIBLE);
- }
-
- @Test
public void onBindViewHolder_appendixGone() {
mPreference.onBindViewHolder(mPreferenceViewHolder);
diff --git a/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java
deleted file mode 100644
index aa5e3e7..0000000
--- a/tests/robotests/src/com/android/settings/widget/AppSwitchPreferenceTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2017 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.widget;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-import android.view.View;
-
-import androidx.preference.PreferenceViewHolder;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class AppSwitchPreferenceTest {
-
- private Context mContext;
- private View mRootView;
- private AppSwitchPreference mPref;
- private PreferenceViewHolder mHolder;
-
- @Before
- public void setUp() {
- mContext = RuntimeEnvironment.application;
- mRootView = View.inflate(mContext, R.layout.preference_app, null /* parent */);
- mHolder = PreferenceViewHolder.createInstanceForTests(mRootView);
- mPref = new AppSwitchPreference(mContext);
- }
-
- @Test
- public void setSummary_showSummaryContainer() {
- mPref.setSummary("test");
- mPref.onBindViewHolder(mHolder);
-
- assertThat(mHolder.findViewById(R.id.summary_container).getVisibility())
- .isEqualTo(View.VISIBLE);
- }
-
- @Test
- public void noSummary_hideSummaryContainer() {
- mPref.setSummary(null);
- mPref.onBindViewHolder(mHolder);
-
- assertThat(mHolder.findViewById(R.id.summary_container).getVisibility())
- .isEqualTo(View.GONE);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingDisclaimerFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingDisclaimerFragmentTest.java
index 6c221e7..25fa737 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingDisclaimerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingDisclaimerFragmentTest.java
@@ -35,6 +35,7 @@
import android.view.ViewGroup;
import android.widget.Button;
+import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.OnScrollListener;
@@ -60,7 +61,7 @@
public class WifiCallingDisclaimerFragmentTest {
@Mock
- private Activity mActivity;
+ private FragmentActivity mActivity;
@Mock
private DisclaimerItem mDisclaimerItem;
@Mock
@@ -89,7 +90,7 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
- mActivity = Robolectric.setupActivity(Activity.class);
+ mActivity = Robolectric.setupActivity(FragmentActivity.class);
mFragment = spy(new WifiCallingDisclaimerFragment());
doReturn(mActivity).when(mFragment).getActivity();
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
index 574d0d6..947d618 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -77,6 +77,7 @@
import com.android.settingslib.wifi.AccessPoint;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -98,6 +99,7 @@
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowDevicePolicyManager.class, ShadowEntityHeaderController.class})
+@Ignore("b/129292549")
public class WifiDetailPreferenceControllerTest {
private static final int LEVEL = 1;
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
index 75a9e11..e9f35d8 100644
--- a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
@@ -139,7 +139,7 @@
private AccessPoint createAccessPoint(String name, boolean active, boolean reachable) {
final AccessPoint accessPoint = mock(AccessPoint.class);
- doReturn(name).when(accessPoint).getConfigName();
+ doReturn(name).when(accessPoint).getTitle();
doReturn(active).when(accessPoint).isActive();
doReturn(reachable).when(accessPoint).isReachable();
if (active) {