Add config for Wi-Fi Hotspot Settings hidden

- Add config_show_wifi_hotspot_settings for Settings customization

- Hide Wi-Fi Hotspot preference in Hotspot & tethering Settings

- Don't launch Wi-Fi Hotspot Settings (e.g long press on Hotspot in QS-tile)

Bug: 213426762
Test: manual test
atest -c com.android.settings.wifi.WifiUtilsTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest

Merged-In: I11f88d0d15d6d5c2766b64b5847ac31ed0f34c25
Change-Id: I11f88d0d15d6d5c2766b64b5847ac31ed0f34c25
(cherry picked from commit 160b5078ed)
This commit is contained in:
Weng Su
2022-10-18 04:08:13 +08:00
parent 062b18c736
commit f9b5e046a8
7 changed files with 204 additions and 24 deletions

View File

@@ -18,6 +18,8 @@ package com.android.settings.wifi.tether;
import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION;
import static com.android.settings.wifi.WifiUtils.canShowWifiHotspot;
import android.app.settings.SettingsEnums;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -107,6 +109,13 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (!canShowWifiHotspot(getContext())) {
Log.e(TAG, "can not launch Wi-Fi hotspot settings"
+ " because the config is not set to show.");
finish();
return;
}
setIfOnlyAvailableForAdmins(true);
mUnavailable = isUiRestricted() || !mWifiRestriction.isHotspotAvailable(getContext());
}