Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0678d631 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix EthernetTetheringTest failure if tethering is not supported" am:...

Merge "Fix EthernetTetheringTest failure if tethering is not supported" am: 6ad5decb am: f3cf2040 am: 0875fe5f am: 3d205241 am: cb1f91f3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1352244

Change-Id: Ibb26230ad003c82134f586435f135e862de6dd74
parents f46f69c5 cb1f91f3
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -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();
        }