Closed Bug 964270 Opened 11 years ago Closed 11 years ago

[NetworkStats API] Alarms methods do not work when data traffic is disabled

Categories

(Firefox OS Graveyard :: Gaia::Cost Control, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:1.3T+, firefox28 wontfix, firefox29 wontfix, firefox30 fixed, b2g-v1.3 affected, b2g-v1.3T fixed, b2g-v1.4 fixed)

RESOLVED FIXED
1.4 S1 (14feb)
blocking-b2g 1.3T+
Tracking Status
firefox28 --- wontfix
firefox29 --- wontfix
firefox30 --- fixed
b2g-v1.3 --- affected
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: mai, Assigned: albert)

References

Details

Attachments

(4 files, 5 obsolete files)

When starts the mobile without enable data traffic, the alarms methods (getAllAlarms, addAlarm,...) of NetworkStats API do not works.
Assignee: nobody → acperez
Blocks: 858017
OS: Windows 7 → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Attached patch Patch (obsolete) — Splinter Review
Added status to network object in connections array to avoid duplicated code when validating networks and enable alarm functions for networks that hasn't established a connection yet.
Attachment #8367854 - Flags: review?(gene.lian)
Blocks: 965319
Attached patch Patch (obsolete) — Splinter Review
Patch updated from test results
Attachment #8367854 - Attachment is obsolete: true
Attachment #8367854 - Flags: review?(gene.lian)
Attachment #8368120 - Flags: review?(gene.lian)
Attached patch Update testsSplinter Review
Attachment #8368121 - Flags: review?(gene.lian)
nominating to v1.3? since it is an issue related to NetworkStats API already uplifted to v1.3. Thanks!
blocking-b2g: --- → 1.3?
I need some time to review this next week because new mechanism has been added. I'll be stick to this it becomes urgent. Anyway, we need Fabrice's approval before uplifting. I don't know if we're still allowed to uplift at this moment.
Flags: needinfo?(fabrice)
Is that a regression or a new feature?
Flags: needinfo?(fabrice)
It is not a new feature but a bug related to the New Network Stats API already landed in v1.3 branch. Currently when trying to call alarms methods: getAllAlarms, addAlarm,... and data or wifi is off we obtain InvalidInterface error which is wrong since the interface is available. This patch allows to call the alarms method when the interface is detected.
Marina Please help understand the user impact if bug fix is not taken. Also, please help with STRs as we are not sure if the issue is a regression or not.
Flags: needinfo?(mri)
Hi, this bug produces that all alarm methods are unavailable when mobile traffic is disabled. This is transparent for the CC application, because the application doesn't need the mobile data is enabled to run. The user impacts when mobile data is disabled are: * The user cannot deactivate the alarms. * The user cannot modify the alarms limit. * The user cannot add a new alarm. * When the user o the system clears the network traffic, the application cannot restore the alarm, whence the alarm never fires when the mobile traffic is restaured. Regards
Flags: needinfo?(mri)
Comment on attachment 8368120 [details] [diff] [review] Patch Review of attachment 8368120 [details] [diff] [review]: ----------------------------------------------------------------- This is a great patch, except for some missing comments that I hope to see. Directly give review+ because this bug seems urgent. ::: dom/network/src/NetworkStatsService.jsm @@ +30,5 @@ > const NET_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE; > > +const NETWORK_STATUS_READY = 0; > +const NETWORK_STATUS_STANDBY = 1; > +const NETWORK_STATUS_AWAY = 2; Please add explicit comments for the purpose of these 3 types, to make the followers easily to maintain the codes. @@ +291,5 @@ > getNetworkId: function getNetworkId(aIccId, aNetworkType) { > return aIccId + '' + aNetworkType; > }, > > + validateNetwork: function validateNetwork(aNetwork, aCallback) { Add a simple comment above this function: // aCallback is signatured as |function(netId)|. @@ +300,5 @@ > + return; > + } > + > + // Check if network is valid (RIL entry) but has not established a connection yet. > + // If So add to networks list with empty interfaceName. s/So/so, / @@ +313,5 @@ > + } > + > + // Check if network is available in the DB. > + this._db.isNetworkAvailable(aNetwork, function(aError, aResult) { > + let result = null; Drop this line. @@ +316,5 @@ > + this._db.isNetworkAvailable(aNetwork, function(aError, aResult) { > + let result = null; > + > + if (aResult) { > + result = netId; Drop this line. @@ +321,5 @@ > + > + this._networks[netId] = Object.create(null); > + this._networks[netId].network = aNetwork; > + this._networks[netId].status = NETWORK_STATUS_AWAY; > + this._currentAlarms[netId] = Object.create(null); aCallback(netId); return; @@ +324,5 @@ > + this._networks[netId].status = NETWORK_STATUS_AWAY; > + this._currentAlarms[netId] = Object.create(null); > + } > + > + aCallback(result); aCallback(null); Just because of too many |result|s. @@ +501,5 @@ > lastElement = { netId: netId, > queueIndex: this.updateQueueIndex(netId)}; > > if (lastElement.queueIndex == -1) { > elements.push({netId: lastElement.netId, callbacks: []}); nit: since you're here please add spaces around "{" and "}". @@ +505,5 @@ > elements.push({netId: lastElement.netId, callbacks: []}); > } > } > > + if (!lastElement) { Please add a comment for why you want to do early return here. I don't get this well. @@ +960,5 @@ > > _setAlarm: function _setAlarm(aAlarm, aCallback) { > let currentAlarm = this._currentAlarms[aAlarm.networkId]; > + if ((Object.getOwnPropertyNames(currentAlarm).length !== 0 && > + aAlarm.absoluteThreshold > currentAlarm.alarm.absoluteThreshold) || Please align "aAlarm" to "Object", instead of the "(". @@ +1012,5 @@ > aCallback(error, result); > return; > } > > + if (!result) { Could you please add some comments for this to clarify me?
Attachment #8368120 - Flags: review?(gene.lian) → review+
Attachment #8368121 - Flags: review?(gene.lian) → review+
triage: 1.3+ for new API bug. it could be worse to backout the new API so the better path forward is to fix bugs related to the new API
blocking-b2g: 1.3? → 1.3+
Whiteboard: ETA: 2/6
Attached patch Patch (obsolete) — Splinter Review
Fixes from comment 11
Attachment #8368120 - Attachment is obsolete: true
Attachment #8370612 - Flags: feedback?(gene.lian)
Attached patch Parch (obsolete) — Splinter Review
Sorry I forgot the qrefresh in the previous patch. This is the correct.
Attachment #8370612 - Attachment is obsolete: true
Attachment #8370612 - Flags: feedback?(gene.lian)
Attachment #8370614 - Flags: feedback?(gene.lian)
Comment on attachment 8370614 [details] [diff] [review] Parch Review of attachment 8370614 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/network/src/NetworkStatsService.jsm @@ +28,5 @@ > const TOPIC_INTERFACE_UNREGISTERED = "network-interface-unregistered"; > const NET_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI; > const NET_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE; > > +// Networks have different status that NetworkStats API needs to aware. s/aware/be aware of/ aware is adj. ;) @@ +29,5 @@ > const NET_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI; > const NET_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE; > > +// Networks have different status that NetworkStats API needs to aware. > +// Network present and ready, so NetworkManager provide whole info. s/present/is present/ s/provide/provides/ s/whole/the whole/ @@ +31,5 @@ > > +// Networks have different status that NetworkStats API needs to aware. > +// Network present and ready, so NetworkManager provide whole info. > +const NETWORK_STATUS_READY = 0; > +// Network present but hasn't established a connection yet (e.g. SIM that has not s/present/is present/ @@ +34,5 @@ > +const NETWORK_STATUS_READY = 0; > +// Network present but hasn't established a connection yet (e.g. SIM that has not > +// enabled 3G since boot). > +const NETWORK_STATUS_STANDBY = 1; > +// Network not present, but stored in database from previous connections. s/not/is not/ s/from/by the/ @@ +299,5 @@ > > + /* Function to ensure that one network is valid. The network is valid if its status is > + * NETWORK_STATUS_READY, NETWORK_STATUS_STANDBY or NETWORK_STATUS_AWAY. > + * > + * The result is null if the network is not valid or the netId if it is. * The result is null if the network or its netId is not valid. @@ +971,5 @@ > _setAlarm: function _setAlarm(aAlarm, aCallback) { > let currentAlarm = this._currentAlarms[aAlarm.networkId]; > + if ((Object.getOwnPropertyNames(currentAlarm).length !== 0 && > + aAlarm.absoluteThreshold > currentAlarm.alarm.absoluteThreshold) || > + this._networks[aAlarm.networkId].status != NETWORK_STATUS_READY) { Please align "this._networks..." to the "(Object...".
Attachment #8370614 - Flags: feedback?(gene.lian) → review+
Attached patch PatchSplinter Review
Changes from commemt 15
Attachment #8370614 - Attachment is obsolete: true
Attachment #8370660 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S1 (14feb)
Hi John, Could you please help us on uplifting this patch to v1.3 branch?. Many Thanks!!
Flags: needinfo?(jhford)
It's a Gecko patch, I'll get it later today when I'm doing other 1.3 uplifts.
Flags: needinfo?(jhford)
This needs some rebasing for v1.3.
Flags: needinfo?(acperez)
Whiteboard: ETA: 2/6
Attached patch Patch for 1.3 (obsolete) — Splinter Review
Attachment #8373957 - Flags: review+
Flags: needinfo?(acperez)
Hi Ryan, Patch for 1.3 ready, could you please help us with the uplift to v1.3 branch?. Many Thanks!
Flags: needinfo?(ryanvm)
Attached patch Patch for 1.3Splinter Review
Sorry, last patch was wrong.
Attachment #8373957 - Attachment is obsolete: true
Attachment #8373959 - Flags: review+
Ryan, tests patch is ok for both master and 1.3
Renoming for more triage discussion. If this gets a minus, we'll back out.
blocking-b2g: 1.3+ → 1.3?
Hi, The patch rebased for v1.3 corresponding to this bug was the one causing Bug 971696 in that branch so it is the one that needs to be backouted from v1.3 branch.
Depends on: 971696
(In reply to Noemí Freire (:noemi) from comment #28) > Hi, > > The patch rebased for v1.3 corresponding to this bug was the one causing Bug > 971696 in that branch so it is the one that needs to be backouted from v1.3 > branch. Okay. Flagging checkin-needed then to backout: https://bugzilla.mozilla.org/show_bug.cgi?id=964270#c26
Keywords: checkin-needed
Patch is needed for Tarako version
blocking-b2g: 1.3? → 1.3T?
traige: 1.3T+ to get this into tarako for usage app memory saving
blocking-b2g: 1.3T? → 1.3T+
Hi Ying Xu, heard that you will be doing uplifts to 1.3T branch. After you completed the uplift, can you please set status-b2g-v1.3T to fixed? please let us know if you have problems with it. thanks
Flags: needinfo?(ying.xu)
Attached patch Patch for 1.3tSplinter Review
Flags: needinfo?(ying.xu)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: