From d451d16712b44c084a3c5e866ae3efb17d2c9569 Mon Sep 17 00:00:00 2001 From: Weng Su Date: Fri, 23 Apr 2021 20:34:07 +0800 Subject: [PATCH] Show security screen for ACTION_PROCESS_WIFI_EASY_CONNECT_URI intent Bug: 183181987 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=WifiDppConfiguratorActivityTest Change-Id: I26e97142cc1c30909bd14eb85d466442274446a9 --- .../wifi/dpp/WifiDppConfiguratorActivity.java | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java index 6659c7ace91..ecaf9ee8fc4 100644 --- a/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java +++ b/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java @@ -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(