StkLauncherActivity.java revision e68857da85f6fb0964da9d58a7cbfcc0348065c6
19d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project/* 29d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * Copyright (C) 2007 The Android Open Source Project 39d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * 49d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 59d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * you may not use this file except in compliance with the License. 69d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * You may obtain a copy of the License at 79d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * 89d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 99d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * 109d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 119d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 129d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * See the License for the specific language governing permissions and 149d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * limitations under the License. 159d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project */ 169d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project 179d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Projectpackage com.android.stk; 189d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project 19e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.app.ListActivity; 20e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.content.Context; 219d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Projectimport android.content.Intent; 229d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Projectimport android.os.Bundle; 23e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.view.View; 24e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.view.KeyEvent; 25e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.view.Window; 26e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.widget.ImageView; 27e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.widget.ListView; 28e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.widget.TextView; 29e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.graphics.Bitmap; 30e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.graphics.BitmapFactory; 31e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 32e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport com.android.internal.telephony.cat.Item; 33e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport com.android.internal.telephony.cat.Menu; 34e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport com.android.internal.telephony.cat.CatLog; 35e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport com.android.internal.telephony.PhoneConstants; 36e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 37e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport android.telephony.TelephonyManager; 38e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 39e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savilleimport java.util.ArrayList; 409d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project 419d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project/** 4279085fcc5b4e54cc374e8720644ce4c1dc0004beWink Saville * Launcher class. Serve as the app's MAIN activity, send an intent to the 439d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project * StkAppService and finish. 4479085fcc5b4e54cc374e8720644ce4c1dc0004beWink Saville * 459d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project */ 46e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Savillepublic class StkLauncherActivity extends ListActivity { 47e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private TextView mTitleTextView = null; 48e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private ImageView mTitleIconView = null; 49e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private static final String className = new Object(){}.getClass().getEnclosingClass().getName(); 50e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private static final String LOG_TAG = className.substring(className.lastIndexOf('.') + 1); 51e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private ArrayList<Item> mStkMenuList = null; 52e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private int mSingleSimId = -1; 53e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private Context mContext = null; 54e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private TelephonyManager mTm = null; 55e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private Bitmap mBitMap = null; 56e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private boolean mAcceptUsersInput = true; 57e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 58e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville @Override 59e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville public void onCreate(Bundle icicle) { 60e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville super.onCreate(icicle); 61e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "onCreate+"); 62e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mContext = getBaseContext(); 63e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mTm = (TelephonyManager) mContext.getSystemService( 64e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville Context.TELEPHONY_SERVICE); 65e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville //Check if needs to show the menu list. 66e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (isShowSTKListMenu()) { 67e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville requestWindowFeature(Window.FEATURE_NO_TITLE); 68e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville setContentView(R.layout.stk_menu_list); 69e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mTitleTextView = (TextView) findViewById(R.id.title_text); 70e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mTitleIconView = (ImageView) findViewById(R.id.title_icon); 71e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mTitleTextView.setText(R.string.app_name); 72e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mBitMap = BitmapFactory.decodeResource(getResources(), 73e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville R.drawable.ic_launcher_sim_toolkit); 74e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else { 75e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville //launch stk menu activity for the SIM. 76e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (mSingleSimId < 0) { 77e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville finish(); 78e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 79e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 80e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 81e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 82e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville @Override 83e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville protected void onNewIntent(Intent intent) { 84e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville super.onNewIntent(intent); 85e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 86e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 87e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville @Override 88e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville protected void onListItemClick(ListView l, View v, int position, long id) { 89e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville super.onListItemClick(l, v, position, id); 90e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (!mAcceptUsersInput) { 91e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "mAcceptUsersInput:false"); 92e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return; 93e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 94e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville int simCount = TelephonyManager.from(mContext).getSimCount(); 95e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville Item item = getSelectedItem(position); 96e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (item == null) { 97e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "Item is null"); 98e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return; 99e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 100e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "launch stk menu id: " + item.id); 101e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (item.id >= PhoneConstants.SIM_ID_1 && item.id < simCount) { 102e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mAcceptUsersInput = false; 103e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville launchSTKMainMenu(item.id); 104e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 105e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 106e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 107e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville @Override 108e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville public boolean onKeyDown(int keyCode, KeyEvent event) { 109e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "mAcceptUsersInput: " + mAcceptUsersInput); 110e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (!mAcceptUsersInput) { 111e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return true; 112e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 113e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville switch (keyCode) { 114e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville case KeyEvent.KEYCODE_BACK: 115e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "KEYCODE_BACK."); 116e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mAcceptUsersInput = false; 117e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville finish(); 118e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return true; 119e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 120e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return super.onKeyDown(keyCode, event); 121e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 122e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 123e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville @Override 124e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville public void onResume() { 125e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville super.onResume(); 126e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "onResume"); 127e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mAcceptUsersInput = true; 128e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville int itemSize = addStkMenuListItems(); 129e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (itemSize == 0) { 130e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "item size = 0 so finish."); 131e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville finish(); 132e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else if (itemSize == 1) { 133e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville launchSTKMainMenu(mSingleSimId); 134e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville finish(); 135e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else { 136e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "resume to show multiple stk list."); 137e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 138e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 139e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 1409d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project @Override 141e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville public void onPause() { 142e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville super.onPause(); 143e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "onPause"); 144e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 145e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 146e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville @Override 147e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville public void onDestroy() { 148e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville super.onDestroy(); 149e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "onDestroy"); 150e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 1519d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project 152e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private Item getSelectedItem(int position) { 153e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville Item item = null; 154e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (mStkMenuList != null) { 155e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville try { 156e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville item = mStkMenuList.get(position); 157e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } catch (IndexOutOfBoundsException e) { 158e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (StkApp.DBG) { 159e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "IOOBE Invalid menu"); 160e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 161e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } catch (NullPointerException e) { 162e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (StkApp.DBG) { 163e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "NPE Invalid menu"); 164e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 165e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 166e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 167e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return item; 168e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 169e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 170e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private int addStkMenuListItems() { 171e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville String appName = mContext.getResources().getString(R.string.app_name); 172e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville String stkItemName = null; 173e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville int simCount = TelephonyManager.from(mContext).getSimCount(); 174e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mStkMenuList = new ArrayList<Item>(); 175e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 176e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "simCount: " + simCount); 177e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville for (int i = 0; i < simCount; i++) { 178e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville //Check if the card is inserted. 179e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (mTm.hasIccCard(i)) { 180e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "SIM " + i + " add to menu."); 181e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mSingleSimId = i; 182e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville stkItemName = new StringBuilder(appName).append(" ") 183e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville .append(Integer.toString(i + 1)).toString(); 184e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville Item item = new Item(i + 1, stkItemName, mBitMap); 185e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville item.id = i; 186e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mStkMenuList.add(item); 187e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else { 188e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "SIM " + i + " is not inserted."); 189e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 190e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 191e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (mStkMenuList != null && mStkMenuList.size() > 0) { 192e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (mStkMenuList.size() > 1) { 193e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville StkMenuAdapter adapter = new StkMenuAdapter(this, 194e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mStkMenuList, false); 195e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville // Bind menu list to the new adapter. 196e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville this.setListAdapter(adapter); 197e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 198e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return mStkMenuList.size(); 199e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else { 200e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "No stk menu item add."); 201e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return 0; 202e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 203e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 204e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private boolean isShowSTKListMenu() { 205e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville int simCount = TelephonyManager.from(mContext).getSimCount(); 206e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville int simInsertedCount = 0; 207e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville int insertedSlotId = -1; 208e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville 209e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "simCount: " + simCount); 210e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville for (int i = 0; i < simCount; i++) { 211e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville //Check if the card is inserted. 212e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (mTm.hasIccCard(i)) { 213e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "SIM " + i + " is inserted."); 214e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville mSingleSimId = i; 215e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville simInsertedCount++; 216e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else { 217e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "SIM " + i + " is not inserted."); 218e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 219e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 220e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville if (simInsertedCount > 1) { 221e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return true; 222e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } else { 223e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville //No card or only one card. 224e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "do not show stk list menu."); 225e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville return false; 226e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 227e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville } 228e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville private void launchSTKMainMenu(int slodId) { 2299d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project Bundle args = new Bundle(); 230e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville CatLog.d(LOG_TAG, "launchSTKMainMenu."); 2319d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project args.putInt(StkAppService.OPCODE, StkAppService.OP_LAUNCH_APP); 232e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville args.putInt(StkAppService.SLOT_ID 233e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville , PhoneConstants.SIM_ID_1 + slodId); 234e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville startService(new Intent(this, StkAppService.class) 235e68857da85f6fb0964da9d58a7cbfcc0348065c6Wink Saville .putExtras(args)); 2369d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project } 2379d9730aecb72e830ef12d66ce6e084d8ae0928f2The Android Open Source Project} 238