Merge "[Wi-Fi] Support hidden SSID Wi-Fi networks for Wi-Fi QR code scanner & generator" into qt-qpr1-dev

am: 318be48d07

Change-Id: I6a33141d8e12a3a16d723b506c986eff941956c9
This commit is contained in:
Arc Wang
2019-08-22 22:23:57 -07:00
committed by android-build-merger
5 changed files with 93 additions and 6 deletions

View File

@@ -390,7 +390,7 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements
WifiDppUtils.getSecurityString(wifiConfiguration),
wifiConfiguration.getPrintableSsid(),
wifiConfiguration.preSharedKey,
/* hiddenSsid */ false,
wifiConfiguration.hiddenSSID,
wifiConfiguration.networkId,
/* isHotspot */ false);
}

View File

@@ -172,22 +172,25 @@ public class WifiDppQrCodeScannerFragment extends WifiDppQrCodeBaseFragment impl
// Adds all Wi-Fi networks in QR code to the set of configured networks and
// connects to it if it's reachable.
boolean hasReachableWifiNetwork = false;
boolean hasHiddenOrReachableWifiNetwork = false;
for (WifiConfiguration qrCodeWifiConfiguration : qrCodeWifiConfigurations) {
final int id = wifiManager.addNetwork(qrCodeWifiConfiguration);
if (id == -1) {
continue;
}
wifiManager.enableNetwork(id, /* attemptConnect */ false);
if (isReachableWifiNetwork(qrCodeWifiConfiguration)) {
hasReachableWifiNetwork = true;
// WifiTracker only contains a hidden SSID Wi-Fi network if it's saved.
// We can't check if a hidden SSID Wi-Fi network is reachable in advance.
if (qrCodeWifiConfiguration.hiddenSSID ||
isReachableWifiNetwork(qrCodeWifiConfiguration)) {
hasHiddenOrReachableWifiNetwork = true;
mEnrolleeWifiConfiguration = qrCodeWifiConfiguration;
wifiManager.connect(id,
/* listener */ WifiDppQrCodeScannerFragment.this);
}
}
if (hasReachableWifiNetwork == false) {
if (!hasHiddenOrReachableWifiNetwork) {
showErrorMessageAndRestartCamera(
R.string.wifi_dpp_check_connection_try_again);
return;

View File

@@ -296,6 +296,7 @@ public class WifiDppUtils {
if (!TextUtils.isEmpty(preSharedKey)) {
intent.putExtra(EXTRA_WIFI_PRE_SHARED_KEY, preSharedKey);
}
intent.putExtra(EXTRA_WIFI_HIDDEN_SSID, wifiConfiguration.hiddenSSID);
}
/**

View File

@@ -220,7 +220,7 @@ public class WifiNetworkListFragment extends SettingsPreferenceFragment implemen
}
final WifiNetworkConfig networkConfig = WifiNetworkConfig.getValidConfigOrNull(
selectedAccessPoint.getSecurityString(/* concise */ true),
wifiConfig.getPrintableSsid(), wifiConfig.preSharedKey, /* hiddenSsid */ false,
wifiConfig.getPrintableSsid(), wifiConfig.preSharedKey, wifiConfig.hiddenSSID,
wifiConfig.networkId, /* isHotspot */ false);
if (mOnChooseNetworkListener != null) {
mOnChooseNetworkListener.onChooseNetwork(networkConfig);