Loading packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class MtpManager { private final UsbManager mManager; // TODO: Save and restore the set of opened device. private final SparseArray<MtpDevice> mDevices = new SparseArray<MtpDevice>(); private final SparseArray<MtpDevice> mDevices = new SparseArray<>(); MtpManager(Context context) { mManager = (UsbManager)context.getSystemService(Context.USB_SERVICE); Loading Loading @@ -142,7 +142,8 @@ class MtpManager { synchronized void importFile(int deviceId, int objectHandle, ParcelFileDescriptor target) throws IOException { throw new UnsupportedOperationException("Importing files is not supported."); final MtpDevice device = getDevice(deviceId); device.importFile(objectHandle, target); } private MtpDevice getDevice(int deviceId) throws IOException { Loading packages/MtpDocumentsProvider/src/com/android/mtp/PipeManager.java +5 −5 Original line number Diff line number Diff line Loading @@ -47,12 +47,12 @@ class PipeManager { } private static abstract class Task implements Runnable { protected final MtpManager mModel; protected final MtpManager mManager; protected final Identifier mIdentifier; protected final ParcelFileDescriptor[] mDescriptors; Task(MtpManager model, Identifier identifier) throws IOException { mModel = model; Task(MtpManager manager, Identifier identifier) throws IOException { mManager = manager; mIdentifier = identifier; mDescriptors = ParcelFileDescriptor.createReliablePipe(); } Loading @@ -70,7 +70,7 @@ class PipeManager { @Override public void run() { try { mModel.importFile( mManager.importFile( mIdentifier.mDeviceId, mIdentifier.mObjectHandle, mDescriptors[1]); mDescriptors[1].close(); } catch (IOException error) { Loading @@ -94,7 +94,7 @@ class PipeManager { try (final ParcelFileDescriptor.AutoCloseOutputStream stream = new ParcelFileDescriptor.AutoCloseOutputStream(mDescriptors[1])) { try { stream.write(mModel.getThumbnail( stream.write(mManager.getThumbnail( mIdentifier.mDeviceId, mIdentifier.mObjectHandle)); } catch (IOException error) { mDescriptors[1].closeWithError("Failed to stream a thumbnail."); Loading Loading
packages/MtpDocumentsProvider/src/com/android/mtp/MtpManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class MtpManager { private final UsbManager mManager; // TODO: Save and restore the set of opened device. private final SparseArray<MtpDevice> mDevices = new SparseArray<MtpDevice>(); private final SparseArray<MtpDevice> mDevices = new SparseArray<>(); MtpManager(Context context) { mManager = (UsbManager)context.getSystemService(Context.USB_SERVICE); Loading Loading @@ -142,7 +142,8 @@ class MtpManager { synchronized void importFile(int deviceId, int objectHandle, ParcelFileDescriptor target) throws IOException { throw new UnsupportedOperationException("Importing files is not supported."); final MtpDevice device = getDevice(deviceId); device.importFile(objectHandle, target); } private MtpDevice getDevice(int deviceId) throws IOException { Loading
packages/MtpDocumentsProvider/src/com/android/mtp/PipeManager.java +5 −5 Original line number Diff line number Diff line Loading @@ -47,12 +47,12 @@ class PipeManager { } private static abstract class Task implements Runnable { protected final MtpManager mModel; protected final MtpManager mManager; protected final Identifier mIdentifier; protected final ParcelFileDescriptor[] mDescriptors; Task(MtpManager model, Identifier identifier) throws IOException { mModel = model; Task(MtpManager manager, Identifier identifier) throws IOException { mManager = manager; mIdentifier = identifier; mDescriptors = ParcelFileDescriptor.createReliablePipe(); } Loading @@ -70,7 +70,7 @@ class PipeManager { @Override public void run() { try { mModel.importFile( mManager.importFile( mIdentifier.mDeviceId, mIdentifier.mObjectHandle, mDescriptors[1]); mDescriptors[1].close(); } catch (IOException error) { Loading @@ -94,7 +94,7 @@ class PipeManager { try (final ParcelFileDescriptor.AutoCloseOutputStream stream = new ParcelFileDescriptor.AutoCloseOutputStream(mDescriptors[1])) { try { stream.write(mModel.getThumbnail( stream.write(mManager.getThumbnail( mIdentifier.mDeviceId, mIdentifier.mObjectHandle)); } catch (IOException error) { mDescriptors[1].closeWithError("Failed to stream a thumbnail."); Loading