From 2cf3661d146e2bdd0d761028e91df775c8eabca3 Mon Sep 17 00:00:00 2001 From: Amin Shaikh Date: Fri, 14 Apr 2017 12:49:11 -0700 Subject: Remove CURATE_SAVED_OPEN_NETWORKS - Update SavedNetworkEvaluator to no longer reference this setting. - Update SavedNetworkEvaluatorTest#setCandidateScanResultsForAllSavedNetworks to ensure that candidate ScanResults are added to saved secure networks in addition to useExternalScores saved networks and open networks Bug: 37356724 Test: ./tests/wifitests/runtests.sh Change-Id: I87794f339a9910fb343d1994910320efe0feafa2 --- .../android/server/wifi/SavedNetworkEvaluator.java | 33 +--------------------- .../java/com/android/server/wifi/WifiInjector.java | 5 ++-- 2 files changed, 3 insertions(+), 35 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java index cafe24ae2..7565f7819 100644 --- a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java +++ b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java @@ -17,12 +17,8 @@ package com.android.server.wifi; import android.content.Context; -import android.database.ContentObserver; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; -import android.os.Handler; -import android.os.Looper; -import android.provider.Settings; import android.util.LocalLog; import android.util.Pair; @@ -51,12 +47,9 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat private final int mSecurityAward; private final int mThresholdSaturatedRssi24; private final int mThresholdSaturatedRssi5; - private final ContentObserver mContentObserver; - private boolean mCurateSavedOpenNetworks; SavedNetworkEvaluator(final Context context, WifiConfigManager configManager, Clock clock, - LocalLog localLog, Looper looper, final FrameworkFacade frameworkFacade, - WifiConnectivityHelper connectivityHelper) { + LocalLog localLog, WifiConnectivityHelper connectivityHelper) { mWifiConfigManager = configManager; mClock = clock; mLocalLog = localLog; @@ -80,23 +73,6 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat R.integer.config_wifi_framework_wifi_score_good_rssi_threshold_24GHz); mThresholdSaturatedRssi5 = context.getResources().getInteger( R.integer.config_wifi_framework_wifi_score_good_rssi_threshold_5GHz); - mContentObserver = new ContentObserver(new Handler(looper)) { - @Override - public void onChange(boolean selfChange) { - boolean networkRecommendationsEnabled = frameworkFacade.getIntegerSetting(context, - Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED, 0) == 1; - boolean curateSavedOpenNetworks = frameworkFacade.getIntegerSetting(context, - Settings.Global.CURATE_SAVED_OPEN_NETWORKS, 0) == 1; - mCurateSavedOpenNetworks = networkRecommendationsEnabled && curateSavedOpenNetworks; - } - }; - mContentObserver.onChange(false /* selfChange*/); - frameworkFacade.registerContentObserver(context, - Settings.Global.getUriFor(Settings.Global.CURATE_SAVED_OPEN_NETWORKS), - false /* notifyForDescendents */, mContentObserver); - frameworkFacade.registerContentObserver(context, - Settings.Global.getUriFor(Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED), - false /* notifyForDescendents */, mContentObserver); } private void localLog(String log) { @@ -320,13 +296,6 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat continue; } - if (mCurateSavedOpenNetworks - && WifiConfigurationUtil.isConfigForOpenNetwork(network)) { - localLog("Network " + WifiNetworkSelector.toNetworkString(network) - + " is open and CURATE_SAVED_OPEN_NETWORKS is enabled."); - continue; - } - if (score > highestScoreOfScanResult) { highestScoreOfScanResult = score; candidateIdOfScanResult = network.networkId; diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index af470eee8..c86bf1b93 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -198,9 +198,8 @@ public class WifiInjector { mConnectivityLocalLog = new LocalLog(ActivityManager.isLowRamDeviceStatic() ? 256 : 512); mWifiNetworkSelector = new WifiNetworkSelector(mContext, mWifiConfigManager, mClock, mConnectivityLocalLog); - mSavedNetworkEvaluator = new SavedNetworkEvaluator(mContext, - mWifiConfigManager, mClock, mConnectivityLocalLog, wifiStateMachineLooper, - mFrameworkFacade, mWifiConnectivityHelper); + mSavedNetworkEvaluator = new SavedNetworkEvaluator(mContext, mWifiConfigManager, mClock, + mConnectivityLocalLog, mWifiConnectivityHelper); mRecommendedNetworkEvaluator = new RecommendedNetworkEvaluator(context, context.getContentResolver(), wifiStateMachineLooper, mFrameworkFacade, mNetworkScoreManager, mWifiConfigManager, mConnectivityLocalLog); -- cgit v1.2.3