Remove several TetherUtil functions which are no longer needed.
Slowly chipping away at TetherUtil to clean up this code. This CL also adds an admin check to ConnectivityService.isTetheringSupported to get parity with the TetherUtil function before removing it. Change-Id: Ibe7c5c9fb420d57e5458f77dad30e8a1e751a3e2
This commit is contained in:
@@ -2670,18 +2670,21 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
// if ro.tether.denied = true we default to no tethering
|
// if ro.tether.denied = true we default to no tethering
|
||||||
// gservices could set the secure setting to 1 though to enable it on a build where it
|
// gservices could set the secure setting to 1 though to enable it on a build where it
|
||||||
// had previously been turned off.
|
// had previously been turned off.
|
||||||
|
@Override
|
||||||
public boolean isTetheringSupported() {
|
public boolean isTetheringSupported() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
int defaultVal = (SystemProperties.get("ro.tether.denied").equals("true") ? 0 : 1);
|
int defaultVal = (SystemProperties.get("ro.tether.denied").equals("true") ? 0 : 1);
|
||||||
boolean tetherEnabledInSettings = (Settings.Global.getInt(mContext.getContentResolver(),
|
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);
|
&& !mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING);
|
||||||
return tetherEnabledInSettings && ((mTethering.getTetherableUsbRegexs().length != 0 ||
|
return tetherEnabledInSettings && mUserManager.isAdminUser() &&
|
||||||
|
((mTethering.getTetherableUsbRegexs().length != 0 ||
|
||||||
mTethering.getTetherableWifiRegexs().length != 0 ||
|
mTethering.getTetherableWifiRegexs().length != 0 ||
|
||||||
mTethering.getTetherableBluetoothRegexs().length != 0) &&
|
mTethering.getTetherableBluetoothRegexs().length != 0) &&
|
||||||
mTethering.getUpstreamIfaceTypes().length != 0);
|
mTethering.getUpstreamIfaceTypes().length != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startTethering(int type, ResultReceiver receiver,
|
public void startTethering(int type, ResultReceiver receiver,
|
||||||
boolean showProvisioningUi) {
|
boolean showProvisioningUi) {
|
||||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||||
@@ -2692,6 +2695,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mTethering.startTethering(type, receiver, showProvisioningUi);
|
mTethering.startTethering(type, receiver, showProvisioningUi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stopTethering(int type) {
|
public void stopTethering(int type) {
|
||||||
ConnectivityManager.enforceTetherChangePermission(mContext);
|
ConnectivityManager.enforceTetherChangePermission(mContext);
|
||||||
mTethering.stopTethering(type);
|
mTethering.stopTethering(type);
|
||||||
|
|||||||
Reference in New Issue
Block a user