Closed Bug 823400 Opened 12 years ago Closed 11 years ago

Wifi toggle should not write settings db twice.

Categories

(Firefox OS Graveyard :: Wifi, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-basecamp:-, firefox19 wontfix, firefox20 wontfix, firefox21 fixed, b2g18 fixed)

RESOLVED FIXED
B2G C4 (2jan on)
blocking-basecamp -
Tracking Status
firefox19 --- wontfix
firefox20 --- wontfix
firefox21 --- fixed
b2g18 --- fixed

People

(Reporter: vchang, Assigned: vchang)

Details

Attachments

(1 file, 1 obsolete file)

Currently, wifi toggle writes the settings db twice. One is in gaia, the other one is in WifiWorker.js. It confuses gaia and makes it difficult to sync the wifi status between settings(settings app) and quick settings from status bar(system app). Moreover, it should be good to write settings db frequently. Writing settings db results in flash access. It should not be a good idea to write flash frequently in the phone.
If we fail to enable wifi, ondisabled event is fired to notify settings app instead of setting wifi.enabled to false.
Attached patch Patch v1.0 (obsolete) — Splinter Review
Attachment #694253 - Flags: review?(mrbkap)
blocking-basecamp: --- → ?
Comment on attachment 694253 [details] [diff] [review]
Patch v1.0

Please test this well.
Attachment #694253 - Flags: review?(mrbkap) → review+
Attachment #694253 - Flags: feedback?(mrbkap)
Comment on attachment 694253 [details] [diff] [review]
Patch v1.0

Review of attachment 694253 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/wifi/WifiWorker.js
@@ +1811,5 @@
>  
>      // Check if we need to dequeue requests first.
>      self._notifyAfterStateChange(false, false);
> +    // Notify everybody, even if they didn't ask us to come up.
> +    self._fireEvent("wifiDown", {});

With this change, onsupplicantlost and onsupplicantfailed only differ in the first parameter passed to _notifyAfterStateChange. Can you refactor them?
Attachment #694253 - Flags: feedback?(mrbkap) → feedback+
Since no motivation was given for why this should block, minusing.

But I'll approve the patch since it seems safe enough.
blocking-basecamp: ? → -
Comment on attachment 694253 [details] [diff] [review]
Patch v1.0

[Triage Comment]
Attachment #694253 - Flags: approval-mozilla-b2g18+
Attachment #694253 - Flags: approval-mozilla-aurora+
Attached patch Patch v1.1Splinter Review
refactor the code based on comment 4.
Attachment #694253 - Attachment is obsolete: true
Attachment #695443 - Flags: review?(mrbkap)
Renominating bb+ so that we will not confuse gaia's implementation when wifi.enabled   settings change event is fired.
blocking-basecamp: - → ?
blocking-basecamp: ? → +
Target Milestone: --- → B2G C3 (12dec-1jan)
Comment on attachment 695443 [details] [diff] [review]
Patch v1.1

Review of attachment 695443 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. Thanks.
Attachment #695443 - Flags: review?(mrbkap) → review+
Actually, Vincent, with this patch it looks like if the supplicant dies (or wifi turns off unexpectedly) we'll now notify gaia via wifiManager.ondisabled, but nothing updates the pref. So, we should either add code here to automatically reconnect to wifi or add code to gaia to update the pref when wifi goes down. Otherwise, we'll end up in a confusing state of "it looks like wifi is up but nothing works."
(In reply to Blake Kaplan (:mrbkap) from comment #10)
> Actually, Vincent, with this patch it looks like if the supplicant dies (or
> wifi turns off unexpectedly) we'll now notify gaia via
> wifiManager.ondisabled, but nothing updates the pref. So, we should either
> add code here to automatically reconnect to wifi or add code to gaia to
> update the pref when wifi goes down. Otherwise, we'll end up in a confusing
> state of "it looks like wifi is up but nothing works."

You are right. But I think it should be gaia's responsibility to handle the ondisabled event and turn the settings to off. Not sure the idea of gaia people ?
Flags: needinfo?(ehung)
Vincent: Does this really need to block? It's proven non-trivial to fix this bug so we should only spend more time on it if it's absolutely necessary.

Can you describe what will not work if we don't fix this bug in addition to unnecessary wear of the flash card.
blocking-basecamp: + → ?
Flags: needinfo?(vchang)
Hi Jonas, 

As I describe in comment 8, both gecko and gaia may toggle setttings change of "wifi.enabled", and it may confuse gaia when receiving settings change event. So I got a request to post a patch. 

I am fine if we don't mark it as BB+. Just gaia people may need additional code when receiving settings change which they have done in current repo. 

Regard
Vincent
Flags: needinfo?(vchang)
given that there is a workaround, let's basecamp- this.
blocking-basecamp: ? → -
Flags: needinfo?(ehung)
Keywords: checkin-needed
Bug 823783 is landed, so we can land this patch without regressing anything.
Marked it as checkin-needed based on the comment 5 in Bug 823783.
https://hg.mozilla.org/mozilla-central/rev/de0d5d8572d0
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: