зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785072 - Part 2: RIL implementation. r=vicamo
This commit is contained in:
Родитель
f3dea01bd1
Коммит
79b5cdecd8
|
@ -106,6 +106,7 @@ MobileICCInfo.prototype = {
|
|||
|
||||
// nsIDOMMozMobileICCInfo
|
||||
|
||||
iccid: null,
|
||||
mcc: 0,
|
||||
mnc: 0
|
||||
};
|
||||
|
@ -231,8 +232,9 @@ RILContentHelper.prototype = {
|
|||
Ci.nsIRILContentHelper]}),
|
||||
|
||||
updateICCInfo: function updateICCInfo(srcInfo, destInfo) {
|
||||
destInfo.mcc = srcInfo.mcc;
|
||||
destInfo.mnc = srcInfo.mnc;
|
||||
for (let key in srcInfo) {
|
||||
destInfo[key] = srcInfo[key];
|
||||
}
|
||||
},
|
||||
|
||||
updateConnectionInfo: function updateConnectionInfo(srcInfo, destInfo) {
|
||||
|
|
|
@ -1080,7 +1080,12 @@ RadioInterfaceLayer.prototype = {
|
|||
handleICCInfoChange: function handleICCInfoChange(message) {
|
||||
let oldIcc = this.rilContext.icc;
|
||||
this.rilContext.icc = message;
|
||||
if (oldIcc && (oldIcc.mcc == message.mcc || oldIcc.mnc == message.mnc)) {
|
||||
|
||||
let iccInfoChanged = !oldIcc ||
|
||||
oldIcc.iccid != message.iccid ||
|
||||
oldIcc.mcc != message.mcc ||
|
||||
oldIcc.mnc != message.mnc;
|
||||
if (!iccInfoChanged) {
|
||||
return;
|
||||
}
|
||||
// RIL:IccInfoChanged corresponds to a DOM event that gets fired only
|
||||
|
|
|
@ -1059,6 +1059,7 @@ let RIL = {
|
|||
* Fetch ICC records.
|
||||
*/
|
||||
fetchICCRecords: function fetchICCRecords() {
|
||||
this.getICCID();
|
||||
this.getIMSI();
|
||||
this.getMSISDN();
|
||||
this.getAD();
|
||||
|
@ -1091,6 +1092,35 @@ let RIL = {
|
|||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
/**
|
||||
* Read the ICCD from the ICC card.
|
||||
*/
|
||||
getICCID: function getICCID() {
|
||||
function callback() {
|
||||
let length = Buf.readUint32();
|
||||
this.iccInfo.iccid = GsmPDUHelper.readSwappedNibbleBcdString(length / 2);
|
||||
Buf.readStringDelimiter(length);
|
||||
|
||||
if (DEBUG) debug("ICCID: " + this.iccInfo.iccid);
|
||||
if (this.iccInfo.iccid) {
|
||||
this._handleICCInfoChange();
|
||||
}
|
||||
}
|
||||
|
||||
this.iccIO({
|
||||
command: ICC_COMMAND_GET_RESPONSE,
|
||||
fileId: ICC_EF_ICCID,
|
||||
pathId: this._getPathIdForICCRecord(ICC_EF_ICCID),
|
||||
p1: 0, // For GET_RESPONSE, p1 = 0
|
||||
p2: 0, // For GET_RESPONSE, p2 = 0
|
||||
p3: GET_RESPONSE_EF_SIZE_BYTES,
|
||||
data: null,
|
||||
pin2: null,
|
||||
type: EF_TYPE_TRANSPARENT,
|
||||
callback: callback,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Read the MSISDN from the ICC.
|
||||
*/
|
||||
|
@ -2329,10 +2359,20 @@ let RIL = {
|
|||
return null;
|
||||
}
|
||||
|
||||
// Here we handle only file ids that are common to RUIM, SIM, USIM
|
||||
// and other types of ICC cards.
|
||||
switch (fileId) {
|
||||
case ICC_EF_ICCID:
|
||||
return EF_PATH_MF_SIM;
|
||||
case ICC_EF_ADN:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_TELECOM;
|
||||
case ICC_EF_PBR:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK;
|
||||
}
|
||||
|
||||
switch (app.app_type) {
|
||||
case CARD_APPTYPE_SIM:
|
||||
switch (fileId) {
|
||||
case ICC_EF_ADN:
|
||||
case ICC_EF_FDN:
|
||||
case ICC_EF_MSISDN:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_TELECOM;
|
||||
|
@ -2341,21 +2381,16 @@ let RIL = {
|
|||
case ICC_EF_MBDN:
|
||||
case ICC_EF_UST:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_GSM;
|
||||
case ICC_EF_PBR:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK;
|
||||
}
|
||||
case CARD_APPTYPE_USIM:
|
||||
switch (fileId) {
|
||||
case ICC_EF_AD:
|
||||
case ICC_EF_FDN:
|
||||
case ICC_EF_MBDN:
|
||||
case ICC_EF_UST:
|
||||
case ICC_EF_MSISDN:
|
||||
return EF_PATH_MF_SIM + EF_PATH_ADF_USIM;
|
||||
case ICC_EF_ADN:
|
||||
case ICC_EF_FDN:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_TELECOM;
|
||||
case ICC_EF_PBR:
|
||||
return EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK;
|
||||
|
||||
default:
|
||||
// The file ids in USIM phone book entries are decided by the
|
||||
// card manufacturer. So if we don't match any of the cases
|
||||
|
|
Загрузка…
Ссылка в новой задаче