Closed Bug 766866 Opened 13 years ago Closed 13 years ago

B2G RIL: DataCallInfo.apn is null in RILv6

Categories

(Core :: DOM: Device Interfaces, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: kanru, Assigned: kanru)

References

Details

Attachments

(1 file, 2 obsolete files)

No description provided.
Also save other parameters in the options object. There is a followup to simplify the data call info object.
Assignee: nobody → kchen
Attachment #635202 - Flags: review?(philipp)
Comment on attachment 635202 [details] [diff] [review] Save data call id to APN mapping. Review of attachment 635202 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/system/gonk/ril_worker.js @@ +656,5 @@ > /** > + * Map data call id to APN. This information is lost in > + * REQUEST_DATA_CALL_LIST response. > + */ > + apnMap: {}, I'm not sure you mean "lost" here. @@ +3273,5 @@ > RIL[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null; > > +RIL.readDataCall_v5 = function readDataCall_v5(options) { > + if (!options) { > + options = {}; Nit: indent by 2 spaces @@ +3311,5 @@ > + if (!options.apn) { > + options.apn = this.apnMap[options.cid]; > + } else { > + this.apnMap[options.cid] = options.apn; > + } So why is `this.apnMap` needed? Either `options` or `this.currentDataCalls[options.cid]` will already contain the right APN, no? If not, let's fix `RIL._processDataCallList()` to keep the right information in `this.currentDataCalls` instead of creating yet another mapping. (Also, `this.apnMap` is never cleaned up, so it'll easily contain stale information.) The rest of the patch looks very good, though! Thanks!
Attachment #635202 - Flags: review?(philipp) → feedback-
(In reply to Philipp von Weitershausen [:philikon] from comment #2) > Comment on attachment 635202 [details] [diff] [review] > Save data call id to APN mapping. > > Review of attachment 635202 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/system/gonk/ril_worker.js > @@ +656,5 @@ > > /** > > + * Map data call id to APN. This information is lost in > > + * REQUEST_DATA_CALL_LIST response. > > + */ > > + apnMap: {}, > > I'm not sure you mean "lost" here. Ah.. I mean lost because in v5 there was a APN field in the response. Now this information is only available from the SetupDataCall parameter. > > @@ +3273,5 @@ > > RIL[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null; > > > > +RIL.readDataCall_v5 = function readDataCall_v5(options) { > > + if (!options) { > > + options = {}; > > Nit: indent by 2 spaces > > @@ +3311,5 @@ > > + if (!options.apn) { > > + options.apn = this.apnMap[options.cid]; > > + } else { > > + this.apnMap[options.cid] = options.apn; > > + } > > So why is `this.apnMap` needed? Either `options` or > `this.currentDataCalls[options.cid]` will already contain the right APN, no? > If not, let's fix `RIL._processDataCallList()` to keep the right information > in `this.currentDataCalls` instead of creating yet another mapping. No. If the options is passed in by setupDataCall() then it will contain the APN field. But if it is passed in by REQUEST_DATA_CALL_LIST (someone called getDataCallList()) then it wont. > > (Also, `this.apnMap` is never cleaned up, so it'll easily contain stale > information.) Right!
(In reply to Kan-Ru Chen [:kanru] from comment #3) > > > /** > > > + * Map data call id to APN. This information is lost in > > > + * REQUEST_DATA_CALL_LIST response. > > > + */ > > > + apnMap: {}, > > > > I'm not sure you mean "lost" here. > > Ah.. I mean lost because in v5 there was a APN field in the response. Now > this information is only available from the SetupDataCall parameter. I see. Historical notes are not very useful as source code comments because newcomers don't necessarily understand the context. > > So why is `this.apnMap` needed? Either `options` or > > `this.currentDataCalls[options.cid]` will already contain the right APN, no? > > If not, let's fix `RIL._processDataCallList()` to keep the right information > > in `this.currentDataCalls` instead of creating yet another mapping. > > No. If the options is passed in by setupDataCall() then it will contain the > APN field. But if it is passed in by REQUEST_DATA_CALL_LIST (someone called > getDataCallList()) then it wont. Ok, but at some point `setupDataCall()` was called to create the data call in the first place. So `this.currentDataCalls` should already have an entry for it that `_processDataCallList()` can simply update. The only scenario that I see where that's not true is if Gecko crashed and has to re-read the state via `getDataCallList()`. But then I don't see how your `apnMap` would help us, either.
(In reply to Philipp von Weitershausen [:philikon] from comment #4) > > > So why is `this.apnMap` needed? Either `options` or > > > `this.currentDataCalls[options.cid]` will already contain the right APN, no? > > > If not, let's fix `RIL._processDataCallList()` to keep the right information > > > in `this.currentDataCalls` instead of creating yet another mapping. > > > > No. If the options is passed in by setupDataCall() then it will contain the > > APN field. But if it is passed in by REQUEST_DATA_CALL_LIST (someone called > > getDataCallList()) then it wont. > > Ok, but at some point `setupDataCall()` was called to create the data call > in the first place. So `this.currentDataCalls` should already have an entry > for it that `_processDataCallList()` can simply update. > > The only scenario that I see where that's not true is if Gecko crashed and > has to re-read the state via `getDataCallList()`. But then I don't see how > your `apnMap` would help us, either. Every time you call `getDataCallList()`, a set of new datacalls without the original parameters is passed to `_processDataCallList()`. But I see, we can copy the information to them in `_processDataCallList()`
(In reply to Kan-Ru Chen [:kanru] from comment #5) > Every time you call `getDataCallList()`, a set of new datacalls without the > original parameters is passed to `_processDataCallList()`. Yes, but `_processDataCallList()` copies information over rather than replacing the data call objection: https://mxr.mozilla.org/mozilla-central/source/dom/system/gonk/ril_worker.js#2296
(In reply to Philipp von Weitershausen [:philikon] from comment #6) > (In reply to Kan-Ru Chen [:kanru] from comment #5) > > Every time you call `getDataCallList()`, a set of new datacalls without the > > original parameters is passed to `_processDataCallList()`. > > Yes, but `_processDataCallList()` copies information over rather than > replacing the data call objection: > https://mxr.mozilla.org/mozilla-central/source/dom/system/gonk/ril_worker. > js#2296 Great! I didn't notice that `datacalls` array is updated in place.
Removed the apnMap.
Attachment #635202 - Attachment is obsolete: true
Attachment #635580 - Flags: review?(philipp)
Attachment #635580 - Flags: review?(philipp) → review+
patch bitrotted
Attachment #635580 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 13 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: