Closed Bug 1188796 Opened 9 years ago Closed 9 years ago

[Gallery]Device can't arrange content in the gallery app based on month/year.

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox43 fixed, b2g-v2.2 affected, b2g-master verified)

VERIFIED FIXED
FxOS-S7 (18Sep)
Tracking Status
firefox43 --- fixed
b2g-v2.2 --- affected
b2g-master --- verified

People

(Reporter: liuke, Assigned: dhylands)

Details

(Whiteboard: [2.5-aries-test-run-1])

Attachments

(6 files)

Attached file logcat_1131.txt
[1.Description]:
[Aries v2.5][Flame v2.2][Gallery]After you launch Gallery, device can't arrange content based on month.
Found time:11:31
See attachments: Aries_2.5.3gp, compare.png and logcat_1131.txt

[2.Testing Steps]: 
1. Launch Camera, take three pictures with the camera at the same time. 
2. Turn on the USB Mass Storage option and import 2-3 pictures from different months/years within the same year to SD card/internal storage.
3. Open the gallery app. 

[3.Expected Result]: 
3. All images should be arrange content based on month/year.

[4.Actual Result]: 
3. All images can't be arrange content based on month/year.

[5.Reproduction build]: 
Device: Aries KK 2.5(Affected)
Build ID               20150728035120
Gaia Revision          14e32276025b0310d3e89027320cf4b2a24cedfb
Gaia Date              2015-07-27 16:43:18
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/33dc8a83cfc0
Gecko Version          42.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20150728.033538
Firmware Date          Tue Jul 28 03:35:46 UTC 2015
Bootloader             s1

Device: Flame KK 2.2(Affected)
Build ID               20150728152503
Gaia Revision          e1e6317f17a840b19af9dbb25f5a771d8d9fa161
Gaia Date              2015-07-15 21:05:11
Gecko Revision         https://hg.mozilla.org/releases/mozilla-b2g37_v2_2/rev/813cb3d271f0
Gecko Version          37.0
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20150728.190103
Firmware Date          Tue Jul 28 19:01:14 EDT 2015
Firmware Version       v18D v4
Bootloader             L1TC000118D0

Device: Flame KK 2.5(Unaffected)
Build ID               20150728150207
Gaia Revision          862f0895f3f5a97200601542d99a152a46385a0b
Gaia Date              2015-07-28 15:30:25
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/833403badc41
Gecko Version          42.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20150728.183347
Firmware Date          Tue Jul 28 18:33:59 EDT 2015
Firmware Version       v18D v4
Bootloader             L1TC000118D0

[6.Reproduction Frequency]: 
Always Recurrence,5/5

[7.TCID]: 
11087
Attached image compare.png
Attached video Aries_2.5.3GP
Where are the images on Aries? On the internal storage? If that's the case they were copied over MTP and then I suspect that the file date has been set to now.
Flags: needinfo?(liuke)
Hi Hubert,
The images are copied to internal storage by MTP. And we have copy those images to Aries 2.5 SD card by MTP, but images still can't be arranged in gallery.
Flags: needinfo?(liuke) → needinfo?(hub)
QA Whiteboard: [MGSEI-Triage+]
Try copying them on the SDcard through a card reader. Or using Mass Storage (to the SDcard since the internal storage isn't available that way). If that works fine, it is because of MTP.
Flags: needinfo?(hub) → needinfo?(liuke)
(In reply to Hubert Figuiere [:hub] from comment #5)
> Try copying them on the SDcard through a card reader. Or using Mass Storage
> (to the SDcard since the internal storage isn't available that way). If that
> works fine, it is because of MTP.

Hi Hubert,

If we copy those images to SD card through card reader or UMS, those images will be arranged in gallery.
Flags: needinfo?(liuke) → needinfo?(hub)
Bug 1143677 should solve partially this if the pictures have the proper Exif metadata.

Otherwise, Dave, do you know the limitation about preserving file datestamp when transfering over MTP on Aries ?

Thanks
Flags: needinfo?(hub) → needinfo?(dhylands)
MTP should present the same filestamp that the file has.

Normally when you copy files their timestamp will be updated to the time they were copied (MTP has no way of knowing the timestamp on the original file).

However, the software which does the copying is free to set the timestamp to anything it desires.
Flags: needinfo?(dhylands)
So what do you use to copy the files with MTP? The Android MTP application from Google or something else?

Thanks.
Flags: needinfo?(liuke)
(In reply to Hubert Figuiere [:hub] from comment #9)
> So what do you use to copy the files with MTP? The Android MTP application
> from Google or something else?
> 
> Thanks.

Hi Hubert,

We have copied those images to HTC butterfly & Evita/Nexus 5/ASUS X550/Huawei P6/Mi 2 by MTP, but only HTC device can arrange images based on month/year. The image date has been set to now in other devices.
Flags: needinfo?(liuke) → needinfo?(hub)
Still not telling which application you use to copy as requested in comment 9. But I can only guess that's where the bug lies.
Flags: needinfo?(hub) → needinfo?(liuke)
Attached video Aries_2.5_0731.3gp
Hi Hubert,
I am not sure what is the application that you said. To make things clearer, I upload a video: Aries_2.5_0731.3gp, which shows my detailed repro process on Aries KK 2.5 device:  connect device to PC-->turn on the USB Storage on device-->select MTP mode on device-->copying some images from PC to device.
Flags: needinfo?(liuke) → needinfo?(hub)
Flags: needinfo?(hub)
The answer is "Windows built-in MTP support".
Dave will look into whether the MTP protocol has an API to set the date/time and whether or not windows is trying to use it or not
Flags: needinfo?(dhylands)
It looks like the MTP spec supports 4 dates: Created, Modified, Authored, and Added.

The VFAT filesystem (used on physical sdcards and sharable internal sdcards) supports 2 dates: created, and last write (aka modified).

The EXT4 filesystem (typically used on non-sharable internal filesystems) supports 3 dates: status changed, modified, and accessed. status changed is modified when you do things like chown, chmod. I always made the assumption that st_ctime (returned by stat) was the creation time, but its not - its the status change time.

It looks like our MTP Server  advertises that it supports Modified and Added, and I think that we should add support for Created (perhaps replacing Added with Created).

DeviceStorage only seems to have the notion of "Modified" date.

I think we probably need to add support to MTP for date created, and then see what the various dates get set to when copying a file onto the device from various hosts.
Flags: needinfo?(dhylands)
Dave, do you think it's a feature bug then? I suppose it's not a release blocker, but probably something that we should address soon.
Flags: needinfo?(dhylands)
I've been investigating this, and it likes like we have no code on the phone to set the modified time of the pictures.

It turns out that a linux host doesn't send any modified/created times, so the behaviour won't change for linux,

But windows does send along last modified times and we're just ignoring it. So I'm working on having the time set properly for files copied to the phone using Windows Explorer.

I still need to test on the Mac and see what the Android File Transfer Utility does.
Assignee: nobody → dhylands
Flags: needinfo?(dhylands)
Along the way, I've discovered a bug in Android's MtpUtil.cpp which I filed here:
https://code.google.com/p/android/issues/detail?id=185159
Of the 3 popular host platforms, only Windows properly passes in the
modification timestamp of the file.

Under linux, it passes in an empty string, which then gets passed
to beginSendObject as zero. This patch now treats that as the current
date/time.

Under OSX, the Android FIle Transfer program passes in the date modified
and date created, but sets both of these fields to be the current
date/time and not the times from the files being copied.

So this patch really only has an effect for Windows hosts (for now).
Attachment #8658465 - Flags: review?(alchen)
Attachment #8658465 - Attachment is patch: true
Comment on attachment 8658465 [details] [diff] [review]
bug-1188796-mtp-times

Review of attachment 8658465 [details] [diff] [review]:
-----------------------------------------------------------------

The patch looks good.
Attachment #8658465 - Flags: review?(alchen) → review+
https://hg.mozilla.org/mozilla-central/rev/13d2e06d95f0
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S7 (18Sep)
This bug has been verified as "pass" on the latest build of Aires KK 2.5 by the STR in comment 0.

Actual results: By MTP for copying images, all images is arranged based on month/year in Gallery.
See attachment: verified_Aries_v2.5.3gp
Reproduce rate: 0/10


Device: Aries KK 2.5 (Pass)
Build ID               20150917232610
Gaia Revision          2082894c8e974b0c371e4dec298e0ad0f3ac56b1
Gaia Date              2015-09-17 14:56:47
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/01a75ffad1024a3f75d494fb77a022c96a497eb2
Gecko Version          43.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20150917.224608
Firmware Date          Thu Sep 17 22:46:16 UTC 2015
Bootloader             s1
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: