diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 2b36137d8f6..e906ff1fd3b 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -3741,38 +3741,6 @@
column="15"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/drawable/one_handed_guideline.xml b/res/drawable/one_handed_guideline.xml
deleted file mode 100644
index 2c1a15834e5..00000000000
--- a/res/drawable/one_handed_guideline.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/drawable/selectable_card.xml b/res/drawable/selectable_card.xml
deleted file mode 100644
index 9c1987731b9..00000000000
--- a/res/drawable/selectable_card.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
diff --git a/res/drawable/tabs_indicator_background.xml b/res/drawable/tabs_indicator_background.xml
deleted file mode 100644
index d326e650fe2..00000000000
--- a/res/drawable/tabs_indicator_background.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/res/layout/one_handed_header.xml b/res/layout/one_handed_header.xml
deleted file mode 100644
index 3fa81837985..00000000000
--- a/res/layout/one_handed_header.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/res/layout/palette_listview_item.xml b/res/layout/palette_listview_item.xml
deleted file mode 100644
index 012e740ae3a..00000000000
--- a/res/layout/palette_listview_item.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/res/layout/radio_list_container.xml b/res/layout/radio_list_container.xml
deleted file mode 100644
index bf40abe6f52..00000000000
--- a/res/layout/radio_list_container.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
diff --git a/res/layout/remember_dock_setting.xml b/res/layout/remember_dock_setting.xml
deleted file mode 100644
index 023a9122cc7..00000000000
--- a/res/layout/remember_dock_setting.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
diff --git a/res/layout/setup_screen_lock_fingerprint_details.xml b/res/layout/setup_screen_lock_fingerprint_details.xml
deleted file mode 100644
index fc4ed986f59..00000000000
--- a/res/layout/setup_screen_lock_fingerprint_details.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
diff --git a/res/layout/time_zone_list_item.xml b/res/layout/time_zone_list_item.xml
deleted file mode 100644
index 471c9d85a50..00000000000
--- a/res/layout/time_zone_list_item.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/trust_agent_item.xml b/res/layout/trust_agent_item.xml
deleted file mode 100644
index 3555775e086..00000000000
--- a/res/layout/trust_agent_item.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/layout/trusted_credential_details.xml b/res/layout/trusted_credential_details.xml
deleted file mode 100644
index c8c16f73bea..00000000000
--- a/res/layout/trusted_credential_details.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
diff --git a/res/layout/twelve_key_entry.xml b/res/layout/twelve_key_entry.xml
deleted file mode 100644
index e1d3172aabe..00000000000
--- a/res/layout/twelve_key_entry.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/twilight_mode_location_off.xml b/res/layout/twilight_mode_location_off.xml
deleted file mode 100644
index da3aa4ceca0..00000000000
--- a/res/layout/twilight_mode_location_off.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/usage_bottom_label.xml b/res/layout/usage_bottom_label.xml
deleted file mode 100644
index 6c168806338..00000000000
--- a/res/layout/usage_bottom_label.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
diff --git a/res/layout/vpn_lockdown_editor.xml b/res/layout/vpn_lockdown_editor.xml
deleted file mode 100644
index 933c5ec61a6..00000000000
--- a/res/layout/vpn_lockdown_editor.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/res/layout/wifi_notify_scan_mode.xml b/res/layout/wifi_notify_scan_mode.xml
deleted file mode 100644
index e9696d70dfb..00000000000
--- a/res/layout/wifi_notify_scan_mode.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f005901e7c9..c5bd5b5eb8d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -47,8 +47,6 @@
Please enable developer options first.
-
- Wireless & networksSystem
@@ -57,8 +55,6 @@
Out of Service
- Emergency Calls Only
-
Radio Off
@@ -80,8 +76,6 @@
Preview
-
- Preview, page %1$d of %2$dMake smaller
@@ -276,8 +270,6 @@
Bluetooth will turn on to pairConnection preferences
-
- Previously connected devicesPreviously connected
@@ -288,21 +280,6 @@
Date & time
-
- Choose time zone
-
-
- Data:
-
- Send broadcast
-
- Action:
-
- Start activity
-
- Resource:
-
- Account: Proxy
@@ -341,8 +318,6 @@
Ping Hostname(www.google.com) IPv4:
- Ping Hostname(www.google.com) IPv6:
-
HTTP Client Test:Run Ping Test
@@ -474,50 +449,22 @@
Airplane modeWireless & networks
-
- Manage Wi\u2011Fi, Bluetooth, airplane mode, mobile networks, & VPNs
-
- Allow data usage over mobile network
-
- Allow data usage when roamingRoamingConnect to data services when roamingConnect to data services when roaming
-
- You have lost data connectivity because you left your home network with data roaming turned off.
-
- Turn it onRoaming charges may apply.
-
- When you allow data roaming, roaming charges may apply.\n\nThis setting affects all users on this tablet.
-
- When you allow data roaming, roaming charges may apply.\n\nThis setting affects all users on this phone.
-
- Allow data roaming?
-
- Operator selection
-
- Choose a network operator
-
- Date & time
-
- Set date and time
-
- Set date, time, time zone, & formatsSet time automaticallySet automaticallyUse locale default
-
- 24\u2011hour formatUse 24-hour format
@@ -536,8 +483,6 @@
RegionSelect UTC offset
-
- %1$s starts on %2$s.%1$s (%2$s)
@@ -557,13 +502,6 @@
Select by UTC offset
-
- Date
-
- Time
-
@@ -574,32 +512,14 @@
Immediately after timeout, except when kept unlocked by %1$s%1$s after timeout, except when kept unlocked by %2$s
-
- Show owner info on lock screenAdd text on lock screen
-
- Enable widgets
-
- Disabled by admin
-
-
- Lock screen when trust is lost
-
- If enabled, the device will lock when the last trust agent loses trustNone
-
- %1$d / %2$dE.g., Joe\u2019s Android.
-
- Show profile info on lock screen
-
-
- AccountsLocation
@@ -646,12 +566,6 @@
Lock screenWhat to show
-
- Set My Location, screen unlock, SIM card lock, credential storage lock
-
- Set My Location, screen unlock, credential storage lock
-
- PrivacyNot available
@@ -822,8 +736,6 @@
Center your face in the circleSkip
-
- You can add up to %d facesYou\u2019ve added the maximum number of faces
@@ -1283,8 +1195,6 @@
security, more security settings, more settings, advanced security settingsMore privacy settings
-
- Autofill, activity controls, and moreYou can add up to %d fingerprints
@@ -1293,15 +1203,9 @@
Can\u2019t add more fingerprints
-
- Remove all fingerprints?
-
Delete \'%1$s\'
-
- Do you want to delete this fingerprint?
-
This deletes the fingerprint images and model associated with \'%1$s\' that are stored on your device
@@ -1309,9 +1213,6 @@
You won\'t be able to use your fingerprint to unlock your phone or verify it\'s you in apps.You won\'t be able to use your fingerprint to unlock your work profile, authorize purchases, or sign in to work apps.
-
- Yes, remove
-
Encryption
@@ -1407,49 +1308,24 @@
Screen lock
-
- %1$s / Immediately after sleep
-
-
- %1$s / %2$s after sleep
-
Work profile lock
-
- Change lock screen
-
-
- Change or disable pattern, PIN, or password security
-
-
- Choose a method to lock the screen
-
None
-
- Swipe
-
- No securityPattern
-
- Medium securityPIN
-
- Medium to high securityPassword
-
- High securityNot now
@@ -1490,10 +1366,6 @@
You can unlock your phone using your face or fingerprint. For security, this option requires a backup screen lock.
-
- Disabled by admin, encryption policy, or
- credential storage
-
None
@@ -1505,14 +1377,6 @@
Password
-
- Once you\u2019ve set up a screen lock, you can also set up your fingerprint in Settings > Security.
-
-
- Turn off screen lock
-
Delete screen lock?
@@ -1554,13 +1418,6 @@
Delete
-
- Change unlock pattern
-
- Change unlock PIN
-
- Change unlock password
-
%1$s recommends a strong PIN or password and may not work as expected without one
@@ -1613,9 +1470,6 @@
PIN must be at least %d digits
-
- Continue
-
Must be fewer than %d character
@@ -1633,15 +1487,6 @@
This can\'t include an invalid character
-
- Must contain at least one letter
-
-
- Must contain at least one digit
-
-
- Must contain at least one symbol
-
Must contain at least 1 letter
@@ -1694,9 +1539,6 @@
Confirm
-
- Cancel
-
Clear
@@ -1709,9 +1551,6 @@
Next
-
- Setup is complete.
-
Device admin apps
@@ -1826,14 +1665,6 @@
Disconnect app
-
- Connected to device for internet access
-
- Sharing local internet connection with device
-
-
- Remember settings
-
Maximum connected Bluetooth audio devices
@@ -1875,8 +1706,6 @@
In useUnavailable
-
- Display settingsWireless display options
@@ -1919,8 +1748,6 @@
%1$s leftExpires on %1$s
-
- Tap here to sign in to network%1$d Mbps
@@ -1945,14 +1772,6 @@
NFC
-
- Allow data exchange when the tablet touches an NFC device
-
- Allow data exchange when the phone touches an NFC device
-
- Turn on NFC
-
- NFC exchanges data between this device and other nearby devices or targets, such as payment terminals, access readers, and interactive ads or tags.Require device unlock for NFC
@@ -1965,16 +1784,10 @@
Ready to transmit app content via NFCUnavailable because NFC is turned off
-
- Android BeamWhen this feature is turned on, you can beam app content to another NFC-capable device by holding the devices close together. For example, you can beam web pages, YouTube videos, contacts, and more.\n\nJust bring the devices together (typically back to back) and then tap your screen. The app determines what gets beamed.
-
- Wi\u2011Fi
-
- Turn on Wi\u2011FiWi\u2011Fi
@@ -1982,10 +1795,6 @@
Use Wi\u2011FiWi\u2011Fi settings
-
- Wi\u2011Fi
-
- Set up & manage wireless access pointsSelect Wi\u2011Fi
@@ -2008,24 +1817,6 @@
Wi\u2011Fi will turn back on near high\u2011quality saved networks, like your home networkUnavailable because location is turned off. Turn on location.
-
- Unavailable because Wi\u2011Fi scanning is turned off
-
- To use, select a network rating provider
-
- Avoid poor connections
-
- Don\u2019t use a Wi\u2011Fi network unless it has a good internet connection
-
- Only use networks that have a good internet connection
-
- Connect to public networks
-
- Automatically connect to high\u2011quality public networks
-
- To use, select a network rating provider
-
- To use, select a compatible network rating providerInstall certificates
- Don\u2019t show again
-
- Keep Wi\u2011Fi on during sleep
-
- Wi\u2011Fi on during sleep
-
- There was a problem changing the setting
-
- Improve efficiency
-
- Wi\u2011Fi optimization
-
- Minimize battery usage when Wi\u2011Fi is on
-
- Limit battery used by Wi\u2011Fi
-
- Switch to mobile data if Wi\u2011Fi loses internet access.Switch to mobile data automatically
@@ -3815,10 +3588,6 @@
Use %1$s instead of %2$s as your SMS app?Use %s as your SMS app?
-
- Network rating provider
- None
-
Change Wi\u2011Fi assistant?
@@ -6535,8 +6304,6 @@
Disable background data?Disabling background data extends battery life and lowers data use. Some apps may still use the background data connection.
-
- Auto-sync app data
@@ -7889,9 +7656,6 @@
Vibrate first then ring gradually
-
- Other sounds
-
Spatial audio
diff --git a/res/xml/mobile_network_list.xml b/res/xml/mobile_network_list.xml
deleted file mode 100644
index 6008de7ac0d..00000000000
--- a/res/xml/mobile_network_list.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/xml/network_and_internet.xml b/res/xml/network_and_internet.xml
deleted file mode 100644
index 2162c96eb8a..00000000000
--- a/res/xml/network_and_internet.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/xml/network_scorer_picker_prefs.xml b/res/xml/network_scorer_picker_prefs.xml
deleted file mode 100644
index fab69e76f87..00000000000
--- a/res/xml/network_scorer_picker_prefs.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/res/xml/notification_group_settings.xml b/res/xml/notification_group_settings.xml
deleted file mode 100644
index e714759aed3..00000000000
--- a/res/xml/notification_group_settings.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/xml/notification_importance.xml b/res/xml/notification_importance.xml
deleted file mode 100644
index 9dc2ee2a51d..00000000000
--- a/res/xml/notification_importance.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/xml/notification_settings.xml b/res/xml/notification_settings.xml
deleted file mode 100644
index 144bef614d9..00000000000
--- a/res/xml/notification_settings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
diff --git a/res/xml/other_sound_settings.xml b/res/xml/other_sound_settings.xml
deleted file mode 100644
index 056551f4e29..00000000000
--- a/res/xml/other_sound_settings.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/xml/profile_challenge_settings.xml b/res/xml/profile_challenge_settings.xml
deleted file mode 100644
index e3ad0c3f1e8..00000000000
--- a/res/xml/profile_challenge_settings.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
diff --git a/res/xml/sync_settings.xml b/res/xml/sync_settings.xml
deleted file mode 100644
index 530f4ab25cb..00000000000
--- a/res/xml/sync_settings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
diff --git a/res/xml/usage_access_settings.xml b/res/xml/usage_access_settings.xml
deleted file mode 100644
index 4cd4a9822eb..00000000000
--- a/res/xml/usage_access_settings.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
diff --git a/res/xml/vibrate_for_calls_settings.xml b/res/xml/vibrate_for_calls_settings.xml
deleted file mode 100644
index 5b6d217a1f2..00000000000
--- a/res/xml/vibrate_for_calls_settings.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
diff --git a/res/xml/voice_input_settings.xml b/res/xml/voice_input_settings.xml
deleted file mode 100644
index 47d72ecc7e9..00000000000
--- a/res/xml/voice_input_settings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/com/android/settings/network/MultiNetworkHeaderController.java b/src/com/android/settings/network/MultiNetworkHeaderController.java
deleted file mode 100644
index 2be4d62ebd5..00000000000
--- a/src/com/android/settings/network/MultiNetworkHeaderController.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2018 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.network;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.core.BasePreferenceController;
-import com.android.settings.wifi.WifiConnectionPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-/**
- * This controls a header at the top of the Network & internet page that only appears when there
- * are two or more active mobile subscriptions. It shows an overview of available network
- * connections with an entry for wifi (if connected) and an entry for each subscription.
- *
- * @deprecated This class will be removed in Android U, there is no networks header anymore.
- */
-@Deprecated
-public class MultiNetworkHeaderController extends BasePreferenceController implements
- WifiConnectionPreferenceController.UpdateListener,
- SubscriptionsPreferenceController.UpdateListener {
- public static final String TAG = "MultiNetworkHdrCtrl";
-
- private WifiConnectionPreferenceController mWifiController;
- private SubscriptionsPreferenceController mSubscriptionsController;
- private PreferenceCategory mPreferenceCategory;
- private PreferenceScreen mPreferenceScreen;
- private int mOriginalExpandedChildrenCount;
-
- public MultiNetworkHeaderController(Context context, String key) {
- super(context, key);
- }
-
- public void init(Lifecycle lifecycle) {
- mWifiController = createWifiController(lifecycle);
- mSubscriptionsController = createSubscriptionsController(lifecycle);
- }
-
- @VisibleForTesting
- WifiConnectionPreferenceController createWifiController(Lifecycle lifecycle) {
- final int prefOrder = 0;
- return new WifiConnectionPreferenceController(mContext, lifecycle, this, mPreferenceKey,
- prefOrder, SettingsEnums.SETTINGS_NETWORK_CATEGORY);
- }
-
- @VisibleForTesting
- SubscriptionsPreferenceController createSubscriptionsController(Lifecycle lifecycle) {
- final int prefStartOrder = 10;
- return new SubscriptionsPreferenceController(mContext, lifecycle, this, mPreferenceKey,
- prefStartOrder);
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- mPreferenceScreen = screen;
- mOriginalExpandedChildrenCount = mPreferenceScreen.getInitialExpandedChildrenCount();
- mPreferenceCategory = screen.findPreference(mPreferenceKey);
- mPreferenceCategory.setVisible(isAvailable());
- mWifiController.displayPreference(screen);
- mSubscriptionsController.displayPreference(screen);
- }
-
- @Override
- public int getAvailabilityStatus() {
- if (mSubscriptionsController == null || !mSubscriptionsController.isAvailable()) {
- return CONDITIONALLY_UNAVAILABLE;
- } else {
- return AVAILABLE;
- }
- }
-
- @Override
- public void onChildrenUpdated() {
- final boolean available = isAvailable();
- // TODO(b/129893781) we need a better way to express where the advanced collapsing starts
- // for preference groups that have items dynamically added/removed in the top expanded
- // section.
- if (mOriginalExpandedChildrenCount != Integer.MAX_VALUE) {
- if (available) {
- mPreferenceScreen.setInitialExpandedChildrenCount(
- mOriginalExpandedChildrenCount + mPreferenceCategory.getPreferenceCount());
- } else {
- mPreferenceScreen.setInitialExpandedChildrenCount(mOriginalExpandedChildrenCount);
- }
- }
- mPreferenceCategory.setVisible(available);
- }
-}
diff --git a/src/com/android/settings/network/NetworkMobileProviderController.java b/src/com/android/settings/network/NetworkMobileProviderController.java
index 33123b30c7f..e0db395caf4 100644
--- a/src/com/android/settings/network/NetworkMobileProviderController.java
+++ b/src/com/android/settings/network/NetworkMobileProviderController.java
@@ -32,10 +32,9 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
* are active mobile subscriptions. It shows an overview of available mobile network
* connections with an entry for each subscription.
*
- * {@link NetworkMobileProviderController} is used to show subscription status on internet
- * page for provider model. This original class can refer to {@link MultiNetworkHeaderController},
- *
- */
+ * {@link NetworkMobileProviderController} is used to show subscription status on internet
+ * page for provider model.
+ */
public class NetworkMobileProviderController extends BasePreferenceController implements
SubscriptionsPreferenceController.UpdateListener {
diff --git a/tests/robotests/res/drawable/selectable_card.xml b/tests/robotests/res/drawable/selectable_card.xml
deleted file mode 100644
index 8d1274a86ca..00000000000
--- a/tests/robotests/res/drawable/selectable_card.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/unit/src/com/android/settings/network/MultiNetworkHeaderControllerTest.java b/tests/unit/src/com/android/settings/network/MultiNetworkHeaderControllerTest.java
deleted file mode 100644
index c51bb18f376..00000000000
--- a/tests/unit/src/com/android/settings/network/MultiNetworkHeaderControllerTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.network;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.os.Looper;
-import android.telephony.SubscriptionManager;
-
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.settings.wifi.WifiConnectionPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-@RunWith(AndroidJUnit4.class)
-public class MultiNetworkHeaderControllerTest {
- private static final String KEY_HEADER = "multi_network_header";
- private static final int EXPANDED_CHILDREN_COUNT = 5;
-
- @Mock
- private PreferenceCategory mPreferenceCategory;
- @Mock
- private WifiConnectionPreferenceController mWifiController;
- @Mock
- private SubscriptionsPreferenceController mSubscriptionsController;
- @Mock
- private SubscriptionManager mSubscriptionManager;
- @Mock
- private Lifecycle mLifecycle;
-
- private Context mContext;
- private PreferenceManager mPreferenceManager;
- private PreferenceScreen mPreferenceScreen;
- private MultiNetworkHeaderController mHeaderController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = spy(ApplicationProvider.getApplicationContext());
- when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
-
- mHeaderController = new MultiNetworkHeaderController(mContext, KEY_HEADER) {
- @Override
- WifiConnectionPreferenceController createWifiController(Lifecycle lifecycle) {
- return mWifiController;
- }
-
- @Override
- SubscriptionsPreferenceController createSubscriptionsController(Lifecycle lifecycle) {
- return mSubscriptionsController;
- }
- };
-
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- mPreferenceManager = new PreferenceManager(mContext);
- mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
- mPreferenceScreen.setInitialExpandedChildrenCount(EXPANDED_CHILDREN_COUNT);
- when(mPreferenceCategory.getKey()).thenReturn(KEY_HEADER);
- when(mPreferenceCategory.getPreferenceCount()).thenReturn(3);
- mPreferenceScreen.addPreference(mPreferenceCategory);
- }
-
- @Test
- public void isAvailable_beforeInitIsCalled_notAvailable() {
- assertThat(mHeaderController.isAvailable()).isFalse();
- }
-
- // When calling displayPreference, the header itself should only be visible if the
- // subscriptions controller says it is available. This is a helper for test cases of this logic.
- private void displayPreferenceTest(boolean wifiAvailable, boolean subscriptionsAvailable,
- boolean setVisibleExpectedValue) {
- when(mWifiController.isAvailable()).thenReturn(wifiAvailable);
- when(mSubscriptionsController.isAvailable()).thenReturn(subscriptionsAvailable);
-
- mHeaderController.init(mLifecycle);
- mHeaderController.displayPreference(mPreferenceScreen);
- Assert.assertEquals(mPreferenceCategory.isVisible(), setVisibleExpectedValue);
- }
-
- @Test
- public void displayPreference_bothNotAvailable_categoryIsNotVisible() {
- displayPreferenceTest(false, false, false);
- }
-
- @Test
- public void displayPreference_wifiAvailableButNotSubscriptions_categoryIsNotVisible() {
- displayPreferenceTest(true, false, false);
- }
-
- @Test
- public void displayPreference_subscriptionsAvailableButNotWifi_categoryIsVisible() {
- displayPreferenceTest(false, true, true);
- }
-
- @Test
- public void displayPreference_bothAvailable_categoryIsVisible() {
- displayPreferenceTest(true, true, true);
- }
-
- @Test
- public void onChildUpdated_subscriptionsBecameAvailable_categoryIsVisible() {
- when(mSubscriptionsController.isAvailable()).thenReturn(false);
- mHeaderController.init(mLifecycle);
- mHeaderController.displayPreference(mPreferenceScreen);
-
- when(mSubscriptionsController.isAvailable()).thenReturn(true);
- mHeaderController.onChildrenUpdated();
-
- Assert.assertTrue(mPreferenceCategory.isVisible());
- assertThat(mPreferenceScreen.getInitialExpandedChildrenCount()).isEqualTo(
- EXPANDED_CHILDREN_COUNT + mPreferenceCategory.getPreferenceCount());
- }
-
- @Test
- public void onChildUpdated_subscriptionsBecameUnavailable_categoryIsNotVisible() {
- when(mSubscriptionsController.isAvailable()).thenReturn(true);
- mHeaderController.init(mLifecycle);
- mHeaderController.displayPreference(mPreferenceScreen);
-
- when(mSubscriptionsController.isAvailable()).thenReturn(false);
- mHeaderController.onChildrenUpdated();
-
- Assert.assertFalse(mPreferenceCategory.isVisible());
- assertThat(mPreferenceScreen.getInitialExpandedChildrenCount()).isEqualTo(
- EXPANDED_CHILDREN_COUNT);
- }
-
- @Test
- public void onChildUpdated_noExpandedChildCountAndAvailable_doesNotSetExpandedCount() {
- mPreferenceScreen.setInitialExpandedChildrenCount(Integer.MAX_VALUE);
-
- when(mSubscriptionsController.isAvailable()).thenReturn(false);
- mHeaderController.init(mLifecycle);
- mHeaderController.displayPreference(mPreferenceScreen);
-
- when(mSubscriptionsController.isAvailable()).thenReturn(true);
- mHeaderController.onChildrenUpdated();
-
- // Check that setInitialExpandedChildrenCount was never called.
- Assert.assertEquals(mPreferenceScreen.getInitialExpandedChildrenCount(), Integer.MAX_VALUE);
- }
-}
diff --git a/tests/unit/src/com/android/settings/network/NetworkMobileProviderControllerTest.java b/tests/unit/src/com/android/settings/network/NetworkMobileProviderControllerTest.java
index b626bff27f6..ac62a09ef59 100644
--- a/tests/unit/src/com/android/settings/network/NetworkMobileProviderControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/NetworkMobileProviderControllerTest.java
@@ -49,8 +49,7 @@ import org.mockito.MockitoAnnotations;
* Unit test for NetworkMobileProviderController.
*
* {@link NetworkMobileProviderController} is used to show subscription status on internet page for
- * provider model. This original class can refer to {@link MultiNetworkHeaderController}, and
- * NetworkMobileProviderControllerTest can also refer to {@link MultiNetworkHeaderControllerTest}.
+ * provider model.
*/
@RunWith(AndroidJUnit4.class)
public class NetworkMobileProviderControllerTest {