Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c am: 87c64dc6b3
Change-Id: Ide34e6cff966a9cd01948a4cb030f4d256cf1782
This commit is contained in:
@@ -262,6 +262,7 @@ final class EthernetTracker {
|
|||||||
|
|
||||||
private void removeInterface(String iface) {
|
private void removeInterface(String iface) {
|
||||||
mFactory.removeInterface(iface);
|
mFactory.removeInterface(iface);
|
||||||
|
maybeUpdateServerModeInterfaceState(iface, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopTrackingInterface(String iface) {
|
private void stopTrackingInterface(String iface) {
|
||||||
@@ -308,6 +309,8 @@ final class EthernetTracker {
|
|||||||
|
|
||||||
Log.d(TAG, "Started tracking interface " + iface);
|
Log.d(TAG, "Started tracking interface " + iface);
|
||||||
mFactory.addInterface(iface, hwAddress, nc, ipConfiguration);
|
mFactory.addInterface(iface, hwAddress, nc, ipConfiguration);
|
||||||
|
} else {
|
||||||
|
maybeUpdateServerModeInterfaceState(iface, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: if the interface already has link (e.g., if we crashed and got
|
// Note: if the interface already has link (e.g., if we crashed and got
|
||||||
@@ -341,12 +344,9 @@ final class EthernetTracker {
|
|||||||
}
|
}
|
||||||
mListeners.finishBroadcast();
|
mListeners.finishBroadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateServerModeInterfaceState(iface, up, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateServerModeInterfaceState(String iface, boolean up, int mode) {
|
private void maybeUpdateServerModeInterfaceState(String iface, boolean available) {
|
||||||
final boolean available = up && (mode == INTERFACE_MODE_SERVER);
|
|
||||||
if (available == mTetheredInterfaceWasAvailable || !iface.equals(mDefaultInterface)) return;
|
if (available == mTetheredInterfaceWasAvailable || !iface.equals(mDefaultInterface)) return;
|
||||||
|
|
||||||
final int pendingCbs = mTetheredInterfaceRequests.beginBroadcast();
|
final int pendingCbs = mTetheredInterfaceRequests.beginBroadcast();
|
||||||
|
|||||||
Reference in New Issue
Block a user