summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpServer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* media: use size_t for integer iterator to Vector::size()Mark Salyzyn2014-04-151-2/+2
| | | | Change-Id: I0a744dc7815a86a993df9b0623440be620ec8903
* media: 64 bit compile issuesMark Salyzyn2014-04-151-3/+4
| | | | | | | | - change internal sized types to use stdint.h - printf & scanf formats - size_t or unsigned int for iterators Change-Id: Id993a70d8bf54c667c5d652b34179a2c727ed446
* MTP: Implement date created field in GetObjectInfoMike Lockwood2013-04-011-1/+2
| | | | | Bug: 8293874 Change-Id: I6b74fe73362bd4fac34ca8a54e127ae91f82aef9
* MTP: Write initial data to correct file offset in SendPartialObjectMike Lockwoood2013-02-081-1/+1
| | | | Change-Id: I84288aeda3e65e6e6487f11d32a72910cd16cff2
* Add mode when open(O_CREAT) is used.Nick Kralevich2012-06-261-1/+1
| | | | | | | | | | When creating a new file using open(..., O_CREAT), it is an error to fail to specify a creation mode. If a mode is not specified, a random stack provided value is used as the "mode". This will become a compile error in a future Android change. Change-Id: I36a3d67d294a915c1f79632a1b0ba45edd1214b1
* Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-081-16/+16
| | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-031-2/+2
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* MTP: Add support for restricting PTP to only certain subdirectories of the ↵Mike Lockwood2011-12-021-4/+7
| | | | | | | | | storage Bug: 5527220 Change-Id: If68e7481617ecb62abd24e2d89e6b7dfdf95ba2b Signed-off-by: Mike Lockwood <lockwood@google.com>
* Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2011-10-261-28/+28
| | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
* MtpServer: Pass 0xFFFFFFFF for file size when receiving files >= 4GB in sizeMike Lockwood2011-10-131-1/+6
| | | | | | | Bug: 5432487 Change-Id: Ie86e72d9d85476941eab6a9d271948b8fdde6926 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Use a single packet for the data phaseMike Lockwood2011-07-171-41/+56
| | | | | | | | 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>
* MTP: Clean up MtpServer initialization and threading:Mike Lockwood2011-07-131-0/+2
| | | | | | | Move thread from native to Java code Remove the stop() method (the thread will exit on its own) Change-Id: Ib897c3630162f82669a4ee8c187e8172da50b29d
* MTP: Return error if user tries to copy a file >= 4GB to a FAT32 file systemMike Lockwood2011-07-111-0/+8
| | | | | | | Bug: 4561836 Change-Id: I2bffb93b032038f6c220c24c752ccd7ca66c23a0 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add support for PTP variant of GetDeviceInfo result.Mike Lockwood2011-06-211-3/+15
| | | | | Change-Id: I09f86fda768b7697665e401adb9516588859bf59 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Fix some problems with GetObjectHandles and GetNumObjects commandsMike Lockwood2011-06-171-6/+2
| | | | | | | | These calls did not correctly handle some variants of the arguments, which showed up when running in PTP mode. Change-Id: Iedbaefebfa39111c8bcaee7c6cc3820a65d6c98f Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Implement GetThumb commandMike Lockwood2011-04-251-1/+20
| | | | | | | | | 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>
* MTP: Fix file descriptor leak in file editing extensionsMike Lockwood2011-04-251-18/+13
| | | | | Change-Id: I6d0de5efe705d8060bbfd526c6880dc995a3aa30 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add extended operations to support in-place editing of filesMike Lockwood2011-04-221-6/+225
| | | | | | | | | | | | | | | | | | | | | | MTP does not support partial writes of files (the entire file must be transferred at once). This makes it impossible to implement a FUSE file system for MTP with acceptable performance. To fix this problem, this change adds extended MTP operations to allow partial writes to files: SendPartialObject - allows writing a subset of a file, or appending to the end of a file TruncateObject - allows changing the size of a file BeginEditObject - must be called before using SendPartialObject and TruncateObject EndEditObject - commits changes to a file after it has been edited with SendPartialObject or TruncateObject We also add GetPartialObject64, which is the same as GetPartialObject but has a 64 bit offset rather than 32. Change-Id: I4b110748b97ae05cdc8aab02ecdbbbeb263f7840 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add support for dynamically adding and removing storage unitsMike Lockwood2011-02-221-17/+74
| | | | | | BUG: 3402847 Change-Id: I7da266061d949abcb6bb11c6faaa47b5e4a2a977
* MTP: Use ro.product.manufacturer system property value for MTP manufacturer nameMike Lockwood2011-01-311-2/+3
| | | | | | | | | Previously it was hard coded to "Google, Inc." BUG: 3405965 Change-Id: I5f962d474814c22e990c39b501c0f01da9e8dc6d Signed-off-by: Mike Lockwood <lockwood@android.com>
* Remove MTP related log spamMike Lockwood2011-01-211-15/+15
| | | | | Change-Id: I9de1792cbeec07fa5ab42ff9a10813f0c3d30fc1 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Fix problems with modification dates for folders and non-media filesMike Lockwood2011-01-181-9/+4
| | | | | | | | | Also removed an unnecessary parameter to MtpDatabase.endSendobject() BUG: 3352142 Change-Id: I6fd812dcba4814956bc8bc1cbd6bd5c868197790 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: check for replacing existing files via the database instead of the file ↵Mike Lockwood2010-12-131-4/+0
| | | | | | | system Change-Id: I283dab48f24d2836e48fab8e49764a9cdf13de55 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add support for reserve storage setting to avoid low storage situations.Mike Lockwood2010-12-121-2/+6
| | | | | | | | | | | | | Set resource config_mtpReserveSpaceMegabytes to number of megabytes to reserve. If MTP has dedicated storage this value should be zero, but if MTP is sharing storage with the rest of the system, set this to a positive value to ensure that MTP activity does not result in the storage being too close to full. BUG: 3250924 Change-Id: I881c87240da268bad1ea1b99ad03673ab85ffdbf Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Improve argument checking in SendObjectInfoMike Lockwood2010-12-081-6/+17
| | | | | | | | In particular, make sure the parent is a folder and make sure file does not already exist. Change-Id: Ifa870faba3285f03a92025d9e82f93fed78a761c Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Use correct return type for getSupportedObjectPropertiesMike Lockwood2010-12-071-1/+1
| | | | | Change-Id: I6d5bd63fecaa3384dfa1b97dbc0d89ea5668981f Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add support for multiple properties in GetObjectPropList commandMike Lockwood2010-12-021-2/+3
| | | | | Change-Id: Ib469a6c8141937aaa3e811345056195117abb4b2 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Fix typo in MtpServer::doGetObjectPropListMike Lockwood2010-11-231-1/+1
| | | | | Change-Id: Ia5fec45a238c49a6797a4ac55457ddb5d6521408 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Implement GetPartialObject commandMike Lockwood2010-11-231-1/+43
| | | | | | | Allows host to read partial contents of files on the device Change-Id: I74927f7394224d674e1d150a4b72a51d9358459b Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Fixes to allow file transfers > 4 gigabytesMike Lockwood2010-11-171-1/+9
| | | | | | | BUG: 3198248 Change-Id: I6f11c79a19d7bdd63718a7370939124b1262d221 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Set correct format for abstract audio playlistsMike Lockwood2010-11-171-0/+2
| | | | | | | | | | Fixes a bad interaction with the media scanner that could result in playlists getting duplicated or deleted after rebooting. BUG: 3175649 Change-Id: I970234e86b24ac17d069aca085683d988abc7881 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Partial implementation of the GetObjectPropList commandMike Lockwood2010-11-151-0/+21
| | | | | | | | | | In this initial implementation we only support fetching one property at a time. Support depth = 0 (single object) or depth = 1 (all objects in a directory) Reimplemented GetObjectPropValue on top of GetObjectPropList, since the former is a special case of the latter. Change-Id: Ia76ee61741d6ee3902b5c5d9fc094cf86dfaf650 Signed-off-by: Mike Lockwood <lockwood@google.com>
* MTP: Add missing call to closedir() in recursive delete codeMike Lockwood2010-11-111-0/+1
| | | | | | | BUG: 3185660 Change-Id: I3744d2cb193829d20a689af2aea50e8516779631 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Include size of 12 byte header in packet size for GetObject data packetMike Lockwood2010-10-111-1/+3
| | | | | | | Fixes file transfer from device to host with libmtp. Change-Id: Ifb304c1f106e94b2710ee5c11816b83cf5f25478 Signed-off-by: Mike Lockwood <lockwood@google.com>
* MTP: Reenable GetObjectPropValue and SetObjectPropValueMike Lockwood2010-09-231-2/+2
| | | | | | | | | Windows no longer chokes now that we implement the minimum set of properties BUG: 2869730 Change-Id: Ie8bd9107610b9b38f060ad8a2f05334a3b4aff9b Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Minor debug output cleanupMike Lockwood2010-09-231-0/+3
| | | | | Change-Id: I1065179aa64f43c7d8067ccda249319a016840ab Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Delete all files and subdirectories when deleting directories.Mike Lockwood2010-09-141-5/+63
| | | | | | | Children are now recursively deleted from the database and filesystem. Change-Id: Ifd9b48cbc34b84b8f5073f2493dfe9735fae5492 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Implement support for getting/setting device propertiesMike Lockwood2010-09-021-1/+4
| | | | | | | | Added support for the "device friendly name" and "synchonization partner" properties, which are required by Microsoft. Change-Id: Ic0443333d75f7d98a2d902a790b9d505a56d4eef Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Send an Intent after an MTP session that resulted in media database ↵Mike Lockwood2010-08-311-0/+7
| | | | | | | modifications Change-Id: Ib2796e9155350c67769502935a73cf98d6ae9c08 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: work in progress on expanded property supportMike Lockwood2010-08-251-41/+77
| | | | | | | | 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>
* MTP: Fix wrong delete operator from previous change.Mike Lockwood2010-08-101-1/+1
| | | | | Change-Id: I64e8fdc610495f21060727b6bed42d1584833405 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Push queries for supported formats and properties up to Java.Mike Lockwood2010-08-101-46/+14
| | | | | Change-Id: I4f117090340e3916afda3d194521a6092a672ddc Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Fix some typosMike Lockwood2010-08-091-1/+1
| | | | | Change-Id: Ib31708c3a925e3c0ab8eea6922ab09e02b740936 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add support for syncing MTP playlistsMike Lockwood2010-08-031-7/+38
| | | | | | | | MTP playlists now correspond to playlists in the media provider (like those created by the Music app). Change-Id: I085cb3cff003037ad62f0e297fb0cfd3047cb3a2 Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Implement GetNumObjectsMike Lockwood2010-08-021-5/+28
| | | | | Change-Id: Iccc3a445f9a1eab7bb76eddd567c6a3a8f155b2b Signed-off-by: Mike Lockwood <lockwood@android.com>
* Clean up MtpDatabase API.Mike Lockwood2010-08-021-19/+17
| | | | | | | | Return MTP response codes instead of booleans for success or failure. Remove some unused code. Change-Id: I82ce80a4d7779233264e3caf139ebd0cece12f5c Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Only send events to host if we have an open session.Mike Lockwood2010-07-191-12/+16
| | | | | Change-Id: I7b2d0c88c2d2ae0490247703d0fb1b862154db92 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Remove our copy of the f_mtp.h kernel header, now that it is in bionic.Mike Lockwood2010-07-151-1/+1
| | | | | Change-Id: I2b5e72bf25b3525ace4b919c6e8b6bd6750f6dfa Signed-off-by: Mike Lockwood <lockwood@android.com>
* MTP: Add support for sending events to the host when objects are added and ↵Mike Lockwood2010-07-131-1/+25
| | | | | | | removed Change-Id: Ia1d5232b919c644c670ff9ca651eca92b3f9ad42 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Integrate host to device file transfer with the media provider.Mike Lockwood2010-07-121-11/+23
| | | | | | | | | | | | | | | | | | | | | MTP file transfers happen in two stages. The SendObjectInfo command sends some information about the file and reserves an ObjectHandle for the new file. The file transfer is then performed using the SendObject command. To support this in the media provider, MtpDatabase.beginSendObject receives the information from SendObjectInfo and creates an row for it in the MTP objects table for the new file. After the file transfer has completed, then MtpDatabase.endSendObject is called. In endSendObject, we run the media scanner on the new file, which will add a row to the images, audio, video or audio playlist table. To avoid the media scanner creating a second row for the file in the MTP objects table, we pass the ObjectHandle created in beginSendObject to the media scanner, which then passes it to the media provider via the content values when it performs its insert. Change-Id: I1ebcc63d6bd4404b0d3a93c703a9d3c097381d3a Signed-off-by: Mike Lockwood <lockwood@android.com>