Closed Bug 979214 Opened 10 years ago Closed 6 years ago

[OPEN C_1.3]How to close background camera app when user change default media location

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(tracking-b2g:backlog)

RESOLVED WONTFIX
tracking-b2g backlog

People

(Reporter: chen.cong, Unassigned)

Details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; CIBA; Tablet PC 2.0; TCO_20140304170526)

Steps to reproduce:

1) Used \system\etc\volume.cfg  file to support internal memory;
2) When the device is detected as an external disk,  there is no camera app on background, 
if user change the "Default media loaction" to "Internal", the Internal memory can available. 
if user change the "Default media location" to "SD Card" , the SD Card can available. 

But if there is camera app on background, user should close this camera app manual, then the changed default media location can  available. 



Expected results:

If user change the default media location, the default media loaction can available.
blocking-b2g: --- → 1.3?
OS: All → Gonk (Firefox OS)
Hardware: All → ARM
QC RIL commit:
a406d321  Add null check when handling set preferred network type
QC RIL TAG version: AU_LINUX_GECKO_B2G_JB_3.2.01.03.00.112.223

gaia commit:
744fb691 Merge pull request #15526 from steveck-chung/bug-961231

gecko commit:
6840e8c2 Bumping gaia.json for 1 gaia-1_3 revision(s) a=gaia-bump
I don't really follow this bug too well. What's the user impact?
Component: Gaia::Settings → Gaia::Camera
Moving to backlog based on the description.
blocking-b2g: 1.3? → backlog
If user change the "Default media location"  from "Internal" to "SD Card", the resume camera app only use the Internal media storage, no use SD Card media storage. At the same issue, the resume contact app export only use the Internal media storage, no use SD Card media storage.
Hi David,

Shall we need to check the default storage changing even camera is in background?
Thanks.
Flags: needinfo?(dflanagan)
Viral: hopefully the camera will not need to access the settings db for this.  Device storage ought to give us all we need.

Dave: can you comment on how this is supposed to work?  I thought that if we jut can navigator.getDeviceStorage() we will get an object that uses user's preferred location?  Is that right?  Currently I think the camera app just calls getDeviceStorage() once and holds onto that value forever.  Should we just call getDeviceStorage() each time instead?  Alternatively, does device storage emit any kind of event when the default location changes?

Wilson: I think you're the one who knows the most about the storage module so want to get this on your radar.
Flags: needinfo?(wilsonpage)
Flags: needinfo?(dhylands)
Flags: needinfo?(dflanagan)
(In reply to David Flanagan [:djf] from comment #6)
> Viral: hopefully the camera will not need to access the settings db for
> this.  Device storage ought to give us all we need.
> 
> Dave: can you comment on how this is supposed to work?  I thought that if we
> jut can navigator.getDeviceStorage() we will get an object that uses user's
> preferred location?  Is that right? 

Yes. Calling navigator.getDeviceStorage returns a volume taking the user's settings preference into effect.

> Currently I think the camera app just
> calls getDeviceStorage() once and holds onto that value forever.  Should we
> just call getDeviceStorage() each time instead?  Alternatively, does device
> storage emit any kind of event when the default location changes?

I think that calling getDeviceStorage each time is the right thing to do.

> Wilson: I think you're the one who knows the most about the storage module
> so want to get this on your radar.
Flags: needinfo?(dhylands)
If we had an event to listen to we could easily re-fetch the storage instance for picture. Currently video storage is handled internally inside lib/camera.js due to how coupled mozCamera.startRecording is to DeviceStorage.

Ideally we should pass a video storage instance into the Camera class at startup, and then update it when this 'change' event occurs.

Do we know if this event exists?
Flags: needinfo?(wilsonpage)
Hi Wilson,
   please refer to below link, is this what you need?
   https://developer.mozilla.org/en-US/docs/Web/API/DeviceStorageChangeEvent


   But I have one question, can camera app observe 'DeviceStorageChangeEvent' when it is in background app?
Flags: needinfo?(wilsonpage)
garychen: Yes, AFAIK apps continue to run just like a web-site continues to run in a minimised tab.  So this event should do the job just fine. Is this a 1.4 blocker?
Flags: needinfo?(wilsonpage)
garychen: I just checked MDN doc and it seems `DeviceStorageChangeEvent` refers to changes to *files* not strorage volume. We want the latter right?
Flags: needinfo?(gchen)
hmmm... 
Tes, it seems I misunderstood  `DeviceStorageChangeEvent` stand for.
Sorry about that. :(
Flags: needinfo?(gchen)
Dave, is this still something we can shoot ourselves in the foot with (albeit only with a bibi gun)?
Flags: needinfo?(dhylands)
Calling navigator.getDeviceStorage will return whichever storage area the user has selected in the settings app.

It may or may not be available for use.

DeviceStorage doesn't currently generate any events when the setting changes.
Flags: needinfo?(dhylands)
(In reply to Dave Hylands [:dhylands] from comment #14)

> DeviceStorage doesn't currently generate any events when the setting changes.

Should it? :)
Flags: needinfo?(dhylands)
It could listen to setting and generate a change event (which means that every app that uses device storage effectively winds up having to listen to the setting).

Or the apps that care about it can do the listening.
Flags: needinfo?(dhylands)
blocking-b2g: backlog → ---
Firefox OS is not being worked on
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.