Make TetherSettings extend RestrictedDashboardFragment

RestrictedSettingsFragment is deprecated and no longer supported. To be
compatible with catalyst, change the super class to
RestrictedDashboardFragment.

Bug: 368359963
Test: atest TetherSettingsTest, manual test with the user restriction
Flag: EXEMPT N/A
Change-Id: If8c5af9d716c63fd33cb508394e7d13450c9d2e7
This commit is contained in:
Jason Chiu
2024-10-24 15:55:13 +08:00
parent b34562ef91
commit 8547d7ad96
2 changed files with 16 additions and 10 deletions

View File

@@ -54,7 +54,7 @@ import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.RestrictedSettingsFragment;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
import com.android.settingslib.RestrictedSwitchPreference;
@@ -130,14 +130,12 @@ public class TetherSettingsTest {
}
@Test
@Config(shadows = ShadowRestrictedSettingsFragment.class)
@Config(shadows = ShadowRestrictedDashboardFragment.class)
public void onCreate_isUiRestricted_doNotSetupViewModel() {
doNothing().when(mTetherSettings).addPreferencesFromResource(anyInt());
when(mTetherSettings.isUiRestricted()).thenReturn(true);
mTetherSettings.onCreate(null);
verify(mTetherSettings).addPreferencesFromResource(anyInt());
verify(mTetherSettings, never()).setupViewModel();
}
@@ -454,8 +452,8 @@ public class TetherSettingsTest {
}
}
@Implements(RestrictedSettingsFragment.class)
public static final class ShadowRestrictedSettingsFragment {
@Implements(RestrictedDashboardFragment.class)
public static final class ShadowRestrictedDashboardFragment {
@Implementation
public void onCreate(Bundle icicle) {
// do nothing