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

Commit 1b8f6194 authored by Daichi Hirono's avatar Daichi Hirono Committed by Android (Google) Code Review
Browse files

Merge "Handle Android M as a MTP device in MtpManagerTest."

parents 30be970a f26af124
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -45,10 +45,20 @@ public class MtpManagerTest extends InstrumentationTestCase {
    @Override
    @Override
    public void setUp() throws Exception {
    public void setUp() throws Exception {
        mUsbManager = getContext().getSystemService(UsbManager.class);
        mUsbManager = getContext().getSystemService(UsbManager.class);
        for (int i = 0; i < 2; i++) {
            mUsbDevice = findDevice();
            mUsbDevice = findDevice();
            mManager = new MtpManager(getContext());
            mManager = new MtpManager(getContext());
            mManager.openDevice(mUsbDevice.getDeviceId());
            mManager.openDevice(mUsbDevice.getDeviceId());
            try {
                waitForStorages(mManager, mUsbDevice.getDeviceId());
                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
    @Override