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 Change-Id: I11f88d0d15d6d5c2766b64b5847ac31ed0f34c25
This commit is contained in:
@@ -16,9 +16,10 @@
|
||||
|
||||
package com.android.settings.wifi.tether;
|
||||
|
||||
import static com.android.settings.wifi.WifiUtils.canShowWifiHotspot;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.net.TetheringManager;
|
||||
import android.net.wifi.SoftApConfiguration;
|
||||
import android.net.wifi.WifiClient;
|
||||
import android.net.wifi.WifiManager;
|
||||
@@ -46,7 +47,6 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
|
||||
private static final String WIFI_TETHER_SETTINGS = "wifi_tether";
|
||||
|
||||
private boolean mIsWifiTetherable;
|
||||
private WifiManager mWifiManager;
|
||||
private boolean mIsWifiTetheringAllow;
|
||||
private int mSoftApState;
|
||||
@@ -59,7 +59,6 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
// TODO(b/246537032):Use fragment context to WifiManager service will caused memory leak
|
||||
this(context, lifecycle,
|
||||
context.getApplicationContext().getSystemService(WifiManager.class),
|
||||
context.getSystemService(TetheringManager.class),
|
||||
true /* initSoftApManager */,
|
||||
WifiEnterpriseRestrictionUtils.isWifiTetheringAllowed(context));
|
||||
}
|
||||
@@ -69,15 +68,9 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
Context context,
|
||||
Lifecycle lifecycle,
|
||||
WifiManager wifiManager,
|
||||
TetheringManager tetheringManager,
|
||||
boolean initSoftApManager,
|
||||
boolean isWifiTetheringAllow) {
|
||||
super(context);
|
||||
final String[] wifiRegexs = tetheringManager.getTetherableWifiRegexs();
|
||||
if (wifiRegexs != null && wifiRegexs.length != 0) {
|
||||
mIsWifiTetherable = true;
|
||||
}
|
||||
|
||||
mIsWifiTetheringAllow = isWifiTetheringAllow;
|
||||
if (!isWifiTetheringAllow) return;
|
||||
|
||||
@@ -93,7 +86,7 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return mIsWifiTetherable && !Utils.isMonkeyRunning();
|
||||
return canShowWifiHotspot(mContext) && !Utils.isMonkeyRunning();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user