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

Commit f26af124 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Handle Android M as a MTP device in MtpManagerTest.

MtpManagerTest uses real MTP device to test functionallity, but
previously it did not handle Android M's USB client behavior.

BUG=25939006

Change-Id: I53fa8c08c41c3adacf85f24694afdea5ec0781ca
parent 259ce801
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -45,10 +45,20 @@ public class MtpManagerTest extends InstrumentationTestCase {
    @Override
    public void setUp() throws Exception {
        mUsbManager = getContext().getSystemService(UsbManager.class);
        for (int i = 0; i < 2; i++) {
            mUsbDevice = findDevice();
            mManager = new MtpManager(getContext());
            mManager.openDevice(mUsbDevice.getDeviceId());
            try {
                waitForStorages(mManager, mUsbDevice.getDeviceId());
                return;
            } catch (IOException exp) {
                // When the MTP device is Android, and it changes the USB device type from
                // "Charging" to "MTP", the device ID will be updated. We need to find a device
                // again.
                continue;
            }
        }
    }

    @Override