Always show wifi wake setting.
Remove WIFI_WAKEUP_AVAILABLE config setting its available by default. Remove check for NETWORK_RECOMMENDATIONS_ENABLED, the feature no longer uses the recommender. Test: make RunSettingsRoboTests RunSettingsLibRoboTests; Test: atest SettingsBackupTest; manual/exploratory Bug: 69624403 Bug: 67952636 Change-Id: Ia65f7f9349e77a13ad4af1dbd992b28a5cb16368
This commit is contained in:
@@ -16,9 +16,7 @@
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import static android.provider.Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED;
|
||||
import static android.provider.Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE;
|
||||
import static android.provider.Settings.Global.WIFI_WAKEUP_AVAILABLE;
|
||||
import static android.provider.Settings.Global.WIFI_WAKEUP_ENABLED;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -33,7 +31,6 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -59,12 +56,8 @@ public class WifiWakeupPreferenceControllerTest {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new WifiWakeupPreferenceController(
|
||||
mContext, mock(Lifecycle.class));
|
||||
mController = new WifiWakeupPreferenceController(mContext);
|
||||
Settings.System.putInt(mContext.getContentResolver(), WIFI_SCAN_ALWAYS_AVAILABLE, 1);
|
||||
Settings.System.putInt(mContext.getContentResolver(), NETWORK_RECOMMENDATIONS_ENABLED, 1);
|
||||
SettingsShadowResources.overrideResource(
|
||||
com.android.internal.R.integer.config_wifi_wakeup_available, 0);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -72,18 +65,6 @@ public class WifiWakeupPreferenceControllerTest {
|
||||
SettingsShadowResources.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable_returnsFalseWhenSettingIsNotAvailable() {
|
||||
Settings.System.putInt(mContext.getContentResolver(), WIFI_WAKEUP_AVAILABLE, 0);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable_returnsTrueWhenSettingIsAvailable() {
|
||||
Settings.System.putInt(mContext.getContentResolver(), WIFI_WAKEUP_AVAILABLE, 1);
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_nonMatchingKey_shouldDoNothing() {
|
||||
final SwitchPreference pref = new SwitchPreference(mContext);
|
||||
@@ -146,17 +127,4 @@ public class WifiWakeupPreferenceControllerTest {
|
||||
verify(preference).setEnabled(false);
|
||||
verify(preference).setSummary(R.string.wifi_wakeup_summary_scanning_disabled);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_preferenceSetUncheckedAndSetDisabledWhenScoringDisabled() {
|
||||
final SwitchPreference preference = mock(SwitchPreference.class);
|
||||
Settings.System.putInt(mContext.getContentResolver(), WIFI_WAKEUP_ENABLED, 1);
|
||||
Settings.System.putInt(mContext.getContentResolver(), NETWORK_RECOMMENDATIONS_ENABLED, 0);
|
||||
|
||||
mController.updateState(preference);
|
||||
|
||||
verify(preference).setChecked(true);
|
||||
verify(preference).setEnabled(false);
|
||||
verify(preference).setSummary(R.string.wifi_wakeup_summary_scoring_disabled);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user