Closed Bug 765444 Opened 12 years ago Closed 12 years ago

Update device storage paths for Gonk

Categories

(Core :: DOM: Device Interfaces, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: dougt, Assigned: dougt)

References

Details

Attachments

(1 file)

      No description provided.
Assignee: nobody → doug.turner
Attached patch patch v.1Splinter Review
This code is GAIA specific.  Asking fabrice to review.

This was tested on a Nexus S running B2G from Jun 15.  Verified that Gallery worked as expected.  This file paths mapped what was on /sdcard/
Attachment #633763 - Flags: review?(fabrice)
Did you just change lowercase /sdcard/{pictures,movies,videos} to uppercase /sdcard/{Pictures,Movies,Videos}?  Or has it always been that way?  I like initial caps better. (But in a gaia code review just made the author of the Music app change from /sdcard/Music to /sdcard/music...)

Will the test for existance of /sdcard work in the case where /sdcard is a symbolic link to /mnt/sdcard?  I.e if /sdcard points to /mnt/sdcard, but nothing is mounted there, does the test do what you want?
Fabrice,

If you can, please test this on an otoro as part of your review.  As similar patch from Doug was not working for me on that device. But perhaps something was misconfigured on mine.  

Also, note that the changing paths in this patch will require changes to the install-media-samples target in the Gaia Makefile
Comment on attachment 633763 [details] [diff] [review]
patch v.1

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

::: dom/devicestorage/nsDeviceStorage.cpp
@@ +138,5 @@
>    nsCOMPtr<nsIProperties> dirService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
>    NS_ASSERTION(dirService, "Must have directory service");
>  
> +#ifdef MOZ_WIDGET_GONK
> +  // check that /sdcard exists, if it doesn't go no further.

On an otoro without sdcard, /sdcard exists because it is just a symlink to /mnt/sdcard

So this test will pass, but any subsequent write will fail. Can we be smarter here?
Attachment #633763 - Flags: review?(fabrice)
OS: Mac OS X → Gonk
Hardware: x86 → All
Summary: Update device storage paths for Gaia → Update device storage paths for Gonk
> Can we be smarter here?

Suggest something.
there is a gonk volume manager - maybe there could be something I could query off that?
(In reply to Doug Turner (:dougt) from comment #6)
> there is a gonk volume manager - maybe there could be something I could
> query off that?

Dave, any hint on how to do that?
I just finished coding a patch (awaiting some review). Its attached to bug 764228

Basically, you would #include "VolumeManager.h" (Hmm. I may need to export some headers). Then you would RegisterVolumeEventObserver and pass in the string 'sdcard' and an observer object.

The Notify method of the observer will be called immediately and each time that the state of the named volume changes.

You can look at Volume.h https://mxr.mozilla.org/mozilla-central/source/dom/system/gonk/Volume.h#27 to see the various states.

The MOUNTED state means that the volume has been mounted on the phone. You can use the Volume class method MountPoint to get the filesystem location where the volume is mounted. Ideally, you should query the mount point each time the volume enters the MOUNTED state, since technically the mount point could change when the volume is not mounted.

In any state other than MOUNTED, the phone is unable to view the contents of the volume. SHARED means that volume is being shared with the PC. I've never seen the state SHARED_MOUNTED, I think it was going to be used for MTP, but that wound up getting implemented differently.


The SHARED state means that the volume is being shared with the PC.
Blocks: 765498
sounds like a perfect thing for a follow up bug!  Filed bug 765498.  Fabrice, would you review as-is?
Attachment #633763 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/c629f31f8218
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: