Send tethered interface callbacks based on interface existence. am: 165b456d92 am: cad2e49acb am: 3449a34474 am: 4615bbe667

Change-Id: I3303d8506a0d715a60843f9073cfd104b286372a
This commit is contained in:
Lorenzo Colitti
2020-03-19 16:27:47 +00:00
committed by Automerger Merge Worker

View File

@@ -262,6 +262,7 @@ final class EthernetTracker {
private void removeInterface(String iface) {
mFactory.removeInterface(iface);
maybeUpdateServerModeInterfaceState(iface, false);
}
private void stopTrackingInterface(String iface) {
@@ -308,6 +309,8 @@ final class EthernetTracker {
Log.d(TAG, "Started tracking interface " + iface);
mFactory.addInterface(iface, hwAddress, nc, ipConfiguration);
} else {
maybeUpdateServerModeInterfaceState(iface, true);
}
// Note: if the interface already has link (e.g., if we crashed and got
@@ -341,12 +344,9 @@ final class EthernetTracker {
}
mListeners.finishBroadcast();
}
updateServerModeInterfaceState(iface, up, mode);
}
private void updateServerModeInterfaceState(String iface, boolean up, int mode) {
final boolean available = up && (mode == INTERFACE_MODE_SERVER);
private void maybeUpdateServerModeInterfaceState(String iface, boolean available) {
if (available == mTetheredInterfaceWasAvailable || !iface.equals(mDefaultInterface)) return;
final int pendingCbs = mTetheredInterfaceRequests.beginBroadcast();