Apply the tethering user restriction to connectivity service.

Bug: 15852213
Change-Id: Ib2df696189981ed1b31955257047fac3ee403965
This commit is contained in:
Julia Reynolds
2014-06-24 10:56:55 -04:00
parent 520d6dc471
commit c8e3a7176f

View File

@@ -109,6 +109,7 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.security.Credentials;
import android.security.KeyStore;
@@ -482,6 +483,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private AppOpsManager mAppOpsManager;
private UserManager mUserManager;
NetworkConfig[] mNetConfigs;
int mNetworksDefined;
@@ -884,6 +887,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mContext.registerReceiver(mProvisioningReceiver, filter);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
}
private synchronized int nextNetworkRequestId() {
@@ -3607,7 +3612,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
enforceTetherAccessPermission();
int defaultVal = (SystemProperties.get("ro.tether.denied").equals("true") ? 0 : 1);
boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.TETHER_SUPPORTED, defaultVal) != 0);
Settings.Global.TETHER_SUPPORTED, defaultVal) != 0)
&& !mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING);
return tetherEnabledInSettings && ((mTethering.getTetherableUsbRegexs().length != 0 ||
mTethering.getTetherableWifiRegexs().length != 0 ||
mTethering.getTetherableBluetoothRegexs().length != 0) &&