Loading packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading
packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -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 Loading