Merge "Release the interface request when Ethernet tethering is stopped."

This commit is contained in:
Treehugger Robot
2020-03-19 14:59:12 +00:00
committed by Gerrit Code Review

View File

@@ -640,21 +640,21 @@ public class Tethering {
mEthernetIfaceRequest = em.requestTetheredInterface(mExecutor, mEthernetCallback); mEthernetIfaceRequest = em.requestTetheredInterface(mExecutor, mEthernetCallback);
} else { } else {
stopEthernetTetheringLocked(); stopEthernetTetheringLocked();
if (mEthernetCallback != null) {
mEthernetIfaceRequest.release();
mEthernetCallback = null;
mEthernetIfaceRequest = null;
}
} }
} }
return TETHER_ERROR_NO_ERROR; return TETHER_ERROR_NO_ERROR;
} }
private void stopEthernetTetheringLocked() { private void stopEthernetTetheringLocked() {
if (mConfiguredEthernetIface == null) return; if (mConfiguredEthernetIface != null) {
changeInterfaceState(mConfiguredEthernetIface, IpServer.STATE_AVAILABLE); stopTrackingInterfaceLocked(mConfiguredEthernetIface);
stopTrackingInterfaceLocked(mConfiguredEthernetIface); mConfiguredEthernetIface = null;
mConfiguredEthernetIface = null; }
if (mEthernetCallback != null) {
mEthernetIfaceRequest.release();
mEthernetCallback = null;
mEthernetIfaceRequest = null;
}
} }
private class EthernetCallback implements EthernetManager.TetheredInterfaceCallback { private class EthernetCallback implements EthernetManager.TetheredInterfaceCallback {