Restart Wi-Fi tethering automatically if configuration change

- When the Wi-Fi Hotspot is already started, if the user changes the configuration, the Wi-Fi Hotspot will be restarted automatically.

- When the Wi-Fi hotspot restarts, display a circle on the screen to indicate that it is processing.

Bug: 245258763
Test: manual test
atest -c WifiTetherSettingsTest \
         WifiHotspotSpeedSettingsTest
atest -c WifiHotspotRepositoryTest \
         WifiHotspotSecuritySettingsTest \
         WifiHotspotSecurityViewModelTest \
         WifiHotspotSpeedViewModelTest \
         WifiTetherViewModelTest

Change-Id: I6fdd5892916703095f28d0589ebc3b7dd59fcd61
This commit is contained in:
Weng Su
2023-04-20 21:40:30 +08:00
parent 0a506448b8
commit bf0e8c1dc7
15 changed files with 552 additions and 178 deletions

View File

@@ -24,6 +24,8 @@ import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_6
import android.app.settings.SettingsEnums;
import android.os.Bundle;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
@@ -80,6 +82,7 @@ public class WifiHotspotSpeedSettings extends DashboardFragment implements
onSpeedInfoMapDataChanged(mWifiHotspotSpeedViewModel.getSpeedInfoMapData().getValue());
mWifiHotspotSpeedViewModel.getSpeedInfoMapData()
.observe(this, this::onSpeedInfoMapDataChanged);
mWifiHotspotSpeedViewModel.getRestarting().observe(this, this::onRestartingChanged);
}
protected void loadPreferences() {
@@ -117,6 +120,12 @@ public class WifiHotspotSpeedSettings extends DashboardFragment implements
}
}
@VisibleForTesting
void onRestartingChanged(Boolean restarting) {
log("onRestartingChanged(), restarting:" + restarting);
setLoading(restarting, false);
}
@Override
public void onRadioButtonClicked(SelectorWithWidgetPreference emiter) {
String key = emiter.getKey();