Make only the "Add Network" WifiDialog fullscreen.

Fixes an issue where other instances of WifiDialog were being launched
fullscreen. Creates static methods for creating fullscreen and modal
WifiDialogs to make the style more explicit.

Bug: 63889135
Test: make -j40 RunSettingsRoboTests
Change-Id: I2200b5d7f817b9f69a6abb73bf2c04ea24556d19
This commit is contained in:
Eric Schwarzenbach
2017-07-21 15:48:58 -07:00
parent bd429f42cb
commit bc1cf7e260
5 changed files with 101 additions and 24 deletions

View File

@@ -626,20 +626,23 @@ public class WifiSettings extends RestrictedSettingsFragment
public Dialog onCreateDialog(int dialogId) {
switch (dialogId) {
case WIFI_DIALOG_ID:
AccessPoint ap = mDlgAccessPoint; // For manual launch
if (ap == null) { // For re-launch from saved state
if (mAccessPointSavedState != null) {
ap = new AccessPoint(getActivity(), mAccessPointSavedState);
// For repeated orientation changes
mDlgAccessPoint = ap;
if (mDlgAccessPoint == null && mAccessPointSavedState == null) {
// add new network
mDialog = WifiDialog
.createFullscreen(getActivity(), this, mDlgAccessPoint, mDialogMode);
} else {
// modify network
if (mDlgAccessPoint == null) {
// restore AP from save state
mDlgAccessPoint = new AccessPoint(getActivity(), mAccessPointSavedState);
// Reset the saved access point data
mAccessPointSavedState = null;
}
mDialog = WifiDialog
.createModal(getActivity(), this, mDlgAccessPoint, mDialogMode);
}
// If it's null, fine, it's for Add Network
mSelectedAccessPoint = ap;
mDialog = new WifiDialog(getActivity(), this, ap, mDialogMode,
/* no hide submit/connect */ false);
mSelectedAccessPoint = mDlgAccessPoint;
return mDialog;
case WPS_PBC_DIALOG_ID:
return new WpsDialog(getActivity(), WpsInfo.PBC);