Telephony: Fix get_imsi and icc_io

Make get_imsi and icc_io requests to follow ril v6 interface

Change-Id: Ifdbdcfd943f985c759359e59ced82b67195f4163
This commit is contained in:
Alex Yakavenka
2011-12-09 11:41:30 -08:00
committed by Wink Saville
parent 064d2d6569
commit 2149014ed3
10 changed files with 100 additions and 31 deletions

View File

@@ -754,6 +754,15 @@ public interface CommandsInterface {
*/
void getIMSI(Message result);
/**
* returned message
* retMsg.obj = AsyncResult ar
* ar.exception carries exception on failure
* ar.userObject contains the orignal value of result.obj
* ar.result is String containing IMSI on success
*/
void getIMSIForApp(String aid, Message result);
/**
* returned message
* retMsg.obj = AsyncResult ar
@@ -1049,6 +1058,14 @@ public interface CommandsInterface {
void iccIO (int command, int fileid, String path, int p1, int p2, int p3,
String data, String pin2, Message response);
/**
* parameters equivalent to 27.007 AT+CRSM command
* response.obj will be an AsyncResult
* response.obj.userObj will be a IccIoResult on success
*/
void iccIOForApp (int command, int fileid, String path, int p1, int p2, int p3,
String data, String pin2, String aid, Message response);
/**
* (AsyncResult)response.obj).result is an int[] with element [0] set to
* 1 for "CLIP is provisioned", and 0 for "CLIP is not provisioned".

View File

@@ -24,7 +24,7 @@ import java.util.ArrayList;
* {@hide}
*/
public class IccCardStatus {
static final int CARD_MAX_APPS = 8;
public static final int CARD_MAX_APPS = 8;
public enum CardState {
CARDSTATE_ABSENT,

View File

@@ -145,8 +145,9 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
= obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, recordNum, onLoaded));
phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null,
phone.getIccCard().getAid(), response);
}
/**
@@ -164,9 +165,10 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
onLoaded));
// TODO(): Verify when path changes are done.
phone.mCM.iccIO(COMMAND_GET_RESPONSE, IccConstants.EF_IMG, "img",
phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, IccConstants.EF_IMG, "img",
recordNum, READ_RECORD_MODE_ABSOLUTE,
GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null, response);
GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null,
phone.getIccCard().getAid(), response);
}
/**
@@ -182,8 +184,9 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
Message response
= obtainMessage(EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, onLoaded));
phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, phone.getIccCard().getAid(),
response);
}
/**
@@ -199,8 +202,9 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
Message response = obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid,onLoaded));
phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null,
phone.getIccCard().getAid(), response);
}
/**
@@ -217,8 +221,9 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
Message response = obtainMessage(EVENT_GET_BINARY_SIZE_DONE,
fileid, 0, onLoaded);
phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null,
phone.getIccCard().getAid(), response);
}
/**
@@ -236,8 +241,8 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
Message response = obtainMessage(EVENT_READ_ICON_DONE, fileid, 0,
onLoaded);
phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, "img", highOffset, lowOffset,
length, null, null, response);
phone.mCM.iccIOForApp(COMMAND_READ_BINARY, fileid, "img", highOffset, lowOffset,
length, null, null, phone.getIccCard().getAid(), response);
}
/**
@@ -251,9 +256,10 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
*/
public void updateEFLinearFixed(int fileid, int recordNum, byte[] data,
String pin2, Message onComplete) {
phone.mCM.iccIO(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid),
phone.mCM.iccIOForApp(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid),
recordNum, READ_RECORD_MODE_ABSOLUTE, data.length,
IccUtils.bytesToHexString(data), pin2, onComplete);
IccUtils.bytesToHexString(data), pin2,
phone.getIccCard().getAid(), onComplete);
}
/**
@@ -262,9 +268,10 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
* @param data must be exactly as long as the EF
*/
public void updateEFTransparent(int fileid, byte[] data, Message onComplete) {
phone.mCM.iccIO(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid),
phone.mCM.iccIOForApp(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid),
0, 0, data.length,
IccUtils.bytesToHexString(data), null, onComplete);
IccUtils.bytesToHexString(data), null,
phone.getIccCard().getAid(), onComplete);
}
@@ -395,10 +402,11 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
lc.results = new ArrayList<byte[]>(lc.countRecords);
}
phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
phone.mCM.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
lc.recordNum,
READ_RECORD_MODE_ABSOLUTE,
lc.recordSize, null, null,
phone.getIccCard().getAid(),
obtainMessage(EVENT_READ_RECORD_DONE, lc));
break;
case EVENT_GET_BINARY_SIZE_DONE:
@@ -433,8 +441,9 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
+ (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
phone.mCM.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
0, 0, size, null, null,
phone.getIccCard().getAid(),
obtainMessage(EVENT_READ_BINARY_DONE,
fileid, 0, response));
break;
@@ -468,10 +477,11 @@ public abstract class IccFileHandler extends Handler implements IccConstants {
if (lc.recordNum > lc.countRecords) {
sendResult(response, lc.results, null);
} else {
phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
phone.mCM.iccIOForApp(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
lc.recordNum,
READ_RECORD_MODE_ABSOLUTE,
lc.recordSize, null, null,
phone.getIccCard().getAid(),
obtainMessage(EVENT_READ_RECORD_DONE, lc));
}
}

View File

@@ -880,9 +880,19 @@ public final class RIL extends BaseCommands implements CommandsInterface {
public void
getIMSI(Message result) {
getIMSIForApp(null, result);
}
public void
getIMSIForApp(String aid, Message result) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMSI, result);
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
rr.mp.writeInt(1);
rr.mp.writeString(aid);
if (RILJ_LOGD) riljLog(rr.serialString() +
"> getIMSI: " + requestToString(rr.mRequest)
+ " aid: " + aid);
send(rr);
}
@@ -1435,6 +1445,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
public void
iccIO (int command, int fileid, String path, int p1, int p2, int p3,
String data, String pin2, Message result) {
iccIOForApp(command, fileid, path, p1, p2, p3, data, pin2, null, result);
}
public void
iccIOForApp (int command, int fileid, String path, int p1, int p2, int p3,
String data, String pin2, String aid, Message result) {
//Note: This RIL request has not been renamed to ICC,
// but this request is also valid for SIM and RUIM
RILRequest rr
@@ -1448,12 +1463,15 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.mp.writeInt(p3);
rr.mp.writeString(data);
rr.mp.writeString(pin2);
rr.mp.writeString(aid);
if (RILJ_LOGD) riljLog(rr.serialString() + "> iccIO: " + requestToString(rr.mRequest)
if (RILJ_LOGD) riljLog(rr.serialString() + "> iccIO: "
+ requestToString(rr.mRequest)
+ " 0x" + Integer.toHexString(command)
+ " 0x" + Integer.toHexString(fileid) + " "
+ " path: " + path + ","
+ p1 + "," + p2 + "," + p3);
+ p1 + "," + p2 + "," + p3
+ " aid: " + aid);
send(rr);
}

View File

@@ -55,8 +55,8 @@ public final class CdmaLteUiccFileHandler extends IccFileHandler {
if (fileid == EF_CSIM_EPRL) {
// Entire PRL could be huge. We are only interested in
// the first 4 bytes of the record.
phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
0, 0, 4, null, null,
phone.mCM.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
0, 0, 4, null, null, phone.getIccCard().getAid(),
obtainMessage(EVENT_READ_BINARY_DONE,
fileid, 0, onLoaded));
} else {

View File

@@ -57,8 +57,9 @@ public final class RuimFileHandler extends IccFileHandler {
Message response = obtainMessage(EVENT_READ_ICON_DONE, fileid, 0,
onLoaded);
phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, "img", 0, 0,
GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null, response);
phone.mCM.iccIOForApp(COMMAND_GET_RESPONSE, fileid, "img", 0, 0,
GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null,
phone.getIccCard().getAid(), response);
}
@Override

View File

@@ -1309,7 +1309,7 @@ public class SIMRecords extends IccRecords {
logv("fetchSimRecords " + recordsToLoad);
phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
phone.mCM.getIMSIForApp(phone.getIccCard().getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));

View File

@@ -84,6 +84,9 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
public void getIMSI(Message result) {
}
public void getIMSIForApp(String aid, Message result) {
}
public void getIMEI(Message result) {
}
@@ -213,6 +216,9 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
public void iccIO (int command, int fileid, String path, int p1, int p2,
int p3, String data, String pin2, Message result) {
}
public void iccIOForApp (int command, int fileid, String path, int p1, int p2,
int p3, String data, String pin2, String aid, Message result) {
}
public void getCLIR(Message result) {
}

View File

@@ -504,6 +504,9 @@ public final class SimulatedCommands extends BaseCommands
resultSuccess(result, null);
}
public void getIMSI(Message result) {
getIMSIForApp(null, result);
}
/**
* returned message
* retMsg.obj = AsyncResult ar
@@ -511,7 +514,7 @@ public final class SimulatedCommands extends BaseCommands
* ar.userObject contains the original value of result.obj
* ar.result is String containing IMSI on success
*/
public void getIMSI(Message result) {
public void getIMSIForApp(String aid, Message result) {
resultSuccess(result, "012345678901234");
}
@@ -1042,13 +1045,18 @@ public final class SimulatedCommands extends BaseCommands
unimplemented(result);
}
public void iccIO(int command, int fileid, String path, int p1, int p2, int p3, String data,
String pin2, Message response) {
iccIOForApp(command, fileid, path, p1, p2, p3, data,pin2, null, response);
}
/**
* parameters equivalent to 27.007 AT+CRSM command
* response.obj will be an AsyncResult
* response.obj.userObj will be a SimIoResult on success
*/
public void iccIO (int command, int fileid, String path, int p1, int p2,
int p3, String data, String pin2, Message result) {
public void iccIOForApp (int command, int fileid, String path, int p1, int p2,
int p3, String data, String pin2, String aid, Message result) {
unimplemented(result);
}

View File

@@ -612,4 +612,13 @@ class UsimDataDownloadCommands extends BaseCommands {
@Override
public void getVoiceRadioTechnology(Message response) {
}
@Override
public void getIMSIForApp(String aid, Message result) {
}
@Override
public void iccIOForApp(int command, int fileid, String path, int p1, int p2, int p3,
String data, String pin2, String aid, Message response) {
}
}