diff options
| author | 2020-07-13 13:30:50 +0000 | |
|---|---|---|
| committer | 2020-07-13 13:30:50 +0000 | |
| commit | 241609e5d2f7a593bb492c0ef25d23fd17f54d1a (patch) | |
| tree | e410d0f1acb637abbb8d77e479961231d31e8abe | |
| parent | 981cdf9ed6232cfa5ba182d2d9d9aab285808a59 (diff) | |
| parent | e6317e5caab717103467a3222eb7d0581d68e61e (diff) | |
Fix EthernetTetheringTest failure if tethering is not supported am: e6317e5caa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12137906
Change-Id: I55b776ef0ae16d0a762f10c979e1efb659200ad8
| -rw-r--r-- | packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java b/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java index e10bab4b36b5..9bb01ae5df1d 100644 --- a/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java +++ b/packages/Tethering/tests/integration/src/android/net/EthernetTetheringTest.java @@ -102,17 +102,21 @@ public class EthernetTetheringTest { private UiAutomation mUiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation(); + private boolean mRunTests; @Before public void setUp() throws Exception { - mHandlerThread = new HandlerThread(getClass().getSimpleName()); - mHandlerThread.start(); - mHandler = new Handler(mHandlerThread.getLooper()); - mTetheredInterfaceRequester = new TetheredInterfaceRequester(mHandler, mEm); // Needed to create a TestNetworkInterface, to call requestTetheredInterface, and to receive // tethered client callbacks. mUiAutomation.adoptShellPermissionIdentity( MANAGE_TEST_NETWORKS, NETWORK_SETTINGS, TETHER_PRIVILEGED); + mRunTests = mTm.isTetheringSupported() && mEm != null; + assumeTrue(mRunTests); + + mHandlerThread = new HandlerThread(getClass().getSimpleName()); + mHandlerThread.start(); + mHandler = new Handler(mHandlerThread.getLooper()); + mTetheredInterfaceRequester = new TetheredInterfaceRequester(mHandler, mEm); } private void cleanUp() throws Exception { @@ -136,7 +140,7 @@ public class EthernetTetheringTest { @After public void tearDown() throws Exception { try { - cleanUp(); + if (mRunTests) cleanUp(); } finally { mUiAutomation.dropShellPermissionIdentity(); } |