Merge "Fix testPhysicalEthernet failure for physical ethernet device"
diff --git a/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java b/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java
index 69eb58f..007bf23 100644
--- a/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java
+++ b/Tethering/tests/integration/base/android/net/EthernetTetheringTestBase.java
@@ -215,6 +215,13 @@
}
}
+ protected void stopEthernetTethering(final MyTetheringEventCallback callback) {
+ runAsShell(TETHER_PRIVILEGED, () -> {
+ mTm.stopTethering(TETHERING_ETHERNET);
+ maybeUnregisterTetheringEventCallback(callback);
+ });
+ }
+
protected void cleanUp() throws Exception {
setPreferTestNetworks(false);
diff --git a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
index 12ac454..55854e2 100644
--- a/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
+++ b/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java
@@ -364,7 +364,7 @@
// Enable Ethernet tethering and check that it starts.
tetheringEventCallback = enableEthernetTethering(iface, null /* any upstream */);
} finally {
- maybeUnregisterTetheringEventCallback(tetheringEventCallback);
+ stopEthernetTethering(tetheringEventCallback);
}
// There is nothing more we can do on a physical interface without connecting an actual
// client, which is not possible in this test.