summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@google.com>2017-08-31 16:37:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-08-31 16:37:56 +0000
commitb3592f242d47784024bc244d8814f68fa46d22c6 (patch)
treec00f6cb33df8e5e368bb360b1721eadab1163794 /service
parent876054396ec8fc5e706e37da0e77297eb8c3cddb (diff)
parenteb3dfcbab191efe0532294b75a5e2ce6837ce1c9 (diff)
Merge "Meteredness should reflect user opinion." into oc-mr1-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java2
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java20
2 files changed, 14 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 93db5ab67..e417fde2c 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -512,6 +512,8 @@ public class WifiConnectivityManager {
}
@Override
public void onSavedNetworkUpdated(int networkId) {
+ // User might have changed meteredOverride, so update capabilties
+ mStateMachine.updateCapabilities();
updatePnoScan();
}
@Override
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 5ebe25902..f1ca17dfd 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -3482,14 +3482,14 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
final WifiConfiguration config = getCurrentWifiConfiguration();
if (config != null) {
mWifiInfo.setEphemeral(config.ephemeral);
+ }
- // Set meteredHint if DHCP result says network is metered
- if (dhcpResults.hasMeteredHint()) {
- mWifiInfo.setMeteredHint(true);
- }
+ // Set meteredHint if DHCP result says network is metered
+ if (dhcpResults.hasMeteredHint()) {
+ mWifiInfo.setMeteredHint(true);
}
- updateCapabilities();
+ updateCapabilities(config);
}
private void handleSuccessfulIpConfiguration() {
@@ -3501,7 +3501,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
WifiConfiguration.NetworkSelectionStatus.DISABLED_DHCP_FAILURE);
// Tell the framework whether the newly connected network is trusted or untrusted.
- updateCapabilities();
+ updateCapabilities(c);
}
if (c != null) {
ScanResult result = getCurrentScanResult();
@@ -5507,7 +5507,11 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
}
}
- private void updateCapabilities() {
+ public void updateCapabilities() {
+ updateCapabilities(getCurrentWifiConfiguration());
+ }
+
+ private void updateCapabilities(WifiConfiguration config) {
final NetworkCapabilities result = new NetworkCapabilities(mDfltNetworkCapabilities);
if (mWifiInfo != null && !mWifiInfo.isEphemeral()) {
@@ -5516,7 +5520,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
result.removeCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED);
}
- if (mWifiInfo != null && !mWifiInfo.getMeteredHint()) {
+ if (mWifiInfo != null && !WifiConfiguration.isMetered(config, mWifiInfo)) {
result.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
} else {
result.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);