History log of /frameworks/av/media/mtp/MtpDataPacket.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
bc1d4b41f4df1b6dd04801ea5a526d23f5321340 28-Mar-2018 Jerry Zhang <zhangjerry@google.com> Fix Unicode string handling

Linux uses UTF8 but java and MTP both
use UTF16. In a few places, this results
in the top byte of a UTF16 string being
truncated on conversion to UTF8.

Also, the hardcoded UTF to byte serialization
in MtpStringBuffer is incorrect.
Replace it with conversions from std, and
replace usages of MtpString with MtpStringBuffer.

Remove any remaining usages of libutils
and replace them with corresponding std
libraries.

Bug: 70546563
Test: Mtp works, tests pass
Test: file/folder names containing emoji can be transferred to/from
windows
Change-Id: Idbcb73f1beac17ce8a90843fa254e759dd1a6369
/frameworks/av/media/mtp/MtpDataPacket.cpp
dee8e1e48982a48b31c2db73a4e6630d70e2bfac 13-Dec-2016 Jerry Zhang <zhangjerry@google.com> Refactored Mtp driver interface into multiple classes. am: 487be61fb0 am: c17a76108b am: 1475041870
am: 28569ba92e

Change-Id: I18b7674cd0c2e05534849c52f78cbcb0e4ad9144
487be61fb0a38873aec1d12da92437fba5e728f2 24-Oct-2016 Jerry Zhang <zhangjerry@google.com> Refactored Mtp driver interface into multiple classes.

Added new interface for FunctionFS. This allows most of
the driver code to exist in userspace. The driver will
automatically use FunctionFS if it is enabled for that
device, otherwise it will default to the kernel driver.

The intention is to eventually deprecate the kernel driver.

Bug: 30976142
Change-Id: I36b8d16ca254fddd995b3ea1bd3d37b0ff4a28f7
Test: New automated tests for MtpFfsHandle, AsyncIO.
Manual testing on each device.
/frameworks/av/media/mtp/MtpDataPacket.cpp
cb8d8af1ad71ca7b800d298376dec7e6b1c1c766 19-Oct-2016 Philip P. Moltmann <moltmann@google.com> Signature of usb_request_wait changed

Test: Compiled
Change-Id: Ib32507811d21205d44be5b4c44a862ae100aba43
/frameworks/av/media/mtp/MtpDataPacket.cpp
d4b4296b401162a7a42f757c96e3652b82255b13 04-Oct-2016 Daichi Hirono <hirono@google.com> Don't send short URB packet when sending MtpDataPacket.

When sending a MtpDataPacket to a MTP device, the kernel driver splits
it into multiple URB packets so that the URB packet size does not exceed
the buffer size at the MTP device.

Previously MtpDataPacket sends its header first, then sends the
payload. It means the first URB packet only contains the header of
MtpDataPacket and the URB packet size is smaller than the maximum URB
packet size (short packet). Some MTP devices regard the short packet as
the end of the sequencail URB packets, thus the devices do not accept
the following URB packets that contain the payload.

The MTP spec says if the responder (MTP device) sends the data in a way
where the first pacekt contains only the header, the initiator (MTP
host) must send data in the same way. Otherwise the initiator must not
send a short packet in the sequencial URB packets.

The CL fixes the MTP host implementation so that it remembers how the
MTP device sends data, and uses the same way when sending data
from the host.

Bug: 31165557
Test: Manually invokes MtpDevice#sendObject
Change-Id: Ic76eb4241ed74957414aef2990be08cd77a9f5a9
/frameworks/av/media/mtp/MtpDataPacket.cpp
b3be006498f28f2630264135e88d266b540bcec3 24-Feb-2016 Daichi Hirono <hirono@google.com> Fix compiler warning in media/mtp.

BUG=27152673

Change-Id: I0a5a7f2005bd76acf4d09353305b66af3fd29e4b
/frameworks/av/media/mtp/MtpDataPacket.cpp
4fd9a8b9865addfedbcd84d5c9efea0f647086a0 20-Aug-2015 Daichi Hirono <hirono@google.com> Use common implementation for getObject and importFile.

Previously the two functions have separate but similar implementation. ag/750097
fixed a bug in importFile, but we have a same bug in getObject. Instead fixing
the bug separately, the CL adds a common function that can be used from both
getObject and importFile.

BUG=23264575

Change-Id: I0bdc876ee9b11301ba4c445cc16556e9c951a8b4
/frameworks/av/media/mtp/MtpDataPacket.cpp
64c948bf5041fdfe391553315c9d028e1ee56382 13-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Fix sending object info in MTP stack.

This CL fixes three bugs:
1. Wrong condition, which caused MtpDevice::sendData always return false.
2. Sending data separately was incompatible with the server side, causing
receiving only partial data on the server side.
3. Sending uninitialized buffers (sic!) from MtpDevice::sendObjectInfo
due to missing call to reset().
4. Sending corrupted packets from MtpDevice::sendObjectInfo (shifted by
4 bytes) due to missing reset().
5. Sending incorrect parent in MtpDevice::sendObjectInfo in case of not
specified parent.

Change-Id: Ia545c66b388ea9a292ba31f6ff034e2467037d92
/frameworks/av/media/mtp/MtpDataPacket.cpp
ab063847e6e893740749029a04cce1f6b7345ed5 12-Nov-2014 Mike Lockwood <lockwood@google.com> MTP: add strict bounds checking for all incoming packets

Previously we did not sanity check incoming MTP packets,
which could result in crashes due to reading off the edge of a packet.
Now all MTP packet getter functions return a boolean result
(true for OK, false for reading off the edge of the packet)
and we now return errors for malformed packets.

Bug: 18113092
Change-Id: Ic7623ee96f00652bdfb4f66acb16a93db5a1c105
/frameworks/av/media/mtp/MtpDataPacket.cpp
ebb1081a624a773a67c49b279c775e18e693c4fc 23-Jun-2014 Marco Nelissen <marcone@google.com> Fix buffer allocation

b/15293123

Change-Id: Icb3ceabf02a55bc931baaf388ce125db6332de0e
/frameworks/av/media/mtp/MtpDataPacket.cpp
014897f5aece2c6212418934bd4618326979f17a 04-Dec-2012 Yin Liu <yin2.liu@sonymobile.com> Long mp3 metadata displays as corrupted file after transfer

Cut the metadata to 1 Byte and return in function
getObjectPropertyList in order to show it properly on a PC.

Change-Id: Iefacf9fa86c20ece2572e6d95d35877a94066fe7
/frameworks/av/media/mtp/MtpDataPacket.cpp
29357bc2c0dd7c43ad3bd0c8e3efa4e6fd9bfd47 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/av/media/mtp/MtpDataPacket.cpp
44c190826d72589f5c9e13d69e32673bd8bd7c64 02-Dec-2011 Mike Lockwood <lockwood@google.com> MTP: Don't attempt to read more than 16K at a time from the MTP driver

This could happen sometimes if other operations increased the size of the
data packet buffer to > 16K

Change-Id: I4d316c7e2e558d3dd861d39accae6514fd9a62f5
Signed-off-by: Mike Lockwood <lockwood@google.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
ef441d965504dbf31c5db690e5b34fcdcecd92ff 15-Jul-2011 Mike Lockwood <lockwood@android.com> MTP: Use a single packet for the data phase

instead of sending 12 byte header in a separate packet.
PTP on the Mac is much happier with this approach.

Change-Id: I7d1ca498f6346afd88876d24332187b466fc469c
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
64000788211f4c7e78c80a4a155390d1316e1176 25-Apr-2011 Mike Lockwood <lockwood@android.com> MTP: Implement GetThumb command

This allows the PC to access thumbnails in JPEG files over MTP/PTP

Bug: 3219495

Change-Id: I4964f8b4826dffb7f0f77464ec91bd2e97a2f007
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
33bde8d8c4fc71fb3cdd8356fd0df70ffb44fcd7 12-Mar-2011 Mike Lockwood <lockwood@android.com> MTP host: Fix problems reading large data packets

Fixes problem reading large thumbnails via PTP

Bug: 4065217

Change-Id: I643672512829c93ab0827091f39103dbb1918071
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
42d0b79a787814d42e4c6f9dfe14f13cc0f6a758 04-Jan-2011 Mike Lockwood <lockwood@android.com> MTP: changes to use new usb_request support in libusbhost

Change-Id: Ic091eab166a66efcde0395dcebbbc513f2322fca
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
1d34b4b921cdac91116e456d97b57a1931e9e335 30-Nov-2010 Mike Lockwood <lockwood@android.com> MTP: Make sure buffer is big enough before reading the data packet

Fixes buffer overflow when transferring large playlists.

Change-Id: I1b7feaf9e56d849e5b6609f0f68a6aa5a3ae1ea8
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
b9ff444a7eaf7ffd43970c0477110c6808bd4a7c 19-Nov-2010 Mike Lockwood <lockwood@android.com> PTP: Improve performance and reliability of file importing

Now the file copy is done completely within the media process
rather than pushing data to the client via ContProvider.openFile().

File system writes are now interleaved with USB reads, which allows us
to copy the data faster and prevents the camera from timing out during transfer.

File is automatically inserted in the media provider after a successful import
and a Uri is returned to the client.

BUG: 2994234

Change-Id: Ie75c63da76f623343d3d966c6a707aa1ae871972
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
d472e2804190ea6261a88dae546e5908309209f9 10-Nov-2010 Mike Lockwood <lockwood@android.com> MTP: Don't dump data packets twice in debug output.

Change-Id: I49b383d39aea101a58ae6902952ba91b44e7dc3b
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
5959988b63ace3fba2fc78b135a4f5ef25dcf860 26-Aug-2010 Mike Lockwood <lockwood@android.com> MTP: Fix build break due to integer constant too large

Change-Id: Ia03ebe171d68bdfb04913abafc11dcb9c9071595
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
8277cec96ffa55082962591bca1c55abbeec8c26 10-Aug-2010 Mike Lockwood <lockwood@android.com> MTP: work in progress on expanded property support

GetObjectPropValue and SetObjectPropValue are disabled until I figure out
why Windows doesn't like what I have done.

Change-Id: I74e945ef3ea031f6d46f4ebaa8df815da0a5c3ed
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
de1e37aad04640ef76f3c017b65adca087c7be0f 18-Aug-2010 Mike Lockwood <lockwood@android.com> MTP: Compatibility fixes for transferring strings

Change-Id: Ic06d754ee68b0389439cdc34f73adff0f2b33afa
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
782aef17c9921a3bf401a0432878df5031f2328b 10-Aug-2010 Mike Lockwood <lockwood@android.com> MTP: Push queries for supported formats and properties up to Java.

Change-Id: I4f117090340e3916afda3d194521a6092a672ddc
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
0cf89f2e622aa53f31fa5762ca4bc805bb509ed3 27-Jul-2010 Mike Lockwood <lockwood@android.com> MTP host: Add support for reading files from an MTP device via ParcelFileDescriptor

Also added some support for sending files to the device that hasn't been debugged yet.
Add locking to MtpDevice to prevent it from attempting multiple transactions simultaneously.

Change-Id: I2b995ba0af086cc6920bd6b8c869f540ad78560a
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
437e945013318de54746422c8b44306e6d5319ca 20-Jul-2010 Mike Lockwood <lockwood@android.com> MTP host fixes:

Add support for detecting android MTP devices
Fix problem reading data packet with header sent separately from payload.

Change-Id: I07b34af6783ebe2e63a317796ba0c8223df86edf
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
1865a5ddcfe7b0e8dc211419aea1094b1491a5fd 03-Jul-2010 Mike Lockwood <lockwood@android.com> MTP: Use media provider database to implement MTP device support.

Uses a new "MTP objects" table in the media provider to support basic
enumeration of the external storage file system.
Support for accessing audio, video and image metadata in the existing
media provider tables will be added in a later commit.

The C++ MtpDatabase class is now abstract, to support a proxy subclass that
calls through JNI to the Java MtpDatabase class in the media provider.

Change-Id: I90f0db5f3acc5d35ae78c27a8507edff16d14305
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
b14e588bec4d5e39e61b020b5b575f2ce555d316 30-Jun-2010 Mike Lockwood <lockwood@android.com> MTP: replace printfs with logcat

Change-Id: I2c30921098e2dc049dc5fc1e0a548ead33c363e0
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
3e072b354d1e1e3ee62d58492f0739139df8aff1 10-Jun-2010 Mike Lockwood <lockwood@android.com> MTP: Add support for retrieving thumbnails to MTP content provider.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
a6c490b8b2d96ebaab632286029463f932ae3b6b 06-Jun-2010 Mike Lockwood <lockwood@android.com> MTP: host support for retrieving device property descriptors

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
335dd2be955607f2632eabc25045857f2cc8b674 19-May-2010 Mike Lockwood <mike@spruce.(none)> More work on PTP host support.

Change-Id: Ifbd5bd5efa3cdb750ae1a2aae38181457554d34d
Signed-off-by: Mike Lockwood <mike@spruce.(none)>
/frameworks/av/media/mtp/MtpDataPacket.cpp
7850ef999740f214a1990a9c090d3f3865d435aa 14-May-2010 Mike Lockwood <lockwood@android.com> Move MTP code to the android namespace

Change-Id: I5da48038fd5e4cdeefaeba42cdc74eb588b3448d
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp
16864bae0f51c32c456da2c43adf7a057c0c4882 11-May-2010 Mike Lockwood <lockwood@android.com> Checkpoint work on MTP and PTP investigation.

This change includes work in progress on a C++ library for both host and device
MTP and PTP support.
Currently the makefile builds two test programs:

mtptest - a command line test program that implements a small subset of device side MTP.
Requires a kernel driver that has not been checked in yet.

ptptest - a host tool to test USB host support for detecting and communicating with
digital cameras over PTP. Runs on Linux host.

Later this will be reformulated as a native library that will be used in the media process.

Change-Id: I81aab279975b600b59d99013ab97f9adf0b58da7
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/av/media/mtp/MtpDataPacket.cpp