ethernet: fix callbacks for running interfaces

updateInterfaceState(true) changes the interface state and triggers an
interface state callback. In addition, maybeTrackInterface() always
sends out a callback (which is correct, as for an interface that is
being added, maybeTrackInterface() would send the initial DOWN
callback). setTetheringInterfaceMode() (the other caller of
addInterface) also already sends its own callback.

Test: atest EthernetManagerTest
Change-Id: I60d884db5e788639b035cad1dd0d6c316e5836f7
diff --git a/service-t/src/com/android/server/ethernet/EthernetTracker.java b/service-t/src/com/android/server/ethernet/EthernetTracker.java
index 92c354f..6ec478b 100644
--- a/service-t/src/com/android/server/ethernet/EthernetTracker.java
+++ b/service-t/src/com/android/server/ethernet/EthernetTracker.java
@@ -622,7 +622,10 @@
         // restarted while it was running), we need to fake a link up notification so we
         // start configuring it.
         if (NetdUtils.hasFlag(config, INetd.IF_FLAG_RUNNING)) {
-            updateInterfaceState(iface, true);
+            // no need to send an interface state change as this is not a true "state change". The
+            // callers (maybeTrackInterface() and setTetheringInterfaceMode()) already broadcast the
+            // state change.
+            mFactory.updateInterfaceLinkState(iface, true);
         }
     }
 
diff --git a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
index e46ba24..228ad13 100644
--- a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
@@ -593,7 +593,6 @@
 
         setEthernetEnabled(true)
         listener.expectCallback(iface, STATE_LINK_UP, ROLE_CLIENT)
-        listener.expectCallback(iface, STATE_LINK_UP, ROLE_CLIENT)
         listener.assertNoCallback()
     }