Merge "Import translations. DO NOT MERGE ANYWHERE" into tm-dev
diff --git a/res/layout/conversation_onboarding.xml b/res/layout/conversation_onboarding.xml
index 5d727f6..5cf36cd 100644
--- a/res/layout/conversation_onboarding.xml
+++ b/res/layout/conversation_onboarding.xml
@@ -15,12 +15,10 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/onboarding"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:layout_gravity="center"
               android:gravity="center"
-              android:visibility="gone"
               android:orientation="vertical">
 
     <ImageView
diff --git a/src/com/android/settings/network/CarrierWifiTogglePreferenceController.java b/src/com/android/settings/network/CarrierWifiTogglePreferenceController.java
index af2c0a5..ce225b4 100644
--- a/src/com/android/settings/network/CarrierWifiTogglePreferenceController.java
+++ b/src/com/android/settings/network/CarrierWifiTogglePreferenceController.java
@@ -23,7 +23,6 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
-import com.android.settings.Utils;
 import com.android.settings.core.TogglePreferenceController;
 import com.android.settings.wifi.WifiPickerTrackerHelper;
 import com.android.wifitrackerlib.WifiPickerTracker;
@@ -65,7 +64,7 @@
 
     @Override
     public boolean isChecked() {
-        return mWifiPickerTrackerHelper.isCarrierNetworkEnabled(mSubId);
+        return mWifiPickerTrackerHelper.isCarrierNetworkEnabled();
     }
 
     @Override
diff --git a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
index a4ae51b..f4ad478 100644
--- a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
+++ b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
@@ -61,12 +61,9 @@
         mCarrierConfigCache = CarrierConfigCache.getInstance(context);
     }
 
-    public ContactDiscoveryPreferenceController init(FragmentManager fragmentManager, int subId,
-            Lifecycle lifecycle) {
+    void init(FragmentManager fragmentManager, int subId) {
         mFragmentManager = fragmentManager;
         mSubId = subId;
-        lifecycle.addObserver(this);
-        return this;
     }
 
     @Override
diff --git a/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java b/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java
index 2bbb1ca..099e01f 100644
--- a/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java
+++ b/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java
@@ -25,7 +25,6 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.Preference;
@@ -52,10 +51,9 @@
         super(context, preferenceKey);
     }
 
-    public void init(Lifecycle lifecycle, int subId) {
+    void init(int subId) {
         this.mSubId = subId;
         mManager = mContext.getSystemService(TelephonyManager.class).createForSubscriptionId(subId);
-        lifecycle.addObserver(this);
     }
 
     @OnLifecycleEvent(ON_RESUME)
diff --git a/src/com/android/settings/network/telephony/DefaultSubscriptionController.java b/src/com/android/settings/network/telephony/DefaultSubscriptionController.java
index 5511829..342b579 100644
--- a/src/com/android/settings/network/telephony/DefaultSubscriptionController.java
+++ b/src/com/android/settings/network/telephony/DefaultSubscriptionController.java
@@ -28,7 +28,6 @@
 import android.telephony.SubscriptionManager;
 import android.view.View;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.ListPreference;
@@ -72,10 +71,6 @@
                 == View.LAYOUT_DIRECTION_RTL;
     }
 
-    public void init(Lifecycle lifecycle) {
-        lifecycle.addObserver(this);
-    }
-
     /** @return SubscriptionInfo for the default subscription for the service, or null if there
      * isn't one. */
     protected abstract SubscriptionInfo getDefaultSubscriptionInfo();
@@ -168,8 +163,8 @@
 
         if (subs.size() == 1) {
             mPreference.setEnabled(false);
-            mPreference.setSummary(SubscriptionUtil.getUniqueSubscriptionDisplayName(
-                    subs.get(0), mContext));
+            mPreference.setSummaryProvider(pref ->
+                    SubscriptionUtil.getUniqueSubscriptionDisplayName(subs.get(0), mContext));
             return;
         }
 
diff --git a/src/com/android/settings/network/telephony/DisabledSubscriptionController.java b/src/com/android/settings/network/telephony/DisabledSubscriptionController.java
index b5febdd..6c62286 100644
--- a/src/com/android/settings/network/telephony/DisabledSubscriptionController.java
+++ b/src/com/android/settings/network/telephony/DisabledSubscriptionController.java
@@ -22,7 +22,6 @@
 import android.content.Context;
 import android.telephony.SubscriptionManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.PreferenceCategory;
@@ -53,8 +52,7 @@
     /**
      * Re-initialize the configuration based on subscription id provided
      */
-    public void init(Lifecycle lifecycle, int subId) {
-        lifecycle.addObserver(this);
+    public void init(int subId) {
         mSubId = subId;
     }
 
diff --git a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
index 658c6c6..43b3cc0 100644
--- a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
+++ b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
@@ -28,7 +28,6 @@
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.ListPreference;
@@ -163,7 +162,7 @@
         return false;
     }
 
-    public void init(Lifecycle lifecycle, int subId) {
+    void init(int subId) {
         mSubId = subId;
         mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                 .createForSubscriptionId(mSubId);
@@ -178,7 +177,6 @@
                         updatePreference();
                     });
         }
-        lifecycle.addObserver(this);
     }
 
     private void updatePreference() {
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index 4eb8a85..94b6aaf 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -176,14 +176,12 @@
         if (dataUsageSummaryPreferenceController != null) {
             dataUsageSummaryPreferenceController.init(mSubId);
         }
-        use(CallsDefaultSubscriptionController.class).init(getLifecycle());
-        use(SmsDefaultSubscriptionController.class).init(getLifecycle());
-        use(MobileNetworkSwitchController.class).init(getLifecycle(), mSubId);
+        use(MobileNetworkSwitchController.class).init(mSubId);
         use(CarrierSettingsVersionPreferenceController.class).init(mSubId);
         use(BillingCyclePreferenceController.class).init(mSubId);
         use(MmsMessagePreferenceController.class).init(mSubId);
-        use(DataDuringCallsPreferenceController.class).init(getLifecycle(), mSubId);
-        use(DisabledSubscriptionController.class).init(getLifecycle(), mSubId);
+        use(DataDuringCallsPreferenceController.class).init(mSubId);
+        use(DisabledSubscriptionController.class).init(mSubId);
         use(DeleteSimProfilePreferenceController.class).init(mSubId, this,
                 REQUEST_CODE_DELETE_SUBSCRIPTION);
         use(DisableSimFooterPreferenceController.class).init(mSubId);
@@ -197,7 +195,7 @@
         use(CarrierPreferenceController.class).init(mSubId);
         use(DataUsagePreferenceController.class).init(mSubId);
         use(PreferredNetworkModePreferenceController.class).init(mSubId);
-        use(EnabledNetworkModePreferenceController.class).init(getLifecycle(), mSubId);
+        use(EnabledNetworkModePreferenceController.class).init(mSubId);
         use(DataServiceSetupPreferenceController.class).init(mSubId);
         use(Enable2gPreferenceController.class).init(mSubId);
         use(CarrierWifiTogglePreferenceController.class).init(getLifecycle(), mSubId);
@@ -206,12 +204,12 @@
                 use(WifiCallingPreferenceController.class).init(mSubId);
 
         final OpenNetworkSelectPagePreferenceController openNetworkSelectPagePreferenceController =
-                use(OpenNetworkSelectPagePreferenceController.class).init(getLifecycle(), mSubId);
+                use(OpenNetworkSelectPagePreferenceController.class).init(mSubId);
         final AutoSelectPreferenceController autoSelectPreferenceController =
                 use(AutoSelectPreferenceController.class)
-                        .init(getLifecycle(), mSubId)
+                        .init(mSubId)
                         .addListener(openNetworkSelectPagePreferenceController);
-        use(NetworkPreferenceCategoryController.class).init(getLifecycle(), mSubId)
+        use(NetworkPreferenceCategoryController.class).init(mSubId)
                 .setChildren(Arrays.asList(autoSelectPreferenceController));
         mCdmaSystemSelectPreferenceController = use(CdmaSystemSelectPreferenceController.class);
         mCdmaSystemSelectPreferenceController.init(getPreferenceManager(), mSubId);
@@ -231,8 +229,7 @@
                 .addListener(videoCallingPreferenceController);
         use(Enhanced4gAdvancedCallingPreferenceController.class).init(mSubId)
                 .addListener(videoCallingPreferenceController);
-        use(ContactDiscoveryPreferenceController.class).init(getParentFragmentManager(), mSubId,
-                getLifecycle());
+        use(ContactDiscoveryPreferenceController.class).init(getParentFragmentManager(), mSubId);
         use(NrAdvancedCallingPreferenceController.class).init(mSubId);
     }
 
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSwitchController.java b/src/com/android/settings/network/telephony/MobileNetworkSwitchController.java
index 42fa95e..5014634 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSwitchController.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSwitchController.java
@@ -23,7 +23,6 @@
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.PreferenceScreen;
@@ -49,8 +48,7 @@
         mChangeListener = new SubscriptionsChangeListener(context, this);
     }
 
-    public void init(Lifecycle lifecycle, int subId) {
-        lifecycle.addObserver(this);
+    void init(int subId) {
         mSubId = subId;
     }
 
diff --git a/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java b/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java
index 4ebcb7a..ed14616 100644
--- a/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java
+++ b/src/com/android/settings/network/telephony/NetworkPreferenceCategoryController.java
@@ -22,7 +22,6 @@
 import android.content.Context;
 import android.telephony.SubscriptionManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.PreferenceScreen;
@@ -69,10 +68,9 @@
         mPreferenceScreen = screen;
     }
 
-    public NetworkPreferenceCategoryController init(Lifecycle lifecycle, int subId) {
+    NetworkPreferenceCategoryController init(int subId) {
         mSubId = subId;
 
-        lifecycle.addObserver(this);
         return this;
     }
 }
diff --git a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
index ed8dc24..a19702f 100644
--- a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
+++ b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
@@ -34,7 +34,6 @@
 import android.telephony.TelephonyManager;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.Preference;
@@ -206,7 +205,10 @@
         });
     }
 
-    public AutoSelectPreferenceController init(Lifecycle lifecycle, int subId) {
+    /**
+     * Initialization based on given subscription id.
+     **/
+    public AutoSelectPreferenceController init(int subId) {
         mSubId = subId;
         mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                 .createForSubscriptionId(mSubId);
@@ -217,7 +219,6 @@
                 CarrierConfigManager.KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL)
                 : false;
 
-        lifecycle.addObserver(this);
         return this;
     }
 
diff --git a/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java b/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
index 4c5dd95..8462228 100644
--- a/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
+++ b/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
@@ -26,7 +26,6 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
 import androidx.lifecycle.OnLifecycleEvent;
 import androidx.preference.Preference;
@@ -118,11 +117,13 @@
         }
     }
 
-    public OpenNetworkSelectPagePreferenceController init(Lifecycle lifecycle, int subId) {
+    /**
+     * Initialization based on given subscription id.
+     **/
+    public OpenNetworkSelectPagePreferenceController init(int subId) {
         mSubId = subId;
         mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                 .createForSubscriptionId(mSubId);
-        lifecycle.addObserver(this);
         return this;
     }
 
diff --git a/src/com/android/settings/notification/app/AllConversationsPreferenceController.java b/src/com/android/settings/notification/app/AllConversationsPreferenceController.java
index f61e167..c863190 100644
--- a/src/com/android/settings/notification/app/AllConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/AllConversationsPreferenceController.java
@@ -17,26 +17,18 @@
 package com.android.settings.notification.app;
 
 import android.content.Context;
-import android.os.AsyncTask;
 import android.service.notification.ConversationChannelWrapper;
 
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 
 import com.android.settings.R;
 import com.android.settings.notification.NotificationBackend;
 
-import java.util.Collections;
-import java.util.List;
-
 public class AllConversationsPreferenceController extends ConversationListPreferenceController {
 
     private static final String KEY = "other_conversations";
 
-    private List<ConversationChannelWrapper> mConversations;
-
-    public AllConversationsPreferenceController(Context context,
-            NotificationBackend backend) {
+    public AllConversationsPreferenceController(Context context, NotificationBackend backend) {
         super(context, backend);
     }
 
@@ -46,11 +38,6 @@
     }
 
     @Override
-    public boolean isAvailable() {
-        return true;
-    }
-
-    @Override
     Preference getSummaryPreference() {
         Preference pref = new Preference(mContext);
         pref.setOrder(1);
@@ -63,15 +50,4 @@
     boolean matchesFilter(ConversationChannelWrapper conversation) {
         return !conversation.getNotificationChannel().isImportantConversation();
     }
-
-    @Override
-    public void updateState(Preference preference) {
-        PreferenceCategory pref = (PreferenceCategory) preference;
-        // Load conversations
-
-        mConversations = mBackend.getConversations(false).getList();
-        Collections.sort(mConversations, mConversationComparator);
-
-        populateList(mConversations, pref);
-    }
 }
diff --git a/src/com/android/settings/notification/app/ConversationListPreferenceController.java b/src/com/android/settings/notification/app/ConversationListPreferenceController.java
index 29f0dea..f893df3 100644
--- a/src/com/android/settings/notification/app/ConversationListPreferenceController.java
+++ b/src/com/android/settings/notification/app/ConversationListPreferenceController.java
@@ -25,8 +25,10 @@
 import android.service.notification.ConversationChannelWrapper;
 import android.text.TextUtils;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settings.applications.AppInfoBase;
@@ -38,14 +40,15 @@
 import java.text.Collator;
 import java.util.Comparator;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public abstract class ConversationListPreferenceController extends AbstractPreferenceController {
 
     private static final String SUMMARY_KEY_SUFFIX = "_summary";
     protected final NotificationBackend mBackend;
+    private PreferenceGroup mPreferenceGroup;
 
-    public ConversationListPreferenceController(Context context,
-            NotificationBackend backend) {
+    public ConversationListPreferenceController(Context context, NotificationBackend backend) {
         super(context);
         mBackend = backend;
     }
@@ -55,44 +58,55 @@
         return true;
     }
 
-    protected void populateList(List<ConversationChannelWrapper> conversations,
-            PreferenceGroup containerGroup) {
-        containerGroup.setVisible(false);
-        containerGroup.removeAll();
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreferenceGroup = screen.findPreference(getPreferenceKey());
+    }
+
+    /**
+     * Updates the conversation list.
+     * @return true if this controller has content to display.
+     */
+    boolean updateList(List<ConversationChannelWrapper> conversations) {
+        mPreferenceGroup.setVisible(false);
+        mPreferenceGroup.removeAll();
         if (conversations != null) {
-            populateConversations(conversations, containerGroup);
+            populateConversations(conversations);
         }
 
-        if (containerGroup.getPreferenceCount() != 0) {
+        boolean hasContent = mPreferenceGroup.getPreferenceCount() != 0;
+        if (hasContent) {
             Preference summaryPref = getSummaryPreference();
             if (summaryPref != null) {
                 summaryPref.setKey(getPreferenceKey() + SUMMARY_KEY_SUFFIX);
-                containerGroup.addPreference(summaryPref);
+                mPreferenceGroup.addPreference(summaryPref);
             }
-            containerGroup.setVisible(true);
+            mPreferenceGroup.setVisible(true);
         }
+        return hasContent;
     }
 
     abstract Preference getSummaryPreference();
 
     abstract boolean matchesFilter(ConversationChannelWrapper conversation);
 
-    protected void populateConversations(List<ConversationChannelWrapper> conversations,
-            PreferenceGroup containerGroup) {
-        int order = 100;
-        for (ConversationChannelWrapper conversation : conversations) {
-            if (conversation.getNotificationChannel().isDemoted()
-                    || !matchesFilter(conversation)) {
-                continue;
-            }
-            containerGroup.addPreference(createConversationPref(conversation, order++));
-        }
+    @VisibleForTesting
+    void populateConversations(List<ConversationChannelWrapper> conversations) {
+        AtomicInteger order = new AtomicInteger(100);
+        conversations.stream()
+                .filter(conversation -> !conversation.getNotificationChannel().isDemoted()
+                        && matchesFilter(conversation))
+                .sorted(mConversationComparator)
+                .map(this::createConversationPref)
+                .forEachOrdered(preference -> {
+                    preference.setOrder(order.getAndIncrement());
+                    mPreferenceGroup.addPreference(preference);
+                });
     }
 
-    protected Preference createConversationPref(final ConversationChannelWrapper conversation,
-            int order) {
+    private Preference createConversationPref(final ConversationChannelWrapper conversation) {
         AppPreference pref = new AppPreference(mContext);
-        pref.setOrder(order);
 
         pref.setTitle(getTitle(conversation));
         pref.setSummary(getSummary(conversation));
@@ -141,7 +155,8 @@
                 .setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS);
     }
 
-    protected Comparator<ConversationChannelWrapper> mConversationComparator =
+    @VisibleForTesting
+    Comparator<ConversationChannelWrapper> mConversationComparator =
             new Comparator<ConversationChannelWrapper>() {
                 private final Collator sCollator = Collator.getInstance();
                 @Override
diff --git a/src/com/android/settings/notification/app/ConversationListSettings.java b/src/com/android/settings/notification/app/ConversationListSettings.java
index 83fc072..f2db47d 100644
--- a/src/com/android/settings/notification/app/ConversationListSettings.java
+++ b/src/com/android/settings/notification/app/ConversationListSettings.java
@@ -19,8 +19,9 @@
 import android.app.people.IPeopleManager;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.os.Bundle;
 import android.os.ServiceManager;
-import android.util.Log;
+import android.service.notification.ConversationChannelWrapper;
 
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
@@ -32,12 +33,16 @@
 
 public class ConversationListSettings extends DashboardFragment {
     private static final String TAG = "ConvoListSettings";
-    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
 
     NotificationBackend mBackend = new NotificationBackend();
     IPeopleManager mPs;
 
     protected List<AbstractPreferenceController> mControllers = new ArrayList<>();
+    private NoConversationsPreferenceController mNoConversationsController;
+    private PriorityConversationsPreferenceController mPriorityConversationsController;
+    private AllConversationsPreferenceController mAllConversationsController;
+    private RecentConversationsPreferenceController mRecentConversationsController;
+    private boolean mUpdatedInOnCreate = false;
 
     public ConversationListSettings() {
         mPs = IPeopleManager.Stub.asInterface(
@@ -62,10 +67,43 @@
     @Override
     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
         mControllers = new ArrayList<>();
-        mControllers.add(new NoConversationsPreferenceController(context, mBackend, mPs));
-        mControllers.add(new PriorityConversationsPreferenceController(context, mBackend));
-        mControllers.add(new AllConversationsPreferenceController(context, mBackend));
-        mControllers.add(new RecentConversationsPreferenceController(context, mBackend, mPs));
+        mNoConversationsController = new NoConversationsPreferenceController(context);
+        mControllers.add(mNoConversationsController);
+        mPriorityConversationsController =
+                new PriorityConversationsPreferenceController(context, mBackend);
+        mControllers.add(mPriorityConversationsController);
+        mAllConversationsController = new AllConversationsPreferenceController(context, mBackend);
+        mControllers.add(mAllConversationsController);
+        mRecentConversationsController =
+                new RecentConversationsPreferenceController(context, mBackend, mPs);
+        mControllers.add(mRecentConversationsController);
         return new ArrayList<>(mControllers);
     }
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        update();
+        mUpdatedInOnCreate = true;
+    }
+
+    @Override
+    public void onStart() {
+        super.onStart();
+        if (mUpdatedInOnCreate) {
+            mUpdatedInOnCreate = false;
+        } else {
+            update();
+        }
+    }
+
+    private void update() {
+        List<ConversationChannelWrapper> conversationList =
+                mBackend.getConversations(false).getList();
+        boolean hasContent = mPriorityConversationsController.updateList(conversationList)
+                | mAllConversationsController.updateList(conversationList)
+                | mRecentConversationsController.updateList();
+        mNoConversationsController.setAvailable(!hasContent);
+        mNoConversationsController.displayPreference(getPreferenceScreen());
+    }
 }
diff --git a/src/com/android/settings/notification/app/NoConversationsPreferenceController.java b/src/com/android/settings/notification/app/NoConversationsPreferenceController.java
index 475d90d..21b8718 100644
--- a/src/com/android/settings/notification/app/NoConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/NoConversationsPreferenceController.java
@@ -16,32 +16,18 @@
 
 package com.android.settings.notification.app;
 
-import android.app.people.IPeopleManager;
 import android.content.Context;
-import android.os.AsyncTask;
-import android.os.RemoteException;
-import android.service.notification.ConversationChannelWrapper;
-import android.util.Log;
-import android.view.View;
 
-import androidx.preference.Preference;
+import com.android.settingslib.core.AbstractPreferenceController;
 
-import com.android.settings.R;
-import com.android.settings.notification.NotificationBackend;
-import com.android.settingslib.widget.LayoutPreference;
+class NoConversationsPreferenceController extends AbstractPreferenceController {
 
-public class NoConversationsPreferenceController extends ConversationListPreferenceController {
-
-    private static String TAG = "NoConversationsPC";
     private static final String KEY = "no_conversations";
 
-    private IPeopleManager mPs;
-    private int mConversationCount = 0;
+    private boolean mIsAvailable = false;
 
-    public NoConversationsPreferenceController(Context context,
-            NotificationBackend backend, IPeopleManager ps) {
-        super(context, backend);
-        mPs = ps;
+    NoConversationsPreferenceController(Context context) {
+        super(context);
     }
 
     @Override
@@ -51,44 +37,10 @@
 
     @Override
     public boolean isAvailable() {
-        return true;
+        return mIsAvailable;
     }
 
-    @Override
-    Preference getSummaryPreference() {
-        return null;
-    }
-
-    @Override
-    boolean matchesFilter(ConversationChannelWrapper conversation) {
-        return false;
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        LayoutPreference pref = (LayoutPreference) preference;
-        // Load conversations
-        new AsyncTask<Void, Void, Void>() {
-            @Override
-            protected Void doInBackground(Void... unused) {
-                mConversationCount = mBackend.getConversations(false).getList().size();
-                try {
-                    mConversationCount += mPs.getRecentConversations().getList().size();
-                } catch (RemoteException e) {
-                    Log.w(TAG, "Error calling PS", e);
-                }
-                return null;
-            }
-
-            @Override
-            protected void onPostExecute(Void unused) {
-                if (mContext == null) {
-                    return;
-                }
-                pref.findViewById(R.id.onboarding).setVisibility(mConversationCount == 0
-                        ? View.VISIBLE : View.GONE);
-                preference.setVisible(mConversationCount == 0);
-            }
-        }.execute();
+    void setAvailable(boolean available) {
+        mIsAvailable = available;
     }
 }
diff --git a/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java b/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java
index 3fb605b..18fc917 100644
--- a/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/PriorityConversationsPreferenceController.java
@@ -17,26 +17,19 @@
 package com.android.settings.notification.app;
 
 import android.content.Context;
-import android.os.AsyncTask;
 import android.service.notification.ConversationChannelWrapper;
 
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 
 import com.android.settings.R;
 import com.android.settings.notification.NotificationBackend;
 
-import java.util.Collections;
-import java.util.List;
-
 public class PriorityConversationsPreferenceController extends
         ConversationListPreferenceController {
 
     private static final String KEY = "important_conversations";
-    private List<ConversationChannelWrapper> mConversations;
 
-    public PriorityConversationsPreferenceController(Context context,
-            NotificationBackend backend) {
+    public PriorityConversationsPreferenceController(Context context, NotificationBackend backend) {
         super(context, backend);
     }
 
@@ -46,11 +39,6 @@
     }
 
     @Override
-    public boolean isAvailable() {
-        return true;
-    }
-
-    @Override
     Preference getSummaryPreference() {
         Preference pref = new Preference(mContext);
         pref.setOrder(1);
@@ -63,14 +51,4 @@
     boolean matchesFilter(ConversationChannelWrapper conversation) {
         return conversation.getNotificationChannel().isImportantConversation();
     }
-
-    @Override
-    public void updateState(Preference preference) {
-        PreferenceCategory pref = (PreferenceCategory) preference;
-        // Load conversations
-        mConversations = mBackend.getConversations(true).getList();
-        Collections.sort(mConversations, mConversationComparator);
-
-        populateList(mConversations, pref);
-    }
 }
diff --git a/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java b/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
index 4d8cefe..f5f2e97 100644
--- a/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
@@ -30,9 +30,10 @@
 import android.util.Slog;
 import android.widget.Button;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
 import com.android.settings.applications.AppInfoBase;
@@ -45,18 +46,20 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public class RecentConversationsPreferenceController extends AbstractPreferenceController {
 
     private static final String TAG = "RecentConversationsPC";
     private static final String KEY = "recent_conversations";
     private static final String CLEAR_ALL_KEY_SUFFIX = "_clear_all";
-    private List<ConversationChannel> mConversations;
     private final IPeopleManager mPs;
     private final NotificationBackend mBackend;
+    private PreferenceGroup mPreferenceGroup;
 
-    public RecentConversationsPreferenceController(Context context, NotificationBackend backend,
-            IPeopleManager ps) {
+    public RecentConversationsPreferenceController(
+            Context context, NotificationBackend backend, IPeopleManager ps) {
         super(context);
         mBackend = backend;
         mPs = ps;
@@ -103,63 +106,69 @@
     }
 
     @Override
-    public void updateState(Preference preference) {
-        PreferenceCategory pref = (PreferenceCategory) preference;
-        // Load conversations
-        try {
-            mConversations = mPs.getRecentConversations().getList();
-        } catch (RemoteException e) {
-            Slog.w(TAG, "Could get recents", e);
-        }
-        Collections.sort(mConversations, mConversationComparator);
-
-        populateList(mConversations, pref);
-
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreferenceGroup = screen.findPreference(getPreferenceKey());
     }
 
-    protected void populateList(List<ConversationChannel> conversations,
-            PreferenceGroup containerGroup) {
-        containerGroup.removeAll();
+    /**
+     * Updates the conversation list.
+     *
+     * @return true if this controller has content to display.
+     */
+    boolean updateList() {
+        // Load conversations
+        List<ConversationChannel> conversations = Collections.emptyList();
+        try {
+            conversations = mPs.getRecentConversations().getList();
+        } catch (RemoteException e) {
+            Slog.w(TAG, "Could not get recent conversations", e);
+        }
+
+        return populateList(conversations);
+    }
+
+    @VisibleForTesting
+    boolean populateList(List<ConversationChannel> conversations) {
+        mPreferenceGroup.removeAll();
         boolean hasClearable = false;
         if (conversations != null) {
-            hasClearable = populateConversations(conversations, containerGroup);
+            hasClearable = populateConversations(conversations);
         }
 
-        if (containerGroup.getPreferenceCount() == 0) {
-            containerGroup.setVisible(false);
-        } else {
-            containerGroup.setVisible(true);
-            if (hasClearable) {
-                Preference clearAll = getClearAll(containerGroup);
-                if (clearAll != null) {
-                    containerGroup.addPreference(clearAll);
-                }
+        boolean hashContent = mPreferenceGroup.getPreferenceCount() != 0;
+        mPreferenceGroup.setVisible(hashContent);
+        if (hashContent && hasClearable) {
+            Preference clearAll = getClearAll(mPreferenceGroup);
+            if (clearAll != null) {
+                mPreferenceGroup.addPreference(clearAll);
             }
         }
+        return hashContent;
     }
 
-    protected boolean populateConversations(List<ConversationChannel> conversations,
-            PreferenceGroup containerGroup) {
-        int order = 100;
-        boolean hasClearable = false;
-        for (ConversationChannel conversation : conversations) {
-            if (conversation.getNotificationChannel().getImportance() == IMPORTANCE_NONE
-                    || (conversation.getNotificationChannelGroup() != null
-                    && conversation.getNotificationChannelGroup().isBlocked())) {
-                continue;
-            }
-            RecentConversationPreference pref =
-                    createConversationPref(containerGroup, conversation, order++);
-            containerGroup.addPreference(pref);
-            if (pref.hasClearListener()) {
-                hasClearable = true;
-            }
-        }
-        return hasClearable;
+    protected boolean populateConversations(List<ConversationChannel> conversations) {
+        AtomicInteger order = new AtomicInteger(100);
+        AtomicBoolean hasClearable = new AtomicBoolean(false);
+        conversations.stream()
+                .filter(conversation ->
+                        conversation.getNotificationChannel().getImportance() != IMPORTANCE_NONE
+                                && (conversation.getNotificationChannelGroup() == null
+                                || !conversation.getNotificationChannelGroup().isBlocked()))
+                .sorted(mConversationComparator)
+                .map(this::createConversationPref)
+                .forEachOrdered(pref -> {
+                    pref.setOrder(order.getAndIncrement());
+                    mPreferenceGroup.addPreference(pref);
+                    if (pref.hasClearListener()) {
+                        hasClearable.set(true);
+                    }
+                });
+        return hasClearable.get();
     }
 
-    protected RecentConversationPreference createConversationPref(PreferenceGroup parent,
-            final ConversationChannel conversation, int order) {
+    protected RecentConversationPreference createConversationPref(
+            final ConversationChannel conversation) {
         final String pkg = conversation.getShortcutInfo().getPackage();
         final int uid = conversation.getUid();
         final String conversationId = conversation.getShortcutInfo().getId();
@@ -171,13 +180,12 @@
                     mPs.removeRecentConversation(pkg, UserHandle.getUserId(uid), conversationId);
                     pref.getClearView().announceForAccessibility(
                             mContext.getString(R.string.recent_convo_removed));
-                    parent.removePreference(pref);
+                    mPreferenceGroup.removePreference(pref);
                 } catch (RemoteException e) {
                     Slog.w(TAG, "Could not clear recent", e);
                 }
             });
         }
-        pref.setOrder(order);
 
         pref.setTitle(getTitle(conversation));
         pref.setSummary(getSummary(conversation));
@@ -230,9 +238,11 @@
                 .setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS);
     }
 
-    protected Comparator<ConversationChannel> mConversationComparator =
+    @VisibleForTesting
+    Comparator<ConversationChannel> mConversationComparator =
             new Comparator<ConversationChannel>() {
                 private final Collator sCollator = Collator.getInstance();
+
                 @Override
                 public int compare(ConversationChannel o1, ConversationChannel o2) {
                     int labelComparison = 0;
diff --git a/src/com/android/settings/wifi/WifiPickerTrackerHelper.java b/src/com/android/settings/wifi/WifiPickerTrackerHelper.java
index 1be71c8..3aa7b83 100644
--- a/src/com/android/settings/wifi/WifiPickerTrackerHelper.java
+++ b/src/com/android/settings/wifi/WifiPickerTrackerHelper.java
@@ -117,16 +117,25 @@
     }
 
     /** Return the enabled/disabled state of the carrier network */
-    public boolean isCarrierNetworkEnabled(int subId) {
-        return mWifiManager.isCarrierNetworkOffloadEnabled(subId, true /* merged */);
+    public boolean isCarrierNetworkEnabled() {
+        final MergedCarrierEntry mergedCarrierEntry = mWifiPickerTracker.getMergedCarrierEntry();
+        if (mergedCarrierEntry == null) {
+            Log.e(TAG, "Failed to get MergedCarrierEntry to query enabled status");
+            return false;
+        }
+        final boolean isCarrierNetworkEnabled = mergedCarrierEntry.isEnabled();
+        Log.i(TAG, "isCarrierNetworkEnabled:" + isCarrierNetworkEnabled);
+        return isCarrierNetworkEnabled;
     }
 
     /** Enables/disables the carrier network */
     public void setCarrierNetworkEnabled(boolean enabled) {
         final MergedCarrierEntry mergedCarrierEntry = mWifiPickerTracker.getMergedCarrierEntry();
         if (mergedCarrierEntry == null) {
+            Log.e(TAG, "Unable to get MergedCarrierEntry to set enabled status");
             return;
         }
+        Log.i(TAG, "setCarrierNetworkEnabled:" + enabled);
         mergedCarrierEntry.setEnabled(enabled);
     }
 
diff --git a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
index b3725fa..de3d2b2 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
@@ -105,7 +105,8 @@
                 "ContactDiscovery");
         // Ensure subscriptionInfo check doesn't fail.
         SubscriptionUtil.setAvailableSubscriptionsForTesting(Collections.emptyList());
-        mPreferenceControllerUT.init(mFragmentManager, TEST_SUB_ID, mLifecycle);
+        mPreferenceControllerUT.init(mFragmentManager, TEST_SUB_ID);
+        mLifecycle.addObserver(mPreferenceControllerUT);
         mSwitchPreferenceUT = spy(new SwitchPreference(mContext));
         mSwitchPreferenceUT.setKey(mPreferenceControllerUT.getPreferenceKey());
         mPreferenceControllerUT.preference = mSwitchPreferenceUT;
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DataDuringCallsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/DataDuringCallsPreferenceControllerTest.java
index 62d9974..4a53aa2 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/DataDuringCallsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/DataDuringCallsPreferenceControllerTest.java
@@ -32,12 +32,9 @@
 import android.content.Context;
 import android.telephony.TelephonyManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
 
-import com.android.settings.network.telephony.DataDuringCallsPreferenceController;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,8 +55,6 @@
     @Mock
     private TelephonyManager mTelephonyManager;
     @Mock
-    private Lifecycle mLifecycle;
-    @Mock
     private PreferenceScreen mPreferenceScreen;
 
     private Context mContext;
@@ -78,7 +73,7 @@
             @Override
             protected boolean hasMobileData() { return true; }
         };
-        mController.init(mLifecycle, SUB_ID_1);
+        mController.init(SUB_ID_1);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/notification/app/ConversationListPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/ConversationListPreferenceControllerTest.java
index 8113f22..aaa2f24 100644
--- a/tests/robotests/src/com/android/settings/notification/app/ConversationListPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/ConversationListPreferenceControllerTest.java
@@ -21,7 +21,6 @@
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -35,47 +34,49 @@
 import android.service.notification.ConversationChannelWrapper;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
-import android.text.style.BulletSpan;
-import android.text.style.QuoteSpan;
 import android.text.style.SubscriptSpan;
-import android.text.style.UnderlineSpan;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceGroup;
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
+import androidx.test.core.app.ApplicationProvider;
 
 import com.android.settings.applications.AppInfoBase;
 import com.android.settings.notification.NotificationBackend;
 
+import com.google.common.collect.ImmutableList;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Answers;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
 import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadows.ShadowApplication;
-
-import java.util.ArrayList;
 
 @RunWith(RobolectricTestRunner.class)
 public class ConversationListPreferenceControllerTest {
 
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private Context mContext;
+    private final Context mContext = ApplicationProvider.getApplicationContext();
     @Mock
     private NotificationBackend mBackend;
+    @Spy
+    private PreferenceGroup mPreferenceGroup = new PreferenceCategory(mContext);
 
     private TestPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        ShadowApplication shadowApplication = ShadowApplication.getInstance();
-        mContext = RuntimeEnvironment.application;
         mController = new TestPreferenceController(mContext, mBackend);
+
+        PreferenceManager preferenceManager = new PreferenceManager(mContext);
+        PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
+        mPreferenceGroup.setKey(mController.getPreferenceKey());
+        preferenceScreen.addPreference(mPreferenceGroup);
+        mController.displayPreference(preferenceScreen);
     }
 
     @Test
@@ -84,39 +85,30 @@
     }
 
     @Test
-    public void testPopulateList_hideIfNoConversations() {
-        PreferenceCategory outerContainer = mock(PreferenceCategory.class);
+    public void testUpdateList_hideIfNoConversations() {
+        boolean hasContent = mController.updateList(ImmutableList.of());
 
-        mController.populateList(new ArrayList<>(), outerContainer);
-
-        verify(outerContainer).setVisible(false);
-        verify(outerContainer, never()).addPreference(any());
+        assertThat(hasContent).isFalse();
+        verify(mPreferenceGroup).setVisible(false);
+        verify(mPreferenceGroup, never()).addPreference(any());
     }
 
     @Test
-    public void testPopulateList_validConversations() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
-        PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
-        ps.addPreference(outerContainer);
-
+    public void testUpdateList_validConversations() {
         ConversationChannelWrapper ccw = new ConversationChannelWrapper();
         ccw.setNotificationChannel(mock(NotificationChannel.class));
         ccw.setPkg("pkg");
         ccw.setUid(1);
         ccw.setShortcutInfo(mock(ShortcutInfo.class));
 
-        ArrayList<ConversationChannelWrapper> list = new ArrayList<>();
-        list.add(ccw);
+        boolean hasContent = mController.updateList(ImmutableList.of(ccw));
 
-        mController.populateList(list, outerContainer);
-        verify(outerContainer, times(1)).addPreference(any());
+        assertThat(hasContent).isTrue();
+        verify(mPreferenceGroup, times(1)).addPreference(any());
     }
 
     @Test
     public void populateConversations() {
-        PreferenceCategory container = mock(PreferenceCategory.class);
-
         ConversationChannelWrapper ccw = new ConversationChannelWrapper();
         ccw.setNotificationChannel(mock(NotificationChannel.class));
         ccw.setPkg("pkg");
@@ -131,13 +123,9 @@
         ccwDemoted.setUid(1);
         ccwDemoted.setShortcutInfo(mock(ShortcutInfo.class));
 
-        ArrayList<ConversationChannelWrapper> list = new ArrayList<>();
-        list.add(ccw);
-        list.add(ccwDemoted);
+        mController.populateConversations(ImmutableList.of(ccw, ccwDemoted));
 
-        mController.populateConversations(list, container);
-
-        verify(container, times(1)).addPreference(any());
+        verify(mPreferenceGroup, times(1)).addPreference(any());
     }
 
     @Test
@@ -240,7 +228,8 @@
         assertThat(mController.mConversationComparator.compare(one, two)).isLessThan(0);
     }
 
-    private final class TestPreferenceController extends ConversationListPreferenceController {
+    private static final class TestPreferenceController extends
+            ConversationListPreferenceController {
 
         private TestPreferenceController(Context context, NotificationBackend backend) {
             super(context, backend);
diff --git a/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java
index 1688d63..3c0a0f3 100644
--- a/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java
@@ -37,9 +37,7 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.text.SpannedString;
-import android.view.LayoutInflater;
 import android.view.View;
-import android.widget.LinearLayout;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
@@ -47,42 +45,46 @@
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.PreferenceViewHolder;
+import androidx.test.core.app.ApplicationProvider;
 
 import com.android.settings.R;
 import com.android.settings.applications.AppInfoBase;
 import com.android.settings.notification.NotificationBackend;
 import com.android.settingslib.widget.LayoutPreference;
 
+import com.google.common.collect.ImmutableList;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Answers;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
 import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadows.ShadowApplication;
-
-import java.util.ArrayList;
 
 @RunWith(RobolectricTestRunner.class)
 public class RecentConversationsPreferenceControllerTest {
 
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private Context mContext;
+    private final Context mContext = ApplicationProvider.getApplicationContext();
     @Mock
     private NotificationBackend mBackend;
     @Mock
     private IPeopleManager mPs;
+    @Spy
+    private PreferenceGroup mPreferenceGroup = new PreferenceCategory(mContext);
 
     private RecentConversationsPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        ShadowApplication shadowApplication = ShadowApplication.getInstance();
-        mContext = RuntimeEnvironment.application;
         mController = new RecentConversationsPreferenceController(mContext, mBackend, mPs);
+
+        PreferenceManager preferenceManager = new PreferenceManager(mContext);
+        PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
+        mPreferenceGroup.setKey(mController.getPreferenceKey());
+        preferenceScreen.addPreference(mPreferenceGroup);
+        mController.displayPreference(preferenceScreen);
     }
 
     @Test
@@ -92,38 +94,29 @@
 
     @Test
     public void testPopulateList_hideIfNoConversations() {
-        PreferenceCategory outerContainer = mock(PreferenceCategory.class);
+        boolean hasContent = mController.populateList(ImmutableList.of());
 
-        mController.populateList(new ArrayList<>(), outerContainer);
-
-        verify(outerContainer).setVisible(false);
-        verify(outerContainer, never()).addPreference(any());
+        assertThat(hasContent).isFalse();
+        verify(mPreferenceGroup).setVisible(false);
+        verify(mPreferenceGroup, never()).addPreference(any());
     }
 
     @Test
     public void testPopulateList_validConversations() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
-        PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
-        ps.addPreference(outerContainer);
-
         ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6,
                 new NotificationChannel("hi", "hi", 4),
                 new NotificationChannelGroup("hi", "hi"), 7,
                 false);
 
-        ArrayList<ConversationChannel> list = new ArrayList<>();
-        list.add(ccw);
+        boolean hasContent = mController.populateList(ImmutableList.of(ccw));
 
-        mController.populateList(list, outerContainer);
+        assertThat(hasContent).isTrue();
         // one for the preference, one for the button ro clear all
-        verify(outerContainer, times(2)).addPreference(any());
+        verify(mPreferenceGroup, times(2)).addPreference(any());
     }
 
     @Test
     public void populateConversations_blocked() {
-        PreferenceCategory container = mock(PreferenceCategory.class);
-
         ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6,
                 new NotificationChannel("hi", "hi", 4),
                 new NotificationChannelGroup("hi", "hi"), 7,
@@ -141,14 +134,10 @@
                 blockedGroup, 7,
                 false);
 
-        ArrayList<ConversationChannel> list = new ArrayList<>();
-        list.add(ccw);
-        list.add(ccw2);
-        list.add(ccw3);
+        boolean hasContent = mController.populateConversations(ImmutableList.of(ccw, ccw2, ccw3));
 
-        mController.populateConversations(list, container);
-
-        verify(container, times(1)).addPreference(any());
+        assertThat(hasContent).isTrue();
+        verify(mPreferenceGroup, times(1)).addPreference(any());
     }
 
     @Test
@@ -223,8 +212,7 @@
                 new NotificationChannelGroup("hi", "group"), 7,
                 true);
 
-        Preference pref = mController.createConversationPref(new PreferenceCategory(mContext),
-                ccw, 100);
+        Preference pref = mController.createConversationPref(ccw);
         try {
             pref.performClick();
         } catch (RuntimeException e) {
@@ -244,9 +232,7 @@
                 new NotificationChannelGroup("hi", "group"), 7,
                 false);
 
-        RecentConversationPreference pref =
-                (RecentConversationPreference) mController.createConversationPref(
-                        new PreferenceCategory(mContext), ccw, 100);
+        RecentConversationPreference pref = mController.createConversationPref(ccw);
         final View view = View.inflate(mContext, pref.getLayoutResource(), null);
         PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
         View delete = View.inflate(mContext, pref.getSecondTargetResId(), null);
@@ -274,34 +260,28 @@
                 new NotificationChannelGroup("hi", "group"), 7,
                 true);
 
-        PreferenceCategory group = new PreferenceCategory(mContext);
-        PreferenceScreen screen = new PreferenceManager(mContext).createPreferenceScreen(mContext);
-        screen.addPreference(group);
-
-        RecentConversationPreference pref = mController.createConversationPref(
-                        new PreferenceCategory(mContext), ccw, 100);
+        RecentConversationPreference pref = mController.createConversationPref(ccw);
         final View view = View.inflate(mContext, pref.getLayoutResource(), null);
         PreferenceViewHolder holder = spy(PreferenceViewHolder.createInstanceForTests(view));
         View delete = View.inflate(mContext, pref.getSecondTargetResId(), null);
         when(holder.findViewById(pref.getClearId())).thenReturn(delete);
-        group.addPreference(pref);
+        mPreferenceGroup.addPreference(pref);
 
-        RecentConversationPreference pref2 = mController.createConversationPref(
-                        new PreferenceCategory(mContext), ccw2, 100);
+        RecentConversationPreference pref2 = mController.createConversationPref(ccw2);
         final View view2 = View.inflate(mContext, pref2.getLayoutResource(), null);
         PreferenceViewHolder holder2 = spy(PreferenceViewHolder.createInstanceForTests(view2));
         View delete2 = View.inflate(mContext, pref2.getSecondTargetResId(), null);
         when(holder2.findViewById(pref.getClearId())).thenReturn(delete2);
-        group.addPreference(pref2);
+        mPreferenceGroup.addPreference(pref2);
 
-        LayoutPreference clearAll = mController.getClearAll(group);
-        group.addPreference(clearAll);
+        LayoutPreference clearAll = mController.getClearAll(mPreferenceGroup);
+        mPreferenceGroup.addPreference(clearAll);
 
         clearAll.findViewById(R.id.conversation_settings_clear_recents).performClick();
 
         verify(mPs).removeAllRecentConversations();
-        assertThat((Preference) group.findPreference("hi:person")).isNull();
-        assertThat((Preference) group.findPreference("bye:person")).isNotNull();
+        assertThat((Preference) mPreferenceGroup.findPreference("hi:person")).isNull();
+        assertThat((Preference) mPreferenceGroup.findPreference("bye:person")).isNotNull();
     }
 
     @Test
@@ -314,30 +294,23 @@
                 new NotificationChannelGroup("hi", "group"), 7,
                 true);
 
-        RecentConversationPreference pref =
-                (RecentConversationPreference) mController.createConversationPref(
-                        new PreferenceCategory(mContext), ccw, 100);
+        RecentConversationPreference pref = mController.createConversationPref(ccw);
+
         assertThat(pref.hasClearListener()).isFalse();
     }
 
     @Test
     public void testPopulateList_onlyNonremoveableConversations() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
-        PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
-        ps.addPreference(outerContainer);
-
         ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6,
                 new NotificationChannel("hi", "hi", 4),
                 new NotificationChannelGroup("hi", "hi"), 7,
                 true /* hasactivenotifs */);
 
-        ArrayList<ConversationChannel> list = new ArrayList<>();
-        list.add(ccw);
+        boolean hasContent = mController.populateList(ImmutableList.of(ccw));
 
-        mController.populateList(list, outerContainer);
+        assertThat(hasContent).isTrue();
         // one for the preference, none for 'clear all'
-        verify(outerContainer, times(1)).addPreference(any());
+        verify(mPreferenceGroup, times(1)).addPreference(any());
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/widget/SeekBarPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/SeekBarPreferenceTest.java
index 770559d..8b527fd 100644
--- a/tests/robotests/src/com/android/settings/widget/SeekBarPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/SeekBarPreferenceTest.java
@@ -112,7 +112,7 @@
 
     @Test
     @Config(qualifiers = "mcc999")
-    public void isSelectable_selectableInXml_returnTrue() {
+    public void isSelectable_selectableInXml_returnFalse() {
         final PreferenceFragmentCompat fragment = FragmentController.of(new TestFragment(),
                 new Bundle())
                 .create()
@@ -122,7 +122,7 @@
 
         final SeekBarPreference seekBarPreference = fragment.findPreference("seek_bar");
 
-        assertThat(seekBarPreference.isSelectable()).isTrue();
+        assertThat(seekBarPreference.isSelectable()).isFalse();
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/network/CarrierWifiTogglePreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/CarrierWifiTogglePreferenceControllerTest.java
index 21a8444..480d744 100644
--- a/tests/unit/src/com/android/settings/network/CarrierWifiTogglePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/CarrierWifiTogglePreferenceControllerTest.java
@@ -107,14 +107,14 @@
 
     @Test
     public void isChecked_carrierNetworkEnabled_returnTrue() {
-        doReturn(true).when(mWifiPickerTrackerHelper).isCarrierNetworkEnabled(SUB_ID);
+        doReturn(true).when(mWifiPickerTrackerHelper).isCarrierNetworkEnabled();
 
         assertThat(mController.isChecked()).isEqualTo(true);
     }
 
     @Test
     public void isChecked_carrierNetworkDisabled_returnFalse() {
-        doReturn(false).when(mWifiPickerTrackerHelper).isCarrierNetworkEnabled(SUB_ID);
+        doReturn(false).when(mWifiPickerTrackerHelper).isCarrierNetworkEnabled();
 
         assertThat(mController.isChecked()).isEqualTo(false);
     }
diff --git a/tests/unit/src/com/android/settings/network/EnabledNetworkModePreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/EnabledNetworkModePreferenceControllerTest.java
index c945206..4b99646 100644
--- a/tests/unit/src/com/android/settings/network/EnabledNetworkModePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/EnabledNetworkModePreferenceControllerTest.java
@@ -111,7 +111,7 @@
         mController = new EnabledNetworkModePreferenceController(mContext, KEY);
         mockAllowedNetworkTypes(ALLOWED_ALL_NETWORK_TYPE);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
         mPreference.setKey(mController.getPreferenceKey());
     }
 
@@ -205,7 +205,7 @@
     public void updateState_5gWorldPhone_GlobalHasNr() {
         mockAllowedNetworkTypes(ALLOWED_ALL_NETWORK_TYPE);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
         mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
 
         mController.updateState(mPreference);
@@ -221,7 +221,7 @@
         mockAllowedNetworkTypes(ALLOWED_ALL_NETWORK_TYPE);
         mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
 
         // NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA = NR | LTE | RAF_TD_SCDMA | GSM | WCDMA
         when(mTelephonyManager.getAllowedNetworkTypesForReason(
@@ -241,7 +241,7 @@
         mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
 
         // NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA = NR | LTE | RAF_TD_SCDMA | GSM | WCDMA
         when(mTelephonyManager.getAllowedNetworkTypesForReason(
@@ -261,7 +261,7 @@
         mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
 
         // NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA = NR | LTE | RAF_TD_SCDMA | GSM | WCDMA
         when(mTelephonyManager.getAllowedNetworkTypesForReason(
@@ -281,7 +281,7 @@
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
         mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
 
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
 
         // NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = LTE | CDMA | EVDO | GSM | WCDMA
         when(mTelephonyManager.getAllowedNetworkTypesForReason(
@@ -304,7 +304,7 @@
     public void updateState_GlobalDisAllowed5g_GlobalWithoutNR() {
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
         mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
         mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
 
         // NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA = NR | LTE | CDMA | EVDO | GSM | WCDMA
@@ -324,7 +324,7 @@
     public void updateState_GlobalDisAllowed5g_SelectOnGlobal() {
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
         mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
         mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
 
         // NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA = NR | LTE | CDMA | EVDO | GSM | WCDMA
diff --git a/tests/unit/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java
index b269660..9f52c4c 100644
--- a/tests/unit/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/DisabledSubscriptionControllerTest.java
@@ -32,8 +32,6 @@
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -48,8 +46,6 @@
 
     @Mock
     private SubscriptionManager mSubscriptionManager;
-    @Mock
-    private Lifecycle mLifecycle;
 
     private PreferenceScreen mScreen;
     private PreferenceManager mPreferenceManager;
@@ -72,7 +68,7 @@
         mScreen.addPreference(mCategory);
 
         mController = new DisabledSubscriptionController(mContext, KEY);
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java
index 23c9531..e460d67 100644
--- a/tests/unit/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/MobileNetworkSwitchControllerTest.java
@@ -48,7 +48,6 @@
 
 import com.android.settings.network.SubscriptionUtil;
 import com.android.settings.widget.SettingsMainSwitchPreference;
-import com.android.settingslib.core.lifecycle.Lifecycle;
 
 import org.junit.After;
 import org.junit.Before;
@@ -67,8 +66,6 @@
     private SubscriptionManager mSubscriptionManager;
     @Mock
     private SubscriptionInfo mSubscription;
-    @Mock
-    private Lifecycle mLifecycle;
 
     private PreferenceScreen mScreen;
     private PreferenceManager mPreferenceManager;
@@ -94,7 +91,7 @@
 
         final String key = "prefKey";
         mController = new MobileNetworkSwitchController(mContext, key);
-        mController.init(mLifecycle, mSubscription.getSubscriptionId());
+        mController.init(mSubscription.getSubscriptionId());
 
         if (Looper.myLooper() == null) {
             Looper.prepare();
diff --git a/tests/unit/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java
index 1e165d7..292b4a9 100644
--- a/tests/unit/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java
@@ -31,7 +31,6 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.preference.SwitchPreference;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -62,8 +61,6 @@
     private CarrierConfigCache mCarrierConfigCache;
     @Mock
     private ProgressDialog mProgressDialog;
-    @Mock
-    private Lifecycle mLifecycle;
 
     private PersistableBundle mCarrierConfig;
     private AutoSelectPreferenceController mController;
@@ -91,7 +88,7 @@
         mController = new AutoSelectPreferenceController(mContext, "auto_select");
         mController.mProgressDialog = mProgressDialog;
         mController.mSwitchPreference = mSwitchPreference;
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
     }
 
     @Test
@@ -139,6 +136,6 @@
         when(mCarrierConfigCache.getConfigForSubId(SUB_ID)).thenReturn(null);
 
         // Should not crash
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
     }
 }
diff --git a/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java
index 53ae1b9..b4d49b2 100644
--- a/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java
@@ -29,7 +29,6 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 
-import androidx.lifecycle.Lifecycle;
 import androidx.preference.Preference;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -59,8 +58,6 @@
     private ServiceState mServiceState;
     @Mock
     private SubscriptionInfo mSubscriptionInfo;
-    @Mock
-    private Lifecycle mLifecycle;
 
     private PersistableBundle mCarrierConfig;
     private OpenNetworkSelectPagePreferenceController mController;
@@ -99,7 +96,7 @@
                 super.updateState(mPreference);
             }
         };
-        mController.init(mLifecycle, SUB_ID);
+        mController.init(SUB_ID);
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java b/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java
index 1c0cf04..b79dd45 100644
--- a/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java
+++ b/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java
@@ -24,7 +24,6 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
@@ -135,14 +134,13 @@
 
     @Test
     public void isCarrierNetworkEnabled_returnCorrect() {
-        doReturn(true).when(mWifiManager).isCarrierNetworkOffloadEnabled(SUB_ID, true /* merged */);
+        when(mMergedCarrierEntry.isEnabled()).thenReturn(true);
 
-        assertThat(mWifiPickerTrackerHelper.isCarrierNetworkEnabled(SUB_ID)).isTrue();
+        assertThat(mWifiPickerTrackerHelper.isCarrierNetworkEnabled()).isTrue();
 
-        doReturn(false).when(mWifiManager)
-                .isCarrierNetworkOffloadEnabled(SUB_ID, true /* merged */);
+        when(mMergedCarrierEntry.isEnabled()).thenReturn(false);
 
-        assertThat(mWifiPickerTrackerHelper.isCarrierNetworkEnabled(SUB_ID)).isFalse();
+        assertThat(mWifiPickerTrackerHelper.isCarrierNetworkEnabled()).isFalse();
     }
 
     @Test