Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7886ffb0 authored by Aleksander Morgado's avatar Aleksander Morgado
Browse files

Remove conditional controller additions from ResetDashboardFragment

The visibility of the controllers is already managed in each of their
getAvailabilityStatus() method, so there should be no need to
conditionally add them.

The case of the NetworkResetPreferenceController is also a bit
special. If it is not explicitly added here, it may be implicitly
added via ResetPreferenceController with an overridden visibility
logic, and it would then be unconditionally shown even if the
isMobileDataCapable() check fails.

Bug: 395714454
Test: mm && atest
Flag: EXEMPT bugfix
Change-Id: I5105eb44f2b933d41bbe6931e16a64eb58964457
parent fbe64186
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.settings.applications.manageapplications.ResetAppPrefPreferen
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.network.EraseEuiccDataController;
import com.android.settings.network.NetworkResetPreferenceController;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.privatespace.delete.ResetOptionsDeletePrivateSpaceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -67,9 +66,7 @@ public class ResetDashboardFragment extends DashboardFragment {
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (SubscriptionUtil.isSimHardwareVisible(context)) {
        use(EraseEuiccDataController.class).setFragment(this);
        }
        if (android.multiuser.Flags.enablePrivateSpaceFeatures()
                && android.multiuser.Flags.deletePrivateSpaceFromReset()) {
            ResetOptionsDeletePrivateSpaceController resetOptionsDeletePrivateSpaceController =
@@ -93,9 +90,7 @@ public class ResetDashboardFragment extends DashboardFragment {
    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
            Lifecycle lifecycle) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        if (SubscriptionUtil.isSimHardwareVisible(context)) {
        controllers.add(new NetworkResetPreferenceController(context));
        }
        controllers.add(new ResetAppPrefPreferenceController(context, lifecycle));
        return controllers;
    }