Add "Speed & compatibility" preference to Wi-Fi hotspot Settings
- Show 4 speed types in summary - 2.4 Ghz - 5 Ghz - 2.4 and 5 GHz - 6 GHz Bug: 245258763 Test: manual test atest -c WifiTetherViewModelTest atest -c WifiHotspotRepositoryTest make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest Change-Id: I6deb41cb355b0ceb1f1fd2d84408a83b90433e7d
This commit is contained in:
@@ -34,11 +34,13 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.widget.SettingsMainSwitchBar;
|
||||
import com.android.settings.wifi.WifiUtils;
|
||||
@@ -69,6 +71,8 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
@VisibleForTesting
|
||||
static final String KEY_WIFI_TETHER_MAXIMIZE_COMPATIBILITY =
|
||||
WifiTetherMaximizeCompatibilityPreferenceController.PREF_KEY;
|
||||
@VisibleForTesting
|
||||
static final String KEY_WIFI_HOTSPOT_SPEED = "wifi_hotspot_speed";
|
||||
|
||||
private WifiTetherSwitchBarController mSwitchBarController;
|
||||
private WifiTetherSSIDPreferenceController mSSIDPreferenceController;
|
||||
@@ -84,6 +88,11 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
@VisibleForTesting
|
||||
TetherChangeReceiver mTetherChangeReceiver;
|
||||
|
||||
@VisibleForTesting
|
||||
WifiTetherViewModel mWifiTetherViewModel;
|
||||
@VisibleForTesting
|
||||
Preference mWifiHotspotSpeed;
|
||||
|
||||
static {
|
||||
TETHER_STATE_CHANGE_FILTER = new IntentFilter(WIFI_AP_STATE_CHANGED_ACTION);
|
||||
}
|
||||
@@ -120,6 +129,13 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
|
||||
setIfOnlyAvailableForAdmins(true);
|
||||
mUnavailable = isUiRestricted() || !mWifiRestriction.isHotspotAvailable(getContext());
|
||||
|
||||
mWifiTetherViewModel = FeatureFactory.getFactory(getContext()).getWifiFeatureProvider()
|
||||
.getWifiTetherViewModel(this);
|
||||
mWifiHotspotSpeed = findPreference(KEY_WIFI_HOTSPOT_SPEED);
|
||||
if (mWifiHotspotSpeed != null && mWifiHotspotSpeed.isVisible()) {
|
||||
mWifiTetherViewModel.getSpeedSummary().observe(this, this::onSpeedSummaryChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,6 +191,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
// Handle the initial state after register the receiver.
|
||||
updateDisplayWithNewConfig();
|
||||
}
|
||||
mWifiTetherViewModel.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,6 +206,9 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
}
|
||||
}
|
||||
|
||||
protected void onSpeedSummaryChanged(Integer summaryResId) {
|
||||
mWifiHotspotSpeed.setSummary(summaryResId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
@@ -228,7 +248,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
mRestartWifiApAfterConfigChange = true;
|
||||
mSwitchBarController.stopTether();
|
||||
}
|
||||
mWifiManager.setSoftApConfiguration(config);
|
||||
mWifiTetherViewModel.setSoftApConfiguration(config);
|
||||
}
|
||||
|
||||
private SoftApConfiguration buildNewConfig() {
|
||||
|
||||
Reference in New Issue
Block a user