summaryrefslogtreecommitdiff
path: root/media/java/android/mtp/MtpDevice.java
Commit message (Collapse)AuthorAgeFilesLines
* MTP: Skip runtime thumbnail generation for Android HostJames Wei2021-06-211-0/+13
| | | | | | | | | | | | | | | Android Host is not capable to deal with the long processing time for runtime thumbnail generation. Skip runtime thumbnail generation for Android Host but keep no impact to other Host Bug: 188752500 Test: atest MtpTests Test: atest MtpServerTest Test: atest MtpServiceTests Test: manual test on Windows 10 File Explorer Test: manual test on Android Host Files App Change-Id: I24ed3bb29c5a6912398a9e00e7748fd406cf6a64
* Properly guard access to CloseGuard in finalizers.Narayan Kamath2017-04-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | CloseGuard instances are allocated in constructors and usually assigned to final fields. This implies they're non-null in finalizers except in the case where the constructor throws. We add a null check to make sure we can continue cleaning up other state in the finalizer (if applicable). Also, this change decouples closeguard warnings in constructors from other state based logic. This because the logic there is usually duplicated with the call to close(). NOTE: This change is not a "complete" fix. Many of these finalizers are broken in the case where <init> throws. The only objective of this change is to make such errors more obvious. Note that some of these classes don't have CTS tests. Test: make, CtsMediaTestCases. Bug: 35609098 Change-Id: I24d9e0215f80e44914dba8ab99b6312fd6ed1fc0
* Properly close USB device connection in Mtp devicePhilip P. Moltmann2016-10-171-9/+39
| | | | | | Test: Built Fixes: 32073045 Change-Id: I05179377532c1bd4dff1f4a4e0e837cb645317e3
* Do not access MTP devices when disabled.Philip P. Moltmann2016-09-141-1/+13
| | | | | | | | | | | | | | | | | The USB data transfer is disabled we should not allow access MTP devices (e.g. usb sticks). We have two ways of accessing them: Either by mounting them or by creating a MTPDevice in an app. Of course an app could implement implement their own MTPDevice implementation. In this case we cannot enforce the policy without completely suppressing all MTP USB devices which would be too restrictive. Note: When the policy is set we do _not_ disconnect already connected MTP devices Fixes: 31472955 Change-Id: I6080c48c49657102774b2b3b4d89ff030245a266
* Add NonNull and Nullable annotations to MtpDevice.Daichi Hirono2016-07-051-23/+25
| | | | | | BUG=26758882 Change-Id: I5fa7130b671c71aefca848c109bf37389f57b9da
* Merge "Add throws definition to MtpDevice#readEvent." into nyc-devDaichi Hirono2016-04-221-7/+7
|\
| * Add throws definition to MtpDevice#readEvent.Daichi Hirono2016-04-201-7/+7
| | | | | | | | | | | | | | | | Previously MtpDevice#readEvent does not have throws IOException at its definition, though internal JNI functions throws it. BUG=28254719 Change-Id: I4e6cf8003d168b7e732c4b4eb2eafe52a12442c2
* | Handle API review comments from the council.Daichi Hirono2016-04-181-4/+4
|/ | | | | | | | | | | | | | | * MtpEvent: Remove public constructor since properties cannot be set directly. * MtpEvent: Move event constants from MtpConstants to MtpEvent class. * getPartialObject64: the byte[] must have indices of Integer.MAX_VALUE at most. Document as such. * sendObjectInfo: what happens if the transfer doesn’t succeed? How is the app notified? If there is a reason for the failure communicated, how does the app find this out? Add docs. * Add isOperationSupported(int) and isEventSupported(int) helpers. Change-Id: Ifd80016d2ddd3b66d5c45f6da76b6133f0c9a617 Fixes: 28146379
* Update the comment of MtpDevice#getObjectSizeLongDaichi Hirono2016-03-281-3/+4
| | | | | | BUG=27805369 Change-Id: I63762fedf540e89e9ca811a143cb178881ef1830
* Add getObjectSizeLong hidden API to MtpDevice class.Daichi Hirono2016-03-251-0/+13
| | | | | | | | | | | | | | In the MTP spec, the object size is stored in MtpObjectInfo as unsigned 32-bit integer and fetched by the getObjectInfo operation. For the objects that are more than 4GB, the object size is provided as one of extra properties, which are fetched by different operation. The CL adds to getObjectSizeLong hidden method to Java MtpDevice class so that client code can obtain 4GB+ object size. BUG=27805369 Change-Id: I8a5b85c8db39734f00e49709c61b271eb48ff33d
* Merge "Implement MtpDevice#getPartialObject64 in Java API."Daichi Hirono2016-01-281-0/+23
|\
| * Implement MtpDevice#getPartialObject64 in Java API.Daichi Hirono2016-01-281-0/+23
| | | | | | | | | | | | BUG=26703522 Change-Id: I08510e3a179b7dc8bf247a9e997dc8a160138fc2
* | Add varietions of MtpDevice's mehtods using long.Daichi Hirono2016-01-281-6/+7
|/ | | | | | BUG=26525304 Change-Id: I0a0b187910cf498720d8e7b8fbe9b0590e67e65e
* Change offset and size arguments of MtpDevice#getPartialObject to JavaDaichi Hirono2016-01-141-5/+9
| | | | | | | | | | | long. To represents full range of 32-bit unsigned integer, we should use jlong instead of jint. BUG=26284424 Change-Id: Id3fa9e3daa778c204ab8e38f821d454c709c317a
* Add getPartialObject to Java MtpDevice class.Daichi Hirono2016-01-071-1/+20
| | | | | | BUG=26284424 Change-Id: Id05dc6297a1682999eee4e72972fb883fa49a5d1
* Add readEvent method to MtpDevice.Daichi Hirono2015-09-251-1/+38
| | | | | | BUG=23368533 Change-Id: Ibefff559fa7dd0bee17e2812bd7cdd129108d804
* Add support for uploading files via MTP.Tomasz Mikolajewski2015-08-281-3/+4
| | | | Change-Id: Id1811ab70cb28be471e0a99999e9ad5380deac49
* Add API for uploading files to MTP devices.Tomasz Mikolajewski2015-08-141-0/+29
| | | | | Bug: 22545670 Change-Id: I038c54db06b7cf780bd027d76693e98c685d57a7
* Add API for streamed reading on MTP devices.Tomasz Mikolajewski2015-08-071-0/+16
| | | | | | | | The existing APIs required to copy all bytes to memory, which will fail in case of very large files, like movies. Bug: 22908937 Change-Id: I23bdcbdbf08b7c1b1017591799bbb94e53249a57
* Fix API doc of MtpDevice#getObjectHandles.Daichi Hirono2015-06-151-1/+2
| | | | | | BUG=21782579 Change-Id: Iadec8923c74f62b7aed44e876fb469b41c7dc59b
* am 1e3395c7: am 105b545e: am 0dce19ca: am 79ceb53a: am c58abeea: Merge ↵Narayan Kamath2014-01-071-1/+1
|\ | | | | | | | | | | | | "AArch64: Use long for pointers in MTP classes" * commit '1e3395c7378a7dd293a2e8a8ac8fbf239adbad0c': AArch64: Use long for pointers in MTP classes
| * AArch64: Use long for pointers in MTP classesAshok Bhat2014-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For storing pointers, long is used in MTP classes, as native pointers can be 64-bit. In addition, some minor changes have been done to conform with standard JNI practice (e.g. use of jint instead of int in JNI function prototypes) Change-Id: I67805547251722e7b77611d47d0bb632a64d3e6d Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
* | Remove unused imports from frameworks/base.John Spurlock2013-11-201-2/+0
|/ | | | Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
* docs: add package description for mtp and a little more info to MtpDeviceScott Main2011-05-051-1/+4
| | | | Change-Id: I44b3926c4a286f624de525a7f0cc896879582bf5
* Improve Javadoc for USB Manager and MTP/PTP support.Mike Lockwood2011-04-011-8/+26
| | | | | | | Bug: 4091519 Change-Id: Ida79593d5a984f7ffd0934ae7bded23b8faf9eef Signed-off-by: Mike Lockwood <lockwood@android.com>
* USB: minor cleanup workMike Lockwood2011-03-111-1/+1
| | | | | | | Bug: 4067029 Change-Id: Icd8f912ab8732b5f770a217b9b3731092597ce02 Signed-off-by: Mike Lockwood <lockwood@android.com>
* UsbDevice: Move IO related methods to new UsbDeviceConnection classMike Lockwood2011-03-111-8/+11
| | | | | | | | | | | | UsbDevice is now just an immutable parcelable object like UsbInterface and UsbEndpoint. All IO related functionality is now contained in UsbDeviceConnection and UsbRequest. Bug: 4067029 Change-Id: Ia84da0b512a697acc940eee0c3566711c62e1a68 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Move USB framework support from android.hardware to android.hardware.usb packageMike Lockwood2011-03-011-4/+4
| | | | | Change-Id: I00fd4f0caaa4aebe48f71c576bb211b5f38bf88d Signed-off-by: Mike Lockwood <lockwood@android.com>
* Add MTP/PTP host support to the public APIMike Lockwood2011-02-111-7/+97
| | | | | | | Needed for unbundling the Gallery app Change-Id: I57e6b76ee5c9e57cb8c055329ac13251879baafd Signed-off-by: Mike Lockwood <lockwood@android.com>
* New APIs for MTP and PTP host supportMike Lockwood2011-01-221-0/+141
This replaces the previous ContentProvider based interface Change-Id: I4cea2544854adb9fdcc04345e4d73d8ef05380f3 Signed-off-by: Mike Lockwood <lockwood@android.com>