STK: CC feature implementation
Handle ALPHA_NOTIFY and display a toast mesage to user.
Bug: 17646476
Change-Id: I44726cb4d124be4c088660faf9fe5bc8322ccea0
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 1220741..8c47948 100755
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -174,6 +174,7 @@
static final int OP_SET_ACT_INST = 8;
static final int OP_SET_DAL_INST = 9;
static final int OP_SET_MAINACT_INST = 10;
+ static final int OP_ALPHA_NOTIFY = 13;
// Response ids
static final int RES_ID_MENU_SELECTION = 11;
@@ -315,6 +316,7 @@
break;
case OP_RESPONSE:
case OP_CARD_STATUS_CHANGED:
+ case OP_ALPHA_NOTIFY:
msg.obj = args;
/* falls through */
case OP_LAUNCH_APP:
@@ -571,6 +573,9 @@
CatLog.d(LOG_TAG, "Set activity instance. " + mainAct);
mStkContext[slotId].mMainActivityInstance = mainAct;
break;
+ case OP_ALPHA_NOTIFY:
+ handleAlphaNotify((Bundle) msg.obj);
+ break;
}
}
@@ -1485,6 +1490,7 @@
mStkContext[slotId].mSetupMenuState = STATE_EXIST;
return false;
}
+
StkContext getStkContext(int slotId) {
if (slotId >= 0 && slotId < mSimCount) {
return mStkContext[slotId];
@@ -1493,4 +1499,13 @@
return null;
}
}
+
+ private void handleAlphaNotify(Bundle args) {
+ String alphaString = args.getString(AppInterface.ALPHA_STRING);
+
+ CatLog.d(this, "Alpha string received from card: " + alphaString);
+ Toast toast = Toast.makeText(sInstance, alphaString, Toast.LENGTH_LONG);
+ toast.setGravity(Gravity.TOP, 0, 0);
+ toast.show();
+ }
}
diff --git a/src/com/android/stk/StkCmdReceiver.java b/src/com/android/stk/StkCmdReceiver.java
index 254c7fb..3eb1689 100644
--- a/src/com/android/stk/StkCmdReceiver.java
+++ b/src/com/android/stk/StkCmdReceiver.java
@@ -42,12 +42,14 @@
handleAction(context, intent, StkAppService.OP_END_SESSION);
} else if (action.equals(AppInterface.CAT_ICC_STATUS_CHANGE)) {
handleAction(context, intent, StkAppService.OP_CARD_STATUS_CHANGED);
+ } else if (action.equals(AppInterface.CAT_ALPHA_NOTIFY_ACTION)) {
+ handleAction(context, intent, StkAppService.OP_ALPHA_NOTIFY);
}
}
private void handleAction(Context context, Intent intent, int op) {
Bundle args = new Bundle();
- int slot_id = intent.getIntExtra(StkAppService.SLOT_ID,0);
+ int slot_id = intent.getIntExtra(StkAppService.SLOT_ID, 0);
args.putInt(StkAppService.OPCODE, op);
args.putInt(StkAppService.SLOT_ID, slot_id);
@@ -68,7 +70,11 @@
args.putInt(AppInterface.REFRESH_RESULT,
intent.getIntExtra(AppInterface.REFRESH_RESULT,
IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE));
+ } else if (StkAppService.OP_ALPHA_NOTIFY == op) {
+ String alphaString = intent.getStringExtra(AppInterface.ALPHA_STRING);
+ args.putString(AppInterface.ALPHA_STRING, alphaString);
}
+
CatLog.d("StkCmdReceiver", "handleAction, op: " + op +
"args: " + args + ", slot id: " + slot_id);
Intent toService = new Intent(context, StkAppService.class);