Clean up FeatureFactory.getFeature()

Bug: 286764889
Test: m Settings
Change-Id: I7e472e6b0ca6b7a735c1b92742ddf06c545176fc
This commit is contained in:
Chaohui Wang
2023-08-04 15:42:43 +08:00
parent 0062308347
commit 8e2ae547d6
220 changed files with 282 additions and 306 deletions

View File

@@ -63,7 +63,7 @@ public class WifiHotspotSecuritySettings extends DashboardFragment implements
}
protected void loadViewModel() {
mWifiHotspotSecurityViewModel = FeatureFactory.getFactory(getContext())
mWifiHotspotSecurityViewModel = FeatureFactory.getFeatureFactory()
.getWifiFeatureProvider().getWifiHotspotSecurityViewModel(this);
LiveData<List<WifiHotspotSecurityViewModel.ViewItem>> viewItemListData =
mWifiHotspotSecurityViewModel.getViewItemListData();
@@ -115,6 +115,6 @@ public class WifiHotspotSecuritySettings extends DashboardFragment implements
}
private void log(String msg) {
FeatureFactory.getFactory(getContext()).getWifiFeatureProvider().verboseLog(TAG, msg);
FeatureFactory.getFeatureFactory().getWifiFeatureProvider().verboseLog(TAG, msg);
}
}

View File

@@ -65,7 +65,7 @@ public class WifiHotspotSecurityViewModel extends AndroidViewModel {
mViewItemMap.put(SECURITY_TYPE_WPA2_PSK, new ViewItem(KEY_SECURITY_WPA2));
mViewItemMap.put(SECURITY_TYPE_OPEN, new ViewItem(KEY_SECURITY_NONE));
mWifiHotspotRepository = FeatureFactory.getFactory(application).getWifiFeatureProvider()
mWifiHotspotRepository = FeatureFactory.getFeatureFactory().getWifiFeatureProvider()
.getWifiHotspotRepository();
mWifiHotspotRepository.getSecurityType().observeForever(mSecurityTypeObserver);
mWifiHotspotRepository.getSpeedType().observeForever(mSpeedTypeObserver);
@@ -159,6 +159,6 @@ public class WifiHotspotSecurityViewModel extends AndroidViewModel {
}
private void log(String msg) {
FeatureFactory.getFactory(getApplication()).getWifiFeatureProvider().verboseLog(TAG, msg);
FeatureFactory.getFeatureFactory().getWifiFeatureProvider().verboseLog(TAG, msg);
}
}

View File

@@ -77,7 +77,7 @@ public class WifiHotspotSpeedSettings extends DashboardFragment implements
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
loadPreferences();
mWifiHotspotSpeedViewModel = FeatureFactory.getFactory(getContext())
mWifiHotspotSpeedViewModel = FeatureFactory.getFeatureFactory()
.getWifiFeatureProvider().getWifiHotspotSpeedViewModel(this);
onSpeedInfoMapDataChanged(mWifiHotspotSpeedViewModel.getSpeedInfoMapData().getValue());
mWifiHotspotSpeedViewModel.getSpeedInfoMapData()
@@ -138,6 +138,6 @@ public class WifiHotspotSpeedSettings extends DashboardFragment implements
}
private void log(String msg) {
FeatureFactory.getFactory(getContext()).getWifiFeatureProvider().verboseLog(TAG, msg);
FeatureFactory.getFeatureFactory().getWifiFeatureProvider().verboseLog(TAG, msg);
}
}

View File

@@ -65,7 +65,7 @@ public class WifiHotspotSpeedViewModel extends AndroidViewModel {
public WifiHotspotSpeedViewModel(@NotNull Application application) {
super(application);
mWifiHotspotRepository = FeatureFactory.getFactory(application).getWifiFeatureProvider()
mWifiHotspotRepository = FeatureFactory.getFeatureFactory().getWifiFeatureProvider()
.getWifiHotspotRepository();
mWifiHotspotRepository.get6gAvailable().observeForever(m6gAvailableObserver);
mWifiHotspotRepository.get5gAvailable().observeForever(m5gAvailableObserver);
@@ -177,6 +177,6 @@ public class WifiHotspotSpeedViewModel extends AndroidViewModel {
}
private void log(String msg) {
FeatureFactory.getFactory(getApplication()).getWifiFeatureProvider().verboseLog(TAG, msg);
FeatureFactory.getFeatureFactory().getWifiFeatureProvider().verboseLog(TAG, msg);
}
}

View File

@@ -38,7 +38,7 @@ public class WifiTetherAutoOffPreferenceController extends BasePreferenceControl
public WifiTetherAutoOffPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
WifiHotspotRepository wifiHotspotRepository = FeatureFactory.getFactory(context)
WifiHotspotRepository wifiHotspotRepository = FeatureFactory.getFeatureFactory()
.getWifiFeatureProvider().getWifiHotspotRepository();
if (wifiHotspotRepository.isSpeedFeatureAvailable() && wifiHotspotRepository.isDualBand()) {
mNeedShutdownSecondarySap = true;

View File

@@ -44,7 +44,7 @@ public class WifiTetherMaximizeCompatibilityPreferenceController extends
WifiTetherBasePreferenceController.OnTetherConfigUpdateListener listener) {
super(context, listener);
// If the Wi-Fi Hotspot Speed Feature available, then hide this controller.
mShouldHidePreference = FeatureFactory.getFactory(context)
mShouldHidePreference = FeatureFactory.getFeatureFactory()
.getWifiFeatureProvider().getWifiHotspotRepository().isSpeedFeatureAvailable();
Log.d(TAG, "mShouldHidePreference:" + mShouldHidePreference);
if (mShouldHidePreference) {

View File

@@ -54,7 +54,7 @@ public class WifiTetherPasswordPreferenceController extends WifiTetherBasePrefer
WifiTetherPasswordPreferenceController(Context context, OnTetherConfigUpdateListener listener,
MetricsFeatureProvider provider) {
super(context, listener);
FeatureFactory featureFactory = FeatureFactory.getFactory(context);
FeatureFactory featureFactory = FeatureFactory.getFeatureFactory();
mMetricsFeatureProvider = (provider != null) ? provider
: featureFactory.getMetricsFeatureProvider();
mWifiHotspotRepository = featureFactory.getWifiFeatureProvider().getWifiHotspotRepository();

View File

@@ -63,7 +63,7 @@ public class WifiTetherSSIDPreferenceController extends WifiTetherBasePreference
super(context, listener);
mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
}
@Override

View File

@@ -56,7 +56,7 @@ public class WifiTetherSecurityPreferenceController extends WifiTetherBasePrefer
OnTetherConfigUpdateListener listener) {
super(context, listener);
// If the Wi-Fi Hotspot Speed Feature available, then hide this controller.
mShouldHidePreference = FeatureFactory.getFactory(context)
mShouldHidePreference = FeatureFactory.getFeatureFactory()
.getWifiFeatureProvider().getWifiHotspotRepository().isSpeedFeatureAvailable();
Log.d(TAG, "shouldHidePreference():" + mShouldHidePreference);
if (mShouldHidePreference) {

View File

@@ -144,7 +144,7 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
return;
}
mWifiTetherViewModel = FeatureFactory.getFactory(getContext()).getWifiFeatureProvider()
mWifiTetherViewModel = FeatureFactory.getFeatureFactory().getWifiFeatureProvider()
.getWifiTetherViewModel(this);
if (mWifiTetherViewModel != null) {
setupSpeedFeature(mWifiTetherViewModel.isSpeedFeatureAvailable());

View File

@@ -80,7 +80,7 @@ public class WifiTetherViewModel extends AndroidViewModel {
public WifiTetherViewModel(@NotNull Application application) {
super(application);
mWifiHotspotRepository = FeatureFactory.getFactory(application).getWifiFeatureProvider()
mWifiHotspotRepository = FeatureFactory.getFeatureFactory().getWifiFeatureProvider()
.getWifiHotspotRepository();
}