Hide "Use network recommendations" in Settings.

Bug: 35141347
Test: make -j40 RunSettingsRoboTests, manual inspection
Change-Id: I7661ef141aeb95d5ec707b8a066818892c3fa870
This commit is contained in:
Stephen Chen
2017-02-08 12:41:12 -08:00
parent bbd80517f0
commit 91acf78173
5 changed files with 1 additions and 166 deletions

View File

@@ -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;
}
}

View File

@@ -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));