Hide new Hotspot preferences if feature is disabled

- Hide new "Security" preference

- Hide new "Speed and compatibility" preference

Bug: 356898105
Flag: EXEMPT bugfix
Test: Manual testing
atest -c WifiTetherSettingsTest

Change-Id: I734959ed511929bfcc9a314770a4acdf9a7e0b99
This commit is contained in:
Weng Su
2024-08-09 21:50:06 +08:00
parent 22677304c9
commit 675b817c49
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