I recently bought a Nexus 4 and I would like to transfer my photos of my previous device to it. My previous Android phone used the standard USB mass storage which gave 0 problems to copy back and forth stuff, but the Nexus 4, like many other modern Android phones I suppose, uses MTP instead, which has the interesting feature of refusing to copy the original dates/timestamps of the files, using instead the date at which the files are being copied.
This is obviously a huge bummer when it comes to photos; not only because one cannot check the original date at which the picture was taken while browsing on the phone, but also because they end up completely unsorted.
Is there a way to transfer photos to a Jelly Bean Android phone that doesn't support USB mass storage preserving the original timestamps?
Things I've tried so far:
- Transferring via USB MTP
- ADB push (both full folders and individual files)
- Transferring via SSH (using SSHDroid + WinSCP)
- Uploading and downloading from Dropbox
- Transferring a ZIP file via MTP and uncompress the file on the phone
- Transferring from the other phone via bluetooth
- QuickPic "fix date" function
- Local Sync
- Photo Date Correction
- FTPSyncX
- Smoke signals
- Yelling at the phone
None of them preserved the timestamp, and this is driving me insane.
(Also, I am not rooted yet, but if the only viable way requires root I would welcome that answer as well.)
Answer
You can't, this is a current permission problem (bugreport here) of Android 4.0+'s /sdcard folder if it's not using FAT32 (but FUSE).
Reason: There's a transition away from FAT32 to unified user storage for both apps and media data (using ext4) on a single file system.
We got tired of seeing OEMs include many GB of internal storage for music, while users were still running out of space for apps and data. This approach lets us merge everything on one volume, which is way better.
-- Dan Morrill, Android engineer at Google
The old FAT32 properties are emulated using a FUSE layer to be compatible with existing apps. Also: /data/ and /sdcard on Google devices starting with the Nexus 7 use a single partition only (/data/media represents the "sdcard" content and is exposed using the FUSE layer to apps).
Here's CyanogenMod's implementation of the FUSE driver if you're interested in seeing the source. Looks like setting timestamp attributes is implemented, though.
EDIT: It only works with root.
Exact reason: All files are owned by root.sdcard_rw (see here).
A caller withouth uid=0 can't call the utimensat() syscall, it fails in the VFS layer already (EPERM) for timestamps other than current:
- the caller's effective user ID must match the owner of the file; or
- the caller must have appropriate privileges.
To make any change other than setting both timestamps to the current
time (i.e., times is not NULL, and both tv_nsec fields are not
UTIME_NOW and both tv_nsec fields are not UTIME_OMIT), either condition
2 or 3 above must apply.
No comments:
Post a Comment