Merge "tether setting: Remove dual mode check for band convert"

This commit is contained in:
TreeHugger Robot
2020-02-10 09:06:57 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 63 deletions

View File

@@ -39,12 +39,10 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen
private String[] mBandEntries;
private String[] mBandSummaries;
private int mBandIndex;
private boolean isDualMode;
public WifiTetherApBandPreferenceController(Context context,
OnTetherConfigUpdateListener listener) {
super(context, listener);
isDualMode = mWifiManager.isStaApConcurrencySupported();
updatePreferenceEntries();
}
@@ -106,16 +104,12 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen
private int validateSelection(int band) {
// unsupported states:
// 1: no dual mode means we can't have multiband - default to 5GHZ
// 1: BAND_5GHZ only - include 2GHZ since some of countries doesn't support 5G hotspot
// 2: no 5 GHZ support means we can't have BAND_5GHZ - default to 2GHZ
// 3: With Dual mode support we can't have BAND_5GHZ only - include 2GHZ
if (!isDualMode
&& ((band & SoftApConfiguration.BAND_5GHZ) != 0)
&& ((band & SoftApConfiguration.BAND_2GHZ) != 0)) {
return SoftApConfiguration.BAND_5GHZ;
} else if (!is5GhzBandSupported() && SoftApConfiguration.BAND_5GHZ == band) {
return SoftApConfiguration.BAND_2GHZ;
} else if (isDualMode && SoftApConfiguration.BAND_5GHZ == band) {
if (SoftApConfiguration.BAND_5GHZ == band) {
if (!is5GhzBandSupported()) {
return SoftApConfiguration.BAND_2GHZ;
}
return SoftApConfiguration.BAND_5GHZ | SoftApConfiguration.BAND_2GHZ;
}
@@ -125,13 +119,8 @@ public class WifiTetherApBandPreferenceController extends WifiTetherBasePreferen
@VisibleForTesting
void updatePreferenceEntries() {
Resources res = mContext.getResources();
int entriesRes = R.array.wifi_ap_band_config_full;
int summariesRes = R.array.wifi_ap_band_summary_full;
// change the list options if this is a dual mode device
if (isDualMode) {
entriesRes = R.array.wifi_ap_band_dual_mode;
summariesRes = R.array.wifi_ap_band_dual_mode_summary;
}
int entriesRes = R.array.wifi_ap_band;
int summariesRes = R.array.wifi_ap_band_summary;
mBandEntries = res.getStringArray(entriesRes);
mBandSummaries = res.getStringArray(summariesRes);
}