/** * Processes SELECT_ITEM proactive command from the SIM card. * * @param cmdDet Command Details container object. * @param ctlvs List of ComprehensionTlv objects following Command Details object and Device * Identities object within the proactive command * @return true if the command is processing is pending and additional asynchronous processing is * required. * @throws ResultException */ private boolean processSelectItem(CommandDetails cmdDet, List<ComprehensionTlv> ctlvs) throws ResultException { CatLog.d(this, "process SelectItem"); Menu menu = new Menu(); IconId titleIconId = null; ItemsIconId itemsIconId = null; Iterator<ComprehensionTlv> iter = ctlvs.iterator(); ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID, ctlvs); if (ctlv != null) { menu.title = ValueParser.retrieveAlphaId(ctlv); } while (true) { ctlv = searchForNextTag(ComprehensionTlvTag.ITEM, iter); if (ctlv != null) { menu.items.add(ValueParser.retrieveItem(ctlv)); } else { break; } } // We must have at least one menu item. if (menu.items.size() == 0) { throw new ResultException(ResultCode.REQUIRED_VALUES_MISSING); } ctlv = searchForTag(ComprehensionTlvTag.ITEM_ID, ctlvs); if (ctlv != null) { // CAT items are listed 1...n while list start at 0, need to // subtract one. menu.defaultItem = ValueParser.retrieveItemId(ctlv) - 1; } ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs); if (ctlv != null) { mIconLoadState = LOAD_SINGLE_ICON; titleIconId = ValueParser.retrieveIconId(ctlv); menu.titleIconSelfExplanatory = titleIconId.selfExplanatory; } ctlv = searchForTag(ComprehensionTlvTag.ITEM_ICON_ID_LIST, ctlvs); if (ctlv != null) { mIconLoadState = LOAD_MULTI_ICONS; itemsIconId = ValueParser.retrieveItemsIconId(ctlv); menu.itemsIconSelfExplanatory = itemsIconId.selfExplanatory; } boolean presentTypeSpecified = (cmdDet.commandQualifier & 0x01) != 0; if (presentTypeSpecified) { if ((cmdDet.commandQualifier & 0x02) == 0) { menu.presentationType = PresentationType.DATA_VALUES; } else { menu.presentationType = PresentationType.NAVIGATION_OPTIONS; } } menu.softKeyPreferred = (cmdDet.commandQualifier & 0x04) != 0; menu.helpAvailable = (cmdDet.commandQualifier & 0x80) != 0; mCmdParams = new SelectItemParams(cmdDet, menu, titleIconId != null); // Load icons data if needed. switch (mIconLoadState) { case LOAD_NO_ICON: return false; case LOAD_SINGLE_ICON: mloadIcon = true; mIconLoader.loadIcon(titleIconId.recordNumber, this.obtainMessage(MSG_ID_LOAD_ICON_DONE)); break; case LOAD_MULTI_ICONS: int[] recordNumbers = itemsIconId.recordNumbers; if (titleIconId != null) { // Create a new array for all the icons (title and items). recordNumbers = new int[itemsIconId.recordNumbers.length + 1]; recordNumbers[0] = titleIconId.recordNumber; System.arraycopy( itemsIconId.recordNumbers, 0, recordNumbers, 1, itemsIconId.recordNumbers.length); } mloadIcon = true; mIconLoader.loadIcons(recordNumbers, this.obtainMessage(MSG_ID_LOAD_ICON_DONE)); break; } return true; }