diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index 8ae83ecd403..bb7a390d1a9 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -1025,6 +1025,8 @@ RILContentHelper.prototype = { iccContact.email = contact.email[0].value; } + iccContact.id = contact.id; + cpmm.sendAsyncMessage("RIL:UpdateIccContact", { clientId: 0, data: { @@ -1683,6 +1685,7 @@ RILContentHelper.prototype = { } contact.init(prop); + contact.id = message.iccid + c.recordId; return contact; }); diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index c117f03b548..1b27bd54a5e 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -876,6 +876,7 @@ let RIL = { function onsuccess(contacts) { // Reuse 'options' to get 'requestId' and 'contactType'. options.contacts = contacts; + options.iccid = RIL.iccInfo.iccid; RIL.sendChromeMessage(options); }.bind(this), function onerror(errorMsg) { @@ -908,6 +909,16 @@ let RIL = { return; } + let contact = options.contact; + let iccid = RIL.iccInfo.iccid; + if (contact.id.startsWith(iccid)) { + contact.recordId = contact.id.substring(iccid.length); + } + + if (DEBUG) { + debug("Update ICC Contact " + JSON.stringify(contact)); + } + // If contact has 'recordId' property, updates corresponding record. // If not, inserts the contact into a free record. if (options.contact.recordId) {