Proxy and port values for automatic APN are not set for Movistar Spain SIMs

RESOLVED FIXED

Status

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: willyaranda, Assigned: jaoo)

Tracking

unspecified
x86
Mac OS X

Firefox Tracking Flags

(blocking-b2g:leo+, b2g18 fixed, b2g-v1.1hd fixed)

Details

Attachments

(1 attachment)

STR:

1) Insert a Movistar (214-07) SIM card.
2) Start the FTU and check that you want data to be active
3) Finish the FTU
4) Go to Settings > Network and Data > Data configuration

Actual result: 
Proxy and port are not set

Expected:
Proxy and port are set.
Problem is on:
data_mobile.js: 55

var apns = apnList[mcc] ? (apnList[mcc][mnc] || []) : [];

That selects the object that it's on the MCC-MNC matrix (214-07, Movistar Spain), which is the [
    {"carrier":"Movistar MMS","apn":"telefonica.es","user":"telefonica","password":"telefonica","mmsc":"http://mms.movistar.com","mmsproxy":"10.138.255.5","mmsport":"8080","type":["mms"]},
    {"voicemail":"123","enableStrict7BitEncodingForSms":true,"operatorSizeLimitation":512000,"type":["operatorvariant"]},
    {"carrier":"Movistar","apn":"telefonica.es","user":"telefonica","password":"telefonica","proxy":"10.138.255.133","port":"8080","type":["default","supl"]}
  ],

var selectedAPN = apns[0];

And this selects the first element of the array, which corresponds to the MMS data, not the 3G data.

Settings uses a different code, checking for a filter. I think the easy way is to steal the code from there:

 function queryAPN(callback, usage) {
    if (!callback)
      return;

    var usageFilter = usage;
    if (!usage || usage == 'data') {
      usageFilter = 'default';
    }

    // filter APNs by usage
    var filter = function(apnList) {
      var found = [];
      for (var i = 0; i < apnList.length; i++) {
        if (apnList[i].type.indexOf(usageFilter) != -1) {
          found.push(apnList[i]);
        }
      }
      return found;
    };

    // early way out if the query has already been performed
    if (gCompatibleAPN) {
      callback(filter(gCompatibleAPN), usage);
      return;
    }

    // load and query APN database, then trigger callback on results
    loadJSON(APN_FILE, function loadAPN(apn) {
      var mcc = mccMncCodes.mcc;
      var mnc = mccMncCodes.mnc;
      // get a list of matching APNs
      gCompatibleAPN = apn[mcc] ? (apn[mcc][mnc] || []) : [];
      callback(filter(gCompatibleAPN), usage);
    });
  }
Flags: needinfo?(fernando.campo)
(Assignee)

Comment 2

5 years ago
I'll take this bug. Clearing ni? at Fernando.
Assignee: nobody → josea.olivera
Flags: needinfo?(fernando.campo)
(Assignee)

Comment 3

5 years ago
(In reply to Guillermo López (:willyaranda) from comment #1)
> Problem is on:
> data_mobile.js: 55
> 
> var apns = apnList[mcc] ? (apnList[mcc][mnc] || []) : [];
> 
> That selects the object that it's on the MCC-MNC matrix (214-07, Movistar
> Spain), which is the [
>     {"carrier":"Movistar
> MMS","apn":"telefonica.es","user":"telefonica","password":"telefonica",
> "mmsc":"http://mms.movistar.com","mmsproxy":"10.138.255.5","mmsport":"8080",
> "type":["mms"]},
>    
> {"voicemail":"123","enableStrict7BitEncodingForSms":true,
> "operatorSizeLimitation":512000,"type":["operatorvariant"]},
>    
> {"carrier":"Movistar","apn":"telefonica.es","user":"telefonica","password":
> "telefonica","proxy":"10.138.255.133","port":"8080","type":["default",
> "supl"]}
>   ],
> 
> var selectedAPN = apns[0];
> 
> And this selects the first element of the array, which corresponds to the
> MMS data, not the 3G data.

This issue is already solved in master (see [1]), I was confused until I realized you found this on v1-train branch.

[1] https://github.com/mozilla-b2g/gaia/blob/master/apps/communications/ftu/js/data_mobile.js#L66_L72
(Assignee)

Comment 4

5 years ago
I tried to reproduced the issue reported in comment #0 and the issue is not happening on a custom v1-train build I tested with.
(Assignee)

Updated

5 years ago
Summary: Proxy and port values for automatic APN are not set → Proxy and port values for automatic APN are not set for Movistar Spain SIMs
(Assignee)

Comment 5

5 years ago
I'm not able to reproduce the issue but IMHO we should ensure the APN settings for data calls corresponds to the default type one. This issue was fixed in Gaia master branch by bug 842252 however we cannot uplift that bug because is about changing the data call setting architecture in Gaia to the new one and v1-train branch still has the old one. I guess the best we can do is to upload a fix for v1-train branch. Let's ping the FTU app owner to see how to handle this issue. Francisco, are you ok with uploading a patch for fixing this bug in v1-train branch? Thanks.
Flags: needinfo?(francisco.jordano)
(Assignee)

Comment 6

5 years ago
Created attachment 801812 [details] [diff] [review]
910579-v1-train.patch

The fix I commented about in #c5 comment.
Hi,

as Jose Antonio comments, doesn't make any sense to uplift bug 842252, cause adds extra functionality that won't work in v1-train.

So, for me, it does make sense just to merge this patch in v1-train.

Thanks a lot for the work Jose Antonio!
Flags: needinfo?(francisco.jordano)
Thanks jaoo, Francisco and Guillermo for the investigation. 
Nominating to leo because it is a certification blocker for one of the launch countries.
Please fix it only in v1-train as you suggested.
blocking-b2g: --- → leo?

Comment 9

5 years ago
Nominate it to leo+ because it will block the upcoming certification for Spain.
blocking-b2g: leo? → leo+
Comment on attachment 801812 [details] [diff] [review]
910579-v1-train.patch

Forgot to request review for this bug. Francisco, would you review this patch please? Thanks.
Attachment #801812 - Flags: review?(francisco.jordano)
Comment on attachment 801812 [details] [diff] [review]
910579-v1-train.patch

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

Thanks nice work, just the small and tiny comment :)

::: apps/communications/ftu/js/data_mobile.js
@@ +54,5 @@
>          var apnList = xhr.response;
>          var apns = apnList[mcc] ? (apnList[mcc][mnc] || []) : [];
> +        var selectedAPN = {};
> +        for (var i = 0; i < apns.length; i++) {
> +          if (apns[i] && apns[i].type.indexOf('default') != -1) {

Can we be a bit paranoid? Checking for example if |type| exist, just in case we have a malformed config file, something like:

if (apns[i] && apns[i].type && apns[i].type.indexOf('default') != -1) {
Attachment #801812 - Flags: review?(francisco.jordano) → review+
https://github.com/mozilla-b2g/gaia/commit/1c38ec5447637e8ad52b85284832376a9b84700a
Status: NEW → RESOLVED
Last Resolved: 5 years ago
status-b2g-v1.1hd: --- → affected
Resolution: --- → FIXED
status-b2g18: --- → fixed
v1.1.0hd: 1c38ec5447637e8ad52b85284832376a9b84700a
v1.1.0hd: 32e8a1b2683d9b93be8db1cb59e4409af007a5f7
status-b2g-v1.1hd: affected → fixed
You need to log in before you can comment on or make changes to this bug.