Filter out unsupported security type for DPP configuration.

There is different Wi-Fi security support between ZXing's Wi-Fi QR code
format and Wi-Fi DPP QR code format.

  ZXing's Wi-Fi QR code format: supports WEP / WPA / none security
  Wi-Fi DPP: supports WPA / SAE

So we will have different UI behavior for different security.

  WEP & none security: only support QR code generator
  WPA: supports both QR code generator & scanner
  SAE: only supports QR code scanner
  others: don't support. The share button is invisible

Bug: 123212410
Test: manual test
Change-Id: I87962d730282fc2c1b96223dca6feb79235fe5a1
This commit is contained in:
Arc Wang
2019-01-22 18:12:55 +08:00
parent 875178bbfa
commit cfa78006a0
6 changed files with 105 additions and 20 deletions

View File

@@ -290,7 +290,8 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
.setButton2OnClickListener(view -> signIntoNetwork())
.setButton3Text(R.string.share)
.setButton3Icon(R.drawable.ic_qrcode_24dp)
.setButton3OnClickListener(view -> shareNetwork());
.setButton3OnClickListener(view -> shareNetwork())
.setButton3Visible(WifiDppUtils.isSuportConfigurator(mContext, mAccessPoint));
mSignalStrengthPref = screen.findPreference(KEY_SIGNAL_STRENGTH_PREF);
mTxLinkSpeedPref = screen.findPreference(KEY_TX_LINK_SPEED);
@@ -558,10 +559,15 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
/**
* Show QR code to share the network represented by this preference.
*/
public void launchQRCodeGenerator() {
Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntent(mContext, mWifiManager,
public void launchWifiDppConfiguratorActivity() {
final Intent intent = WifiDppUtils.getConfiguratorIntentOrNull(mContext, mWifiManager,
mAccessPoint);
mContext.startActivity(intent);
if (intent == null) {
Log.e(TAG, "Launch Wi-Fi DPP configurator with a wrong Wi-Fi network!");
} else {
mContext.startActivity(intent);
}
}
/**
@@ -584,7 +590,7 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
WifiNetworkDetailsFragment.REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);
}
} else {
launchQRCodeGenerator();
launchWifiDppConfiguratorActivity();
}
}