Show security screen for ACTION_PROCESS_WIFI_EASY_CONNECT_URI intent

Bug: 183181987
Test: manual test
make RunSettingsRoboTests
ROBOTEST_FILTER=WifiDppConfiguratorActivityTest

Change-Id: I26e97142cc1c30909bd14eb85d466442274446a9
This commit is contained in:
Weng Su
2021-04-23 20:34:07 +08:00
parent 2fcb8531ab
commit d451d16712

View File

@@ -144,31 +144,8 @@ public class WifiDppConfiguratorActivity extends WifiDppBaseActivity implements
}
break;
case Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI:
final Uri uri = intent.getData();
final String uriString = (uri == null) ? null : uri.toString();
mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(uriString);
mWifiDppRemoteBandSupport = intent.getIntArrayExtra(
Settings.EXTRA_EASY_CONNECT_BAND_LIST); // returns null if none
final boolean isDppSupported = WifiDppUtils.isWifiDppEnabled(this);
if (!isDppSupported) {
Log.e(TAG,
"ACTION_PROCESS_WIFI_EASY_CONNECT_URI for a device that doesn't "
+ "support Wifi DPP - use WifiManager#isEasyConnectSupported");
}
if (mWifiDppQrCode == null) {
Log.e(TAG, "ACTION_PROCESS_WIFI_EASY_CONNECT_URI with null URI!");
}
if (mWifiDppQrCode == null || !isDppSupported) {
cancelActivity = true;
} else {
final WifiNetworkConfig connectedConfig = getConnectedWifiNetworkConfigOrNull();
if (connectedConfig == null || !connectedConfig.isSupportWifiDpp(this)) {
showChooseSavedWifiNetworkFragment(/* addToBackStack */ false);
} else {
mWifiNetworkConfig = connectedConfig;
showAddDeviceFragment(/* addToBackStack */ false);
}
}
WifiDppUtils.showLockScreen(this,
() -> handleActionProcessWifiEasyConnectUriIntent(intent));
break;
default:
cancelActivity = true;
@@ -180,6 +157,34 @@ public class WifiDppConfiguratorActivity extends WifiDppBaseActivity implements
}
}
private void handleActionProcessWifiEasyConnectUriIntent(Intent intent) {
final Uri uri = intent.getData();
final String uriString = (uri == null) ? null : uri.toString();
mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(uriString);
mWifiDppRemoteBandSupport = intent.getIntArrayExtra(
Settings.EXTRA_EASY_CONNECT_BAND_LIST); // returns null if none
final boolean isDppSupported = WifiDppUtils.isWifiDppEnabled(this);
if (!isDppSupported) {
Log.e(TAG,
"ACTION_PROCESS_WIFI_EASY_CONNECT_URI for a device that doesn't "
+ "support Wifi DPP - use WifiManager#isEasyConnectSupported");
}
if (mWifiDppQrCode == null) {
Log.e(TAG, "ACTION_PROCESS_WIFI_EASY_CONNECT_URI with null URI!");
}
if (mWifiDppQrCode == null || !isDppSupported) {
finish();
} else {
final WifiNetworkConfig connectedConfig = getConnectedWifiNetworkConfigOrNull();
if (connectedConfig == null || !connectedConfig.isSupportWifiDpp(this)) {
showChooseSavedWifiNetworkFragment(/* addToBackStack */ false);
} else {
mWifiNetworkConfig = connectedConfig;
showAddDeviceFragment(/* addToBackStack */ false);
}
}
}
private void showQrCodeScannerFragment() {
WifiDppQrCodeScannerFragment fragment =
(WifiDppQrCodeScannerFragment) mFragmentManager.findFragmentByTag(