From aef1e8db969b094b32195171998f8ae2df18f87d Mon Sep 17 00:00:00 2001 From: Zhen Zhang Date: Tue, 11 Feb 2020 16:22:08 -0800 Subject: [PATCH] Fix bug: Add some controllers to AllInOneTetherSettings Lifecycle These controllers are not added to lifecycle as observers, which caused the preferences are disabled persistently. Adding them explicitly can fix the issue. Bug: 149339076 Test: CodeInspectionTest, AllInOneTetherSettingsTest Change-Id: Ia53e0845ed38f63a9a370488b028966d6a066889 --- src/com/android/settings/AllInOneTetherSettings.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/AllInOneTetherSettings.java b/src/com/android/settings/AllInOneTetherSettings.java index f2a0f52db76..4576fb762b6 100644 --- a/src/com/android/settings/AllInOneTetherSettings.java +++ b/src/com/android/settings/AllInOneTetherSettings.java @@ -46,7 +46,10 @@ import androidx.preference.PreferenceGroup; import com.android.settings.core.FeatureFlags; import com.android.settings.dashboard.RestrictedDashboardFragment; import com.android.settings.datausage.DataSaverBackend; +import com.android.settings.network.BluetoothTetherPreferenceController; import com.android.settings.network.TetherEnabler; +import com.android.settings.network.UsbTetherPreferenceController; +import com.android.settings.network.WifiTetherDisablePreferenceController; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.SwitchBar; import com.android.settings.widget.SwitchBarController; @@ -66,7 +69,6 @@ import java.util.concurrent.atomic.AtomicReference; /** * Displays preferences for all Tethering options. - * TODO(b/147323306): Add tether option preferences into this fragment after controllers created. */ @SearchIndexable public final class AllInOneTetherSettings extends RestrictedDashboardFragment @@ -172,6 +174,9 @@ public final class AllInOneTetherSettings extends RestrictedDashboardFragment mSecurityPreferenceController = use(WifiTetherSecurityPreferenceController.class); mPasswordPreferenceController = use(WifiTetherPasswordPreferenceController.class); mApBandPreferenceController = use(WifiTetherApBandPreferenceController.class); + getSettingsLifecycle().addObserver(use(UsbTetherPreferenceController.class)); + getSettingsLifecycle().addObserver(use(BluetoothTetherPreferenceController.class)); + getSettingsLifecycle().addObserver(use(WifiTetherDisablePreferenceController.class)); } @Override