Merge "Release the interface request when Ethernet tethering is stopped."
diff --git a/Tethering/src/com/android/server/connectivity/tethering/Tethering.java b/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
index a9e9a75..1cfc04b 100644
--- a/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
+++ b/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
@@ -640,21 +640,21 @@
mEthernetIfaceRequest = em.requestTetheredInterface(mExecutor, mEthernetCallback);
} else {
stopEthernetTetheringLocked();
- if (mEthernetCallback != null) {
- mEthernetIfaceRequest.release();
- mEthernetCallback = null;
- mEthernetIfaceRequest = null;
- }
}
}
return TETHER_ERROR_NO_ERROR;
}
private void stopEthernetTetheringLocked() {
- if (mConfiguredEthernetIface == null) return;
- changeInterfaceState(mConfiguredEthernetIface, IpServer.STATE_AVAILABLE);
- stopTrackingInterfaceLocked(mConfiguredEthernetIface);
- mConfiguredEthernetIface = null;
+ if (mConfiguredEthernetIface != null) {
+ stopTrackingInterfaceLocked(mConfiguredEthernetIface);
+ mConfiguredEthernetIface = null;
+ }
+ if (mEthernetCallback != null) {
+ mEthernetIfaceRequest.release();
+ mEthernetCallback = null;
+ mEthernetIfaceRequest = null;
+ }
}
private class EthernetCallback implements EthernetManager.TetheredInterfaceCallback {