Implement untetherAll as calls to stopTethering

Calling untether() on an interface name leaves the system
in an inconsistent state, since this is an API for use by
network subsystems to start or stop the tethering of a prepared
downstream network interface.  The proper way to disable tethering
is to call stopTethering() with an appropriate technology.

untetherAll() is called in parts of the system UI to disable
all tethering on system state changes (e.g. on the enabling
of data saver).

Bug: 31405407
Test: Enabling data saver now correctly disables tethering
Change-Id: I8e5724a31e015721910a8d278e100daf697c34d7
This commit is contained in:
Christopher Wiley
2016-09-19 08:58:06 -07:00
parent d73faf0760
commit 5df6ed4a87

View File

@@ -625,12 +625,9 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
}
public void untetherAll() {
synchronized (mPublicSync) {
if (DBG) Log.d(TAG, "Untethering " + mTetherStates.keySet());
for (int i = 0; i < mTetherStates.size(); i++) {
untether(mTetherStates.keyAt(i));
}
}
stopTethering(ConnectivityManager.TETHERING_WIFI);
stopTethering(ConnectivityManager.TETHERING_USB);
stopTethering(ConnectivityManager.TETHERING_BLUETOOTH);
}
public int getLastTetherError(String iface) {