From 25054ba36d573814f81bf5070eebf87c3f71ca9c Mon Sep 17 00:00:00 2001 From: Pavel Grafov Date: Thu, 16 Apr 2020 15:53:03 +0100 Subject: [PATCH] Stop disabling wifi toggle when tethering is restricted When an admin disallows the user from configuring tethering, the user should still be able to configure wifi. When an admin disallows wifi configuration, the behavior is unchanged: the toggle stays enabled and allows the user to turn wifi on and off, but clicking on the text results in admin transparency dialog, so the user won't be able to change wifi config. Bug: 149481093 Test: manual with TestDPC as the device owner Change-Id: I6b33e43901454125c7f3f4dd3c70f050997e4e71 --- src/com/android/settings/wifi/WifiEnabler.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/com/android/settings/wifi/WifiEnabler.java b/src/com/android/settings/wifi/WifiEnabler.java index 536ea613b59..dc5be4209a8 100644 --- a/src/com/android/settings/wifi/WifiEnabler.java +++ b/src/com/android/settings/wifi/WifiEnabler.java @@ -26,8 +26,6 @@ import android.net.NetworkInfo; import android.net.wifi.SupplicantState; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; -import android.os.UserHandle; -import android.os.UserManager; import android.provider.Settings; import android.widget.Toast; @@ -35,8 +33,6 @@ import androidx.annotation.VisibleForTesting; import com.android.settings.R; import com.android.settings.widget.SwitchWidgetController; -import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; -import com.android.settingslib.RestrictedLockUtilsInternal; import com.android.settingslib.WirelessUtils; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; @@ -76,9 +72,6 @@ public class WifiEnabler implements SwitchWidgetController.OnSwitchChangeListene } }; - private static final String EVENT_DATA_IS_WIFI_ON = "is_wifi_on"; - private static final int EVENT_UPDATE_INDEX = 0; - public WifiEnabler(Context context, SwitchWidgetController switchWidget, MetricsFeatureProvider metricsFeatureProvider) { this(context, switchWidget, metricsFeatureProvider, @@ -161,15 +154,6 @@ public class WifiEnabler implements SwitchWidgetController.OnSwitchChangeListene setSwitchBarChecked(false); mSwitchWidget.setEnabled(true); } - - if (RestrictedLockUtilsInternal.hasBaseUserRestriction(mContext, - UserManager.DISALLOW_CONFIG_TETHERING, UserHandle.myUserId())) { - mSwitchWidget.setEnabled(false); - } else { - final EnforcedAdmin admin = RestrictedLockUtilsInternal.checkIfRestrictionEnforced( - mContext, UserManager.DISALLOW_CONFIG_TETHERING, UserHandle.myUserId()); - mSwitchWidget.setDisabledByAdmin(admin); - } } private void setSwitchBarChecked(boolean checked) {