summaryrefslogtreecommitdiff
path: root/media/java/android/mtp/MtpDevice.java
AgeCommit message (Collapse)Author
2021-06-21MTP: Skip runtime thumbnail generation for Android HostJames Wei
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
2017-04-03Properly guard access to CloseGuard in finalizers.Narayan Kamath
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
2016-10-17Properly close USB device connection in Mtp devicePhilip P. Moltmann
Test: Built Fixes: 32073045 Change-Id: I05179377532c1bd4dff1f4a4e0e837cb645317e3
2016-09-14Do not access MTP devices when disabled.Philip P. Moltmann
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
2016-07-05Add NonNull and Nullable annotations to MtpDevice.Daichi Hirono
BUG=26758882 Change-Id: I5fa7130b671c71aefca848c109bf37389f57b9da
2016-04-22Merge "Add throws definition to MtpDevice#readEvent." into nyc-devDaichi Hirono
2016-04-20Add throws definition to MtpDevice#readEvent.Daichi Hirono
Previously MtpDevice#readEvent does not have throws IOException at its definition, though internal JNI functions throws it. BUG=28254719 Change-Id: I4e6cf8003d168b7e732c4b4eb2eafe52a12442c2
2016-04-18Handle API review comments from the council.Daichi Hirono
* 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
2016-03-28Update the comment of MtpDevice#getObjectSizeLongDaichi Hirono
BUG=27805369 Change-Id: I63762fedf540e89e9ca811a143cb178881ef1830
2016-03-25Add getObjectSizeLong hidden API to MtpDevice class.Daichi Hirono
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
2016-01-28Merge "Implement MtpDevice#getPartialObject64 in Java API."Daichi Hirono
2016-01-28Add varietions of MtpDevice's mehtods using long.Daichi Hirono
BUG=26525304 Change-Id: I0a0b187910cf498720d8e7b8fbe9b0590e67e65e
2016-01-28Implement MtpDevice#getPartialObject64 in Java API.Daichi Hirono
BUG=26703522 Change-Id: I08510e3a179b7dc8bf247a9e997dc8a160138fc2
2016-01-14Change offset and size arguments of MtpDevice#getPartialObject to JavaDaichi Hirono
long. To represents full range of 32-bit unsigned integer, we should use jlong instead of jint. BUG=26284424 Change-Id: Id3fa9e3daa778c204ab8e38f821d454c709c317a
2016-01-07Add getPartialObject to Java MtpDevice class.Daichi Hirono
BUG=26284424 Change-Id: Id05dc6297a1682999eee4e72972fb883fa49a5d1
2015-09-25Add readEvent method to MtpDevice.Daichi Hirono
BUG=23368533 Change-Id: Ibefff559fa7dd0bee17e2812bd7cdd129108d804
2015-08-28Add support for uploading files via MTP.Tomasz Mikolajewski
Change-Id: Id1811ab70cb28be471e0a99999e9ad5380deac49
2015-08-14Add API for uploading files to MTP devices.Tomasz Mikolajewski
Bug: 22545670 Change-Id: I038c54db06b7cf780bd027d76693e98c685d57a7
2015-08-07Add API for streamed reading on MTP devices.Tomasz Mikolajewski
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
2015-06-15Fix API doc of MtpDevice#getObjectHandles.Daichi Hirono
BUG=21782579 Change-Id: Iadec8923c74f62b7aed44e876fb469b41c7dc59b
2014-01-07am 1e3395c7: am 105b545e: am 0dce19ca: am 79ceb53a: am c58abeea: Merge ↵Narayan Kamath
"AArch64: Use long for pointers in MTP classes" * commit '1e3395c7378a7dd293a2e8a8ac8fbf239adbad0c': AArch64: Use long for pointers in MTP classes
2014-01-07AArch64: Use long for pointers in MTP classesAshok Bhat
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>
2013-11-20Remove unused imports from frameworks/base.John Spurlock
Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
2011-05-05docs: add package description for mtp and a little more info to MtpDeviceScott Main
Change-Id: I44b3926c4a286f624de525a7f0cc896879582bf5
2011-04-01Improve Javadoc for USB Manager and MTP/PTP support.Mike Lockwood
Bug: 4091519 Change-Id: Ida79593d5a984f7ffd0934ae7bded23b8faf9eef Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-11USB: minor cleanup workMike Lockwood
Bug: 4067029 Change-Id: Icd8f912ab8732b5f770a217b9b3731092597ce02 Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-11UsbDevice: Move IO related methods to new UsbDeviceConnection classMike Lockwood
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>
2011-03-01Move USB framework support from android.hardware to android.hardware.usb packageMike Lockwood
Change-Id: I00fd4f0caaa4aebe48f71c576bb211b5f38bf88d Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-11Add MTP/PTP host support to the public APIMike Lockwood
Needed for unbundling the Gallery app Change-Id: I57e6b76ee5c9e57cb8c055329ac13251879baafd Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-22New APIs for MTP and PTP host supportMike Lockwood
This replaces the previous ContentProvider based interface Change-Id: I4cea2544854adb9fdcc04345e4d73d8ef05380f3 Signed-off-by: Mike Lockwood <lockwood@android.com>