Loading AndroidManifest.xml +5 −1 Original line number Diff line number Diff line Loading @@ -3092,9 +3092,13 @@ <intent-filter> <action android:name="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER"/> <action android:name="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR"/> <action android:name="android.settings.PROCESS_WIFI_EASY_CONNECT_QR_CODE"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="android.settings.PROCESS_WIFI_EASY_CONNECT_URI"/> <category android:name="android.intent.category.DEFAULT"/> <data android:scheme="DPP"/> </intent-filter> </activity> <activity Loading src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java +8 −6 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.settings.wifi.dpp; import android.app.ActionBar; import android.app.settings.SettingsEnums; import android.content.Intent; import android.net.Uri; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; Loading Loading @@ -50,8 +51,8 @@ import java.util.List; * {@code WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY} * {@code WifiDppUtils.EXTRA_WIFI_HIDDEN_SSID} * * For intent action {@link Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE}, specify Wi-Fi (DPP) * QR code in {@code WifiDppUtils.EXTRA_QR_CODE} * For intent action {@link Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_URI}, specify Wi-Fi * Easy Connect bootstrapping information string in Intent's data URI. */ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements WifiNetworkConfig.Retriever, Loading Loading @@ -80,7 +81,7 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements /** The Wi-Fi network which will be configured */ private WifiNetworkConfig mWifiNetworkConfig; /** The Wi-Fi DPP QR code from intent ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE */ /** The Wi-Fi DPP QR code from intent ACTION_PROCESS_WIFI_EASY_CONNECT_URI */ private WifiQrCode mWifiDppQrCode; /** Secret extra that allows fake networks to show in UI for testing purposes */ Loading Loading @@ -144,10 +145,11 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements showQrCodeGeneratorFragment(); } break; case Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE: String qrCode = intent.getStringExtra(Settings.EXTRA_QR_CODE); case Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI: final Uri uri = intent.getData(); final String uriString = (uri == null) ? null : uri.toString(); mIsTest = intent.getBooleanExtra(WifiDppUtils.EXTRA_TEST, false); mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(qrCode); mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(uriString); final boolean isDppSupported = WifiDppUtils.isWifiDppEnabled(this); if (!isDppSupported) { Log.d(TAG, "Device doesn't support Wifi DPP"); Loading src/com/android/settings/wifi/dpp/WifiDppUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class WifiDppUtils { /** The data corresponding to {@code WifiConfiguration} networkId */ public static final String EXTRA_WIFI_NETWORK_ID = "networkId"; /** Used by {@link android.provider.Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE} to /** Used by {@link android.provider.Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_URI} to * indicate test mode UI should be shown. Test UI does not make API calls. Value is a boolean.*/ public static final String EXTRA_TEST = "test"; Loading tests/unit/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragmentTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.Settings; import androidx.fragment.app.FragmentManager; Loading Loading @@ -89,8 +90,8 @@ public class WifiDppChooseSavedWifiNetworkFragmentTest { @Test public void clickCancelButton_processWifiDppQrCodeIntent_shouldFinish() { final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE); intent.putExtra(Settings.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE); final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI); intent.setData(Uri.parse(VALID_WIFI_DPP_QR_CODE)); final WifiDppConfiguratorActivity hostActivity = mActivityRule.launchActivity(intent); onView(withText(resourceString(CANCEL))).perform(click()); Loading tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java +7 −6 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Instrumentation; import android.content.Intent; import android.content.pm.ActivityInfo; import android.net.Uri; import android.os.RemoteException; import android.provider.Settings; import android.support.test.uiautomator.UiDevice; Loading Loading @@ -78,8 +79,8 @@ public class WifiDppConfiguratorActivityTest { @Test public void launchActivity_chooseSavedWifiNetwork_shouldNotAutoFinish() { Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE); intent.putExtra(Settings.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE); final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI); intent.setData(Uri.parse(VALID_WIFI_DPP_QR_CODE)); mActivityRule.launchActivity(intent); Loading Loading @@ -145,10 +146,10 @@ public class WifiDppConfiguratorActivityTest { @Test public void rotateScreen_shouldGetCorrectWifiNetworkConfig() { WifiNetworkConfig wifiNetworkConfig = new WifiNetworkConfig("WPA", "WifiSsid", "password", /* hiddenSsid */ false, /* networkId */ 0); Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE); intent.putExtra(Settings.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE); final WifiNetworkConfig wifiNetworkConfig = new WifiNetworkConfig("WPA", "WifiSsid", "password", /* hiddenSsid */ false, /* networkId */ 0); final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI); intent.setData(Uri.parse(VALID_WIFI_DPP_QR_CODE)); // setWifiNetworkConfig and check if getWifiNetworkConfig correctly after rotation mActivityRule.launchActivity(intent); Loading Loading
AndroidManifest.xml +5 −1 Original line number Diff line number Diff line Loading @@ -3092,9 +3092,13 @@ <intent-filter> <action android:name="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_SCANNER"/> <action android:name="android.settings.WIFI_DPP_CONFIGURATOR_QR_CODE_GENERATOR"/> <action android:name="android.settings.PROCESS_WIFI_EASY_CONNECT_QR_CODE"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="android.settings.PROCESS_WIFI_EASY_CONNECT_URI"/> <category android:name="android.intent.category.DEFAULT"/> <data android:scheme="DPP"/> </intent-filter> </activity> <activity Loading
src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivity.java +8 −6 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.settings.wifi.dpp; import android.app.ActionBar; import android.app.settings.SettingsEnums; import android.content.Intent; import android.net.Uri; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; Loading Loading @@ -50,8 +51,8 @@ import java.util.List; * {@code WifiDppUtils.EXTRA_WIFI_PRE_SHARED_KEY} * {@code WifiDppUtils.EXTRA_WIFI_HIDDEN_SSID} * * For intent action {@link Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE}, specify Wi-Fi (DPP) * QR code in {@code WifiDppUtils.EXTRA_QR_CODE} * For intent action {@link Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_URI}, specify Wi-Fi * Easy Connect bootstrapping information string in Intent's data URI. */ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements WifiNetworkConfig.Retriever, Loading Loading @@ -80,7 +81,7 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements /** The Wi-Fi network which will be configured */ private WifiNetworkConfig mWifiNetworkConfig; /** The Wi-Fi DPP QR code from intent ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE */ /** The Wi-Fi DPP QR code from intent ACTION_PROCESS_WIFI_EASY_CONNECT_URI */ private WifiQrCode mWifiDppQrCode; /** Secret extra that allows fake networks to show in UI for testing purposes */ Loading Loading @@ -144,10 +145,11 @@ public class WifiDppConfiguratorActivity extends InstrumentedActivity implements showQrCodeGeneratorFragment(); } break; case Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE: String qrCode = intent.getStringExtra(Settings.EXTRA_QR_CODE); case Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI: final Uri uri = intent.getData(); final String uriString = (uri == null) ? null : uri.toString(); mIsTest = intent.getBooleanExtra(WifiDppUtils.EXTRA_TEST, false); mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(qrCode); mWifiDppQrCode = WifiQrCode.getValidWifiDppQrCodeOrNull(uriString); final boolean isDppSupported = WifiDppUtils.isWifiDppEnabled(this); if (!isDppSupported) { Log.d(TAG, "Device doesn't support Wifi DPP"); Loading
src/com/android/settings/wifi/dpp/WifiDppUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public class WifiDppUtils { /** The data corresponding to {@code WifiConfiguration} networkId */ public static final String EXTRA_WIFI_NETWORK_ID = "networkId"; /** Used by {@link android.provider.Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE} to /** Used by {@link android.provider.Settings#ACTION_PROCESS_WIFI_EASY_CONNECT_URI} to * indicate test mode UI should be shown. Test UI does not make API calls. Value is a boolean.*/ public static final String EXTRA_TEST = "test"; Loading
tests/unit/src/com/android/settings/wifi/dpp/WifiDppChooseSavedWifiNetworkFragmentTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.Settings; import androidx.fragment.app.FragmentManager; Loading Loading @@ -89,8 +90,8 @@ public class WifiDppChooseSavedWifiNetworkFragmentTest { @Test public void clickCancelButton_processWifiDppQrCodeIntent_shouldFinish() { final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE); intent.putExtra(Settings.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE); final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI); intent.setData(Uri.parse(VALID_WIFI_DPP_QR_CODE)); final WifiDppConfiguratorActivity hostActivity = mActivityRule.launchActivity(intent); onView(withText(resourceString(CANCEL))).perform(click()); Loading
tests/unit/src/com/android/settings/wifi/dpp/WifiDppConfiguratorActivityTest.java +7 −6 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Instrumentation; import android.content.Intent; import android.content.pm.ActivityInfo; import android.net.Uri; import android.os.RemoteException; import android.provider.Settings; import android.support.test.uiautomator.UiDevice; Loading Loading @@ -78,8 +79,8 @@ public class WifiDppConfiguratorActivityTest { @Test public void launchActivity_chooseSavedWifiNetwork_shouldNotAutoFinish() { Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE); intent.putExtra(Settings.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE); final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI); intent.setData(Uri.parse(VALID_WIFI_DPP_QR_CODE)); mActivityRule.launchActivity(intent); Loading Loading @@ -145,10 +146,10 @@ public class WifiDppConfiguratorActivityTest { @Test public void rotateScreen_shouldGetCorrectWifiNetworkConfig() { WifiNetworkConfig wifiNetworkConfig = new WifiNetworkConfig("WPA", "WifiSsid", "password", /* hiddenSsid */ false, /* networkId */ 0); Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_QR_CODE); intent.putExtra(Settings.EXTRA_QR_CODE, VALID_WIFI_DPP_QR_CODE); final WifiNetworkConfig wifiNetworkConfig = new WifiNetworkConfig("WPA", "WifiSsid", "password", /* hiddenSsid */ false, /* networkId */ 0); final Intent intent = new Intent(Settings.ACTION_PROCESS_WIFI_EASY_CONNECT_URI); intent.setData(Uri.parse(VALID_WIFI_DPP_QR_CODE)); // setWifiNetworkConfig and check if getWifiNetworkConfig correctly after rotation mActivityRule.launchActivity(intent); Loading