Merge "Hide new Hotspot preferences if feature is disabled" into main

This commit is contained in:
Treehugger Robot
2024-08-12 04:55:54 +00:00
committed by Android (Google) Code Review
2 changed files with 127 additions and 78 deletions

View File

@@ -371,12 +371,20 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|| !mWifiRestriction.isHotspotAvailable(context)) {
keys.add(KEY_WIFI_TETHER_NETWORK_NAME);
keys.add(KEY_WIFI_TETHER_SECURITY);
keys.add(KEY_WIFI_HOTSPOT_SECURITY);
keys.add(KEY_WIFI_TETHER_NETWORK_PASSWORD);
keys.add(KEY_WIFI_TETHER_AUTO_OFF);
keys.add(KEY_WIFI_TETHER_MAXIMIZE_COMPATIBILITY);
keys.add(KEY_WIFI_HOTSPOT_SPEED);
keys.add(KEY_INSTANT_HOTSPOT);
} else if (!mIsInstantHotspotEnabled) {
keys.add(KEY_INSTANT_HOTSPOT);
} else {
if (!isSpeedFeatureAvailable()) {
keys.add(KEY_WIFI_HOTSPOT_SECURITY);
keys.add(KEY_WIFI_HOTSPOT_SPEED);
}
if (!mIsInstantHotspotEnabled) {
keys.add(KEY_INSTANT_HOTSPOT);
}
}
// Remove duplicate
@@ -400,6 +408,12 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
public List<AbstractPreferenceController> createPreferenceControllers(Context context) {
return buildPreferenceControllers(context, null /* listener */);
}
@VisibleForTesting
boolean isSpeedFeatureAvailable() {
return FeatureFactory.getFeatureFactory().getWifiFeatureProvider()
.getWifiHotspotRepository().isSpeedFeatureAvailable();
}
}
@VisibleForTesting