Support to share Wi-Fi hotspot via QR code

1. QR code scanner (Wi-Fi Easy Connect) does not support sharing Wi-Fi hotspot
   at current stage
2. Wi-Fi hotspot QR code button only shows when Wi-Fi hotspot is enabled
3. The QR code has the security string "WPA" for hotspot's WPA2_PSK

Bug: 123151660
Test: atest WifiTetherSSIDPreferenceControllerTest
            WifiQrCodeTest WifiDppConfiguratorActivityTest
            WifiDppEnrolleeActivityTest
            WifiDppQrCodeGeneratorFragmentTest
            WifiDppQrCodeScannerFragmentTest
            WifiNetworkListFragmentTest
            WifiDppChooseSavedWifiNetworkFragmentTest

Change-Id: I2e89450180b82cc841ee3b15be52bfc6f9f6164d
This commit is contained in:
Arc Wang
2019-03-04 17:20:41 +08:00
parent 131eeac4aa
commit b249fb7d13
13 changed files with 361 additions and 102 deletions

View File

@@ -86,7 +86,8 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
MenuItem menuItem;
if (wifiNetworkConfig.isSupportWifiDpp(getActivity())) {
if (!wifiNetworkConfig.isHotspot() &&
wifiNetworkConfig.isSupportWifiDpp(getActivity())) {
menuItem = menu.add(0, Menu.FIRST, 0, R.string.next_label);
menuItem.setIcon(R.drawable.ic_scan_24dp);
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
@@ -127,9 +128,15 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
setHeaderIconImageResource(R.drawable.ic_qrcode_24dp);
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
mTitle.setText(R.string.wifi_dpp_share_wifi);
mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
wifiNetworkConfig.getSsid()));
if (wifiNetworkConfig.isHotspot()) {
mTitle.setText(R.string.wifi_dpp_share_hotspot);
mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_to_share_hotspot,
wifiNetworkConfig.getSsid()));
} else {
mTitle.setText(R.string.wifi_dpp_share_wifi);
mSummary.setText(getString(R.string.wifi_dpp_scan_qr_code_with_another_device,
wifiNetworkConfig.getSsid()));
}
mQrCode = wifiNetworkConfig.getQrCode();
setQrCode();