Closed
Bug 921930
Opened 11 years ago
Closed 11 years ago
[B2G][Helix][Setting][Sound][Bug][shijinde]The vibrate state is error by Setting the volume mute and unmute in sleep menu function
Categories
(Firefox OS Graveyard :: Gaia::System, defect, P2)
Firefox OS Graveyard
Gaia::System
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: lecky.wanglei, Assigned: dwi2)
Details
Attachments
(6 files)
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; aff-kingsoft-ciba; .NET4.0C; .NET4.0E; Zune 4.7; Tablet PC 2.0) Steps to reproduce: 1、set the vibrate state off by manual in setting->sound screen. 2、press power key long time, and select "silence incoming calls" 3、go to setting->sound, the vibrate state is off 4、press power key long time, and select "ring incoming calls" 5、go to setting->sound, the vibrate state is on 6、press volume down or up, the vibrate icon state is off in volume status bar Actual results: 1、the vibrate state is on 2、the vibrate icon state is off in volume status bar Expected results: 1、the vibrate state is on 2、the vibrate icon state is off in volume status bar
Hi, I had added the pictures and you can follow the steps to reproduce this bug. Thanks
Severity: normal → major
Flags: needinfo?(wchang)
Priority: -- → P1
Hi, I had found this problem in sound_manager.js. you need to record initial state about vibrate when you received the "mute" event. I modified the code: + var oldstate = false; window.addEventListener('mute', function() { // Turn off vibration for really silence. + oldstate = vibrationEnabled; setVibrationEnabled(false); enterSilentMode('notification'); }); /** * The unmute event is dispatched from sleep menu. * But if we have a mute hardware button or virtual button, * we could make the button handler to fire this event, too. */ window.addEventListener('unmute', function() { // Turn on vibration. + if(oldstate === true) + { + setVibrationEnabled(true); + } leaveSilentMode('notification'); leaveSilentMode('content'); }); I had test the code and the function is OK. Thanks
Comment 8•11 years ago
|
||
Lecky, Your expected result and actual result are the same, I think you copy and pasted incorrectly? Evelyn, Someone can take a look at sound manager? I think there is some status indicator out-of-sync issue?
Flags: needinfo?(wchang)
Flags: needinfo?(lecky.wanglei)
Flags: needinfo?(ehung)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → tzhuang
Flags: needinfo?(tzhuang)
Assignee | ||
Comment 10•11 years ago
|
||
Root cause: asynchronous issue There is a 'vibration.enabled' observer in sound_manager.js (https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/sound_manager.js#L385). When 'vibration.enabled' has changed, it will update local variable 'vibrationEnabled' inside sound_manager.js (https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/sound_manager.js#L400) However, there is a semaphore 'pendingRequestCount' to protect modification on vibrationEnabled. When there are ongoing events related to volumn processing, 'pendingRequestCount' would be increase. And 'pendingRequestcount' would be decrease when processing is done. The problem is that when either 'mute' or 'unmute' happens, sound_manager will increase 'pendingRequestCount' and update vibration (thru setVibrationEnabled()) thus trigger observer to react. And 'pendingRequestCount' will not go back to zero until we got callback from SettingsListener. This results in every time sound_manager.js observer 'vibration.enabled' changed, 'pendingRequestCount' will always larger then zero and block the updating of local variable 'vibrationEnabled' of sound_manager.js example sequence of problem: (assuming vibration is off) 1. The user hold power button and select 'ringing incoming calls'. 'unmute' event is triggered. https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/sound_manager.js#L45 2. call setVibrationEnabled() and set to true (this will not happen immediately) 3. call leaveSilentMode(), increase pendingRequestCount to one 4. sound_manager.js observed 'vibration.enabled' changed as result of 2, but 'pendingRequest' is now larger than zero. The function returns without modifying local variable 'vibrationEnabled'(https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/sound_manager.js#L393). 5. 'success' event of SettingsListener, 'pendingRequest' go back down to zero again.
Flags: needinfo?(lecky.wanglei)
Assignee | ||
Comment 11•11 years ago
|
||
accidentally clear the flag, reflag again.
Flags: needinfo?(lecky.wanglei)
Assignee | ||
Comment 13•11 years ago
|
||
proposed solution: Implement an asynchronous semaphore. And make sure the code block by semaphore will get executed once semaphore drop back to zero.
Assignee | ||
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 14•11 years ago
|
||
Attachment #814811 -
Flags: review?(alive)
Comment 15•11 years ago
|
||
Comment on attachment 814811 [details]
pullrequest.html
r+ for the semaphore idea, it's wonderful.
However I would like to have that defined in another file named async_semaphore.js
And please see github comments.
Once you have that module please also write an unit test for it(not sound manager).
Attachment #814811 -
Flags: review?(alive) → review+
Comment 16•11 years ago
|
||
Please feedback?=me if you need feedback once the patch is modified.
Comment 17•11 years ago
|
||
Comment on attachment 814811 [details]
pullrequest.html
f+ instead.
Attachment #814811 -
Flags: review+ → feedback+
Assignee | ||
Comment 18•11 years ago
|
||
Hi Alive, I've pull out async_semaphore.js and add unit tests for it as discussion on github. Please help to give me some feedback.
Comment 19•11 years ago
|
||
Comment on attachment 814811 [details]
pullrequest.html
r=me!
Attachment #814811 -
Flags: review+
Assignee | ||
Comment 20•11 years ago
|
||
Hi Alive, This pull request is green light in Travis now. Please kindly help to land this patch since I don't have the privilege to do this. Thanks
Comment 21•11 years ago
|
||
Please say "what you done" in commit message instead of copy/paste bug summary next time. https://github.com/mozilla-b2g/gaia/commit/5cfebf44f988ccde09a33ac58745a3ca70b4040f
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 22•11 years ago
|
||
got it, thanks
Reporter | ||
Comment 23•11 years ago
|
||
Hi, do you will merge to 1.1HD version? Thanks.
Flags: needinfo?(wchang)
Comment 24•11 years ago
|
||
Not a regression, similar on other v1.1 devices. Low user impact - not blocking for v1.1/hd.
Flags: needinfo?(wchang)
You need to log in
before you can comment on or make changes to this bug.
Description
•