Update device storage paths for Gonk

RESOLVED FIXED in mozilla16

Status

()

Core
DOM: Device Interfaces
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dougt, Assigned: dougt)

Tracking

Trunk
mozilla16
All
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Updated

5 years ago
Assignee: nobody → doug.turner
(Assignee)

Comment 1

5 years ago
Created attachment 633763 [details] [diff] [review]
patch v.1

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
(Assignee)

Comment 5

5 years ago
> Can we be smarter here?

Suggest something.
(Assignee)

Comment 6

5 years ago
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.
(Assignee)

Updated

5 years ago
Blocks: 765498
(Assignee)

Comment 9

5 years ago
sounds like a perfect thing for a follow up bug!  Filed bug 765498.  Fabrice, would you review as-is?
Attachment #633763 - Flags: review+
(Assignee)

Comment 10

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/c629f31f8218

I'll look at bug 765498 this coming week.
https://hg.mozilla.org/mozilla-central/rev/c629f31f8218
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.