Add Instant hotspot preference

- Add Instant hotspot preference to Wi-Fi hotspot settings

- Wait onServiceConnected callback and then getSettingsState

- Use the PendingIntent provided by SharedConnectivitySettingsState to launch Instant hotspot settings

Bug: 268550769
Test: manual test
atest -c WifiTetherSettingsTest
atest -c WifiTetherViewModelTest \
         SharedConnectivityRepositoryTest

Change-Id: I343599e6127d9b1cb4af661dcc80a8683589c7b8
This commit is contained in:
Weng Su
2023-08-15 22:22:23 +08:00
parent 4957e2d000
commit 63321a1a83
9 changed files with 581 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import com.android.settings.wifi.repository.SharedConnectivityRepository;
import com.android.settings.wifi.repository.WifiHotspotRepository;
import com.android.settings.wifi.tether.WifiHotspotSecurityViewModel;
import com.android.settings.wifi.tether.WifiHotspotSpeedViewModel;
@@ -44,6 +45,7 @@ public class WifiFeatureProvider {
private TetheringManager mTetheringManager;
private WifiVerboseLogging mWifiVerboseLogging;
private WifiHotspotRepository mWifiHotspotRepository;
private SharedConnectivityRepository mSharedConnectivityRepository;
public WifiFeatureProvider(@NonNull Context appContext) {
mAppContext = appContext;
@@ -92,6 +94,17 @@ public class WifiFeatureProvider {
return mWifiHotspotRepository;
}
/**
* Gets SharedConnectivityRepository
*/
public SharedConnectivityRepository getSharedConnectivityRepository() {
if (mSharedConnectivityRepository == null) {
mSharedConnectivityRepository = new SharedConnectivityRepository(mAppContext);
verboseLog(TAG, "getSharedConnectivityRepository():" + mSharedConnectivityRepository);
}
return mSharedConnectivityRepository;
}
/**
* Gets WifiTetherViewModel
*/