Bug 849725: remove RIL.iccInfoPrivate.SPN.spn. r=allstars.chh

This commit is contained in:
Patrick Wang 2013-05-14 11:32:16 +08:00
parent a9a19a363a
commit 31bbc66fb6
3 changed files with 18 additions and 36 deletions

View File

@ -10170,10 +10170,7 @@ let ICCRecordHelper = {
", spnDisplayCondition = " + spnDisplayCondition);
}
RIL.iccInfoPrivate.SPN = {
spn : spn,
spnDisplayCondition : spnDisplayCondition,
};
RIL.iccInfoPrivate.spnDisplayCondition = spnDisplayCondition;
RIL.iccInfo.spn = spn;
ICCUtilsHelper.updateDisplayCondition();
ICCUtilsHelper.handleICCInfoChange();
@ -11138,11 +11135,11 @@ let ICCUtilsHelper = {
// isDisplaySpnRequired = false
let iccInfo = RIL.iccInfo;
let iccInfoPriv = RIL.iccInfoPrivate;
let iccSpn = iccInfoPriv.SPN;
let displayCondition = iccInfoPriv.spnDisplayCondition;
let origIsDisplayNetworkNameRequired = iccInfo.isDisplayNetworkNameRequired;
let origIsDisplaySPNRequired = iccInfo.isDisplaySpnRequired;
if (!iccSpn) {
if (displayCondition === undefined) {
iccInfo.isDisplayNetworkNameRequired = true;
iccInfo.isDisplaySpnRequired = false;
} else if (RIL._isCdma) {
@ -11153,9 +11150,9 @@ let ICCUtilsHelper = {
iccInfo.isDisplayNetworkNameRequired = false;
// If display condition is false, we don't even need to check network id
// If display condition is 0x0, we don't even need to check network id
// or system id.
if (iccSpn.spnDisplayCondition == false) {
if (displayCondition == 0x0) {
iccInfo.isDisplaySpnRequired = false;
} else {
// CDMA SPN Display condition dosen't specify whenever network name is
@ -11227,11 +11224,7 @@ let ICCUtilsHelper = {
// EF_SPDI contains a list of PLMNs in which the Service Provider Name
// shall be displayed.
iccInfo.isDisplaySpnRequired = true;
if (iccSpn.spnDisplayCondition & 0x01) {
iccInfo.isDisplayNetworkNameRequired = true;
} else {
iccInfo.isDisplayNetworkNameRequired = false;
}
iccInfo.isDisplayNetworkNameRequired = (displayCondition & 0x01) != 0;
} else {
// The second bit of display condition tells us if we should display
// registered PLMN.
@ -11240,13 +11233,8 @@ let ICCUtilsHelper = {
// We didn't found the requirement of displaying network name if
// current PLMN isn't HPLMN nor one of PLMN in SPDI. So we keep
// isDisplayNetworkNameRequired false.
if (iccSpn.spnDisplayCondition & 0x02) {
iccInfo.isDisplayNetworkNameRequired = false;
iccInfo.isDisplaySpnRequired = false;
} else {
iccInfo.isDisplayNetworkNameRequired = false;
iccInfo.isDisplaySpnRequired = true;
}
iccInfo.isDisplaySpnRequired = (displayCondition & 0x02) == 0;
}
}
@ -12069,9 +12057,7 @@ let RuimRecordHelper = {
debug("CDMA SPN: " + RIL.iccInfo.spn +
", Display condition: " + displayCondition);
}
RIL.iccInfoPrivate.SPN = {
spnDisplayCondition: displayCondition
};
RIL.iccInfoPrivate.spnDisplayCondition = displayCondition;
Buf.seekIncoming((octetLen - readLen) * PDU_HEX_OCTET_SIZE);
Buf.readStringDelimiter(strLen);
}

View File

@ -975,9 +975,7 @@ add_test(function test_spn_display_condition() {
expectedIsDisplayNetworkNameRequired,
expectedIsDisplaySPNRequired,
callback) {
RIL.iccInfoPrivate.SPN = {
spnDisplayCondition: iccDisplayCondition
};
RIL.iccInfoPrivate.spnDisplayCondition = iccDisplayCondition;
RIL.iccInfo = {
mcc: iccMcc,
mnc: iccMnc

View File

@ -143,7 +143,7 @@ add_test(function test_read_cdmaspn() {
worker.RuimRecordHelper.readSPN();
do_check_eq(worker.RIL.iccInfo.spn, expectedSpn);
do_check_eq(worker.RIL.iccInfoPrivate.SPN.spnDisplayCondition,
do_check_eq(worker.RIL.iccInfoPrivate.spnDisplayCondition,
expectedDisplayCondition);
}
@ -156,7 +156,7 @@ add_test(function test_read_cdmaspn() {
String.fromCharCode(0x592a) +
String.fromCharCode(0x96fb) +
String.fromCharCode(0x4fe1),
true);
0x1);
// Test when there's no tailing 0xff in spn string.
testReadSpn([0x01, 0x04, 0x06, 0x4e, 0x9e, 0x59, 0x2a, 0x96,
@ -165,7 +165,7 @@ add_test(function test_read_cdmaspn() {
String.fromCharCode(0x592a) +
String.fromCharCode(0x96fb) +
String.fromCharCode(0x4fe1),
true);
0x1);
run_next_test();
});
@ -199,9 +199,7 @@ add_test(function test_cdma_spn_display_condition() {
currentSystemId, currentNetworkId,
expectUpdateDisplayCondition,
expectIsDisplaySPNRequired) {
RIL.iccInfoPrivate.SPN = {
spnDisplayCondition: ruimDisplayCondition
};
RIL.iccInfoPrivate.spnDisplayCondition = ruimDisplayCondition;
RIL.cdmaHome = {
systemId: homeSystemIds,
networkId: homeNetworkIds
@ -217,16 +215,16 @@ add_test(function test_cdma_spn_display_condition() {
};
// SPN is not required when ruimDisplayCondition is false.
testDisplayCondition(false, [123], [345], 123, 345, true, false);
testDisplayCondition(0x0, [123], [345], 123, 345, true, false);
// System id and network id are all match.
testDisplayCondition(true, [123], [345], 123, 345, true, true);
testDisplayCondition(0x1, [123], [345], 123, 345, true, true);
// Network is 65535, we should only need to match system id.
testDisplayCondition(true, [123], [65535], 123, 345, false, true);
testDisplayCondition(0x1, [123], [65535], 123, 345, false, true);
// Not match.
testDisplayCondition(true, [123], [456], 123, 345, true, false);
testDisplayCondition(0x1, [123], [456], 123, 345, true, false);
run_next_test();
});