Closed Bug 819560 Opened 8 years ago Closed 8 years ago

RIL: remember the last mcc code

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20
blocking-basecamp +
Tracking Status
firefox19 --- fixed
firefox20 --- fixed
b2g18 --- fixed

People

(Reporter: gwagner, Assigned: gwagner)

References

Details

Attachments

(1 file, 3 obsolete files)

The current version falls back to Brasil as the default country if we don't have a SIM card or the RIL is not initialized. We should remember the last mcc code in the library.
Assignee: nobody → anygregor
Attached patch patch (obsolete) — Splinter Review
Attachment #689942 - Flags: review?(bent.mozilla)
blocking-basecamp: --- → ?
Attached patch patch (obsolete) — Splinter Review
Attachment #689942 - Attachment is obsolete: true
Attachment #689942 - Flags: review?(bent.mozilla)
Attachment #689945 - Flags: review?(bent.mozilla)
Comment on attachment 689945 [details] [diff] [review]
patch

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

::: dom/phonenumberutils/PhoneNumberUtils.jsm
@@ +40,5 @@
>        mcc = ril.voiceConnectionInfo.network.mcc;
>  
>      // Get SIM mcc or set it to mcc for Brasil
>      if (!mcc)
> +      mcc = ril.iccInfo.mcc || Services.prefs.getIntPref("ril.lastmcc");

getIntPref will throw if the pref doesn't exist.

@@ +43,5 @@
>      if (!mcc)
> +      mcc = ril.iccInfo.mcc || Services.prefs.getIntPref("ril.lastmcc");
> +
> +    if (!mcc) {
> +      dump("WARNING: Using the default country code for normalizing telephone numbers!\n");

Let's also add another warning if we use the pref version.
Attached patch patch (obsolete) — Splinter Review
Attachment #689945 - Attachment is obsolete: true
Attachment #689945 - Flags: review?(bent.mozilla)
blocking-basecamp: ? → +
I think we should move this to RIL and maybe add it to nsIDOMMozMobileICCInfo.
something like
ril.voiceConnectionInfo.network.previousMcc
Attached patch patchSplinter Review
Attachment #689960 - Attachment is obsolete: true
Attachment #690586 - Flags: review?(jonas)
Depends on: 820135
Summary: PhonenumberJS: remember the last mcc code → RIL: remember the last mcc code
Comment on attachment 690586 [details] [diff] [review]
patch

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

r=me with those things fixed.

::: dom/network/interfaces/nsIDOMMobileConnection.idl
@@ +431,5 @@
>  
>    /**
> +   * Mobile Country Code (MCC) of previous subscriber's home network.
> +   */
> +  readonly attribute unsigned short previousMcc;

I'd call this lastKnownMcc or something. Right now it sounds like it's the previous value that the mcc has had, but in reality it can often be the same value as the mcc.

::: dom/system/gonk/RILContentHelper.js
@@ +360,5 @@
>    updateICCInfo: function updateICCInfo(srcInfo, destInfo) {
>      for (let key in srcInfo) {
>        destInfo[key] = srcInfo[key];
> +      if (key === 'mcc') {
> +        Services.prefs.setIntPref("ril.previousMcc", srcInfo[key]);

Shouldn't you also set the previousMcc property here?
Attachment #690586 - Flags: review?(jonas) → review+
https://hg.mozilla.org/mozilla-central/rev/22c6700c8794
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.