Bug 1113476: RIL patch - B2G RIL: support nsck/pck for SIM Lock types. r=edgar.

This commit is contained in:
Shawn Ku 2015-01-08 11:24:31 +08:00
parent 231e823738
commit 695e6adb63
3 changed files with 39 additions and 57 deletions

View File

@ -668,6 +668,8 @@ this.ICC_SEL_CODE_PH_SP_PIN = "PH-SP PIN";
this.ICC_SEL_CODE_PH_SP_PUK = "PH-SP PUK";
this.ICC_SEL_CODE_PH_CORP_PIN = "PH-CORP PIN";
this.ICC_SEL_CODE_PH_CORP_PUK = "PH-CORP PUK";
// TODO: Bug 1116072: identify the mapping between RIL_PERSOSUBSTATE_SIM_SIM @
// ril.h and TS 27.007, clause 8.65 for GECKO_CARDLOCK_PCK.
this.ICC_USIM_TYPE1_TAG = 0xa8;
this.ICC_USIM_TYPE2_TAG = 0xa9;
@ -2611,22 +2613,26 @@ this.GECKO_CARDLOCK_PIN2 = 1;
this.GECKO_CARDLOCK_PUK = 2;
this.GECKO_CARDLOCK_PUK2 = 3;
this.GECKO_CARDLOCK_NCK = 4;
this.GECKO_CARDLOCK_NCK1 = 5;
this.GECKO_CARDLOCK_NCK2 = 6;
this.GECKO_CARDLOCK_HNCK = 7;
this.GECKO_CARDLOCK_CCK = 8;
this.GECKO_CARDLOCK_SPCK = 9;
this.GECKO_CARDLOCK_RCCK = 10;
this.GECKO_CARDLOCK_RSPCK = 11;
this.GECKO_CARDLOCK_NCK_PUK = 12;
this.GECKO_CARDLOCK_NCK1_PUK = 13;
this.GECKO_CARDLOCK_NCK2_PUK = 14;
this.GECKO_CARDLOCK_HNCK_PUK = 15;
this.GECKO_CARDLOCK_CCK_PUK = 16;
this.GECKO_CARDLOCK_SPCK_PUK = 17;
this.GECKO_CARDLOCK_RCCK_PUK = 18;
this.GECKO_CARDLOCK_RSPCK_PUK = 19;
this.GECKO_CARDLOCK_FDN = 20;
this.GECKO_CARDLOCK_NSCK = 5;
this.GECKO_CARDLOCK_NCK1 = 6;
this.GECKO_CARDLOCK_NCK2 = 7;
this.GECKO_CARDLOCK_HNCK = 8;
this.GECKO_CARDLOCK_CCK = 9;
this.GECKO_CARDLOCK_SPCK = 10;
this.GECKO_CARDLOCK_PCK = 11;
this.GECKO_CARDLOCK_RCCK = 12;
this.GECKO_CARDLOCK_RSPCK = 13;
this.GECKO_CARDLOCK_NCK_PUK = 14;
this.GECKO_CARDLOCK_NSCK_PUK = 15;
this.GECKO_CARDLOCK_NCK1_PUK = 16;
this.GECKO_CARDLOCK_NCK2_PUK = 17;
this.GECKO_CARDLOCK_HNCK_PUK = 18;
this.GECKO_CARDLOCK_CCK_PUK = 19;
this.GECKO_CARDLOCK_SPCK_PUK = 20;
this.GECKO_CARDLOCK_PCK_PUK = 21;
this.GECKO_CARDLOCK_RCCK_PUK = 22;
this.GECKO_CARDLOCK_RSPCK_PUK = 23;
this.GECKO_CARDLOCK_FDN = 24;
this.GECKO_CARDLOCK_TO_FACILITY = {};
GECKO_CARDLOCK_TO_FACILITY[GECKO_CARDLOCK_PIN] = ICC_CB_FACILITY_SIM;
@ -2638,8 +2644,11 @@ GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PIN2] = ICC_SEL_CODE_SIM_PIN2;
GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PUK] = ICC_SEL_CODE_SIM_PUK;
GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_PUK2] = ICC_SEL_CODE_SIM_PUK2;
GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_NCK] = ICC_SEL_CODE_PH_NET_PIN;
GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_NSCK] = ICC_SEL_CODE_PH_NETSUB_PIN;
GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_CCK] = ICC_SEL_CODE_PH_CORP_PIN;
GECKO_CARDLOCK_TO_SEL_CODE[GECKO_CARDLOCK_SPCK] = ICC_SEL_CODE_PH_SP_PIN;
// TODO: Bug 1116072: identify the mapping between RIL_PERSOSUBSTATE_SIM_SIM @
// ril.h and TS 27.007, clause 8.65 for GECKO_CARDLOCK_PCK.
// See nsIIccProvider::CARD_CONTACT_TYPE_*
this.GECKO_CARDCONTACT_TYPE_ADN = 0;
@ -2682,24 +2691,6 @@ PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_CORPORATE_PUK] = GECKO_CARDSTATE_RUIM_COR
PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK] = GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_RUIM_PUK] = GECKO_CARDSTATE_RUIM_PUK_REQUIRED;
this.GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK = {};
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK] = CARD_PERSOSUBSTATE_SIM_NETWORK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK1] = CARD_PERSOSUBSTATE_RUIM_NETWORK1;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK2] = CARD_PERSOSUBSTATE_RUIM_NETWORK2;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_HNCK] = CARD_PERSOSUBSTATE_RUIM_HRPD;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_CCK] = CARD_PERSOSUBSTATE_SIM_CORPORATE;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_SPCK] = CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RCCK] = CARD_PERSOSUBSTATE_RUIM_CORPORATE;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RSPCK] = CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK_PUK] = CARD_PERSOSUBSTATE_SIM_NETWORK_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK1_PUK] = CARD_PERSOSUBSTATE_RUIM_NETWORK1_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK2_PUK] = CARD_PERSOSUBSTATE_RUIM_NETWORK2_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_HNCK_PUK] = CARD_PERSOSUBSTATE_RUIM_HRPD_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_CCK_PUK] = CARD_PERSOSUBSTATE_SIM_CORPORATE_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_SPCK_PUK] = CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RCCK_PUK] = CARD_PERSOSUBSTATE_RUIM_CORPORATE_PUK;
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RSPCK_PUK] = CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK;
// See nsIMobileConnection::NETWORK_SELECTION_MODE_*
this.GECKO_NETWORK_SELECTION_UNKNOWN = -1;
this.GECKO_NETWORK_SELECTION_AUTOMATIC = 0;

View File

@ -616,23 +616,25 @@ RilObject.prototype = {
this.enterICCPUK2(options);
break;
case GECKO_CARDLOCK_NCK:
case GECKO_CARDLOCK_NSCK:
case GECKO_CARDLOCK_NCK1:
case GECKO_CARDLOCK_NCK2:
case GECKO_CARDLOCK_HNCK:
case GECKO_CARDLOCK_CCK:
case GECKO_CARDLOCK_SPCK:
case GECKO_CARDLOCK_PCK:
case GECKO_CARDLOCK_RCCK:
case GECKO_CARDLOCK_RSPCK:
case GECKO_CARDLOCK_NCK_PUK:
case GECKO_CARDLOCK_NSCK_PUK:
case GECKO_CARDLOCK_NCK1_PUK:
case GECKO_CARDLOCK_NCK2_PUK:
case GECKO_CARDLOCK_HNCK_PUK:
case GECKO_CARDLOCK_CCK_PUK:
case GECKO_CARDLOCK_SPCK_PUK:
case GECKO_CARDLOCK_PCK_PUK:
case GECKO_CARDLOCK_RCCK_PUK: // Fall through.
case GECKO_CARDLOCK_RSPCK_PUK:
options.personlization =
GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
this.enterDepersonalization(options);
break;
default:
@ -690,7 +692,7 @@ RilObject.prototype = {
enterDepersonalization: function(options) {
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE, options);
Buf.writeInt32(options.personlization);
Buf.writeInt32(1);
Buf.writeString(options.password);
Buf.sendParcel();
},
@ -863,8 +865,11 @@ RilObject.prototype = {
case GECKO_CARDLOCK_PUK:
case GECKO_CARDLOCK_PUK2:
case GECKO_CARDLOCK_NCK:
case GECKO_CARDLOCK_NSCK:
case GECKO_CARDLOCK_CCK: // Fall through.
case GECKO_CARDLOCK_SPCK:
// TODO: Bug 1116072: identify the mapping between RIL_PERSOSUBSTATE_SIM_SIM
// @ ril.h and TS 27.007, clause 8.65 for GECKO_CARDLOCK_SPCK.
options.selCode = GECKO_CARDLOCK_TO_SEL_CODE[options.lockType];
break;
default:

View File

@ -270,7 +270,7 @@ add_test(function test_icc_unlock_card_lock_depersonalization() {
let ril = context.RIL;
let buf = context.Buf;
function do_test(aLock, aPassword) {
function do_test(aPassword) {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE);
@ -279,32 +279,18 @@ add_test(function test_icc_unlock_card_lock_depersonalization() {
this.readInt32();
// Data
do_check_eq(this.readInt32(), GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[aLock]);
do_check_eq(this.readString(), aPassword);
let parcel = this.readStringList();
do_check_eq(parcel.length, 1);
do_check_eq(parcel[0], aPassword);
};
ril.iccUnlockCardLock({
lockType: aLock,
lockType: GECKO_CARDLOCK_NCK,
password: aPassword
});
}
do_test(GECKO_CARDLOCK_NCK, "12345678");
do_test(GECKO_CARDLOCK_NCK1, "12345678");
do_test(GECKO_CARDLOCK_NCK2, "12345678");
do_test(GECKO_CARDLOCK_HNCK, "12345678");
do_test(GECKO_CARDLOCK_CCK, "12345678");
do_test(GECKO_CARDLOCK_SPCK, "12345678");
do_test(GECKO_CARDLOCK_RCCK, "12345678");
do_test(GECKO_CARDLOCK_RSPCK, "12345678");
do_test(GECKO_CARDLOCK_NCK_PUK, "12345678");
do_test(GECKO_CARDLOCK_NCK1_PUK, "12345678");
do_test(GECKO_CARDLOCK_NCK2_PUK, "12345678");
do_test(GECKO_CARDLOCK_HNCK_PUK, "12345678");
do_test(GECKO_CARDLOCK_CCK_PUK, "12345678");
do_test(GECKO_CARDLOCK_SPCK_PUK, "12345678");
do_test(GECKO_CARDLOCK_RCCK_PUK, "12345678");
do_test(GECKO_CARDLOCK_RSPCK_PUK, "12345678");
do_test("12345678");
run_next_test();
});