diff options
author | Nate Jiang <qiangjiang@google.com> | 2020-03-13 17:06:41 -0700 |
---|---|---|
committer | Nate Jiang <qiangjiang@google.com> | 2020-03-15 18:07:58 -0700 |
commit | f3540497d1d1a15eaf645037515cdaba38db3d00 (patch) | |
tree | 68f393e6fb14ab9a766094ca33088d5eba76c232 /service | |
parent | 8a1ca31de5f3233b4989920b53016039d25694aa (diff) |
Persist trust network bit inside WifiConfiguration
Remove untrusted bit from suggestion, instead persist inside the
wifiConfiguration.
Bug: 151150610
Test: atest com.android.server.wifi
Change-Id: I8c323963aaaa047fdd88cea2bacd63bf676aed3d
Diffstat (limited to 'service')
3 files changed, 9 insertions, 11 deletions
diff --git a/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java b/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java index 05cf4cc92..169e87db9 100644 --- a/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java +++ b/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java @@ -67,7 +67,6 @@ public class NetworkSuggestionStoreData implements WifiConfigStore.StoreData { "IsUserAllowedToManuallyConnect"; private static final String XML_TAG_IS_INITIALIZED_AUTO_JOIN = "InitializedAutoJoinEnabled"; private static final String XML_TAG_IS_AUTO_JOIN = "AutoJoinEnabled"; - private static final String XML_TAG_IS_NETWORK_UNTRUSTED = "IsNetworkUntrusted"; private static final String XML_TAG_SUGGESTOR_UID = "SuggestorUid"; private static final String XML_TAG_SUGGESTOR_PACKAGE_NAME = "SuggestorPackageName"; private static final String XML_TAG_SUGGESTOR_FEATURE_ID = "SuggestorFeatureId"; @@ -249,7 +248,6 @@ public class NetworkSuggestionStoreData implements WifiConfigStore.StoreData { suggestion.isInitialAutoJoinEnabled); XmlUtil.writeNextValue(out, XML_TAG_IS_AUTO_JOIN, extSuggestion.isAutojoinEnabled); - XmlUtil.writeNextValue(out, XML_TAG_IS_NETWORK_UNTRUSTED, suggestion.isNetworkUntrusted); XmlUtil.writeNextSectionEnd(out, XML_TAG_SECTION_HEADER_NETWORK_SUGGESTION); } @@ -409,8 +407,6 @@ public class NetworkSuggestionStoreData implements WifiConfigStore.StoreData { // Only needed for migration of data from Q to R. suggestorUid = (int) value; break; - case XML_TAG_IS_NETWORK_UNTRUSTED: - isNetworkUntrusted = (boolean) value; default: Log.w(TAG, "Ignoring unknown value name found: " + valueName[0]); break; @@ -473,7 +469,7 @@ public class NetworkSuggestionStoreData implements WifiConfigStore.StoreData { } return Pair.create(new WifiNetworkSuggestion(wifiConfiguration, passpointConfiguration, isAppInteractionRequired, isUserInteractionRequired, isUserAllowedToManuallyConnect, - isInitializedAutoJoinEnabled, isNetworkUntrusted), isAutoJoinEnabled); + isInitializedAutoJoinEnabled), isAutoJoinEnabled); } } diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java index 5f4f1a1e9..b0b1251d2 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java +++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java @@ -851,7 +851,7 @@ public class WifiNetworkSuggestionsManager { // Install Passpoint config, if failure, ignore that suggestion if (!mWifiInjector.getPasspointManager().addOrUpdateProvider( ewns.wns.passpointConfiguration, uid, - packageName, true, !ewns.wns.isNetworkUntrusted)) { + packageName, true, !ewns.wns.isUntrusted())) { Log.e(TAG, "Passpoint profile install failure for FQDN: " + ewns.wns.wifiConfiguration.FQDN); continue; @@ -1178,11 +1178,7 @@ public class WifiNetworkSuggestionsManager { WifiConfiguration network = mWifiConfigManager .getConfiguredNetwork(ewns.wns.getWifiConfiguration().getKey()); if (network == null) { - network = new WifiConfiguration(ewns.wns.getWifiConfiguration()); - network.ephemeral = true; - network.fromWifiNetworkSuggestion = true; - network.allowAutojoin = ewns.isAutojoinEnabled; - network.trusted = !ewns.wns.isNetworkUntrusted; + network = ewns.createInternalWifiConfiguration(); } networks.add(network); } diff --git a/service/java/com/android/server/wifi/util/XmlUtil.java b/service/java/com/android/server/wifi/util/XmlUtil.java index 906f99802..94d60e756 100644 --- a/service/java/com/android/server/wifi/util/XmlUtil.java +++ b/service/java/com/android/server/wifi/util/XmlUtil.java @@ -354,6 +354,7 @@ public class XmlUtil { public static final String XML_TAG_MAC_RANDOMIZATION_SETTING = "MacRandomizationSetting"; public static final String XML_TAG_CARRIER_ID = "CarrierId"; public static final String XML_TAG_IS_AUTO_JOIN = "AutoJoinEnabled"; + public static final String XML_TAG_IS_TRUSTED = "Trusted"; /** * Write WepKeys to the XML stream. @@ -454,6 +455,8 @@ public class XmlUtil { configuration.allowedSuiteBCiphers.toByteArray()); XmlUtil.writeNextValue(out, XML_TAG_SHARED, configuration.shared); XmlUtil.writeNextValue(out, XML_TAG_IS_AUTO_JOIN, configuration.allowAutojoin); + XmlUtil.writeNextValue(out, XML_TAG_IS_TRUSTED, configuration.trusted); + } /** @@ -707,6 +710,9 @@ public class XmlUtil { case XML_TAG_IS_AUTO_JOIN: configuration.allowAutojoin = (boolean) value; break; + case XML_TAG_IS_TRUSTED: + configuration.trusted = (boolean) value; + break; default: Log.w(TAG, "Ignoring unknown value name found: " + valueName[0]); break; |