diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-24 12:01:56 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-24 12:01:56 -0700 |
commit | 8cac9064f5e4863f62d59560cbe9a54a61ba4a9a (patch) | |
tree | c131db935fdf48a0bc56de5a7e2b8986c26140b1 /telephony/java/com | |
parent | ba2eba40fe24eca6af1563181ce07e4e006a4f5d (diff) | |
parent | 469d5ba4cd963e9a6b39bb0514f7cf54ea503b30 (diff) | |
download | frameworks_base-8cac9064f5e4863f62d59560cbe9a54a61ba4a9a.zip frameworks_base-8cac9064f5e4863f62d59560cbe9a54a61ba4a9a.tar.gz frameworks_base-8cac9064f5e4863f62d59560cbe9a54a61ba4a9a.tar.bz2 |
Merge change 528 into donut
* changes:
Send the path of the EF file for ICC IO
Diffstat (limited to 'telephony/java/com')
4 files changed, 113 insertions, 49 deletions
diff --git a/telephony/java/com/android/internal/telephony/IccConstants.java b/telephony/java/com/android/internal/telephony/IccConstants.java index 59ce5bb..014fbb6 100644 --- a/telephony/java/com/android/internal/telephony/IccConstants.java +++ b/telephony/java/com/android/internal/telephony/IccConstants.java @@ -21,39 +21,44 @@ package com.android.internal.telephony; */ public interface IccConstants { // GSM SIM file ids from TS 51.011 - public static final int EF_ADN = 0x6F3A; - public static final int EF_FDN = 0x6F3B; - public static final int EF_SDN = 0x6F49; - public static final int EF_EXT1 = 0x6F4A; - public static final int EF_EXT2 = 0x6F4B; - public static final int EF_EXT3 = 0x6F4C; - public static final int EF_EXT6 = 0x6fc8; // Ext record for EF[MBDN] - public static final int EF_MWIS = 0x6FCA; - public static final int EF_MBDN = 0x6fc7; - public static final int EF_PNN = 0x6fc5; - public static final int EF_SPN = 0x6F46; - public static final int EF_SMS = 0x6F3C; - public static final int EF_ICCID = 0x2fe2; - public static final int EF_AD = 0x6FAD; - public static final int EF_MBI = 0x6fc9; - public static final int EF_MSISDN = 0x6f40; - public static final int EF_SPDI = 0x6fcd; - public static final int EF_SST = 0x6f38; - public static final int EF_CFIS = 0x6FCB; - public static final int EF_IMG = 0x4f20; + static final int EF_ADN = 0x6F3A; + static final int EF_FDN = 0x6F3B; + static final int EF_SDN = 0x6F49; + static final int EF_EXT1 = 0x6F4A; + static final int EF_EXT2 = 0x6F4B; + static final int EF_EXT3 = 0x6F4C; + static final int EF_EXT6 = 0x6fc8; // Ext record for EF[MBDN] + static final int EF_MWIS = 0x6FCA; + static final int EF_MBDN = 0x6fc7; + static final int EF_PNN = 0x6fc5; + static final int EF_SPN = 0x6F46; + static final int EF_SMS = 0x6F3C; + static final int EF_ICCID = 0x2fe2; + static final int EF_AD = 0x6FAD; + static final int EF_MBI = 0x6fc9; + static final int EF_MSISDN = 0x6f40; + static final int EF_SPDI = 0x6fcd; + static final int EF_SST = 0x6f38; + static final int EF_CFIS = 0x6FCB; + static final int EF_IMG = 0x4f20; // GSM SIM file ids from CPHS (phase 2, version 4.2) CPHS4_2.WW6 - public static final int EF_MAILBOX_CPHS = 0x6F17; - public static final int EF_VOICE_MAIL_INDICATOR_CPHS = 0x6F11; - public static final int EF_CFF_CPHS = 0x6F13; - public static final int EF_SPN_CPHS = 0x6f14; - public static final int EF_SPN_SHORT_CPHS = 0x6f18; - public static final int EF_INFO_CPHS = 0x6f16; + static final int EF_MAILBOX_CPHS = 0x6F17; + static final int EF_VOICE_MAIL_INDICATOR_CPHS = 0x6F11; + static final int EF_CFF_CPHS = 0x6F13; + static final int EF_SPN_CPHS = 0x6f14; + static final int EF_SPN_SHORT_CPHS = 0x6f18; + static final int EF_INFO_CPHS = 0x6f16; // CDMA RUIM file ids from 3GPP2 C.S0023-0 - public static final int EF_CST = 0x6f32; - public static final int EF_RUIM_SPN =0x6F41; + static final int EF_CST = 0x6f32; + static final int EF_RUIM_SPN =0x6F41; // SMS record length from TS 51.011 10.5.3 static public final int SMS_RECORD_LENGTH = 176; + + static final String MF_SIM = "3F00"; + static final String DF_TELECOM = "7F10"; + static final String DF_GRAPHICS = "5F50"; + static final String DF_GSM = "7F20"; } diff --git a/telephony/java/com/android/internal/telephony/IccFileHandler.java b/telephony/java/com/android/internal/telephony/IccFileHandler.java index e751c5e..92ddd2c 100644 --- a/telephony/java/com/android/internal/telephony/IccFileHandler.java +++ b/telephony/java/com/android/internal/telephony/IccFileHandler.java @@ -23,7 +23,7 @@ import java.util.ArrayList; /** * {@hide} */ -public abstract class IccFileHandler extends Handler { +public abstract class IccFileHandler extends Handler implements IccConstants { //from TS 11.11 9.1 or elsewhere static protected final int COMMAND_READ_BINARY = 0xb0; @@ -145,7 +145,7 @@ public abstract class IccFileHandler extends Handler { = obtainMessage(EVENT_GET_RECORD_SIZE_DONE, new LoadLinearFixedContext(fileid, recordNum, onLoaded)); - phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null, + phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid), 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response); } @@ -163,6 +163,7 @@ public abstract class IccFileHandler extends Handler { new LoadLinearFixedContext(IccConstants.EF_IMG, recordNum, onLoaded)); + // TODO(): Verify when path changes are done. phone.mCM.iccIO(COMMAND_GET_RESPONSE, IccConstants.EF_IMG, "img", recordNum, READ_RECORD_MODE_ABSOLUTE, GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null, response); @@ -181,7 +182,7 @@ public abstract class IccFileHandler extends Handler { Message response = obtainMessage(EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE, new LoadLinearFixedContext(fileid, onLoaded)); - phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null, + phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid), 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response); } @@ -198,7 +199,7 @@ public abstract class IccFileHandler extends Handler { Message response = obtainMessage(EVENT_GET_RECORD_SIZE_DONE, new LoadLinearFixedContext(fileid,onLoaded)); - phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null, + phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid), 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response); } @@ -216,7 +217,7 @@ public abstract class IccFileHandler extends Handler { Message response = obtainMessage(EVENT_GET_BINARY_SIZE_DONE, fileid, 0, onLoaded); - phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null, + phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid), 0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response); } @@ -250,7 +251,7 @@ public abstract class IccFileHandler extends Handler { */ public void updateEFLinearFixed(int fileid, int recordNum, byte[] data, String pin2, Message onComplete) { - phone.mCM.iccIO(COMMAND_UPDATE_RECORD, fileid, null, + phone.mCM.iccIO(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid), recordNum, READ_RECORD_MODE_ABSOLUTE, data.length, IccUtils.bytesToHexString(data), pin2, onComplete); } @@ -261,7 +262,7 @@ public abstract class IccFileHandler extends Handler { * @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, null, + phone.mCM.iccIO(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid), 0, 0, data.length, IccUtils.bytesToHexString(data), null, onComplete); } @@ -394,7 +395,7 @@ public abstract class IccFileHandler extends Handler { lc.results = new ArrayList<byte[]>(lc.countRecords); } - phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, null, + phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid), lc.recordNum, READ_RECORD_MODE_ABSOLUTE, lc.recordSize, null, null, @@ -432,7 +433,7 @@ public abstract class IccFileHandler extends Handler { size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8) + (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff); - phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, null, + phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, getEFPath(fileid), 0, 0, size, null, null, obtainMessage(EVENT_READ_BINARY_DONE, fileid, 0, response)); @@ -467,7 +468,7 @@ public abstract class IccFileHandler extends Handler { if (lc.recordNum > lc.countRecords) { sendResult(response, lc.results, null); } else { - phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, null, + phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid), lc.recordNum, READ_RECORD_MODE_ABSOLUTE, lc.recordSize, null, null, @@ -506,6 +507,36 @@ public abstract class IccFileHandler extends Handler { } } + /** + * Returns the root path of the EF file. + * i.e returns MasterFile + DFfile as a string. + * Ex: For EF_ADN on a SIM, it will return "3F007F10" + * This function handles only EFids that are common to + * RUIM, SIM, USIM and other types of Icc cards. + * + * @param efId + * @return root path of the file. + */ + protected String getCommonIccEFPath(int efid) { + switch(efid) { + case EF_ADN: + case EF_FDN: + case EF_MSISDN: + case EF_SDN: + case EF_EXT1: + case EF_EXT2: + case EF_EXT3: + return MF_SIM + DF_TELECOM; + + case EF_ICCID: + return MF_SIM; + case EF_IMG: + return MF_SIM + DF_TELECOM + DF_GRAPHICS; + } + return null; + } + + protected abstract String getEFPath(int efid); protected abstract void logd(String s); protected abstract void loge(String s); diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java index 7d392f0..9de6c42 100644 --- a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java +++ b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java @@ -17,7 +17,6 @@ package com.android.internal.telephony.cdma; import android.os.*; -import android.os.AsyncResult; import android.util.Log; import com.android.internal.telephony.IccConstants; @@ -68,6 +67,11 @@ public final class RuimFileHandler extends IccFileHandler { super.handleMessage(msg); } + protected String getEFPath(int efid) { + // TODO(): Implement for CDMA EFs. + return getCommonIccEFPath(efid); + } + protected void logd(String msg) { Log.d(LOG_TAG, "[RuimFileHandler] " + msg); } diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java index ead1327..a08cdde 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java @@ -16,26 +16,19 @@ package com.android.internal.telephony.gsm; -import android.os.*; -import android.os.AsyncResult; +import android.os.Message; import android.util.Log; import com.android.internal.telephony.IccConstants; -import com.android.internal.telephony.IccException; import com.android.internal.telephony.IccFileHandler; -import com.android.internal.telephony.IccFileTypeMismatch; -import com.android.internal.telephony.IccIoResult; -import com.android.internal.telephony.IccUtils; -import com.android.internal.telephony.PhoneProxy; - -import java.util.ArrayList; /** * {@hide} */ -public final class SIMFileHandler extends IccFileHandler { +public final class SIMFileHandler extends IccFileHandler implements IccConstants { static final String LOG_TAG = "GSM"; + //***** Instance Variables //***** Constructor @@ -59,6 +52,37 @@ public final class SIMFileHandler extends IccFileHandler { super.handleMessage(msg); } + protected String getEFPath(int efid) { + // TODO(): Make changes when USIM is supported + // TODO(): DF_GSM can be 7F20 or 7F21 to handle backward compatibility. + // Implement this after discussion with OEMs. + switch(efid) { + case EF_SMS: + return MF_SIM + DF_TELECOM; + + case EF_EXT6: + case EF_MWIS: + case EF_MBI: + case EF_SPN: + case EF_AD: + case EF_MBDN: + case EF_PNN: + case EF_SPDI: + case EF_SST: + case EF_CFIS: + return MF_SIM + DF_GSM; + + case EF_MAILBOX_CPHS: + case EF_VOICE_MAIL_INDICATOR_CPHS: + case EF_CFF_CPHS: + case EF_SPN_CPHS: + case EF_SPN_SHORT_CPHS: + case EF_INFO_CPHS: + return MF_SIM + DF_GSM; + } + return getCommonIccEFPath(efid); + } + protected void logd(String msg) { Log.d(LOG_TAG, "[SIMFileHandler] " + msg); } |