summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpServer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* MtpServer: Fix concurrent access to mStoragesTom Marshall2016-06-071-15/+21
| | | | | | | | | | | * getStorage is called both internally with mMutex held and externally without mMutex held. Create getStorageLocked for internal use and make getStorage a wrapper. * hasStorage is only called internally with mMutex held. Make it a private method. Change-Id: I8f73310ad6cca14cd88b8e29f20cc181b3a4fac3
* MTP: Fix crash when no storages are availableTom Marshall2016-06-071-1/+1
| | | | Change-Id: I6d7202ade46a5d781a3db5a1a3bdde17c8e70a60
* Use errno correctly.tao.pei2016-03-221-14/+29
| | | | | | | | | | | | | | | | | After a failed write() or ioctl(), errno wasn't being checked until after some other function calls that could also modify errno, thus checking the wrong errno. Make sure to check it prior to doing anything else that can modify it. [Preconditions] 1.PC connects with phone(mtp). [Procedures] 1.Copy a file from PC to phone. 2.Cancel the copying. 3.Recopy the file. Change-Id: Id772fca7ccb96d3f43bd4beb210bedd8d3ac17fa
* Screenshots info is not updated when device is plugged in MTP modeMaunik Shah2015-10-311-0/+6
| | | | | | | | | | When device is connected as MTP mode and user opens folder /sdcard/Pictures/Screenshots/ in windows system and captures new screenshot, image information is always shown as 0 KB Issue: https://code.google.com/p/android/issues/detail?id=56204 Change-Id: I86d8e1ee54c0d8b2008b5f6bc0de2cac3faafc20
* Fix MTP deleteMarco Nelissen2015-01-231-2/+2
| | | | | Bug: 18836972 Change-Id: Ia1caa9bfb0f2084af774745b5c01b260ab1f1b20
* Fix bounds checking for GetPartialObject commandMike Lockwood2014-12-171-2/+8
| | | | | | | GetPartialObject has only 3 arguments, whereas the 64 bit version takes 4. Bug: 18786282 Change-Id: I4376962769ed0eae2f4991c2569244db22509204
* MTP: add strict bounds checking for all incoming packetsMike Lockwood2014-11-121-18/+79
| | | | | | | | | | | 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
* mtp: 64-bit compile warningsMark Salyzyn2014-06-251-4/+5
| | | | Change-Id: I9ebc270c990d2f83311cec8fef8f1d2842ebf291
* Improve MTP error checkingMarco Nelissen2014-06-241-23/+42
| | | | Change-Id: I1ab02ca0e99a1c284411fb368a773fb481d72ab2
* am e80631aa: am 839d11d1: Merge changes I0a744dc7,Id993a70dMark Salyzyn2014-04-151-3/+4
|\ | | | | | | | | | | * commit 'e80631aa1992ca50af679cd6a018c0ffda7f9b17': media: use size_t for integer iterator to Vector::size() media: 64 bit compile issues
| * 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
* | MTP: Add support for device property changed eventsMike Lockwood2014-03-111-0/+6
| | | | | | | | | | | | | | Also fixed bug in MtpProperty::write() for device properties Bug: 7342482 Change-Id: If0099095d101409d131564e55b1939895c69c202
* | 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>