Merge "Show security screen for ACTION_PROCESS_WIFI_EASY_CONNECT_URI intent" into sc-dev am: 5f876de174

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14292670

Change-Id: Ib54669896cf9c50d02f13d33a44c123679acbf80
This commit is contained in:
TreeHugger Robot
2021-04-26 07:38:20 +00:00
committed by Automerger Merge Worker

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(