Merge "[Wi-Fi] Support hidden SSID Wi-Fi networks for Wi-Fi QR code scanner & generator" into qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
318be48d07
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user