Skip to content

Commit d8d03c8

Browse files
Jean-Baptiste QueruAndroid Code Review
authored andcommitted
Merge "Ccat: Initial CCAT implementation"
2 parents a4fd007 + 4f1244e commit d8d03c8

File tree

5 files changed

+41
-36
lines changed

5 files changed

+41
-36
lines changed

telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import com.android.internal.telephony.Connection;
5050
import com.android.internal.telephony.DataConnection;
5151
import com.android.internal.telephony.MccTable;
52+
import com.android.internal.telephony.gsm.stk.StkService;
5253
import com.android.internal.telephony.IccCard;
5354
import com.android.internal.telephony.IccException;
5455
import com.android.internal.telephony.IccFileHandler;
@@ -109,7 +110,7 @@ public class CDMAPhone extends PhoneBase {
109110
PhoneSubInfo mSubInfo;
110111
EriManager mEriManager;
111112
WakeLock mWakeLock;
112-
113+
StkService mStkService;
113114

114115
// mNvLoadedRegistrants are informed after the EVENT_NV_READY
115116
private RegistrantList mNvLoadedRegistrants = new RegistrantList();
@@ -161,6 +162,8 @@ public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier,
161162
mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this);
162163
mSubInfo = new PhoneSubInfo(this);
163164
mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);
165+
mStkService = StkService.getInstance(mCM, mRuimRecords, mContext,
166+
mIccFileHandler, mRuimCard);
164167

165168
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
166169
mRuimRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
@@ -236,6 +239,7 @@ public void dispose() {
236239
mRuimSmsInterfaceManager.dispose();
237240
mSubInfo.dispose();
238241
mEriManager.dispose();
242+
mStkService.dispose();
239243
}
240244
}
241245

@@ -251,6 +255,7 @@ public void removeReferences() {
251255
this.mCT = null;
252256
this.mSST = null;
253257
this.mEriManager = null;
258+
this.mStkService = null;
254259
}
255260

256261
protected void finalize() {

telephony/java/com/android/internal/telephony/gsm/stk/CommandParamsFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import android.os.Message;
2222

2323
import com.android.internal.telephony.GsmAlphabet;
24-
import com.android.internal.telephony.gsm.SIMFileHandler;
24+
import com.android.internal.telephony.IccFileHandler;
2525

2626
import java.util.Iterator;
2727
import java.util.List;
@@ -53,7 +53,7 @@ class CommandParamsFactory extends Handler {
5353
static final int REFRESH_UICC_RESET = 0x04;
5454

5555
static synchronized CommandParamsFactory getInstance(RilMessageDecoder caller,
56-
SIMFileHandler fh) {
56+
IccFileHandler fh) {
5757
if (sInstance != null) {
5858
return sInstance;
5959
}
@@ -63,7 +63,7 @@ static synchronized CommandParamsFactory getInstance(RilMessageDecoder caller,
6363
return null;
6464
}
6565

66-
private CommandParamsFactory(RilMessageDecoder caller, SIMFileHandler fh) {
66+
private CommandParamsFactory(RilMessageDecoder caller, IccFileHandler fh) {
6767
mCaller = caller;
6868
mIconLoader = IconLoader.getInstance(this, fh);
6969
}

telephony/java/com/android/internal/telephony/gsm/stk/IconLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.android.internal.telephony.gsm.stk;
1818

19-
import com.android.internal.telephony.gsm.SIMFileHandler;
19+
import com.android.internal.telephony.IccFileHandler;
2020

2121
import android.graphics.Bitmap;
2222
import android.graphics.Color;
@@ -40,7 +40,7 @@ class IconLoader extends Handler {
4040
private ImageDescriptor mId = null;
4141
private Bitmap mCurrentIcon = null;
4242
private int mRecordNumber;
43-
private SIMFileHandler mSimFH = null;
43+
private IccFileHandler mSimFH = null;
4444
private Message mEndMsg = null;
4545
private byte[] mIconData = null;
4646
// multi icons state members
@@ -68,14 +68,14 @@ class IconLoader extends Handler {
6868
private static final int CLUT_ENTRY_SIZE = 3;
6969

7070

71-
private IconLoader(Looper looper , SIMFileHandler fh) {
71+
private IconLoader(Looper looper , IccFileHandler fh) {
7272
super(looper);
7373
mSimFH = fh;
7474

7575
mIconsCache = new HashMap<Integer, Bitmap>(50);
7676
}
7777

78-
static IconLoader getInstance(Handler caller, SIMFileHandler fh) {
78+
static IconLoader getInstance(Handler caller, IccFileHandler fh) {
7979
if (sLoader != null) {
8080
return sLoader;
8181
}

telephony/java/com/android/internal/telephony/gsm/stk/RilMessageDecoder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.android.internal.telephony.gsm.stk;
1818

19-
import com.android.internal.telephony.gsm.SIMFileHandler;
19+
import com.android.internal.telephony.IccFileHandler;
2020
import com.android.internal.telephony.IccUtils;
2121

2222
import android.os.Handler;
@@ -51,7 +51,7 @@ class RilMessageDecoder extends HierarchicalStateMachine {
5151
* @param fh
5252
* @return RilMesssageDecoder
5353
*/
54-
public static synchronized RilMessageDecoder getInstance(Handler caller, SIMFileHandler fh) {
54+
public static synchronized RilMessageDecoder getInstance(Handler caller, IccFileHandler fh) {
5555
if (sInstance == null) {
5656
sInstance = new RilMessageDecoder(caller, fh);
5757
sInstance.start();
@@ -90,7 +90,7 @@ private void sendCmdForExecution(RilMessage rilMsg) {
9090
msg.sendToTarget();
9191
}
9292

93-
private RilMessageDecoder(Handler caller, SIMFileHandler fh) {
93+
private RilMessageDecoder(Handler caller, IccFileHandler fh) {
9494
super("RilMessageDecoder");
9595

9696
addState(mStateStart);

telephony/java/com/android/internal/telephony/gsm/stk/StkService.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
import com.android.internal.telephony.IccUtils;
2727
import com.android.internal.telephony.CommandsInterface;
28-
import com.android.internal.telephony.gsm.SimCard;
29-
import com.android.internal.telephony.gsm.SIMFileHandler;
30-
import com.android.internal.telephony.gsm.SIMRecords;
28+
import com.android.internal.telephony.IccCard;
29+
import com.android.internal.telephony.IccFileHandler;
30+
import com.android.internal.telephony.IccRecords;
3131

3232
import android.util.Config;
3333

@@ -114,7 +114,7 @@ class RilMessage {
114114
public class StkService extends Handler implements AppInterface {
115115

116116
// Class members
117-
private static SIMRecords mSimRecords;
117+
private static IccRecords mIccRecords;
118118

119119
// Service members.
120120
private static StkService sInstance;
@@ -136,7 +136,7 @@ public class StkService extends Handler implements AppInterface {
136136
static final int MSG_ID_RIL_MSG_DECODED = 10;
137137

138138
// Events to signal SIM presence or absent in the device.
139-
private static final int MSG_ID_SIM_LOADED = 20;
139+
private static final int MSG_ID_ICC_RECORDS_LOADED = 20;
140140

141141
private static final int DEV_ID_KEYPAD = 0x01;
142142
private static final int DEV_ID_DISPLAY = 0x02;
@@ -146,10 +146,10 @@ public class StkService extends Handler implements AppInterface {
146146
private static final int DEV_ID_NETWORK = 0x83;
147147

148148
/* Intentionally private for singleton */
149-
private StkService(CommandsInterface ci, SIMRecords sr, Context context,
150-
SIMFileHandler fh, SimCard sc) {
151-
if (ci == null || sr == null || context == null || fh == null
152-
|| sc == null) {
149+
private StkService(CommandsInterface ci, IccRecords ir, Context context,
150+
IccFileHandler fh, IccCard ic) {
151+
if (ci == null || ir == null || context == null || fh == null
152+
|| ic == null) {
153153
throw new NullPointerException(
154154
"Service: Input parameters must not be null");
155155
}
@@ -166,17 +166,17 @@ private StkService(CommandsInterface ci, SIMRecords sr, Context context,
166166
mCmdIf.setOnStkCallSetUp(this, MSG_ID_CALL_SETUP, null);
167167
//mCmdIf.setOnSimRefresh(this, MSG_ID_REFRESH, null);
168168

169-
mSimRecords = sr;
169+
mIccRecords = ir;
170170

171171
// Register for SIM ready event.
172-
mSimRecords.registerForRecordsLoaded(this, MSG_ID_SIM_LOADED, null);
172+
mIccRecords.registerForRecordsLoaded(this, MSG_ID_ICC_RECORDS_LOADED, null);
173173

174174
mCmdIf.reportStkServiceIsRunning(null);
175175
StkLog.d(this, "StkService: is running");
176176
}
177177

178178
public void dispose() {
179-
mSimRecords.unregisterForRecordsLoaded(this);
179+
mIccRecords.unregisterForRecordsLoaded(this);
180180
mCmdIf.unSetOnStkSessionEnd(this);
181181
mCmdIf.unSetOnStkProactiveCmd(this);
182182
mCmdIf.unSetOnStkEvent(this);
@@ -446,32 +446,32 @@ private void eventDownload(int event, int sourceId, int destinationId,
446446
}
447447

448448
/**
449-
* Used for instantiating/updating the Service from the GsmPhone constructor.
449+
* Used for instantiating/updating the Service from the GsmPhone or CdmaPhone constructor.
450450
*
451451
* @param ci CommandsInterface object
452-
* @param sr SIMRecords object
452+
* @param ir IccRecords object
453453
* @param context phone app context
454-
* @param fh SIM file handler
455-
* @param sc GSM SIM card
454+
* @param fh Icc file handler
455+
* @param ic Icc card
456456
* @return The only Service object in the system
457457
*/
458-
public static StkService getInstance(CommandsInterface ci, SIMRecords sr,
459-
Context context, SIMFileHandler fh, SimCard sc) {
458+
public static StkService getInstance(CommandsInterface ci, IccRecords ir,
459+
Context context, IccFileHandler fh, IccCard ic) {
460460
if (sInstance == null) {
461-
if (ci == null || sr == null || context == null || fh == null
462-
|| sc == null) {
461+
if (ci == null || ir == null || context == null || fh == null
462+
|| ic == null) {
463463
return null;
464464
}
465465
HandlerThread thread = new HandlerThread("Stk Telephony service");
466466
thread.start();
467-
sInstance = new StkService(ci, sr, context, fh, sc);
467+
sInstance = new StkService(ci, ir, context, fh, ic);
468468
StkLog.d(sInstance, "NEW sInstance");
469-
} else if ((sr != null) && (mSimRecords != sr)) {
469+
} else if ((ir != null) && (mIccRecords != ir)) {
470470
StkLog.d(sInstance, "Reinitialize the Service with SIMRecords");
471-
mSimRecords = sr;
471+
mIccRecords = ir;
472472

473473
// re-Register for SIM ready event.
474-
mSimRecords.registerForRecordsLoaded(sInstance, MSG_ID_SIM_LOADED, null);
474+
mIccRecords.registerForRecordsLoaded(sInstance, MSG_ID_ICC_RECORDS_LOADED, null);
475475
StkLog.d(sInstance, "sr changed reinitialize and return current sInstance");
476476
} else {
477477
StkLog.d(sInstance, "Return current sInstance");
@@ -513,7 +513,7 @@ public void handleMessage(Message msg) {
513513
case MSG_ID_CALL_SETUP:
514514
mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, null));
515515
break;
516-
case MSG_ID_SIM_LOADED:
516+
case MSG_ID_ICC_RECORDS_LOADED:
517517
break;
518518
case MSG_ID_RIL_MSG_DECODED:
519519
handleRilMsg((RilMessage) msg.obj);

0 commit comments

Comments
 (0)