Add tether preferences into AllInOneTetherSettings

These preferences are for user to toggle a specific tethering option,
like USB, BT or WIFI.

Bug: 147323306
Test: CodeInspectionTest, AllInOneTetherSettingsTest, TetherEnablerTest
Change-Id: I1229ffd2dd12b39e9c6e48dc29c6e46ce9ad7634
This commit is contained in:
Zhen Zhang
2020-02-05 12:52:35 -08:00
parent 5610db5a2b
commit ec966cb7a3
6 changed files with 148 additions and 47 deletions

View File

@@ -31,6 +31,7 @@ import androidx.preference.SwitchPreference;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.TetherUtil;
/**
* This controller helps to manage the switch state and visibility of wifi tether disable switch
@@ -84,7 +85,8 @@ public final class WifiTetherDisablePreferenceController extends BasePreferenceC
@Override
public int getAvailabilityStatus() {
final String[] wifiRegexs = mCm.getTetherableWifiRegexs();
if (wifiRegexs == null || wifiRegexs.length == 0 || !shouldShow()) {
if (wifiRegexs == null || wifiRegexs.length == 0 || !shouldShow()
|| !TetherUtil.isTetherAvailable(mContext)) {
return CONDITIONALLY_UNAVAILABLE;
} else {
return AVAILABLE;