[EthernetManagerTest] Skip the test if EthernetManager is null
On Emulator system image, EthernetManager is not supported and it will
cause test crash when the "!!" operator is in place. Therefore, we
should skip the test before the lazy evaluation.
BUG: 323896504
Change-Id: I0f6f7bbb8ff7394730b193cf3f4ab5d89e65fa96
Signed-off-by: Weilun Du <wdu@google.com>
diff --git a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
index 7af3c83..d052551 100644
--- a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
@@ -348,7 +348,9 @@
}
}
- private fun isEthernetSupported() = em != null
+ private fun isEthernetSupported() : Boolean {
+ return context.getSystemService(EthernetManager::class.java) != null
+ }
@Before
fun setUp() {