Merge "Handle null case in AppStateAppOpsBridge"
diff --git a/res/layout/contextual_slice_full_tile.xml b/res/layout/contextual_slice_full_tile.xml
index 1438cfb..4b1155e 100644
--- a/res/layout/contextual_slice_full_tile.xml
+++ b/res/layout/contextual_slice_full_tile.xml
@@ -21,23 +21,17 @@
android:layout_height="wrap_content"
style="@style/ContextualCardStyle">
- <FrameLayout
+ <include layout="@layout/dismissal_swipe_background"/>
+
+ <androidx.slice.widget.SliceView
+ android:id="@+id/slice_view"
+ android:theme="@style/Theme.Settings.ContextualCard"
+ style="@style/ContextualCardSliceViewStyle"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="wrap_content"
+ android:importantForAccessibility="no"/>
- <include layout="@layout/dismissal_swipe_background"/>
+ <!--dismissal view-->
+ <include layout="@layout/contextual_card_dismissal_view"/>
- <androidx.slice.widget.SliceView
- android:id="@+id/slice_view"
- android:theme="@style/Theme.Settings.ContextualCard"
- style="@style/ContextualCardSliceViewStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:importantForAccessibility="no"/>
-
- <!--dismissal view-->
- <include layout="@layout/contextual_card_dismissal_view"/>
-
- </FrameLayout>
</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
diff --git a/res/layout/contextual_slice_sticky_tile.xml b/res/layout/contextual_slice_sticky_tile.xml
index 117732d..734697f 100644
--- a/res/layout/contextual_slice_sticky_tile.xml
+++ b/res/layout/contextual_slice_sticky_tile.xml
@@ -15,11 +15,12 @@
limitations under the License.
-->
-<com.google.android.material.card.MaterialCardView
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- style="@style/ContextualCardStyle">
+ android:orientation="vertical"
+ style="@style/StickyCardStyle">
<androidx.slice.widget.SliceView
android:id="@+id/slice_view"
@@ -27,7 +28,9 @@
style="@style/ContextualCardSliceViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
+ android:layout_marginBottom="@dimen/contextual_card_vertical_margin"
android:importantForAccessibility="no"/>
-</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
+ <include layout="@layout/horizontal_divider"/>
+
+</LinearLayout>
diff --git a/res/layout/notification_history_app_layout.xml b/res/layout/notification_history_app_layout.xml
index 84fe91b..4c899e6 100644
--- a/res/layout/notification_history_app_layout.xml
+++ b/res/layout/notification_history_app_layout.xml
@@ -47,7 +47,7 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:paddingStart="8dp" />
</LinearLayout>
<TextView
@@ -56,9 +56,8 @@
android:layout_width="wrap_content"
android:paddingStart="6dp"
android:layout_gravity="center_vertical"
- android:fontFamily="sans-serif-medium"
android:paddingTop="8dp"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"/>
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"/>
</LinearLayout>
<ImageButton
android:id="@+id/expand"
diff --git a/res/layout/notification_history_log_row.xml b/res/layout/notification_history_log_row.xml
index 748e134..136af38 100644
--- a/res/layout/notification_history_log_row.xml
+++ b/res/layout/notification_history_log_row.xml
@@ -40,8 +40,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
- android:fontFamily="sans-serif-medium"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
android:textAlignment="viewStart"/>
<ImageView
@@ -65,8 +64,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
- android:textColor="?android:attr/textColorPrimary"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAlignment="viewEnd"
/>
</RelativeLayout>
@@ -79,8 +77,7 @@
android:ellipsize="end"
android:singleLine="true"
android:paddingTop="3dp"
- android:textColor="?android:attr/textColorPrimary"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAlignment="viewStart" />
</LinearLayout>
diff --git a/res/layout/notification_sbn_log_row.xml b/res/layout/notification_sbn_log_row.xml
index 39b918d..e94150d 100644
--- a/res/layout/notification_sbn_log_row.xml
+++ b/res/layout/notification_sbn_log_row.xml
@@ -95,8 +95,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
- android:textColor="?android:attr/textColorPrimary"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAlignment="viewEnd"
/>
</RelativeLayout>
@@ -116,7 +115,7 @@
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
- android:textColor="?android:attr/textColorPrimary"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
android:textAlignment="viewStart"
/>
@@ -127,8 +126,7 @@
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
- android:textColor="?android:attr/textColorPrimary"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAlignment="viewStart"
/>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 272020d..c32d557 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3750,6 +3750,14 @@
<!-- Tethering controls, footer note displayed when tethering is disabled because Data Saver mode is on [CHAR LIMIT=none]-->
<string name="tether_settings_disabled_on_data_saver">"Can\u2019t tether or use portable hotspots while Data Saver is on"</string>
+ <!-- Disable Wifi Hotspot option-->
+ <!-- Don't use Wi-Fi hotspot summary when USB tethering is chosen [CHAR LIMIT=NONE]-->
+ <string name="disable_wifi_hotspot_when_usb_on">Only share internet via USB</string>
+ <!-- Don't use Wi-Fi hotspot summary when Bluetooth tethering is chosen [CHAR LIMIT=NONE]-->
+ <string name="disable_wifi_hotspot_when_bluetooth_on">Only share internet via Bluetooth</string>
+ <!-- Don't use Wi-Fi hotspot summary when USB tethering and Bluetooth tethering are chosen [CHAR LIMIT=NONE]-->
+ <string name="disable_wifi_hotspot_when_usb_and_bluetooth_on">Only share internet via USB and Bluetooth</string>
+
<!-- USB Tethering options -->
<string name="usb_title">USB</string>
<string name="usb_tethering_button_text">USB tethering</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 02998ae..9816e07 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -423,6 +423,12 @@
<item name="rippleColor">?android:attr/colorControlHighlight</item>
</style>
+ <style name="StickyCardStyle">
+ <item name="android:layout_marginBottom">@dimen/contextual_card_vertical_margin</item>
+ <item name="android:layout_marginStart">@dimen/contextual_card_side_margin</item>
+ <item name="android:layout_marginEnd">@dimen/contextual_card_side_margin</item>
+ </style>
+
<style name="SearchBarStyle">
<item name="android:layout_margin">@dimen/search_bar_margin</item>
<item name="cardCornerRadius">@*android:dimen/config_dialogCornerRadius</item>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index b7b88ed..914cc7a 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -24,8 +24,7 @@
android:fragment="com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment"
android:key="accessibility_shortcut_preference"
android:persistent="false"
- android:title="@string/accessibility_global_gesture_preference_title"
- settings:controller="com.android.settings.accessibility.AccessibilityShortcutPreferenceController"/>
+ android:title="@string/accessibility_global_gesture_preference_title" />
<PreferenceCategory
android:key="user_installed_services_category"
diff --git a/res/xml/accessibility_shortcut_settings.xml b/res/xml/accessibility_shortcut_settings.xml
index 0bfd6b6..7708551 100644
--- a/res/xml/accessibility_shortcut_settings.xml
+++ b/res/xml/accessibility_shortcut_settings.xml
@@ -17,11 +17,6 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/accessibility_global_gesture_preference_title">
- <Preference
- android:fragment="com.android.settings.accessibility.ShortcutServicePickerFragment"
- android:key="accessibility_shortcut_service"
- android:title="@string/accessibility_shortcut_service_title" />
-
<SwitchPreference
android:key="accessibility_shortcut_on_lock_screen"
android:title="@string/accessibility_shortcut_service_on_lock_screen_title" />
diff --git a/res/xml/all_tether_prefs.xml b/res/xml/all_tether_prefs.xml
index bc3471b..d16adc5 100644
--- a/res/xml/all_tether_prefs.xml
+++ b/res/xml/all_tether_prefs.xml
@@ -74,6 +74,7 @@
<SwitchPreference
android:key="disable_wifi_tethering"
android:title="Don't use Wi-Fi hotspot"
+ android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.network.WifiTetherDisablePreferenceController"
settings:keywords="@string/keywords_hotspot_tethering" />
</PreferenceCategory>
diff --git a/res/xml/connected_devices_advanced.xml b/res/xml/connected_devices_advanced.xml
index ba62380..bd8f1dd 100644
--- a/res/xml/connected_devices_advanced.xml
+++ b/res/xml/connected_devices_advanced.xml
@@ -21,7 +21,7 @@
<Preference
android:fragment="com.android.settings.connecteddevice.BluetoothDashboardFragment"
- android:key="bluetooth_settings"
+ android:key="bluetooth_switchbar_screen"
android:title="@string/bluetooth_settings_title"
android:icon="@*android:drawable/ic_settings_bluetooth"
android:order="-9"/>
diff --git a/res/xml/development_tile_settings.xml b/res/xml/development_tile_settings.xml
index e5bfbbf..558535fe 100644
--- a/res/xml/development_tile_settings.xml
+++ b/res/xml/development_tile_settings.xml
@@ -18,5 +18,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="development_tile_settings"
android:title="@string/quick_settings_developer_tiles"
+ settings:searchable="false"
settings:controller="com.android.settings.development.qstile.DevelopmentTilePreferenceController" />
diff --git a/res/xml/device_admin_settings.xml b/res/xml/device_admin_settings.xml
index 9a48761..6fbc139 100644
--- a/res/xml/device_admin_settings.xml
+++ b/res/xml/device_admin_settings.xml
@@ -19,6 +19,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/manage_device_admin"
+ android:key="device_admin_settings"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminListPreferenceController">
<com.android.settingslib.widget.FooterPreference
diff --git a/res/xml/network_and_internet.xml b/res/xml/network_and_internet.xml
index c57c5b0..7653746 100644
--- a/res/xml/network_and_internet.xml
+++ b/res/xml/network_and_internet.xml
@@ -30,7 +30,7 @@
<com.android.settings.widget.MasterSwitchPreference
android:fragment="com.android.settings.wifi.WifiSettings"
- android:key="toggle_wifi"
+ android:key="main_toggle_wifi"
android:title="@string/wifi_settings"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_settings_wireless"
diff --git a/res/xml/notification_access_settings.xml b/res/xml/notification_access_settings.xml
index ca84f1b..43f7c49 100644
--- a/res/xml/notification_access_settings.xml
+++ b/res/xml/notification_access_settings.xml
@@ -18,5 +18,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="notification_access_screen"
android:title="@string/manage_notification_access_title"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessScreenPreferenceController" />
diff --git a/res/xml/picture_in_picture_settings.xml b/res/xml/picture_in_picture_settings.xml
index 1f08246..c9e3a3f 100644
--- a/res/xml/picture_in_picture_settings.xml
+++ b/res/xml/picture_in_picture_settings.xml
@@ -18,5 +18,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="picture_in_picture_screen"
android:title="@string/picture_in_picture_title"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureScreenPreferenceController" />
diff --git a/res/xml/premium_sms_settings.xml b/res/xml/premium_sms_settings.xml
index 82aece3..ede6057 100644
--- a/res/xml/premium_sms_settings.xml
+++ b/res/xml/premium_sms_settings.xml
@@ -18,5 +18,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="premium_sms_screen"
android:title="@string/premium_sms_access"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.premiumsms.PremiumSmsScreenPreferenceController" />
diff --git a/res/xml/trust_agent_settings.xml b/res/xml/trust_agent_settings.xml
index 88837b8..25b3139 100644
--- a/res/xml/trust_agent_settings.xml
+++ b/res/xml/trust_agent_settings.xml
@@ -17,6 +17,8 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="trust_agents"
android:title="@string/manage_trust_agents"
+ settings:searchable="false"
settings:controller="com.android.settings.security.trustagent.TrustAgentsPreferenceController">
</PreferenceScreen>
diff --git a/res/xml/user_dictionary_list_fragment.xml b/res/xml/user_dictionary_list_fragment.xml
index 2f921a0..2565a1a 100644
--- a/res/xml/user_dictionary_list_fragment.xml
+++ b/res/xml/user_dictionary_list_fragment.xml
@@ -17,7 +17,9 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="user_dict_list"
android:title="@string/user_dict_settings_title"
+ settings:searchable="false"
settings:controller="com.android.settings.inputmethod.UserDictionaryListPreferenceController">
</PreferenceScreen>
diff --git a/res/xml/vr_listeners_settings.xml b/res/xml/vr_listeners_settings.xml
index a35b987..d9b364c 100644
--- a/res/xml/vr_listeners_settings.xml
+++ b/res/xml/vr_listeners_settings.xml
@@ -18,5 +18,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="vr_listener_settings"
android:title="@string/vr_listeners_title"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.vrlistener.VrListenerScreenPreferenceController" />
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index 2dbfd62..de89e3c 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -51,7 +51,6 @@
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
-import com.android.internal.telephony.TelephonyIntents;
import com.android.settings.network.ProxySubscriptionManager;
import java.util.List;
@@ -143,7 +142,7 @@
private final BroadcastReceiver mSimStateReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
- if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(action)) {
+ if (Intent.ACTION_SIM_STATE_CHANGED.equals(action)) {
mHandler.sendMessage(mHandler.obtainMessage(MSG_SIM_STATE_CHANGED));
}
}
@@ -293,7 +292,7 @@
// ACTION_SIM_STATE_CHANGED is sticky, so we'll receive current state after this call,
// which will call updatePreferences().
- final IntentFilter filter = new IntentFilter(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
+ final IntentFilter filter = new IntentFilter(Intent.ACTION_SIM_STATE_CHANGED);
getContext().registerReceiver(mSimStateReceiver, filter);
if (mDialogState != OFF_MODE) {
diff --git a/src/com/android/settings/TestingSettingsBroadcastReceiver.java b/src/com/android/settings/TestingSettingsBroadcastReceiver.java
index 2172cd0..0e1296b 100644
--- a/src/com/android/settings/TestingSettingsBroadcastReceiver.java
+++ b/src/com/android/settings/TestingSettingsBroadcastReceiver.java
@@ -1,22 +1,21 @@
package com.android.settings;
-import static com.android.internal.telephony.TelephonyIntents.SECRET_CODE_ACTION;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.telephony.TelephonyManager;
import com.android.settings.Settings.TestingSettingsActivity;
public class TestingSettingsBroadcastReceiver extends BroadcastReceiver {
-
+
public TestingSettingsBroadcastReceiver() {
}
-
+
@Override
public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(SECRET_CODE_ACTION)) {
+ if (intent.getAction().equals(TelephonyManager.ACTION_SECRET_CODE)) {
Intent i = new Intent(Intent.ACTION_MAIN);
i.setClass(context, TestingSettingsActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 1722c99..9793e85 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -31,7 +31,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.UserHandle;
-import android.provider.DeviceConfig;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -121,8 +120,6 @@
// presentation.
private static final long DELAY_UPDATE_SERVICES_MILLIS = 1000;
- static final String RAMPING_RINGER_ENABLED = "ramping_ringer_enabled";
-
private final Handler mHandler = new Handler();
private final Runnable mUpdateRunnable = new Runnable() {
@@ -273,11 +270,8 @@
@VisibleForTesting
static boolean isRampingRingerEnabled(final Context context) {
- return (Settings.Global.getInt(
- context.getContentResolver(),
- Settings.Global.APPLY_RAMPING_RINGER, 0) == 1)
- && DeviceConfig.getBoolean(
- DeviceConfig.NAMESPACE_TELEPHONY, RAMPING_RINGER_ENABLED, false);
+ return Settings.Global.getInt(
+ context.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 0) == 1;
}
private void initializeAllPreferences() {
diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceController.java
deleted file mode 100644
index af0a99f..0000000
--- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceController.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.os.UserHandle;
-import android.view.accessibility.AccessibilityManager;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-import com.android.settingslib.accessibility.AccessibilityUtils;
-
-public class AccessibilityShortcutPreferenceController extends BasePreferenceController {
- public AccessibilityShortcutPreferenceController(Context context, String preferenceKey) {
- super(context, preferenceKey);
- }
-
- @Override
- public int getAvailabilityStatus() {
- return AccessibilityManager
- .getInstance(mContext).getInstalledAccessibilityServiceList().isEmpty()
- ? DISABLED_DEPENDENT_SETTING : AVAILABLE;
- }
-
- @Override
- public CharSequence getSummary() {
- if (AccessibilityManager.getInstance(mContext)
- .getInstalledAccessibilityServiceList().isEmpty()) {
- return mContext.getString(R.string.accessibility_no_services_installed);
- } else {
- final boolean shortcutEnabled =
- AccessibilityUtils.isShortcutEnabled(mContext, UserHandle.myUserId());
- return shortcutEnabled
- ? AccessibilityShortcutPreferenceFragment.getServiceName(mContext)
- : mContext.getString(R.string.accessibility_feature_state_off);
- }
- }
-}
diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
index 659eaca..ca3c2e8 100644
--- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
@@ -50,10 +50,8 @@
public class AccessibilityShortcutPreferenceFragment extends ToggleFeaturePreferenceFragment
implements Indexable {
- public static final String SHORTCUT_SERVICE_KEY = "accessibility_shortcut_service";
public static final String ON_LOCK_SCREEN_KEY = "accessibility_shortcut_on_lock_screen";
- private Preference mServicePreference;
private SwitchPreference mOnLockScreenSwitchPreference;
private final ContentObserver mContentObserver = new ContentObserver(new Handler()) {
@Override
@@ -75,8 +73,6 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- mServicePreference = findPreference(SHORTCUT_SERVICE_KEY);
mOnLockScreenSwitchPreference = (SwitchPreference) findPreference(ON_LOCK_SCREEN_KEY);
mOnLockScreenSwitchPreference.setOnPreferenceChangeListener((Preference p, Object o) -> {
Settings.Secure.putInt(getContentResolver(),
@@ -94,7 +90,7 @@
preferenceScreen.findPreference(KEY_GENERAL_CATEGORY).setVisible(false);
preferenceScreen.setOrderingAsAdded(false);
- mToggleServiceDividerSwitchPreference.setOrder(mServicePreference.getOrder() - 1);
+ mToggleServiceDividerSwitchPreference.setVisible(false);
}
@Override
@@ -118,56 +114,13 @@
}
@Override
- protected void onRemoveSwitchPreferenceToggleSwitch() {
- super.onRemoveSwitchPreferenceToggleSwitch();
- mToggleServiceDividerSwitchPreference.setOnPreferenceClickListener(null);
- }
-
- @Override
- protected void onInstallSwitchPreferenceToggleSwitch() {
- super.onInstallSwitchPreferenceToggleSwitch();
- mToggleServiceDividerSwitchPreference.setOnPreferenceClickListener((preference) -> {
- boolean enabled = ((SwitchPreference) preference).isChecked();
- Context context = getContext();
- if (enabled && !shortcutFeatureAvailable(context)) {
- // If no service is configured, we'll disable the shortcut shortly. Give the user
- // a chance to select a service. We'll update the preferences when we resume.
- Settings.Secure.putInt(getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, ON);
- mServicePreference.setEnabled(true);
- mServicePreference.performClick();
- } else {
- onPreferenceToggled(Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, enabled);
- }
- return true;
- });
- }
-
- @Override
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
Settings.Secure.putInt(getContentResolver(), preferenceKey, enabled ? ON : OFF);
updatePreferences();
}
- @Override
- protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
- final String switchBarText = getString(R.string.accessibility_service_master_switch_title,
- getString(R.string.accessibility_global_gesture_preference_title));
- switchPreference.setTitle(switchBarText);
- }
-
private void updatePreferences() {
ContentResolver cr = getContentResolver();
- Context context = getContext();
- mServicePreference.setSummary(getServiceName(context));
- if (!shortcutFeatureAvailable(context)) {
- // If no service is configured, make sure the overall shortcut is turned off
- Settings.Secure.putInt(
- getContentResolver(), Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, OFF);
- }
- boolean isEnabled = Settings.Secure
- .getInt(cr, Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, ON) == ON;
- mToggleServiceDividerSwitchPreference.setChecked(isEnabled);
// The shortcut is enabled by default on the lock screen as long as the user has
// enabled the shortcut with the warning dialog
final int dialogShown = Settings.Secure.getInt(
@@ -175,9 +128,6 @@
final boolean enabledFromLockScreen = Settings.Secure.getInt(
cr, Settings.Secure.ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, dialogShown) == ON;
mOnLockScreenSwitchPreference.setChecked(enabledFromLockScreen);
- // Only enable changing the service and lock screen behavior if the shortcut is on
- mServicePreference.setEnabled(mToggleServiceDividerSwitchPreference.isChecked());
- mOnLockScreenSwitchPreference.setEnabled(mToggleServiceDividerSwitchPreference.isChecked());
}
/**
@@ -214,8 +164,7 @@
return getServiceInfo(context) != null;
}
- private static @Nullable
- ComponentName getShortcutComponent(Context context) {
+ private static @Nullable ComponentName getShortcutComponent(Context context) {
String componentNameString = AccessibilityUtils.getShortcutTargetServiceComponentNameString(
context, UserHandle.myUserId());
if (componentNameString == null) return null;
diff --git a/src/com/android/settings/accessibility/ShortcutPreference.java b/src/com/android/settings/accessibility/ShortcutPreference.java
index 84ced68..2a62439 100644
--- a/src/com/android/settings/accessibility/ShortcutPreference.java
+++ b/src/com/android/settings/accessibility/ShortcutPreference.java
@@ -53,7 +53,7 @@
}
private OnClickListener mListener = null;
- private static final float DISABLED_ALPHA = 0.5f;
+ private static final float DISABLED_ALPHA = 0.77f;
private static final float ENABLED_ALPHA = 1.0f;
private int mSettingsVisibility = View.VISIBLE;
private boolean mAutoEnabledSettings;
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 0f7a8c2..eb6515e 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -410,7 +410,7 @@
mApplications.mHasReceivedBridgeCallback =
savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
}
- int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
+ int userId = mIsWorkOnly ? mWorkUserId : UserHandle.myUserId();
if (mStorageType == STORAGE_TYPE_MUSIC) {
Context context = getContext();
mApplications.setExtraViewController(
diff --git a/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java b/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java
index 128f4da..0f429c7 100644
--- a/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java
+++ b/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceController.java
@@ -83,7 +83,7 @@
final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
synchronized (mBluetoothA2dpConfigStore) {
if (mBluetoothA2dp != null) {
- setCodecConfigPreference(mBluetoothA2dp.getActiveDevice(), codecConfig);
+ setCodecConfigPreference(null, codecConfig); // Use current active device
}
}
// Because the setting is not persisted into permanent storage, we cannot call update state
@@ -102,14 +102,13 @@
@Override
public void updateState(Preference preference) {
- BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
- if (getCodecConfig(activeDevice) == null || mPreference == null) {
+ if (getCodecConfig(null) == null || mPreference == null) { // Use current active device
return;
}
BluetoothCodecConfig codecConfig;
synchronized (mBluetoothA2dpConfigStore) {
- codecConfig = getCodecConfig(activeDevice);
+ codecConfig = getCodecConfig(null); // Use current active device
}
final int index = getCurrentA2dpSettingIndex(codecConfig);
diff --git a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
index 6f1eab0..71907b6 100644
--- a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
@@ -80,7 +80,7 @@
}
writeConfigurationValues(index);
final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
- bluetoothA2dp.setCodecConfigPreference(bluetoothA2dp.getActiveDevice(), codecConfig);
+ bluetoothA2dp.setCodecConfigPreference(null, codecConfig);
mPreference.setSummary(((BaseBluetoothDialogPreference) mPreference).generateSummary(
index));
}
@@ -146,8 +146,7 @@
if (bluetoothA2dp == null) {
return null;
}
- final BluetoothCodecStatus codecStatus =
- bluetoothA2dp.getCodecStatus(bluetoothA2dp.getActiveDevice());
+ final BluetoothCodecStatus codecStatus = bluetoothA2dp.getCodecStatus(null);
if (codecStatus == null) {
Log.d(TAG, "Unable to get current codec config. Codec status is null");
return null;
@@ -178,8 +177,7 @@
* @return {@link BluetoothCodecConfig}.
*/
protected BluetoothCodecConfig getSelectableByCodecType(int codecTypeValue) {
- final BluetoothCodecConfig[] configs = getSelectableConfigs(
- mBluetoothA2dp.getActiveDevice());
+ final BluetoothCodecConfig[] configs = getSelectableConfigs(null);
if (configs == null) {
Log.d(TAG, "Unable to get selectable config. Selectable configs is empty.");
return null;
diff --git a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java
index 8eecec9..c2977a8 100644
--- a/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceController.java
@@ -83,9 +83,9 @@
return index;
}
// Check HD audio is enabled, display the available list.
- if (bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
+ if (bluetoothA2dp.getOptionalCodecsEnabled(activeDevice)
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED) {
- BluetoothCodecConfig[] configs = getSelectableConfigs(bluetoothA2dp.getActiveDevice());
+ BluetoothCodecConfig[] configs = getSelectableConfigs(null);
if (configs != null) {
return getIndexFromConfig(configs);
}
@@ -101,8 +101,7 @@
int codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
switch (index) {
case 0:
- codecTypeValue = getHighestCodec(getSelectableConfigs(
- mBluetoothA2dp.getActiveDevice()));
+ codecTypeValue = getHighestCodec(getSelectableConfigs(null));
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
break;
case 1:
diff --git a/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceController.java b/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceController.java
index 714b9ab..8008188 100644
--- a/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceController.java
@@ -58,11 +58,11 @@
mPreference.setEnabled(false);
return;
}
- final boolean supported = (bluetoothA2dp.isOptionalCodecsSupported(activeDevice)
+ final boolean supported = (bluetoothA2dp.supportsOptionalCodecs(activeDevice)
== BluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
mPreference.setEnabled(supported);
if (supported) {
- final boolean isEnabled = bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
+ final boolean isEnabled = bluetoothA2dp.getOptionalCodecsEnabled(activeDevice)
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED;
((SwitchPreference) mPreference).setChecked(isEnabled);
}
diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
index f87ff33..c2a0b62 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
@@ -20,7 +20,6 @@
import static com.android.settings.dashboard.profileselector.ProfileSelectFragment.WORK_TAB;
import android.app.settings.SettingsEnums;
-import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -173,7 +172,7 @@
if (intent != null) {
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
- launchIntent(intent);
+ Utils.launchIntent(mFragment, intent);
return true;
}
@@ -467,24 +466,6 @@
}
}
- private void launchIntent(Intent intent) {
- try {
- final int userId = intent.getIntExtra(Intent.EXTRA_USER_ID, -1);
-
- // b/33117269: Note that launchIntent may launch activity in different task which set
- // different launchMode (e.g. Files), using startActivityForesult to set task as
- // source task, and set requestCode as 0 means don't care about returnCode currently.
- if (userId == -1) {
- mFragment.startActivityForResult(intent, 0 /* requestCode not used */);
- } else {
- mFragment.getActivity().startActivityForResultAsUser(intent,
- 0 /* requestCode not used */, new UserHandle(userId));
- }
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "No activity found for " + intent);
- }
- }
-
private static long totalValues(StorageMeasurement.MeasurementDetails details, int userId,
String... keys) {
long total = 0;
diff --git a/src/com/android/settings/homepage/contextualcards/conditional/ConditionHeaderContextualCardRenderer.java b/src/com/android/settings/homepage/contextualcards/conditional/ConditionHeaderContextualCardRenderer.java
index c5e987a..6fba85e 100644
--- a/src/com/android/settings/homepage/contextualcards/conditional/ConditionHeaderContextualCardRenderer.java
+++ b/src/com/android/settings/homepage/contextualcards/conditional/ConditionHeaderContextualCardRenderer.java
@@ -59,7 +59,7 @@
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(
mContext).getMetricsFeatureProvider();
view.icons.removeAllViews();
- headerCard.getConditionalCards().stream().forEach(card -> {
+ headerCard.getConditionalCards().forEach(card -> {
final ImageView icon = (ImageView) LayoutInflater.from(mContext).inflate(
R.layout.conditional_card_header_icon, view.icons, false);
icon.setImageDrawable(card.getIconDrawable());
diff --git a/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java b/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java
index 6f07d47..05531d6 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRenderer.java
@@ -166,7 +166,7 @@
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
public void onStop() {
- mFlippedCardSet.stream().forEach(holder -> resetCardView(holder));
+ mFlippedCardSet.forEach(holder -> resetCardView(holder));
mFlippedCardSet.clear();
}
diff --git a/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java b/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java
index 3f35fb5..f634d43 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/SliceFullCardRendererHelper.java
@@ -16,6 +16,8 @@
package com.android.settings.homepage.contextualcards.slices;
+import static com.android.settings.homepage.contextualcards.slices.SliceContextualCardRenderer.VIEW_TYPE_STICKY;
+
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.view.View;
@@ -75,7 +77,9 @@
// Customize slice view for Settings
cardHolder.sliceView.setShowTitleItems(true);
if (card.isLargeCard()) {
- cardHolder.sliceView.setShowHeaderDivider(true);
+ if (holder.getItemViewType() != VIEW_TYPE_STICKY) {
+ cardHolder.sliceView.setShowHeaderDivider(true);
+ }
cardHolder.sliceView.setShowActionDividers(true);
}
}
diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java
index 8e6da80..3c9999e 100644
--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -104,7 +104,7 @@
}
private void addRow(MediaDevice device, MediaDevice connectedDevice, ListBuilder listBuilder) {
- if (TextUtils.equals(device.getId(), connectedDevice.getId())) {
+ if (connectedDevice != null && TextUtils.equals(device.getId(), connectedDevice.getId())) {
listBuilder.addInputRange(getActiveDeviceHeaderRow(device));
} else {
listBuilder.addRow(getMediaDeviceRow(device));
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 2bc97e6..71d7066 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -150,13 +150,5 @@
null /* metricsFeatureProvider */, null /* fragment */,
null /* mobilePlanHost */);
}
-
- @Override
- public List<String> getNonIndexableKeys(Context context) {
- List<String> keys = super.getNonIndexableKeys(context);
- // Remove master switch as a result
- keys.add(WifiMasterSwitchPreferenceController.KEY_TOGGLE_WIFI);
- return keys;
- }
};
}
diff --git a/src/com/android/settings/network/WifiTetherDisablePreferenceController.java b/src/com/android/settings/network/WifiTetherDisablePreferenceController.java
index a7242cf..32f841d 100644
--- a/src/com/android/settings/network/WifiTetherDisablePreferenceController.java
+++ b/src/com/android/settings/network/WifiTetherDisablePreferenceController.java
@@ -30,6 +30,7 @@
import androidx.preference.SwitchPreference;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.TetherUtil;
@@ -95,8 +96,14 @@
@Override
public CharSequence getSummary() {
- // TODO(b/146818850): Update summary accordingly.
- return super.getSummary();
+ if (mUSBTetherEnabled && mBluetoothTetherEnabled) {
+ return mContext.getString(R.string.disable_wifi_hotspot_when_usb_and_bluetooth_on);
+ } else if (mUSBTetherEnabled) {
+ return mContext.getString(R.string.disable_wifi_hotspot_when_usb_on);
+ } else if (mBluetoothTetherEnabled) {
+ return mContext.getString(R.string.disable_wifi_hotspot_when_bluetooth_on);
+ }
+ return mContext.getString(R.string.summary_placeholder);
}
@Override
diff --git a/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java b/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java
index 31e8239..52fc99c 100644
--- a/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java
+++ b/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java
@@ -163,19 +163,30 @@
* @param intent action performed
*/
public void handleEnhanced4gLteChanged(Intent intent) {
- final int subId = getDefaultVoiceSubId();
+ // skip checking when no toggle state update contained within Intent
+ final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE, false);
+ if (newValue != intent.getBooleanExtra(EXTRA_TOGGLE_STATE, true)) {
+ notifyEnhanced4gLteUpdate();
+ return;
+ }
- if (SubscriptionManager.isValidSubscriptionId(subId)) {
- final VolteQueryImsState queryState = queryImsState(subId);
- if (queryState.isVoLteProvisioned()) {
- final boolean currentValue = queryState.isEnabledByUser()
- && queryState.isAllowUserControl();
- final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
- currentValue);
- if (newValue != currentValue) {
- setEnhanced4gLteModeSetting(subId, newValue);
- }
- }
+ final int subId = getDefaultVoiceSubId();
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ notifyEnhanced4gLteUpdate();
+ return;
+ }
+
+ final VolteQueryImsState queryState = queryImsState(subId);
+ final boolean currentValue = queryState.isEnabledByUser()
+ && queryState.isAllowUserControl();
+ if (newValue == currentValue) {
+ notifyEnhanced4gLteUpdate();
+ return;
+ }
+
+ // isVoLteProvisioned() is the last item to check since it might block the main thread
+ if (queryState.isVoLteProvisioned()) {
+ setEnhanced4gLteModeSetting(subId, newValue);
}
notifyEnhanced4gLteUpdate();
}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index 875a804..4f62f7f 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -18,6 +18,15 @@
import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.CDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.EVDO;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.GSM;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.LTE;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.NR;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_TD_SCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_UNKNOWN;
+import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.WCDMA;
+
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -54,6 +63,7 @@
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
+import com.android.settings.network.ims.WifiCallingQueryImsState;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import com.android.settingslib.development.DevelopmentSettingsEnabler;
import com.android.settingslib.graph.SignalDrawable;
@@ -61,15 +71,6 @@
import java.util.Arrays;
import java.util.List;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.CDMA;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.EVDO;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.GSM;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.LTE;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.NR;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_TD_SCDMA;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_UNKNOWN;
-import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.WCDMA;
-
public class MobileNetworkUtils {
private static final String TAG = "MobileNetworkUtils";
@@ -152,10 +153,10 @@
isWifiCallingEnabled = intent != null;
} else {
+ final WifiCallingQueryImsState queryState =
+ new WifiCallingQueryImsState(context, subId);
final ImsManager imsMgr = ImsManager.getInstance(context, phoneId);
- isWifiCallingEnabled = imsMgr != null
- && imsMgr.isWfcEnabledByPlatform()
- && isWfcProvisionedOnDevice(subId)
+ isWifiCallingEnabled = queryState.isWifiCallingProvisioned()
&& isImsServiceStateReady(imsMgr);
}
diff --git a/src/com/android/settings/network/telephony/RoamingPreferenceController.java b/src/com/android/settings/network/telephony/RoamingPreferenceController.java
index 08fe323..2e116d8 100644
--- a/src/com/android/settings/network/telephony/RoamingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/RoamingPreferenceController.java
@@ -22,7 +22,6 @@
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
-import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -111,20 +110,10 @@
}
@Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
- if (isDialogNeeded()) {
- showDialog();
- }
- return true;
- }
-
- return false;
- }
-
- @Override
public boolean setChecked(boolean isChecked) {
- if (!isDialogNeeded()) {
+ if (isDialogNeeded()) {
+ showDialog();
+ } else {
// Update data directly if we don't need dialog
mTelephonyManager.setDataRoamingEnabled(isChecked);
return true;
diff --git a/src/com/android/settings/users/AddUserWhenLockedPreferenceController.java b/src/com/android/settings/users/AddUserWhenLockedPreferenceController.java
index f931fa4..34892fa 100644
--- a/src/com/android/settings/users/AddUserWhenLockedPreferenceController.java
+++ b/src/com/android/settings/users/AddUserWhenLockedPreferenceController.java
@@ -16,22 +16,29 @@
package com.android.settings.users;
import android.content.Context;
+import android.os.UserHandle;
import android.provider.Settings;
import androidx.preference.Preference;
+import com.android.internal.widget.LockPatternUtils;
import com.android.settings.core.TogglePreferenceController;
import com.android.settingslib.RestrictedSwitchPreference;
public class AddUserWhenLockedPreferenceController extends TogglePreferenceController {
private final UserCapabilities mUserCaps;
+ private LockPatternUtils mLockPatternUtils;
public AddUserWhenLockedPreferenceController(Context context, String key) {
super(context, key);
mUserCaps = UserCapabilities.create(context);
}
+ void setLockPatternUtils(LockPatternUtils lockPatternUtils) {
+ mLockPatternUtils = lockPatternUtils;
+ }
+
@Override
public void updateState(Preference preference) {
super.updateState(preference);
@@ -53,6 +60,8 @@
return DISABLED_FOR_USER;
} else if (mUserCaps.disallowAddUser() || mUserCaps.disallowAddUserSetByAdmin()) {
return DISABLED_FOR_USER;
+ } else if (!mLockPatternUtils.isSecure(UserHandle.myUserId())) {
+ return CONDITIONALLY_UNAVAILABLE;
} else {
return mUserCaps.mUserSwitcherEnabled ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index cd305e9..51da9d2 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -241,6 +241,9 @@
mAddUserWhenLockedPreferenceController = new AddUserWhenLockedPreferenceController(
activity, KEY_ADD_USER_WHEN_LOCKED);
+ mAddUserWhenLockedPreferenceController.setLockPatternUtils(
+ new LockPatternUtils(getPrefContext()));
+
mMultiUserFooterPreferenceController = new MultiUserFooterPreferenceController(activity,
KEY_MULTIUSER_FOOTER);
@@ -1290,8 +1293,11 @@
boolean suppressAllPage) {
final List<String> niks = super.getNonIndexableKeysFromXml(context, xmlResId,
suppressAllPage);
- new AddUserWhenLockedPreferenceController(context, KEY_ADD_USER_WHEN_LOCKED)
- .updateNonIndexableKeys(niks);
+ AddUserWhenLockedPreferenceController controller =
+ new AddUserWhenLockedPreferenceController(
+ context, KEY_ADD_USER_WHEN_LOCKED);
+ controller.setLockPatternUtils(new LockPatternUtils(context));
+ controller.updateNonIndexableKeys(niks);
new AutoSyncDataPreferenceController(context, null /* parent */)
.updateNonIndexableKeys(niks);
new AutoSyncPersonalDataPreferenceController(context, null /* parent */)
diff --git a/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java b/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
index 6a4774b..2f57249 100644
--- a/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiMasterSwitchPreferenceController.java
@@ -36,7 +36,7 @@
implements PreferenceControllerMixin, SummaryUpdater.OnSummaryChangeListener,
LifecycleObserver, OnResume, OnPause, OnStart, OnStop {
- public static final String KEY_TOGGLE_WIFI = "toggle_wifi";
+ public static final String KEY_TOGGLE_WIFI = "main_toggle_wifi";
private MasterSwitchPreference mWifiPreference;
private WifiEnabler mWifiEnabler;
diff --git a/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java b/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java
index 895bdba..69adf55 100644
--- a/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java
+++ b/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java
@@ -43,12 +43,9 @@
import androidx.slice.builders.SliceAction;
import com.android.ims.ImsConfig;
-import com.android.ims.ImsManager;
import com.android.settings.R;
import com.android.settings.Utils;
-import com.android.settings.network.SubscriptionUtil;
import com.android.settings.network.ims.WifiCallingQueryImsState;
-import com.android.settings.network.telephony.MobileNetworkUtils;
import com.android.settings.slices.SliceBroadcastReceiver;
import java.util.concurrent.Callable;
@@ -140,10 +137,7 @@
return null;
}
- final ImsManager imsManager = getImsManager(subId);
-
- if (!imsManager.isWfcEnabledByPlatform()
- || !isWfcProvisionedOnDevice(subId)) {
+ if (!queryImsState(subId).isWifiCallingProvisioned()) {
Log.d(TAG, "Wifi calling is either not provisioned or not enabled by Platform");
return null;
}
@@ -168,9 +162,8 @@
}
private boolean isWifiCallingEnabled() {
- final int subId = getDefaultVoiceSubId();
- return queryImsState(subId).isEnabledByUser()
- && queryImsState(subId).isAllowUserControl();
+ final WifiCallingQueryImsState queryState = queryImsState(getDefaultVoiceSubId());
+ return queryState.isEnabledByUser() && queryState.isAllowUserControl();
}
/**
@@ -224,23 +217,21 @@
CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL, subId, false);
final boolean isWifiOnlySupported = isCarrierConfigManagerKeyEnabled(
CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, subId, true);
- final ImsManager imsManager = getImsManager(subId);
- final ImsMmTelManager imsMmTelManager = getImsMmTelManager(subId);
-
- if (!imsManager.isWfcEnabledByPlatform()
- || !isWfcProvisionedOnDevice(subId)) {
- Log.d(TAG, "Wifi calling is either not provisioned or not enabled by platform");
- return null;
- }
if (!isWifiCallingPrefEditable) {
Log.d(TAG, "Wifi calling preference is not editable");
return null;
}
+ if (!queryImsState(subId).isWifiCallingProvisioned()) {
+ Log.d(TAG, "Wifi calling is either not provisioned or not enabled by platform");
+ return null;
+ }
+
boolean isWifiCallingEnabled = false;
int wfcMode = -1;
try {
+ final ImsMmTelManager imsMmTelManager = getImsMmTelManager(subId);
isWifiCallingEnabled = isWifiCallingEnabled();
wfcMode = getWfcMode(imsMmTelManager);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
@@ -351,10 +342,6 @@
}
}
- protected ImsManager getImsManager(int subId) {
- return ImsManager.getInstance(mContext, SubscriptionUtil.getPhoneId(mContext, subId));
- }
-
protected ImsMmTelManager getImsMmTelManager(int subId) {
return ImsMmTelManager.createForSubscriptionId(subId);
}
@@ -382,11 +369,10 @@
final int subId = getDefaultVoiceSubId();
if (SubscriptionManager.isValidSubscriptionId(subId)) {
- final ImsManager imsManager = getImsManager(subId);
- if (imsManager.isWfcEnabledByPlatform()
- && isWfcProvisionedOnDevice(subId)) {
- final boolean currentValue = queryImsState(subId).isEnabledByUser()
- && queryImsState(subId).isAllowUserControl();
+ final WifiCallingQueryImsState queryState = queryImsState(subId);
+ if (queryState.isWifiCallingProvisioned()) {
+ final boolean currentValue = queryState.isEnabledByUser()
+ && queryState.isAllowUserControl();
final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE,
currentValue);
final Intent activationAppIntent =
@@ -425,12 +411,11 @@
final boolean isWifiOnlySupported = isCarrierConfigManagerKeyEnabled(
CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, subId, true);
- final ImsManager imsManager = getImsManager(subId);
+ final WifiCallingQueryImsState queryState = queryImsState(subId);
if (isWifiCallingPrefEditable
- && imsManager.isWfcEnabledByPlatform()
- && isWfcProvisionedOnDevice(subId)
- && queryImsState(subId).isEnabledByUser()
- && queryImsState(subId).isAllowUserControl()) {
+ && queryState.isWifiCallingProvisioned()
+ && queryState.isEnabledByUser()
+ && queryState.isAllowUserControl()) {
// Change the preference only when wifi calling is enabled
// And when wifi calling preference is editable for the current carrier
final ImsMmTelManager imsMmTelManager = getImsMmTelManager(subId);
@@ -511,11 +496,6 @@
return SubscriptionManager.getDefaultVoiceSubscriptionId();
}
- @VisibleForTesting
- boolean isWfcProvisionedOnDevice(int subId) {
- return MobileNetworkUtils.isWfcProvisionedOnDevice(subId);
- }
-
/**
* Returns Intent of the activation app required to activate wifi calling or null if there is no
* need for activation.
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
index 325e7f9..0adc6d5 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
@@ -22,7 +22,6 @@
import static org.mockito.Mockito.spy;
import android.content.Context;
-import android.provider.DeviceConfig;
import android.provider.Settings;
import android.view.accessibility.AccessibilityManager;
@@ -72,11 +71,9 @@
@Test
@Config(shadows = {ShadowDeviceConfig.class})
- public void testIsRampingRingerEnabled_bothFlagsOn_Enabled() {
+ public void testIsRampingRingerEnabled_settingsFlagOn_Enabled() {
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 1 /* ON */);
- DeviceConfig.setProperty(DeviceConfig.NAMESPACE_TELEPHONY,
- AccessibilitySettings.RAMPING_RINGER_ENABLED, "true", false /* makeDefault*/);
assertThat(AccessibilitySettings.isRampingRingerEnabled(mContext)).isTrue();
}
@@ -87,12 +84,4 @@
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 0 /* OFF */);
assertThat(AccessibilitySettings.isRampingRingerEnabled(mContext)).isFalse();
}
-
- @Test
- @Config(shadows = {ShadowDeviceConfig.class})
- public void testIsRampingRingerEnabled_deviceConfigFlagOff_Disabled() {
- DeviceConfig.setProperty(DeviceConfig.NAMESPACE_TELEPHONY,
- AccessibilitySettings.RAMPING_RINGER_ENABLED, "false", false /* makeDefault*/);
- assertThat(AccessibilitySettings.isRampingRingerEnabled(mContext)).isFalse();
- }
}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceControllerTest.java
deleted file mode 100644
index ad4195e..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceControllerTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.google.common.truth.Truth.assertThat;
-
-import android.accessibilityservice.AccessibilityServiceInfo;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.provider.Settings;
-import android.view.accessibility.AccessibilityManager;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.shadow.api.Shadow;
-import org.robolectric.shadows.ShadowAccessibilityManager;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class AccessibilityShortcutPreferenceControllerTest {
- private final static String PACKAGE_NAME = "com.foo.bar";
- private final static String CLASS_NAME = PACKAGE_NAME + ".fake_a11y_service";
- private final static String COMPONENT_NAME = PACKAGE_NAME + "/" + CLASS_NAME;
- private final static String SERVICE_NAME = "fake_a11y_service";
- private final static int ON = 1;
- private final static int OFF = 0;
-
- private Context mContext;
- private AccessibilityShortcutPreferenceController mController;
- private ShadowAccessibilityManager mShadowAccessibilityManager;
-
- @Before
- public void setUp() {
- mContext = RuntimeEnvironment.application;
- mController = new AccessibilityShortcutPreferenceController(mContext, "shortcut_key");
- mShadowAccessibilityManager = Shadow.extract(AccessibilityManager.getInstance(mContext));
- mShadowAccessibilityManager.setInstalledAccessibilityServiceList(getMockServiceList());
- }
-
- @Test
- public void getAvailabilityStatus_hasInstalledA11yServices_shouldReturnAvailable() {
- assertThat(mController.getAvailabilityStatus())
- .isEqualTo(BasePreferenceController.AVAILABLE);
- }
-
- @Test
- public void getAvailabilityStatus_noInstalledServices_shouldReturnDisabledDependentSetting() {
- mShadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
-
- assertThat(mController.getAvailabilityStatus())
- .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
- }
-
- @Test
- @Config(shadows = {ShadowAccessibilityShortcutPreferenceFragment.class})
- public void getSummary_enabledAndSelectedA11yServices_shouldReturnSelectedServiceName() {
- ShadowAccessibilityShortcutPreferenceFragment.setServiceName(SERVICE_NAME);
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, ON);
-
- assertThat(mController.getSummary()).isEqualTo(SERVICE_NAME);
- }
-
- @Test
- public void getSummary_enabledAndNoA11yServices_shouldReturnNoServiceInstalled() {
- mShadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, ON);
-
- assertThat(mController.getSummary())
- .isEqualTo(mContext.getString(R.string.accessibility_no_services_installed));
- }
-
- @Test
- public void getSummary_disabledShortcut_shouldReturnOffSummary() {
- Settings.Secure.putInt(mContext.getContentResolver(),
- Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED, OFF);
-
- assertThat(mController.getSummary())
- .isEqualTo(mContext.getString(R.string.accessibility_feature_state_off));
- }
-
- @Implements(AccessibilityShortcutPreferenceFragment.class)
- private static class ShadowAccessibilityShortcutPreferenceFragment {
- private static String sSelectedServiceName;
-
- public static void setServiceName(String selectedServiceName) {
- sSelectedServiceName = selectedServiceName;
- }
-
- @Implementation
- protected static CharSequence getServiceName(Context context) {
- return sSelectedServiceName;
- }
- }
-
- private AccessibilityServiceInfo getMockAccessibilityServiceInfo() {
- final ApplicationInfo applicationInfo = new ApplicationInfo();
- final ServiceInfo serviceInfo = new ServiceInfo();
- applicationInfo.packageName = PACKAGE_NAME;
- serviceInfo.packageName = PACKAGE_NAME;
- serviceInfo.name = CLASS_NAME;
- serviceInfo.applicationInfo = applicationInfo;
-
- final ResolveInfo resolveInfo = new ResolveInfo();
- resolveInfo.serviceInfo = serviceInfo;
-
- try {
- final AccessibilityServiceInfo info = new AccessibilityServiceInfo(resolveInfo,
- mContext);
- ComponentName componentName = ComponentName.unflattenFromString(COMPONENT_NAME);
- info.setComponentName(componentName);
- return info;
- } catch (XmlPullParserException | IOException e) {
- // Do nothing
- }
-
- return null;
- }
-
- private List<AccessibilityServiceInfo> getMockServiceList() {
- final List<AccessibilityServiceInfo> infoList = new ArrayList<>();
- infoList.add(getMockAccessibilityServiceInfo());
- return infoList;
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/RingVibrationPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/RingVibrationPreferenceFragmentTest.java
index d23d2f0..cd1d17e 100644
--- a/tests/robotests/src/com/android/settings/accessibility/RingVibrationPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/RingVibrationPreferenceFragmentTest.java
@@ -20,10 +20,8 @@
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
import android.content.Context;
-import android.provider.DeviceConfig;
import android.provider.Settings;
import com.android.settings.testutils.shadow.ShadowDeviceConfig;
@@ -54,8 +52,6 @@
// Turn on both flags to enable ramping ringer.
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 1 /* ON */);
- DeviceConfig.setProperty(DeviceConfig.NAMESPACE_TELEPHONY,
- AccessibilitySettings.RAMPING_RINGER_ENABLED, "true", false /* makeDefault*/);
assertThat(mFragment.getVibrationEnabledSetting()).isEqualTo(
Settings.Global.APPLY_RAMPING_RINGER);
}
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java
index 7ff179e..802f871 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceControllerTest.java
@@ -103,15 +103,13 @@
@Test
public void onIndexUpdated_checkFlow() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, null);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
when(mBluetoothA2dpConfigStore.createCodecConfig()).thenReturn(mCodecConfigAAC);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.onIndexUpdated(mCurrentConfig);
verify(mController).writeConfigurationValues(mCurrentConfig);
- verify(mBluetoothA2dp).setCodecConfigPreference(
- mBluetoothA2dp.getActiveDevice(), mCodecConfigAAC);
+ verify(mBluetoothA2dp).setCodecConfigPreference(null, mCodecConfigAAC);
assertThat(mPreference.getSummary()).isEqualTo(SUMMARY);
}
@@ -136,15 +134,14 @@
assertThat(mController.getCurrentCodecConfig()).isNull();
mController.onBluetoothServiceConnected(mBluetoothA2dp);
- when(mBluetoothA2dp.getCodecStatus(mBluetoothA2dp.getActiveDevice())).thenReturn(null);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(null);
assertThat(mController.getCurrentCodecConfig()).isNull();
}
@Test
public void getCurrentCodecConfig_verifyConfig() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, null);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
assertThat(mController.getCurrentCodecConfig()).isEqualTo(mCodecConfigAAC);
@@ -153,8 +150,7 @@
@Test
public void getSelectableConfigs_verifyConfig() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
assertThat(mController.getSelectableConfigs(null)).isEqualTo(mCodecConfigs);
@@ -163,8 +159,7 @@
@Test
public void getSelectableByCodecType_verifyConfig() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
assertThat(mController.getSelectableByCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC))
@@ -174,8 +169,7 @@
@Test
public void getSelectableByCodecType_unavailable() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
assertThat(mController.getSelectableByCodecType(
@@ -185,8 +179,7 @@
@Test
public void onBluetoothServiceConnected_verifyBluetoothA2dpConfigStore() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
verify(mBluetoothA2dpConfigStore).setCodecType(mCodecConfigAAC.getCodecType());
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothBitPerSampleDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothBitPerSampleDialogPreferenceControllerTest.java
index 7c5e86e..0061fc0 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothBitPerSampleDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothBitPerSampleDialogPreferenceControllerTest.java
@@ -92,8 +92,7 @@
public void writeConfigurationValues_selectDefault_setHighest() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
@@ -122,8 +121,7 @@
public void getSelectableIndex_verifyList() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
List<Integer> indexList = new ArrayList<>();
indexList.add(mPreference.getDefaultIndex());
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothChannelModeDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothChannelModeDialogPreferenceControllerTest.java
index 32651ba..326cc22 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothChannelModeDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothChannelModeDialogPreferenceControllerTest.java
@@ -92,8 +92,7 @@
public void writeConfigurationValues_selectDefault_setHighest() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
@@ -119,8 +118,7 @@
public void getSelectableIndex_verifyList() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
List<Integer> indexList = new ArrayList<>();
indexList.add(mPreference.getDefaultIndex());
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java
index f93766f..f4ed811 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothCodecDialogPreferenceControllerTest.java
@@ -99,8 +99,7 @@
public void writeConfigurationValues_selectDefault_setHighest() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
@@ -112,8 +111,7 @@
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(1);
@@ -140,8 +138,7 @@
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX,
mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(2);
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceControllerTest.java
index 0701e78..1f0daa3 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothHDAudioPreferenceControllerTest.java
@@ -91,7 +91,7 @@
@Test
public void updateState_codecSupported_setEnable() {
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
- when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
+ when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
mBluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
@@ -102,7 +102,7 @@
@Test
public void updateState_codecNotSupported_setDisable() {
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
- when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
+ when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
mBluetoothA2dp.OPTIONAL_CODECS_NOT_SUPPORTED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
@@ -113,9 +113,9 @@
@Test
public void updateState_codecSupportedAndEnabled_checked() {
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
- when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
+ when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
mBluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
- when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
+ when(mBluetoothA2dp.getOptionalCodecsEnabled(mActiveDevice)).thenReturn(
mBluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
@@ -126,9 +126,9 @@
@Test
public void updateState_codecSupportedAndDisabled_notChecked() {
when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
- when(mBluetoothA2dp.isOptionalCodecsSupported(mActiveDevice)).thenReturn(
+ when(mBluetoothA2dp.supportsOptionalCodecs(mActiveDevice)).thenReturn(
mBluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
- when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
+ when(mBluetoothA2dp.getOptionalCodecsEnabled(mActiveDevice)).thenReturn(
mBluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothQualityDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothQualityDialogPreferenceControllerTest.java
index 30e3f31..35bd704 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothQualityDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothQualityDialogPreferenceControllerTest.java
@@ -110,8 +110,7 @@
public void updateState_codeTypeIsLDAC_enablePreference() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigLDAC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigLDAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
@@ -122,8 +121,7 @@
public void updateState_codeTypeAAC_disablePreference() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigLDAC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
diff --git a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java
index 089acc5..d274a57 100644
--- a/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/bluetooth/BluetoothSampleRateDialogPreferenceControllerTest.java
@@ -93,8 +93,7 @@
mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
@@ -126,8 +125,7 @@
public void getSelectableIndex_verifyList() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
- when(mBluetoothA2dp.getCodecStatus(
- mBluetoothA2dp.getActiveDevice())).thenReturn(mCodecStatus);
+ when(mBluetoothA2dp.getCodecStatus(null)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
List<Integer> indexList = new ArrayList<>();
indexList.add(mController.getDefaultIndex());
diff --git a/tests/robotests/src/com/android/settings/network/telephony/RoamingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/RoamingPreferenceControllerTest.java
index 0abd6d5..092b9b7 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/RoamingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/RoamingPreferenceControllerTest.java
@@ -117,10 +117,10 @@
}
@Test
- public void handlePreferenceTreeClick_needDialog_showDialog() {
+ public void setChecked_needDialog_showDialog() {
doReturn(true).when(mController).isDialogNeeded();
- mController.handlePreferenceTreeClick(mPreference);
+ mController.setChecked(true);
verify(mFragmentManager).beginTransaction();
}
diff --git a/tests/robotests/src/com/android/settings/users/AddUserWhenLockedPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/users/AddUserWhenLockedPreferenceControllerTest.java
index b27b636..9e0f2cc 100644
--- a/tests/robotests/src/com/android/settings/users/AddUserWhenLockedPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/users/AddUserWhenLockedPreferenceControllerTest.java
@@ -18,6 +18,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -27,6 +28,8 @@
import androidx.preference.PreferenceScreen;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.core.BasePreferenceController;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settingslib.RestrictedSwitchPreference;
@@ -51,13 +54,16 @@
private Context mContext;
private ShadowUserManager mUserManager;
private AddUserWhenLockedPreferenceController mController;
+ private LockPatternUtils mLockPatternUtils;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
+ mLockPatternUtils = mock(LockPatternUtils.class);
mUserManager = ShadowUserManager.getShadow();
mController = new AddUserWhenLockedPreferenceController(mContext, "fake_key");
+ mController.setLockPatternUtils(mLockPatternUtils);
mUserManager.setSupportsMultipleUsers(true);
}
@@ -69,6 +75,7 @@
@Test
public void displayPref_NotAdmin_shouldNotDisplay() {
mUserManager.setIsAdminUser(false);
+ when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
when(preference.getKey()).thenReturn(mController.getPreferenceKey());
when(mScreen.findPreference(preference.getKey())).thenReturn(preference);
@@ -81,6 +88,7 @@
@Test
public void updateState_NotAdmin_shouldNotDisplayPreference() {
mUserManager.setIsAdminUser(false);
+ when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
mController.updateState(preference);
@@ -93,8 +101,10 @@
mUserManager.setIsAdminUser(true);
mUserManager.setUserSwitcherEnabled(true);
mUserManager.setSupportsMultipleUsers(true);
+ when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
final AddUserWhenLockedPreferenceController controller =
new AddUserWhenLockedPreferenceController(mContext, "fake_key");
+ controller.setLockPatternUtils(mLockPatternUtils);
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
controller.updateState(preference);
@@ -143,4 +153,40 @@
assertThat(Global.getInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0))
.isEqualTo(0);
}
+
+ @Test
+ public void updateState_insecureLockScreen_shouldNotDisplayPreference() {
+ mUserManager.setIsAdminUser(true);
+ mUserManager.setUserSwitcherEnabled(true);
+ mUserManager.setSupportsMultipleUsers(true);
+ when(mLockPatternUtils.isSecure(anyInt())).thenReturn(false);
+ final AddUserWhenLockedPreferenceController controller =
+ new AddUserWhenLockedPreferenceController(mContext, "fake_key");
+ controller.setLockPatternUtils(mLockPatternUtils);
+ final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
+
+ controller.updateState(preference);
+
+ verify(preference).setVisible(false);
+ assertThat(controller.getAvailabilityStatus()).isEqualTo(
+ BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
+ }
+
+ @Test
+ public void updateState_secureLockScreen_shouldDisplayPreference() {
+ mUserManager.setIsAdminUser(true);
+ mUserManager.setUserSwitcherEnabled(true);
+ mUserManager.setSupportsMultipleUsers(true);
+ when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
+ final AddUserWhenLockedPreferenceController controller =
+ new AddUserWhenLockedPreferenceController(mContext, "fake_key");
+ controller.setLockPatternUtils(mLockPatternUtils);
+ final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
+
+ controller.updateState(preference);
+
+ verify(preference).setVisible(true);
+ assertThat(controller.getAvailabilityStatus()).isEqualTo(
+ BasePreferenceController.AVAILABLE);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
index aaff22a..f537be3 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
@@ -107,6 +107,7 @@
mQueryImsState = spy(new WifiCallingQueryImsState(mContext, SUB_ID));
doReturn(true).when(mQueryImsState).isEnabledByUser();
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
mWfcSliceHelper = spy(new FakeWifiCallingSliceHelper(mContext));
doReturn(mQueryImsState).when(mWfcSliceHelper).queryImsState(anyInt());
@@ -117,6 +118,8 @@
@Test
public void test_CreateWifiCallingSlice_invalidSubId() {
+ doReturn(true).when(mQueryImsState).isEnabledByUser();
+ doReturn(false).when(mQueryImsState).isWifiCallingProvisioned();
mWfcSliceHelper.setDefaultVoiceSubId(-1);
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
@@ -127,7 +130,7 @@
@Test
public void test_CreateWifiCallingSlice_wfcNotSupported() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(false);
+ doReturn(false).when(mQueryImsState).isWifiCallingProvisioned();
final Slice slice = mWfcSliceHelper.createWifiCallingSlice(
CustomSliceRegistry.WIFI_CALLING_URI);
@@ -143,8 +146,7 @@
turned off) we need to guide the user to wifi calling settings
activity so the user can perform the activation there.(PrimaryAction)
*/
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(false).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(false);
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
@@ -161,8 +163,7 @@
@Test
public void test_CreateWifiCallingSlice_success() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(true).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
@@ -176,8 +177,7 @@
@Test
public void test_SettingSliceProvider_getsRightSliceWifiCalling() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(true).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
when(mMockCarrierConfigManager.getConfigForSubId(1)).thenReturn(null);
@@ -192,8 +192,7 @@
@Test
public void test_SliceBroadcastReceiver_toggleOnWifiCalling() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(false).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext))
@@ -217,8 +216,7 @@
@Test
public void test_CreateWifiCallingPreferenceSlice_prefNotEditable() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(true).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
mWfcSliceHelper.setIsWifiCallingPrefEditable(false);
@@ -232,8 +230,7 @@
@Test
public void test_CreateWifiCallingPreferenceSlice_wfcOff() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(false).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
@@ -249,8 +246,7 @@
@Test
public void test_CreateWifiCallingPreferenceSlice_success() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(true).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
@@ -267,8 +263,7 @@
@Test
public void test_SettingsSliceProvider_getWfcPreferenceSlice() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(true).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
@@ -286,8 +281,7 @@
}
@Test
public void test_SliceBroadcastReceiver_setWfcPrefCellularPref() {
- when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
- when(mWfcSliceHelper.isWfcProvisionedOnDevice(anyInt())).thenReturn(true);
+ doReturn(true).when(mQueryImsState).isWifiCallingProvisioned();
doReturn(true).when(mQueryImsState).isEnabledByUser();
when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
when(mMockImsMmTelManager.getVoWiFiModeSetting()).thenReturn(
@@ -441,12 +435,6 @@
return mMockCarrierConfigManager;
}
- @Override
- protected ImsManager getImsManager(int subId) {
- return mMockImsManager;
- }
-
- @Override
protected ImsMmTelManager getImsMmTelManager(int subId) {
return mMockImsMmTelManager;
}