Hide "Use network recommendations" in Settings.
Bug: 35141347 Test: make -j40 RunSettingsRoboTests, manual inspection Change-Id: I7661ef141aeb95d5ec707b8a066818892c3fa870
This commit is contained in:
@@ -1598,11 +1598,6 @@
|
||||
<!-- Checkbox summary for option to toggle poor network detection [CHAR LIMIT=60] -->
|
||||
<string name="wifi_avoid_poor_network_detection_summary">Only use networks that have a good Internet connection</string>
|
||||
|
||||
<!-- Network recommendations toggle -->
|
||||
<!--TODO(jjoslin): Provide final strings and mark for translation. BUG: 32913919 -->
|
||||
<string translatable="false" name="networking_allow_recommendations_title">Use network recommendations</string>
|
||||
<string translatable="false" name="networking_allow_recommendations_summary">When enabled, use network recommendations when selecting the Wi\u2011Fi network to connect to</string>
|
||||
|
||||
<!-- Preference title for option to install certificates -->
|
||||
<string name="wifi_install_credentials">Install certificates</string>
|
||||
<!-- Message to describe "Wi-Fi scan always available feature" when Wi-Fi is off. The
|
||||
|
@@ -24,11 +24,6 @@
|
||||
android:title="@string/wifi_wakeup"
|
||||
android:summary="@string/wifi_wakeup_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="allow_recommendations"
|
||||
android:title="@string/networking_allow_recommendations_title"
|
||||
android:summary="@string/networking_allow_recommendations_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="notify_open_networks"
|
||||
android:title="@string/wifi_notify_open_networks"
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.core.PreferenceController;
|
||||
|
||||
public class AllowRecommendationPreferenceController extends PreferenceController {
|
||||
|
||||
private static final String KEY_ALLOW_RECOMMENDATIONS = "allow_recommendations";
|
||||
|
||||
public AllowRecommendationPreferenceController(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
((SwitchPreference) preference).setChecked(Settings.Global.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED, 0) == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (!TextUtils.equals(preference.getKey(), KEY_ALLOW_RECOMMENDATIONS)) {
|
||||
return false;
|
||||
}
|
||||
if (!(preference instanceof SwitchPreference)) {
|
||||
return false;
|
||||
}
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED,
|
||||
((SwitchPreference) preference).isChecked() ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_ALLOW_RECOMMENDATIONS;
|
||||
}
|
||||
}
|
@@ -53,7 +53,7 @@ public class ConfigureWifiSettings extends DashboardFragment {
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mProgressiveDisclosureMixin.setTileLimit(3);
|
||||
mProgressiveDisclosureMixin.setTileLimit(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +67,6 @@ public class ConfigureWifiSettings extends DashboardFragment {
|
||||
final List<PreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new WifiInfoPreferenceController(context, getLifecycle(), mWifiManager));
|
||||
controllers.add(new CellularFallbackPreferenceController(context));
|
||||
controllers.add(new AllowRecommendationPreferenceController(context));
|
||||
controllers.add(new NotifyOpenNetworksPreferenceController(context, getLifecycle()));
|
||||
controllers.add(new WifiWakeupPreferenceController(context, getLifecycle()));
|
||||
controllers.add(new WifiSleepPolicyPreferenceController(context));
|
||||
|
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class AllowRecommendationPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private AllowRecommendationPreferenceController mController;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new AllowRecommendationPreferenceController(mContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAvailable_shouldAlwaysReturnTrue() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_nonMatchingKey_shouldDoNothing() {
|
||||
final SwitchPreference pref = new SwitchPreference(mContext);
|
||||
|
||||
assertThat(mController.handlePreferenceTreeClick(pref)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_nonMatchingType_shouldDoNothing() {
|
||||
final Preference pref = new Preference(mContext);
|
||||
pref.setKey(mController.getPreferenceKey());
|
||||
|
||||
assertThat(mController.handlePreferenceTreeClick(pref)).isFalse();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_matchingKeyAndType_shouldUpdateSetting() {
|
||||
final SwitchPreference pref = new SwitchPreference(mContext);
|
||||
pref.setKey(mController.getPreferenceKey());
|
||||
|
||||
// Turn on
|
||||
pref.setChecked(true);
|
||||
assertThat(mController.handlePreferenceTreeClick(pref)).isTrue();
|
||||
assertThat(Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED, 0))
|
||||
.isEqualTo(1);
|
||||
|
||||
// Turn off
|
||||
pref.setChecked(false);
|
||||
assertThat(mController.handlePreferenceTreeClick(pref)).isTrue();
|
||||
assertThat(Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED, 0))
|
||||
.isEqualTo(0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user