Improve UX of Wi-Fi QR code scanner enrollee flow
1. Do not start WifiSettings after enrollee success 2. Return WifiConfiguration to the calling object after enrollee success 3. In WifiDialog, do not show scan button if Save button is not visible to users 4. Fix scanner button may not respond problem by setting listener for scanner button of ssid field and password field 5. If SSID is assigned, only allow to enrollee for the network of assigned SSID Bug: 124416152 Test: manual test Change-Id: Ic5241c4767eaa8ea01782817d8302d8b0572ab36
This commit is contained in:
@@ -29,6 +29,7 @@ import android.util.Log;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.settings.wifi.dpp.WifiDppUtils;
|
||||
import com.android.settingslib.wifi.AccessPoint;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
@@ -49,10 +50,13 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo
|
||||
@VisibleForTesting
|
||||
static final String KEY_CONNECT_FOR_CALLER = "connect_for_caller";
|
||||
|
||||
private static final String KEY_WIFI_CONFIGURATION = "wifi_configuration";
|
||||
public static final String KEY_WIFI_CONFIGURATION = "wifi_configuration";
|
||||
|
||||
private static final int RESULT_CONNECTED = RESULT_FIRST_USER;
|
||||
private static final int RESULT_FORGET = RESULT_FIRST_USER + 1;
|
||||
|
||||
private static final int REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER = 0;
|
||||
|
||||
private WifiDialog mDialog;
|
||||
|
||||
@Override
|
||||
@@ -162,4 +166,25 @@ public class WifiDialogActivity extends Activity implements WifiDialog.WifiDialo
|
||||
mDialog = null;
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScan(WifiDialog dialog, String ssid) {
|
||||
// Launch QR code scanner to join a network.
|
||||
startActivityForResult(WifiDppUtils.getEnrolleeQrCodeScannerIntent(ssid),
|
||||
REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode == REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER) {
|
||||
if (resultCode != RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
setResult(RESULT_CONNECTED, data);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user