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:
@@ -18,6 +18,7 @@ package com.android.settings.wifi.factory;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.net.TetheringManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -40,6 +41,7 @@ public class WifiFeatureProvider {
|
||||
|
||||
private final Context mAppContext;
|
||||
private WifiManager mWifiManager;
|
||||
private TetheringManager mTetheringManager;
|
||||
private WifiVerboseLogging mWifiVerboseLogging;
|
||||
private WifiHotspotRepository mWifiHotspotRepository;
|
||||
|
||||
@@ -48,7 +50,7 @@ public class WifiFeatureProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WifiManager
|
||||
* Gets WifiManager
|
||||
*/
|
||||
public WifiManager getWifiManager() {
|
||||
if (mWifiManager == null) {
|
||||
@@ -58,7 +60,18 @@ public class WifiFeatureProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WifiVerboseLogging
|
||||
* Gets TetheringManager
|
||||
*/
|
||||
public TetheringManager getTetheringManager() {
|
||||
if (mTetheringManager == null) {
|
||||
mTetheringManager = mAppContext.getSystemService(TetheringManager.class);
|
||||
verboseLog(TAG, "getTetheringManager():" + mTetheringManager);
|
||||
}
|
||||
return mTetheringManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets WifiVerboseLogging
|
||||
*/
|
||||
public WifiVerboseLogging getWifiVerboseLogging() {
|
||||
if (mWifiVerboseLogging == null) {
|
||||
@@ -68,25 +81,26 @@ public class WifiFeatureProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WifiHotspotRepository
|
||||
* Gets WifiHotspotRepository
|
||||
*/
|
||||
public WifiHotspotRepository getWifiHotspotRepository() {
|
||||
if (mWifiHotspotRepository == null) {
|
||||
mWifiHotspotRepository = new WifiHotspotRepository(mAppContext, getWifiManager());
|
||||
mWifiHotspotRepository = new WifiHotspotRepository(mAppContext, getWifiManager(),
|
||||
getTetheringManager());
|
||||
verboseLog(TAG, "getWifiHotspotRepository():" + mWifiHotspotRepository);
|
||||
}
|
||||
return mWifiHotspotRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WifiTetherViewModel
|
||||
* Gets WifiTetherViewModel
|
||||
*/
|
||||
public WifiTetherViewModel getWifiTetherViewModel(@NotNull ViewModelStoreOwner owner) {
|
||||
return new ViewModelProvider(owner).get(WifiTetherViewModel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WifiHotspotSecurityViewModel
|
||||
* Gets WifiHotspotSecurityViewModel
|
||||
*/
|
||||
public WifiHotspotSecurityViewModel getWifiHotspotSecurityViewModel(
|
||||
@NotNull ViewModelStoreOwner owner) {
|
||||
@@ -97,7 +111,7 @@ public class WifiFeatureProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WifiHotspotSpeedViewModel
|
||||
* Gets WifiHotspotSpeedViewModel
|
||||
*/
|
||||
public WifiHotspotSpeedViewModel getWifiHotspotSpeedViewModel(
|
||||
@NotNull ViewModelStoreOwner owner) {
|
||||
|
Reference in New Issue
Block a user