am d8d03c89: Merge "Ccat: Initial CCAT implementation"

Merge commit 'd8d03c890b03f063bdb669e25742b4f4c69d2bcf' into gingerbread-plus-aosp

* commit 'd8d03c890b03f063bdb669e25742b4f4c69d2bcf':
  Ccat: Initial CCAT implementation
This commit is contained in:
Jean-Baptiste Queru
2010-07-30 10:54:59 -07:00
committed by Android Git Automerger
5 changed files with 41 additions and 36 deletions

View File

@ -49,6 +49,7 @@ import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection; import com.android.internal.telephony.Connection;
import com.android.internal.telephony.DataConnection; import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.MccTable; import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.gsm.stk.StkService;
import com.android.internal.telephony.IccCard; import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccException; import com.android.internal.telephony.IccException;
import com.android.internal.telephony.IccFileHandler; import com.android.internal.telephony.IccFileHandler;
@ -109,7 +110,7 @@ public class CDMAPhone extends PhoneBase {
PhoneSubInfo mSubInfo; PhoneSubInfo mSubInfo;
EriManager mEriManager; EriManager mEriManager;
WakeLock mWakeLock; WakeLock mWakeLock;
StkService mStkService;
// mNvLoadedRegistrants are informed after the EVENT_NV_READY // mNvLoadedRegistrants are informed after the EVENT_NV_READY
private RegistrantList mNvLoadedRegistrants = new RegistrantList(); private RegistrantList mNvLoadedRegistrants = new RegistrantList();
@ -161,6 +162,8 @@ public class CDMAPhone extends PhoneBase {
mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this); mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this);
mSubInfo = new PhoneSubInfo(this); mSubInfo = new PhoneSubInfo(this);
mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML); mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);
mStkService = StkService.getInstance(mCM, mRuimRecords, mContext,
mIccFileHandler, mRuimCard);
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
mRuimRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null); mRuimRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
@ -236,6 +239,7 @@ public class CDMAPhone extends PhoneBase {
mRuimSmsInterfaceManager.dispose(); mRuimSmsInterfaceManager.dispose();
mSubInfo.dispose(); mSubInfo.dispose();
mEriManager.dispose(); mEriManager.dispose();
mStkService.dispose();
} }
} }
@ -251,6 +255,7 @@ public class CDMAPhone extends PhoneBase {
this.mCT = null; this.mCT = null;
this.mSST = null; this.mSST = null;
this.mEriManager = null; this.mEriManager = null;
this.mStkService = null;
} }
protected void finalize() { protected void finalize() {

View File

@ -21,7 +21,7 @@ import android.os.Handler;
import android.os.Message; import android.os.Message;
import com.android.internal.telephony.GsmAlphabet; import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.gsm.SIMFileHandler; import com.android.internal.telephony.IccFileHandler;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -53,7 +53,7 @@ class CommandParamsFactory extends Handler {
static final int REFRESH_UICC_RESET = 0x04; static final int REFRESH_UICC_RESET = 0x04;
static synchronized CommandParamsFactory getInstance(RilMessageDecoder caller, static synchronized CommandParamsFactory getInstance(RilMessageDecoder caller,
SIMFileHandler fh) { IccFileHandler fh) {
if (sInstance != null) { if (sInstance != null) {
return sInstance; return sInstance;
} }
@ -63,7 +63,7 @@ class CommandParamsFactory extends Handler {
return null; return null;
} }
private CommandParamsFactory(RilMessageDecoder caller, SIMFileHandler fh) { private CommandParamsFactory(RilMessageDecoder caller, IccFileHandler fh) {
mCaller = caller; mCaller = caller;
mIconLoader = IconLoader.getInstance(this, fh); mIconLoader = IconLoader.getInstance(this, fh);
} }

View File

@ -16,7 +16,7 @@
package com.android.internal.telephony.gsm.stk; package com.android.internal.telephony.gsm.stk;
import com.android.internal.telephony.gsm.SIMFileHandler; import com.android.internal.telephony.IccFileHandler;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
@ -40,7 +40,7 @@ class IconLoader extends Handler {
private ImageDescriptor mId = null; private ImageDescriptor mId = null;
private Bitmap mCurrentIcon = null; private Bitmap mCurrentIcon = null;
private int mRecordNumber; private int mRecordNumber;
private SIMFileHandler mSimFH = null; private IccFileHandler mSimFH = null;
private Message mEndMsg = null; private Message mEndMsg = null;
private byte[] mIconData = null; private byte[] mIconData = null;
// multi icons state members // multi icons state members
@ -68,14 +68,14 @@ class IconLoader extends Handler {
private static final int CLUT_ENTRY_SIZE = 3; private static final int CLUT_ENTRY_SIZE = 3;
private IconLoader(Looper looper , SIMFileHandler fh) { private IconLoader(Looper looper , IccFileHandler fh) {
super(looper); super(looper);
mSimFH = fh; mSimFH = fh;
mIconsCache = new HashMap<Integer, Bitmap>(50); mIconsCache = new HashMap<Integer, Bitmap>(50);
} }
static IconLoader getInstance(Handler caller, SIMFileHandler fh) { static IconLoader getInstance(Handler caller, IccFileHandler fh) {
if (sLoader != null) { if (sLoader != null) {
return sLoader; return sLoader;
} }

View File

@ -16,7 +16,7 @@
package com.android.internal.telephony.gsm.stk; package com.android.internal.telephony.gsm.stk;
import com.android.internal.telephony.gsm.SIMFileHandler; import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.IccUtils; import com.android.internal.telephony.IccUtils;
import android.os.Handler; import android.os.Handler;
@ -51,7 +51,7 @@ class RilMessageDecoder extends HierarchicalStateMachine {
* @param fh * @param fh
* @return RilMesssageDecoder * @return RilMesssageDecoder
*/ */
public static synchronized RilMessageDecoder getInstance(Handler caller, SIMFileHandler fh) { public static synchronized RilMessageDecoder getInstance(Handler caller, IccFileHandler fh) {
if (sInstance == null) { if (sInstance == null) {
sInstance = new RilMessageDecoder(caller, fh); sInstance = new RilMessageDecoder(caller, fh);
sInstance.start(); sInstance.start();
@ -90,7 +90,7 @@ class RilMessageDecoder extends HierarchicalStateMachine {
msg.sendToTarget(); msg.sendToTarget();
} }
private RilMessageDecoder(Handler caller, SIMFileHandler fh) { private RilMessageDecoder(Handler caller, IccFileHandler fh) {
super("RilMessageDecoder"); super("RilMessageDecoder");
addState(mStateStart); addState(mStateStart);

View File

@ -25,9 +25,9 @@ import android.os.Message;
import com.android.internal.telephony.IccUtils; import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.gsm.SimCard; import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.gsm.SIMFileHandler; import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.gsm.SIMRecords; import com.android.internal.telephony.IccRecords;
import android.util.Config; import android.util.Config;
@ -114,7 +114,7 @@ class RilMessage {
public class StkService extends Handler implements AppInterface { public class StkService extends Handler implements AppInterface {
// Class members // Class members
private static SIMRecords mSimRecords; private static IccRecords mIccRecords;
// Service members. // Service members.
private static StkService sInstance; private static StkService sInstance;
@ -136,7 +136,7 @@ public class StkService extends Handler implements AppInterface {
static final int MSG_ID_RIL_MSG_DECODED = 10; static final int MSG_ID_RIL_MSG_DECODED = 10;
// Events to signal SIM presence or absent in the device. // Events to signal SIM presence or absent in the device.
private static final int MSG_ID_SIM_LOADED = 20; private static final int MSG_ID_ICC_RECORDS_LOADED = 20;
private static final int DEV_ID_KEYPAD = 0x01; private static final int DEV_ID_KEYPAD = 0x01;
private static final int DEV_ID_DISPLAY = 0x02; private static final int DEV_ID_DISPLAY = 0x02;
@ -146,10 +146,10 @@ public class StkService extends Handler implements AppInterface {
private static final int DEV_ID_NETWORK = 0x83; private static final int DEV_ID_NETWORK = 0x83;
/* Intentionally private for singleton */ /* Intentionally private for singleton */
private StkService(CommandsInterface ci, SIMRecords sr, Context context, private StkService(CommandsInterface ci, IccRecords ir, Context context,
SIMFileHandler fh, SimCard sc) { IccFileHandler fh, IccCard ic) {
if (ci == null || sr == null || context == null || fh == null if (ci == null || ir == null || context == null || fh == null
|| sc == null) { || ic == null) {
throw new NullPointerException( throw new NullPointerException(
"Service: Input parameters must not be null"); "Service: Input parameters must not be null");
} }
@ -166,17 +166,17 @@ public class StkService extends Handler implements AppInterface {
mCmdIf.setOnStkCallSetUp(this, MSG_ID_CALL_SETUP, null); mCmdIf.setOnStkCallSetUp(this, MSG_ID_CALL_SETUP, null);
//mCmdIf.setOnSimRefresh(this, MSG_ID_REFRESH, null); //mCmdIf.setOnSimRefresh(this, MSG_ID_REFRESH, null);
mSimRecords = sr; mIccRecords = ir;
// Register for SIM ready event. // Register for SIM ready event.
mSimRecords.registerForRecordsLoaded(this, MSG_ID_SIM_LOADED, null); mIccRecords.registerForRecordsLoaded(this, MSG_ID_ICC_RECORDS_LOADED, null);
mCmdIf.reportStkServiceIsRunning(null); mCmdIf.reportStkServiceIsRunning(null);
StkLog.d(this, "StkService: is running"); StkLog.d(this, "StkService: is running");
} }
public void dispose() { public void dispose() {
mSimRecords.unregisterForRecordsLoaded(this); mIccRecords.unregisterForRecordsLoaded(this);
mCmdIf.unSetOnStkSessionEnd(this); mCmdIf.unSetOnStkSessionEnd(this);
mCmdIf.unSetOnStkProactiveCmd(this); mCmdIf.unSetOnStkProactiveCmd(this);
mCmdIf.unSetOnStkEvent(this); mCmdIf.unSetOnStkEvent(this);
@ -446,32 +446,32 @@ public class StkService extends Handler implements AppInterface {
} }
/** /**
* Used for instantiating/updating the Service from the GsmPhone constructor. * Used for instantiating/updating the Service from the GsmPhone or CdmaPhone constructor.
* *
* @param ci CommandsInterface object * @param ci CommandsInterface object
* @param sr SIMRecords object * @param ir IccRecords object
* @param context phone app context * @param context phone app context
* @param fh SIM file handler * @param fh Icc file handler
* @param sc GSM SIM card * @param ic Icc card
* @return The only Service object in the system * @return The only Service object in the system
*/ */
public static StkService getInstance(CommandsInterface ci, SIMRecords sr, public static StkService getInstance(CommandsInterface ci, IccRecords ir,
Context context, SIMFileHandler fh, SimCard sc) { Context context, IccFileHandler fh, IccCard ic) {
if (sInstance == null) { if (sInstance == null) {
if (ci == null || sr == null || context == null || fh == null if (ci == null || ir == null || context == null || fh == null
|| sc == null) { || ic == null) {
return null; return null;
} }
HandlerThread thread = new HandlerThread("Stk Telephony service"); HandlerThread thread = new HandlerThread("Stk Telephony service");
thread.start(); thread.start();
sInstance = new StkService(ci, sr, context, fh, sc); sInstance = new StkService(ci, ir, context, fh, ic);
StkLog.d(sInstance, "NEW sInstance"); StkLog.d(sInstance, "NEW sInstance");
} else if ((sr != null) && (mSimRecords != sr)) { } else if ((ir != null) && (mIccRecords != ir)) {
StkLog.d(sInstance, "Reinitialize the Service with SIMRecords"); StkLog.d(sInstance, "Reinitialize the Service with SIMRecords");
mSimRecords = sr; mIccRecords = ir;
// re-Register for SIM ready event. // re-Register for SIM ready event.
mSimRecords.registerForRecordsLoaded(sInstance, MSG_ID_SIM_LOADED, null); mIccRecords.registerForRecordsLoaded(sInstance, MSG_ID_ICC_RECORDS_LOADED, null);
StkLog.d(sInstance, "sr changed reinitialize and return current sInstance"); StkLog.d(sInstance, "sr changed reinitialize and return current sInstance");
} else { } else {
StkLog.d(sInstance, "Return current sInstance"); StkLog.d(sInstance, "Return current sInstance");
@ -513,7 +513,7 @@ public class StkService extends Handler implements AppInterface {
case MSG_ID_CALL_SETUP: case MSG_ID_CALL_SETUP:
mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, null)); mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, null));
break; break;
case MSG_ID_SIM_LOADED: case MSG_ID_ICC_RECORDS_LOADED:
break; break;
case MSG_ID_RIL_MSG_DECODED: case MSG_ID_RIL_MSG_DECODED:
handleRilMsg((RilMessage) msg.obj); handleRilMsg((RilMessage) msg.obj);