Closed Bug 1036375 Opened 12 years ago Closed 12 years ago

[B2G][DeviceStorage] Can't save to external storage after changing media location(settings -> media storage -> location -> SD card)

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1024384

People

(Reporter: hyeyoung1024.kim, Unassigned)

Details

(Whiteboard: TD68919 )

User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Steps to reproduce: * Precondition : - The Device has 2 storages. ( internal and external memory) * Steps : 1. Start up "Camera" app. 2. Setting -> Media Storage -> Default Storage path, change "internal" to "Sdcard" 3. go back to "camera" app. 4. Take a picture. Actual results: * actual results - Taken picture was saved in internal memory not external memory even though default storage path was set to sdcard. Expected results: * extected results. - When default storage path is set to sdcard, all of files should be stored in sdcard (external memory).
I checked this source code "nsDeviceStorage.cpp" http://mxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp When the File is stored, App calls "addNamed" api. =========================================== nsDOMDeviceStorage::AddNamed(nsIDOMBlob* aBlob, const nsAString& aPath, ErrorResult& aRv) { .... nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType, mStorageName, aPath); ..... ] ============================================== "mStorageName" is already set to preference value ("device.storage.writable.name"), When "getDeviceStorage" api is called. ================================================= CreateDeviceStorageFor() { ..... GetDefaultStorageName(aType, storageName); ..... if (NS_FAILED(ds->Init(aWin, aType, storageName))) { *aStore = nullptr; return; ..... } Inside of "Init" function, "mStorageName" is set to default storage path. =================================================== But, When "addNamed" api is called, "mStorageName" is not updated even though "device.storage.writable.name" is changed at that time. Because of this code flow, this issue is occurred I think. So, I think it need that "mStorageName" is updated as change of "device.storage.writable.name". Please check it and comment. Thanks, Hyeyoung, Kim
blocking-b2g: --- → 1.4?
OS: All → Gonk (Firefox OS)
Hardware: All → ARM
Whiteboard: TD68919
Dear,Kyle Huey I found that you have fixed some bugs related with "device storage". https://bugzilla.mozilla.org/show_bug.cgi?id=985197 So, Could you check this issue? If you are not in charge of this, please let me know who can handle this. Thanks, Hyeyoung, Kim
Flags: needinfo?(khuey)
Dave, can you answer Hyeyoung's questions?
Component: General → DOM: Device Interfaces
Flags: needinfo?(khuey) → needinfo?(dhylands)
Product: Firefox OS → Core
When you call navigator.getDeviceStorage it returns the default storage area at the time of the call. The user changing the default storage area doesn't change any existing storage areas. If you call navgator.getDeviceStorage again, then you will get the new default storage area (which points to a different location than the initial storage area). Calling navigator.getDeviceStorage is like opening a file. Changing the current directory once the file is open doesn't change the location of the file.
Flags: needinfo?(dhylands)
Thank you for comment. but, I'd like to know one thing more. I checked this on B2G v1.1. There's no this issue. when I changed the storage area while camera is running, captured pic was stored in updated storage area. What is the different between v1.1 and v1.4? Thanks, Hyeyoung, Kim
Flags: needinfo?(dhylands)
(In reply to hyeyoung1024.kim from comment #5) > Thank you for comment. > but, I'd like to know one thing more. > > I checked this on B2G v1.1. > > There's no this issue. > > when I changed the storage area while camera is running, captured pic was > stored in updated storage area. > > What is the different between v1.1 and v1.4? > > Thanks, > Hyeyoung, Kim Can you also check 1.3, please?
Looks like a duplicate of Bug 1024384 ?
(In reply to hyeyoung1024.kim from comment #5) > Thank you for comment. > but, I'd like to know one thing more. > > I checked this on B2G v1.1. > > There's no this issue. > > when I changed the storage area while camera is running, captured pic was > stored in updated storage area. > > What is the different between v1.1 and v1.4? > > Thanks, > Hyeyoung, Kim I'm going to guess that in rewriting the camera app, it used to call navigator.getDeviceStorage each time it took a photo and that the newer code doesn't do this. From my reading of bug 1024384, I also believe that this is a duplicate of that bug, so I'm going to mark it as such.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Flags: needinfo?(dhylands)
Resolution: --- → DUPLICATE
Remove 1.4 nomination here and request the 1.4 uplift in bug 1024384.
blocking-b2g: 1.4? → ---
You need to log in before you can comment on or make changes to this bug.