/** * Get the call arguments when CallWaiting reject for CDMA. * * @param ci The caller information for the call being logged. * @param number The number for the call being logged. * @param presentation The presentation to use in the logs. * @param callType The type of call log entry. * @param start The start time of call being logged. * @param duration The duration for call being logged. * @param slotId The slot id for the call being logged. * @return CallLogAsync.AddCallArgs related args for the call being logged. */ private CallLogAsync.AddCallArgs getCallArgsForCdmaCallWaitingReject( CallerInfo ci, String number, int presentation, int callType, long start, long duration, int slotId) { if (DBG) { log("getCallArgsForCdmaCallWaitingReject"); } CallLogAsync.AddCallArgs cdmaArgs; if (GeminiUtils.isGeminiSupport()) { if (DBG) { log("getCallArgsForCdmaCallWaitingReject, support gemini."); } int cdmaSimId = 0; if (ITelephonyWrapper.hasIccCard(slotId)) { SimInfoRecord si = SimInfoManager.getSimInfoBySlot(PhoneGlobals.getInstance(), slotId); if (si != null) { cdmaSimId = (int) si.mSimInfoId; } } cdmaArgs = new CallLogAsync.AddCallArgs( mApplication, ci, number, presentation, callType, start, duration, cdmaSimId); } else { cdmaArgs = new CallLogAsync.AddCallArgs( mApplication, ci, number, presentation, callType, start, duration); } return cdmaArgs; }
/** * Get "Restriction of menu options for manual PLMN selection" bit status from EF_CSP data, this * belongs to "Value Added Services Group". * * @param phone * @param context * @return */ public static boolean isCspPlmnEnabled(Phone phone, Context context) { Assert.assertNotNull(phone); boolean isShowPlmn = false; if (GeminiUtils.isGeminiSupport()) { List<SimInfoRecord> sims = SimInfoManager.getInsertedSimInfoList(context); for (SimInfoRecord sim : sims) { isShowPlmn |= ((GeminiPhone) phone).getPhonebyId(sim.mSimSlotId).isCspPlmnEnabled(); } } else { isShowPlmn = phone.isCspPlmnEnabled(); } return isShowPlmn; }
CheckCurAPN(Context c, String key) { super(c, key); setTitle(R.string.apn_check_title); if (key.equals(CheckItemKeySet.CI_CMWAP_CHECK_ONLY)) { setProperty(PROPERTY_AUTO_CHECK); checkAPN = "cmwap"; setNote(R.string.apn_cmwap); StringBuilder apn_cmwap = new StringBuilder(); apn_cmwap.append(getContext().getString(R.string.apn_cmwap)); apn_cmwap.append("\n" + getContext().getString(R.string.internet_doc)); setNote(apn_cmwap.toString()); } else if (key.equals(CheckItemKeySet.CI_CMWAP_AUTO_CONFG) || key.equals(CheckItemKeySet.CI_CMWAP)) { setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG); checkAPN = "cmwap"; StringBuilder apn_cmwap = new StringBuilder(); apn_cmwap.append(getContext().getString(R.string.apn_cmwap)); apn_cmwap.append("\n" + getContext().getString(R.string.internet_doc)); setNote(apn_cmwap.toString()); } else if (key.equals(CheckItemKeySet.CI_CMNET_CHECK_ONLY)) { setProperty(PROPERTY_AUTO_CHECK); checkAPN = "cmnet"; StringBuilder apn_cmnet = new StringBuilder(); apn_cmnet.append(getContext().getString(R.string.apn_cmnet)); apn_cmnet.append("\n" + getContext().getString(R.string.streaming_doc)); setNote(apn_cmnet.toString()); } else { setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG); checkAPN = "cmnet"; StringBuilder apn_cmnet = new StringBuilder(); apn_cmnet.append(getContext().getString(R.string.apn_cmnet)); apn_cmnet.append("\n" + getContext().getString(R.string.streaming_doc)); setNote(apn_cmnet.toString()); } mSimInfoList = SimInfoManager.getInsertedSimInfoList(c); if (mSimInfoList.isEmpty()) { setProperty(PROPERTY_AUTO_CHECK); } }
CheckLabAPN(Context c, String key) { super(c, key); setTitle(R.string.apn_check_title); StringBuilder noteStr = new StringBuilder(); noteStr.append(getContext().getString(R.string.apn_name) + "\n"); noteStr.append(getContext().getString(R.string.apn_apn_lab) + "labwap3" + "\n"); noteStr.append(getContext().getString(R.string.apn_proxy_lab) + "\n"); noteStr.append(getContext().getString(R.string.apn_port_lab) + "\n"); if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS)) { mCheckProperty = mCheckProperty | CHECK_MMS; noteStr.append(getContext().getString(R.string.apn_mms) + "\n"); noteStr.append(getContext().getString(R.string.apn_mms_proxy) + "\n"); noteStr.append(getContext().getString(R.string.apn_mms_port) + "\n"); } else if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_TYPE)) { mCheckProperty = mCheckProperty | CHECK_TYPE; noteStr.append(getContext().getString(R.string.apn_type) + "\n"); } else if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS_TYPE)) { mCheckProperty = mCheckProperty | CHECK_MMS; mCheckProperty = mCheckProperty | CHECK_TYPE; noteStr.append(getContext().getString(R.string.apn_mms) + "\n"); noteStr.append(getContext().getString(R.string.apn_mms_proxy) + "\n"); noteStr.append(getContext().getString(R.string.apn_mms_port) + "\n"); noteStr.append(getContext().getString(R.string.apn_type) + "\n"); } else { mCheckProperty = CHECK_BASE; } if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS)) { noteStr.append(getContext().getString(R.string.agps_doc) + "\n"); noteStr.append(getContext().getString(R.string.card_doc)); } else if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS_TYPE)) { noteStr.append(getContext().getString(R.string.iot_doc)); } setNote(noteStr.toString()); setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG); mSimInfoList = SimInfoManager.getInsertedSimInfoList(c); if (mSimInfoList.isEmpty()) { setProperty(PROPERTY_AUTO_CHECK); } }
@Override public void addOptionsMenu(Menu menu, Bundle args, String commd) { Log.i(TAG, "addOptionsMenu"); if (!ContactPluginDefault.COMMD_FOR_OP01.equals(commd)) { return; } MenuItem item = menu.findItem(MENU_SIM_STORAGE); List<SimInfoRecord> simInfos = SimInfoManager.getInsertedSimInfoList(mContext); if (item == null && simInfos != null && simInfos.size() > 0) { String string = mContext.getResources().getString(R.string.look_simstorage); menu.add(0, MENU_SIM_STORAGE, 0, string) .setOnMenuItemClickListener( new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { ShowSimCardStorageInfoTask.showSimCardStorageInfo(mContext); return true; } }); } }
CheckSMSC(Context c, String key) { super(c, key); setTitle(R.string.smsc_check_title); if (key.equals(CheckItemKeySet.CI_SMSC_CHECK_ONLY)) { setProperty(PROPERTY_AUTO_CHECK); } else { setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG); } mSimInfoList = SimInfoManager.getInsertedSimInfoList(c); if (mSimInfoList.isEmpty()) { setProperty(PROPERTY_AUTO_CHECK); } StringBuilder smscNote = new StringBuilder(); smscNote.append(getContext().getString(R.string.smsc_number)); smscNote.append("\n" + getContext().getString(R.string.agps_doc)); setNote(smscNote.toString()); }
@Override protected Void doInBackground(Void... args) { Log.i(TAG, "[ShowSimCardStorageInfoTask]: doInBackground_beg"); sSurplugMap.clear(); List<SimInfoRecord> simInfos = getSortedInsertedSimInfoList(SimInfoManager.getInsertedSimInfoList(mContext)); Log.i(TAG, "[ShowSimCardStorageInfoTask]: simInfos.size = " + simInfos.size()); if (!mIsCancelled && (simInfos != null) && simInfos.size() > 0) { StringBuilder build = new StringBuilder(); int simId = 0; for (SimInfoRecord simInfo : simInfos) { if (simId > 0) { build.append("\n\n"); } simId++; int[] storageInfos = null; Log.i( TAG, "[ShowSimCardStorageInfoTask] simName = " + simInfo.mDisplayName + "; simSlot = " + simInfo.mSimSlotId + "; simId = " + simInfo.mSimInfoId); build.append(simInfo.mDisplayName); build.append(":\n"); try { ITelephonyEx phoneEx = ITelephonyEx.Stub.asInterface(ServiceManager.checkService("phoneEx")); if (!mIsCancelled && phoneEx != null) { storageInfos = phoneEx.getAdnStorageInfo(simInfo.mSimSlotId); if (storageInfos == null) { mIsException = true; Log.i(TAG, " storageInfos is null"); return null; } Log.i(TAG, "[ShowSimCardStorageInfoTask] infos: " + storageInfos.toString()); } else { Log.i(TAG, "[ShowSimCardStorageInfoTask]: phone = null"); mIsException = true; return null; } } catch (RemoteException ex) { Log.i(TAG, "[ShowSimCardStorageInfoTask]_exception: " + ex); mIsException = true; return null; } Log.i( TAG, "slotId:" + simInfo.mSimSlotId + "||storage:" + (storageInfos == null ? "NULL" : storageInfos[1]) + "||used:" + (storageInfos == null ? "NULL" : storageInfos[0])); if (storageInfos != null && storageInfos[1] > 0) { sSurplugMap.put(simInfo.mSimSlotId, storageInfos[1] - storageInfos[0]); } build.append( mContext .getResources() .getString(R.string.dlg_simstorage_content, storageInfos[1], storageInfos[0])); if (mIsCancelled) { return null; } } mDlgContent = build.toString(); } Log.i(TAG, "[ShowSimCardStorageInfoTask]: doInBackground_end"); return null; }
/** * Describe <code>implementComposeOneEntity</code> method here. * * @return a <code>boolean</code> value */ public boolean implementComposeOneEntity() { boolean result = false; for (int i = 0; i < mSmsCursorArray.length; ++i) { if (mSmsCursorArray[i] != null && !mSmsCursorArray[i].isAfterLast()) { Cursor tmpCur = mSmsCursorArray[i]; long mtime = tmpCur.getLong(tmpCur.getColumnIndex(COLUMN_NAME_DATE)); String timeStamp = formatTimeStampString(mContext, mtime); int read = tmpCur.getInt(tmpCur.getColumnIndex(COLUMN_NAME_READ)); String readByte = (read == 0 ? "UNREAD" : "READ"); String seen = tmpCur.getString(tmpCur.getColumnIndex(COLUMN_NAME_SEEN)); int box = tmpCur.getInt(tmpCur.getColumnIndex(COLUMN_NAME_TYPE)); String boxType = null; switch (box) { case 1: boxType = "INBOX"; break; case 2: boxType = "SENDBOX"; break; default: boxType = "INBOX"; break; } long simid = tmpCur.getLong(tmpCur.getColumnIndex(COLUMN_NAME_SIM_ID)); String mSlotid = "0"; if (FeatureOption.MTK_GEMINI_SUPPORT == true && simid >= 0) { int slot = SimInfoManager.getSlotById(mContext, simid); mSlotid = String.valueOf(slot + 1); } int lock = tmpCur.getInt(tmpCur.getColumnIndex(COLUMN_NAME_LOCKED)); String locked = (lock == 1 ? "LOCKED" : "UNLOCKED"); String smsAddress = null; if (i == 3) { String threadId = tmpCur.getString(tmpCur.getColumnIndex(COLUMN_NAME_THREAD_ID)); Cursor draftCursor = mContext .getContentResolver() .query( Uri.parse("content://sms"), new String[] {TRICKY_TO_GET_DRAFT_SMS_ADDRESS + threadId + " --"}, null, null, null); if (draftCursor != null) { if (draftCursor.moveToFirst()) { smsAddress = draftCursor.getString(draftCursor.getColumnIndex(COLUMN_NAME_ADDRESS)); } draftCursor.close(); } } else { smsAddress = tmpCur.getString(tmpCur.getColumnIndex(COLUMN_NAME_ADDRESS)); } if (smsAddress == null) { smsAddress = ""; } String sc = tmpCur.getString(tmpCur.getColumnIndex(COLUMN_NAME_SC)); String body = tmpCur.getString(tmpCur.getColumnIndex(COLUMN_NAME_BODY)); StringBuffer sbf = new StringBuffer(body); int num = 0; num = sbf.indexOf("END:VBODY"); do { if (num >= 0) { sbf.insert(num, "/"); } else { break; } } while ((num = sbf.indexOf("END:VBODY", num + 1 + "END:VBODY".length())) >= 0); body = sbf.toString(); try { if (mWriter != null) { mWriter.write( combineVmsg(timeStamp, readByte, boxType, mSlotid, locked, smsAddress, body, seen)); result = true; } } catch (Exception e) { MyLogger.logE(CLASS_TAG, "mWriter.write() failed"); } finally { tmpCur.moveToNext(); } break; } } return result; }
/** * Get the call arguments when disconnected. * * @param ci The caller information for the call being logged. * @param number The number for the call being logged. * @param presentation The presentation to use in the logs. * @param callType The type of call log entry. * @param start The start time of call being logged. * @param duration The duration of call being logged. * @param slotId The slot id for the call being logged. * @return CallLogAsync.AddCallArgs related args for the call being logged. */ private CallLogAsync.AddCallArgs getCallArgs( CallerInfo ci, String number, int presentation, int callType, long start, long duration, int slotId) { CallLogAsync.AddCallArgs args; int simIdEx = CallNotifier.CALL_TYPE_NONE; // Get the phone type for sip boolean isSipCall = false; if (mPhoneType == PhoneConstants.PHONE_TYPE_SIP) { isSipCall = true; } if (!GeminiUtils.isGeminiSupport() || isSipCall) { // Single Card if (isSipCall) { simIdEx = CallNotifier.CALL_TYPE_SIP; } else { simIdEx = CallNotifier.CALL_TYPE_NONE; if (ITelephonyWrapper.hasIccCard(PhoneConstants.GEMINI_SIM_1)) { SimInfoRecord info = SIMInfoWrapper.getDefault().getSimInfoBySlot(0); if (info != null) { simIdEx = (int) info.mSimInfoId; } else { // Give an default simId, in most case, this is invalid simIdEx = 1; } } if (DBG) { log("for single card, simIdEx = " + simIdEx); } } } else { // dual SIM // Geminni Enhancement: change call log to sim id; SimInfoRecord si; if (ITelephonyWrapper.hasIccCard(slotId)) { si = SimInfoManager.getSimInfoBySlot(PhoneGlobals.getInstance(), slotId); if (si != null) { simIdEx = (int) si.mSimInfoId; } } if (DBG) { log("for dual SIM, simIdEx = " + simIdEx); } } if (FeatureOption.MTK_VT3G324M_SUPPORT) { args = new CallLogAsync.AddCallArgs( mApplication, ci, number, presentation, callType, start, duration, simIdEx, mVtCall); } else { args = new CallLogAsync.AddCallArgs( mApplication, ci, number, presentation, callType, start, duration, simIdEx); } addCallHistoryAsync(number, start, duration, isSipCall, slotId); return args; }