Closed
Bug 767311
Opened 14 years ago
Closed 14 years ago
Migrate volume change to mozSettings
Categories
(Firefox OS Graveyard :: General, defect)
Firefox OS Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
DeveloperPhone
People
(Reporter: alive, Assigned: alive)
References
Details
Attachments
(4 files)
|
3.08 KB,
patch
|
vingtetun
:
review-
|
Details | Diff | Splinter Review |
|
3.56 KB,
patch
|
vingtetun
:
review-
|
Details | Diff | Splinter Review |
|
3.40 KB,
patch
|
vingtetun
:
review+
|
Details | Diff | Splinter Review |
|
2.40 KB,
patch
|
Details | Diff | Splinter Review |
The scenario of volume change now is:
* Listen to keyup/keydown event in shell.js
* call changeVolume(+1/-1)
This is duplicated in gaia, which also changes volume by listening to keyup/keydown of volume buttons.
The patch tried to move volume change into mozSettings, named 'sound.volume'.
And set volume directly according to SettingsListener.observe
It will need gaia's support. I will comment with gaia's pull request later.
Reference gaia issue:
https://github.com/mozilla-b2g/gaia/issues/1668
| Assignee | ||
Comment 1•14 years ago
|
||
Attachment #635676 -
Flags: review?(21)
| Assignee | ||
Updated•14 years ago
|
Assignee: nobody → alive
| Assignee | ||
Comment 2•14 years ago
|
||
Related gaia pull request:
https://github.com/mozilla-b2g/gaia/pull/1877
Comment 3•14 years ago
|
||
Comment on attachment 635676 [details] [diff] [review]
patch for change volume's new scenario
Review of attachment 635676 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for taking this! Just move a little bit the code and it would be fine.
::: b2g/chrome/content/shell.js
@@ +153,5 @@
> +
> + let self = this;
> + SettingsListener.observe("sound.volume", 5, function(value) {
> + self.setVolume(value);
> + });
Move this code and setVolume to settings.js. You can inline setVolume inside this observer.
@@ +190,5 @@
> let currentVolume = audioManager.masterVolume;
> let newStep = Math.round(steps * Math.sqrt(currentVolume)) + delta;
> let volume = (newStep / steps) * (newStep / steps);
>
> + this.setVolume(volume);
I would like to remove all this logic to have it in Gaia. Remove it completely.
@@ +202,5 @@
> +
> + let audioManager = Services.audioManager;
> + if (!audioManager)
> + return;
> +
Check audioManager on top of the method.
Attachment #635676 -
Flags: review?(21) → review-
Comment 4•14 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) from comment #3)
> Comment on attachment 635676 [details] [diff] [review]
> patch for change volume's new scenario
>
> Review of attachment 635676 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Thanks for taking this! Just move a little bit the code and it would be fine.
>
> ::: b2g/chrome/content/shell.js
> @@ +153,5 @@
> > +
> > + let self = this;
> > + SettingsListener.observe("sound.volume", 5, function(value) {
> > + self.setVolume(value);
> > + });
>
> Move this code and setVolume to settings.js. You can inline setVolume inside
> this observer.
>
Yeah that make sense.
> @@ +190,5 @@
> > let currentVolume = audioManager.masterVolume;
> > let newStep = Math.round(steps * Math.sqrt(currentVolume)) + delta;
> > let volume = (newStep / steps) * (newStep / steps);
> >
> > + this.setVolume(volume);
>
> I would like to remove all this logic to have it in Gaia. Remove it
> completely.
So audioManager.masterVolume = "sound.volume" value with out any calculation?
>
> @@ +202,5 @@
> > +
> > + let audioManager = Services.audioManager;
> > + if (!audioManager)
> > + return;
> > +
>
> Check audioManager on top of the method.
and move that to settings.js?
Comment 5•14 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #4)
> >
> > I would like to remove all this logic to have it in Gaia. Remove it
> > completely.
>
> So audioManager.masterVolume = "sound.volume" value with out any calculation?
Yep. I expect the calculation to be done in Gaia, not here.
> >
> > @@ +202,5 @@
> > > +
> > > + let audioManager = Services.audioManager;
> > > + if (!audioManager)
> > > + return;
> > > +
> >
> > Check audioManager on top of the method.
>
> and move that to settings.js?
Correct.
Comment 6•14 years ago
|
||
BTW, @alive, I propose we change the settings name to "audio.volume.master", how do you think?
| Assignee | ||
Comment 7•14 years ago
|
||
I think if we are going to control volume on different part like system-volume, notification-volume, ring-volume, and media-volume, the parameter should also be separated. Right? I couldn't image how we can separate these in gaia level.
So "audio.volume.master" means os-wide volume? Make sense.
Comment 8•14 years ago
|
||
(In reply to Alive Kuo from comment #7)
> So "audio.volume.master" means os-wide volume?
Yes.
Comment 9•14 years ago
|
||
(In reply to Alive Kuo from comment #7)
> I think if we are going to control volume on different part like
> system-volume, notification-volume, ring-volume, and media-volume, the
> parameter should also be separated. Right? I couldn't image how we can
> separate these in gaia level.
There is no way for Gaia to control that for now.
| Assignee | ||
Comment 10•14 years ago
|
||
Patch modified according to the comments
Attachment #636222 -
Flags: review?(21)
Comment 11•14 years ago
|
||
(In reply to Alive Kuo from comment #10)
> Created attachment 636222 [details] [diff] [review]
> patch for volume setting, rev#2
>
> Patch modified according to the comments
Did you test you patched Gecko? I think you should also move the topmost part here:
http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#31
Comment 12•14 years ago
|
||
Comment on attachment 636222 [details] [diff] [review]
patch for volume setting, rev#2
Review of attachment 636222 [details] [diff] [review]:
-----------------------------------------------------------------
::: b2g/chrome/content/settings.js
@@ +54,5 @@
> + {
> + dump('======get audioManager failed');
> + return;
> + }
> +
if (!audioManager)
return;
@@ +61,5 @@
> + if (value < 0)
> + value = 0;
> +
> + audioManager.masterVolume = value;
> + dump('=======',value);
audioManager.masterVolume = Math.min(0, Math.max(value, 1));
Attachment #636222 -
Flags: review?(21) → review-
| Assignee | ||
Comment 13•14 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #11)
> Did you test you patched Gecko? I think you should also move the topmost
> part here:
>
> http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#31
Yes I tested and worked fine.
Did you mean move the single 'lazyservicegetter' line or all the '#ifdef'~'#endif' part of audioManager?
Comment 14•14 years ago
|
||
(In reply to Alive Kuo from comment #13)
> (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #11)
> > Did you test you patched Gecko? I think you should also move the topmost
> > part here:
> >
> > http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#31
>
> Yes I tested and worked fine.
> Did you mean move the single 'lazyservicegetter' line or all the
> '#ifdef'~'#endif' part of audioManager?
Yes that's what I meant. Vivien, is that correct?
Comment 15•14 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #14)
> (In reply to Alive Kuo from comment #13)
> > (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #11)
> > > Did you test you patched Gecko? I think you should also move the topmost
> > > part here:
> > >
> > > http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#31
> >
> > Yes I tested and worked fine.
> > Did you mean move the single 'lazyservicegetter' line or all the
> > '#ifdef'~'#endif' part of audioManager?
>
> Yes that's what I meant. Vivien, is that correct?
What Tim says.
Comment 16•14 years ago
|
||
Progress?
| Assignee | ||
Comment 17•14 years ago
|
||
Attachment #638267 -
Flags: review?(21)
| Assignee | ||
Comment 18•14 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) from comment #15)
> (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #14)
> > (In reply to Alive Kuo from comment #13)
> > > (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #11)
> > > > Did you test you patched Gecko? I think you should also move the topmost
> > > > part here:
> > > >
> > > > http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#31
> > >
> > > Yes I tested and worked fine.
> > > Did you mean move the single 'lazyservicegetter' line or all the
> > > '#ifdef'~'#endif' part of audioManager?
> >
> > Yes that's what I meant. Vivien, is that correct?
>
> What Tim says.
Move those line(s) to settings.js will result in booting fail. Dunno what happend :|
Need further investigation.
Comment 19•14 years ago
|
||
(In reply to Alive Kuo from comment #18)
> (In reply to Vivien Nicolas (:vingtetun) from comment #15)
> > (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #14)
> > > (In reply to Alive Kuo from comment #13)
> > > > (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #11)
> > > > > Did you test you patched Gecko? I think you should also move the topmost
> > > > > part here:
> > > > >
> > > > > http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js#31
> > > >
> > > > Yes I tested and worked fine.
> > > > Did you mean move the single 'lazyservicegetter' line or all the
> > > > '#ifdef'~'#endif' part of audioManager?
> > >
> > > Yes that's what I meant. Vivien, is that correct?
> >
> > What Tim says.
>
> Move those line(s) to settings.js will result in booting fail. Dunno what
> happend :|
> Need further investigation.
What is breaking? Is it because of the ordering of the files in shell.xul? Or because of the definition of the audioManager?
| Assignee | ||
Comment 20•14 years ago
|
||
@vingtetun, the actual reason is redefine of `const Cu = Components.utils;`
Because it is already defined in head of shell.js
Comment 21•14 years ago
|
||
(In reply to Alive Kuo from comment #20)
> @vingtetun, the actual reason is redefine of `const Cu = Components.utils;`
> Because it is already defined in head of shell.js
Can you fix that?
Comment 22•14 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) from comment #21)
> (In reply to Alive Kuo from comment #20)
> > @vingtetun, the actual reason is redefine of `const Cu = Components.utils;`
> > Because it is already defined in head of shell.js
>
> Can you fix that?
There are many, many constants declared in shell.js that is used in settings.js. Do you want to decouple ALL THAT? I would say that should go to another bug and let's follow the *consistency* here.
Comment 23•14 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TW) from comment #22)
> (In reply to Vivien Nicolas (:vingtetun) from comment #21)
> > (In reply to Alive Kuo from comment #20)
> > > @vingtetun, the actual reason is redefine of `const Cu = Components.utils;`
> > > Because it is already defined in head of shell.js
> >
> > Can you fix that?
>
> There are many, many constants declared in shell.js that is used in
> settings.js. Do you want to decouple ALL THAT? I would say that should go to
> another bug and let's follow the *consistency* here.
I don't understand why you said that. I'm not going to review a patch where the author says it does *not* work. It seems like there is some incomprehension here...
Comment 24•14 years ago
|
||
(In reply to Vivien Nicolas (:vingtetun) from comment #23)
> I don't understand why you said that. I'm not going to review a patch where
> the author says it does *not* work. It seems like there is some
> incomprehension here...
Hum, there are some miscommunication here.
Patch v3 will work, ironically, moving topmost part to settings.js as I suggested in comment 11 will not work. The reason comment 11 will not work is because Cu, Cc, etc can not be defined in both files.
Comment 25•14 years ago
|
||
What is need to be done to have this bug moving forward?
Attachment #638267 -
Flags: review?(21) → review+
| Assignee | ||
Comment 26•14 years ago
|
||
the patch to be checkin
| Assignee | ||
Updated•14 years ago
|
Keywords: checkin-needed
Comment 27•14 years ago
|
||
Comment 28•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 774000
You need to log in
before you can comment on or make changes to this bug.
Description
•