Smart Router settings UI changes
- Remove "AP band" preference - Add "Maximize Compatibility" switch preference - Use bridged mode API for new devices (after P21) - Screenshot: https://screenshot.googleplex.com/84X9Av8gVj3idjB Bug: 168052744 Test: manual test atest WifiTetherMaximizeCompatibilityPreferenceControllerTest make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest Change-Id: Ib74156c0fa6eccdd13239854047b1fb4e49a293c
This commit is contained in:
@@ -54,8 +54,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
private static final String TAG = "WifiTetherSettings";
|
||||
private static final IntentFilter TETHER_STATE_CHANGE_FILTER;
|
||||
private static final String KEY_WIFI_TETHER_SCREEN = "wifi_tether_settings_screen";
|
||||
private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 3;
|
||||
private static final int EXPANDED_CHILD_COUNT_DEFAULT = 4;
|
||||
private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
|
||||
|
||||
@VisibleForTesting
|
||||
static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name";
|
||||
@@ -64,13 +63,14 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
@VisibleForTesting
|
||||
static final String KEY_WIFI_TETHER_AUTO_OFF = "wifi_tether_auto_turn_off";
|
||||
@VisibleForTesting
|
||||
static final String KEY_WIFI_TETHER_NETWORK_AP_BAND = "wifi_tether_network_ap_band";
|
||||
static final String KEY_WIFI_TETHER_MAXIMIZE_COMPATIBILITY =
|
||||
WifiTetherMaximizeCompatibilityPreferenceController.PREF_KEY;
|
||||
|
||||
private WifiTetherSwitchBarController mSwitchBarController;
|
||||
private WifiTetherSSIDPreferenceController mSSIDPreferenceController;
|
||||
private WifiTetherPasswordPreferenceController mPasswordPreferenceController;
|
||||
private WifiTetherApBandPreferenceController mApBandPreferenceController;
|
||||
private WifiTetherSecurityPreferenceController mSecurityPreferenceController;
|
||||
private WifiTetherMaximizeCompatibilityPreferenceController mMaxCompatibilityPrefController;
|
||||
|
||||
private WifiManager mWifiManager;
|
||||
private boolean mRestartWifiApAfterConfigChange;
|
||||
@@ -116,7 +116,8 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
mSSIDPreferenceController = use(WifiTetherSSIDPreferenceController.class);
|
||||
mSecurityPreferenceController = use(WifiTetherSecurityPreferenceController.class);
|
||||
mPasswordPreferenceController = use(WifiTetherPasswordPreferenceController.class);
|
||||
mApBandPreferenceController = use(WifiTetherApBandPreferenceController.class);
|
||||
mMaxCompatibilityPrefController =
|
||||
use(WifiTetherMaximizeCompatibilityPreferenceController.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,10 +181,9 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
controllers.add(new WifiTetherSSIDPreferenceController(context, listener));
|
||||
controllers.add(new WifiTetherSecurityPreferenceController(context, listener));
|
||||
controllers.add(new WifiTetherPasswordPreferenceController(context, listener));
|
||||
controllers.add(new WifiTetherApBandPreferenceController(context, listener));
|
||||
controllers.add(
|
||||
new WifiTetherAutoOffPreferenceController(context, KEY_WIFI_TETHER_AUTO_OFF));
|
||||
|
||||
controllers.add(new WifiTetherMaximizeCompatibilityPreferenceController(context, listener));
|
||||
return controllers;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
mPasswordPreferenceController.getPasswordValidated(securityType),
|
||||
securityType);
|
||||
}
|
||||
configBuilder.setBand(mApBandPreferenceController.getBandIndex());
|
||||
mMaxCompatibilityPrefController.setupMaximizeCompatibility(configBuilder);
|
||||
return configBuilder.build();
|
||||
}
|
||||
|
||||
@@ -229,14 +229,10 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
}
|
||||
|
||||
private void updateDisplayWithNewConfig() {
|
||||
use(WifiTetherSSIDPreferenceController.class)
|
||||
.updateDisplay();
|
||||
use(WifiTetherSecurityPreferenceController.class)
|
||||
.updateDisplay();
|
||||
use(WifiTetherPasswordPreferenceController.class)
|
||||
.updateDisplay();
|
||||
use(WifiTetherApBandPreferenceController.class)
|
||||
.updateDisplay();
|
||||
use(WifiTetherSSIDPreferenceController.class).updateDisplay();
|
||||
use(WifiTetherSecurityPreferenceController.class).updateDisplay();
|
||||
use(WifiTetherPasswordPreferenceController.class).updateDisplay();
|
||||
use(WifiTetherMaximizeCompatibilityPreferenceController.class).updateDisplay();
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
@@ -250,7 +246,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
keys.add(KEY_WIFI_TETHER_NETWORK_NAME);
|
||||
keys.add(KEY_WIFI_TETHER_NETWORK_PASSWORD);
|
||||
keys.add(KEY_WIFI_TETHER_AUTO_OFF);
|
||||
keys.add(KEY_WIFI_TETHER_NETWORK_AP_BAND);
|
||||
keys.add(KEY_WIFI_TETHER_MAXIMIZE_COMPATIBILITY);
|
||||
}
|
||||
|
||||
// Remove duplicate
|
||||
@@ -294,22 +290,17 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
|
||||
private void reConfigInitialExpandedChildCount() {
|
||||
final PreferenceGroup screen = getPreferenceScreen();
|
||||
if (mSecurityPreferenceController.getSecurityType()
|
||||
== SoftApConfiguration.SECURITY_TYPE_OPEN) {
|
||||
screen.setInitialExpandedChildrenCount(EXPANDED_CHILD_COUNT_WITH_SECURITY_NON);
|
||||
return;
|
||||
if (screen != null) {
|
||||
screen.setInitialExpandedChildrenCount(getInitialExpandedChildCount());
|
||||
}
|
||||
screen.setInitialExpandedChildrenCount(EXPANDED_CHILD_COUNT_DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialExpandedChildCount() {
|
||||
if (mSecurityPreferenceController == null) {
|
||||
return EXPANDED_CHILD_COUNT_DEFAULT;
|
||||
if (mSecurityPreferenceController != null && mSecurityPreferenceController.getSecurityType()
|
||||
== SoftApConfiguration.SECURITY_TYPE_OPEN) {
|
||||
return (EXPANDED_CHILD_COUNT_DEFAULT - 1);
|
||||
}
|
||||
|
||||
return (mSecurityPreferenceController.getSecurityType()
|
||||
== SoftApConfiguration.SECURITY_TYPE_OPEN)
|
||||
? EXPANDED_CHILD_COUNT_WITH_SECURITY_NON : EXPANDED_CHILD_COUNT_DEFAULT;
|
||||
return EXPANDED_CHILD_COUNT_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user