Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +70 −59 Original line number Diff line number Diff line Loading @@ -2073,6 +2073,26 @@ public class GsmCdmaPhone extends Phone { && mImsPhone.isUtEnabled(); } private boolean isCsRetry(Message onComplete) { if (onComplete != null) { return onComplete.getData().getBoolean(CS_FALLBACK_SS, false); } return false; } @Override public boolean useSsOverIms(Message onComplete) { boolean isUtEnabled = isUtEnabled(); Rlog.d(LOG_TAG, "useSsOverIms: isUtEnabled()= " + isUtEnabled + " isCsRetry(onComplete))= " + isCsRetry(onComplete)); if (isUtEnabled && !isCsRetry(onComplete)) { return true; } return false; } @Override public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) { getCallForwardingOption(commandInterfaceCFReason, Loading @@ -2082,16 +2102,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getCallForwardingOption(int commandInterfaceCFReason, int serviceClass, Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { imsPhone.getCallForwardingOption(commandInterfaceCFReason, serviceClass, onComplete); if (useSsOverIms(onComplete)) { imsPhone.getCallForwardingOption(commandInterfaceCFReason, serviceClass, onComplete); return; } if (isPhoneTypeGsm()) { if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) { if (DBG) logd("requesting call forwarding query."); Message resp; Loading Loading @@ -2126,17 +2143,14 @@ public class GsmCdmaPhone extends Phone { int serviceClass, int timerSeconds, Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { imsPhone.setCallForwardingOption(commandInterfaceCFAction, commandInterfaceCFReason, dialingNumber, serviceClass, timerSeconds, onComplete); if (useSsOverIms(onComplete)) { imsPhone.setCallForwardingOption(commandInterfaceCFAction, commandInterfaceCFReason, dialingNumber, serviceClass, timerSeconds, onComplete); return; } if (isPhoneTypeGsm()) { if ((isValidCommandInterfaceCFAction(commandInterfaceCFAction)) && (isValidCommandInterfaceCFReason(commandInterfaceCFReason))) { Loading Loading @@ -2177,12 +2191,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getCallBarring(String facility, String password, Message onComplete, int serviceClass) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && imsPhone.isUtEnabled()) { if (useSsOverIms(onComplete)) { imsPhone.getCallBarring(facility, password, onComplete, serviceClass); return; } if (isPhoneTypeGsm()) { mCi.queryFacilityLock(facility, password, serviceClass, onComplete); } else { loge("getCallBarringOption: not possible in CDMA"); Loading @@ -2192,12 +2207,13 @@ public class GsmCdmaPhone extends Phone { @Override public void setCallBarring(String facility, boolean lockState, String password, Message onComplete, int serviceClass) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && imsPhone.isUtEnabled()) { if (useSsOverIms(onComplete)) { imsPhone.setCallBarring(facility, lockState, password, onComplete, serviceClass); return; } if (isPhoneTypeGsm()) { mCi.setFacilityLock(facility, lockState, password, serviceClass, onComplete); } else { loge("setCallBarringOption: not possible in CDMA"); Loading @@ -2223,14 +2239,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getOutgoingCallerIdDisplay(Message onComplete) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.getOutgoingCallerIdDisplay(onComplete); return; } if (isPhoneTypeGsm()) { mCi.getCLIR(onComplete); } else { loge("getOutgoingCallerIdDisplay: not possible in CDMA"); Loading @@ -2239,14 +2254,13 @@ public class GsmCdmaPhone extends Phone { @Override public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.setOutgoingCallerIdDisplay(commandInterfaceCLIRMode, onComplete); return; } if (isPhoneTypeGsm()) { // Packing CLIR value in the message. This will be required for // SharedPreference caching, if the message comes back as part of // a success response. Loading @@ -2259,15 +2273,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getCallWaiting(Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.getCallWaiting(onComplete); return; } if (isPhoneTypeGsm()) { //As per 3GPP TS 24.083, section 1.6 UE doesn't need to send service //class parameter in call waiting interrogation to network mCi.queryCallWaiting(CommandsInterface.SERVICE_CLASS_NONE, onComplete); Loading @@ -2293,14 +2305,13 @@ public class GsmCdmaPhone extends Phone { @Override public void setCallWaiting(boolean enable, int serviceClass, Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.setCallWaiting(enable, onComplete); return; } if (isPhoneTypeGsm()) { mCi.setCallWaiting(enable, serviceClass, onComplete); } else { String cwPrefix = CdmaMmiCode.getCallWaitingPrefix(enable); Loading src/java/com/android/internal/telephony/Phone.java +8 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * TODO: Replace this with a proper exception; {@link CallStateException} doesn't make sense. */ public static final String CS_FALLBACK = "cs_fallback"; // Used for retry over cs for supplementary services public static final String CS_FALLBACK_SS = "cs_fallback_ss"; /** * @deprecated Use {@link android.telephony.ims.ImsManager#EXTRA_WFC_REGISTRATION_FAILURE_TITLE} * instead. Loading Loading @@ -4268,6 +4272,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return mCarrierPrivilegesTracker; } public boolean useSsOverIms(Message onComplete) { return false; } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("Phone: subId=" + getSubId()); pw.println(" mPhoneId=" + mPhoneId); Loading src/java/com/android/internal/telephony/imsphone/ImsPhone.java +193 −20 Original line number Diff line number Diff line Loading @@ -301,6 +301,85 @@ public class ImsPhone extends ImsPhoneBase { } } // Create SS (Supplementary Service) so that save SS params & // mOnComplete (Message object passed by client) can be packed // given as a single SS object as user data to UtInterface. @VisibleForTesting public static class SS { int mCfAction; int mCfReason; String mDialingNumber; int mTimerSeconds; boolean mEnable; int mClirMode; String mFacility; boolean mLockState; String mPassword; int mServiceClass; @VisibleForTesting public Message mOnComplete; // Default // Query CW, CLIR SS(Message onComplete) { mOnComplete = onComplete; } // Update CLIP SS(boolean enable, Message onComplete) { mEnable = enable; mOnComplete = onComplete; } // Update CLIR SS(int clirMode, Message onComplete) { mClirMode = clirMode; mOnComplete = onComplete; } // Update CW SS(boolean enable, int serviceClass, Message onComplete) { mEnable = enable; mServiceClass = serviceClass; mOnComplete = onComplete; } // Query CF SS(int cfReason, int serviceClass, Message onComplete) { mCfReason = cfReason; mServiceClass = serviceClass; mOnComplete = onComplete; } // Update CF SS(int cfAction, int cfReason, String dialingNumber, int serviceClass, int timerSeconds, Message onComplete) { mCfAction = cfAction; mCfReason = cfReason; mDialingNumber = dialingNumber; mServiceClass = serviceClass; mTimerSeconds = timerSeconds; mOnComplete = onComplete; } // Query CB SS(String facility, String password, int serviceClass, Message onComplete) { mFacility = facility; mPassword = password; mServiceClass = serviceClass; mOnComplete = onComplete; } // Update CB SS(String facility, boolean lockState, String password, int serviceClass, Message onComplete) { mFacility = facility; mLockState = lockState; mPassword = password; mServiceClass = serviceClass; mOnComplete = onComplete; } } // Constructors public ImsPhone(Context context, PhoneNotifier notifier, Phone defaultPhone) { this(context, notifier, defaultPhone, false); Loading Loading @@ -1009,7 +1088,8 @@ public class ImsPhone extends ImsPhoneBase { public void getOutgoingCallerIdDisplay(Message onComplete) { if (DBG) logd("getCLIR"); Message resp; resp = obtainMessage(EVENT_GET_CLIR_DONE, onComplete); SS ss = new SS(onComplete); resp = obtainMessage(EVENT_GET_CLIR_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1026,7 +1106,8 @@ public class ImsPhone extends ImsPhoneBase { // Packing CLIR value in the message. This will be required for // SharedPreference caching, if the message comes back as part of // a success response. resp = obtainMessage(EVENT_SET_CLIR_DONE, clirMode, 0, onComplete); SS ss = new SS(clirMode, onComplete); resp = obtainMessage(EVENT_SET_CLIR_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); ut.updateCLIR(clirMode, resp); Loading @@ -1050,7 +1131,8 @@ public class ImsPhone extends ImsPhoneBase { if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) { if (DBG) logd("requesting call forwarding query."); Message resp; resp = obtainMessage(EVENT_GET_CALL_FORWARD_DONE, onComplete); SS ss = new SS(commandInterfaceCFReason, serviceClass, onComplete); resp = obtainMessage(EVENT_GET_CALL_FORWARD_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading Loading @@ -1088,10 +1170,9 @@ public class ImsPhone extends ImsPhoneBase { if ((isValidCommandInterfaceCFAction(commandInterfaceCFAction)) && (isValidCommandInterfaceCFReason(commandInterfaceCFReason))) { Message resp; Cf cf = new Cf(dialingNumber, GsmMmiCode.isVoiceUnconditionalForwarding( commandInterfaceCFReason, serviceClass), onComplete); resp = obtainMessage(EVENT_SET_CALL_FORWARD_DONE, isCfEnable(commandInterfaceCFAction) ? 1 : 0, 0, cf); SS ss = new SS(commandInterfaceCFAction, commandInterfaceCFReason, dialingNumber, serviceClass, timerSeconds, onComplete); resp = obtainMessage(EVENT_SET_CALL_FORWARD_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1114,7 +1195,8 @@ public class ImsPhone extends ImsPhoneBase { public void getCallWaiting(Message onComplete) { if (DBG) logd("getCallWaiting"); Message resp; resp = obtainMessage(EVENT_GET_CALL_WAITING_DONE, onComplete); SS ss = new SS(onComplete); resp = obtainMessage(EVENT_GET_CALL_WAITING_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1141,7 +1223,8 @@ public class ImsPhone extends ImsPhoneBase { public void setCallWaiting(boolean enable, int serviceClass, Message onComplete) { if (DBG) logd("setCallWaiting enable=" + enable); Message resp; resp = obtainMessage(EVENT_SET_CALL_WAITING_DONE, onComplete); SS ss = new SS(enable, serviceClass, onComplete); resp = obtainMessage(EVENT_SET_CALL_WAITING_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading Loading @@ -1188,7 +1271,8 @@ public class ImsPhone extends ImsPhoneBase { int serviceClass) { if (DBG) logd("getCallBarring facility=" + facility + ", serviceClass = " + serviceClass); Message resp; resp = obtainMessage(EVENT_GET_CALL_BARRING_DONE, onComplete); SS ss = new SS(facility, password, serviceClass, onComplete); resp = obtainMessage(EVENT_GET_CALL_BARRING_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1213,7 +1297,8 @@ public class ImsPhone extends ImsPhoneBase { + ", lockState=" + lockState + ", serviceClass = " + serviceClass); } Message resp; resp = obtainMessage(EVENT_SET_CALL_BARRING_DONE, onComplete); SS ss = new SS(facility, lockState, password, serviceClass, onComplete); resp = obtainMessage(EVENT_SET_CALL_BARRING_DONE, ss); int action; if (lockState) { Loading Loading @@ -1548,18 +1633,96 @@ public class ImsPhone extends ImsPhoneBase { } } boolean isCsRetryException(Throwable e) { if ((e != null) && (e instanceof ImsException) && (((ImsException)e).getCode() == ImsReasonInfo.CODE_LOCAL_CALL_CS_RETRY_REQUIRED)) { return true; } return false; } private Bundle setCsfbBundle(boolean isCsRetry) { Bundle b = new Bundle(); b.putBoolean(CS_FALLBACK_SS, isCsRetry); return b; } private void sendResponseOrRetryOnCsfbSs(SS ss, int what, Throwable e, Object obj) { if (!isCsRetryException(e)) { sendResponse(ss.mOnComplete, obj, e); return; } Rlog.d(LOG_TAG, "Try CSFB: " + what); ss.mOnComplete.setData(setCsfbBundle(true)); switch (what) { case EVENT_GET_CALL_FORWARD_DONE: mDefaultPhone.getCallForwardingOption(ss.mCfReason, ss.mServiceClass, ss.mOnComplete); break; case EVENT_SET_CALL_FORWARD_DONE: mDefaultPhone.setCallForwardingOption(ss.mCfAction, ss.mCfReason, ss.mDialingNumber, ss.mServiceClass, ss.mTimerSeconds, ss.mOnComplete); break; case EVENT_GET_CALL_BARRING_DONE: mDefaultPhone.getCallBarring(ss.mFacility, ss.mPassword, ss.mOnComplete, ss.mServiceClass); break; case EVENT_SET_CALL_BARRING_DONE: mDefaultPhone.setCallBarring(ss.mFacility, ss.mLockState, ss.mPassword, ss.mOnComplete, ss.mServiceClass); break; case EVENT_GET_CALL_WAITING_DONE: mDefaultPhone.getCallWaiting(ss.mOnComplete); break; case EVENT_SET_CALL_WAITING_DONE: mDefaultPhone.setCallWaiting(ss.mEnable, ss.mServiceClass, ss.mOnComplete); break; case EVENT_GET_CLIR_DONE: mDefaultPhone.getOutgoingCallerIdDisplay(ss.mOnComplete); break; case EVENT_SET_CLIR_DONE: mDefaultPhone.setOutgoingCallerIdDisplay(ss.mClirMode, ss.mOnComplete); break; default: break; } } @Override public void handleMessage(Message msg) { AsyncResult ar = (AsyncResult) msg.obj; Message onComplete; SS ss = null; if (ar.userObj instanceof SS) { ss = (SS) ar.userObj; } if (DBG) logd("handleMessage what=" + msg.what); switch (msg.what) { case EVENT_SET_CALL_FORWARD_DONE: Cf cf = (Cf) ar.userObj; if (cf.mIsCfu && ar.exception == null) { setVoiceCallForwardingFlag(getIccRecords(), 1, msg.arg1 == 1, cf.mSetCfNumber); if (ar.exception == null && ss != null && (ss.mCfReason == CF_REASON_UNCONDITIONAL)) { setVoiceCallForwardingFlag(getIccRecords(), 1, isCfEnable(ss.mCfAction), ss.mDialingNumber); } if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, null); } sendResponse(cf.mOnComplete, null, ar.exception); break; case EVENT_GET_CALL_FORWARD_DONE: Loading @@ -1567,7 +1730,9 @@ public class ImsPhone extends ImsPhoneBase { if (ar.exception == null) { cfInfos = handleCfQueryResult((ImsCallForwardInfo[])ar.result); } sendResponse((Message) ar.userObj, cfInfos, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, cfInfos); } break; case EVENT_GET_CALL_BARRING_DONE: Loading @@ -1580,7 +1745,9 @@ public class ImsPhone extends ImsPhoneBase { ssInfos = handleCwQueryResult((ImsSsInfo[])ar.result); } } sendResponse((Message) ar.userObj, ssInfos, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, ssInfos); } break; case EVENT_GET_CLIR_DONE: Loading @@ -1591,17 +1758,23 @@ public class ImsPhone extends ImsPhoneBase { // that for compatibility clirInfo = ssInfo.getCompatArray(ImsSsData.SS_CLIR); } sendResponse((Message) ar.userObj, clirInfo, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, clirInfo); } break; case EVENT_SET_CLIR_DONE: if (ar.exception == null) { saveClirSetting(msg.arg1); if (ss != null) { saveClirSetting(ss.mClirMode); } } // (Intentional fallthrough) case EVENT_SET_CALL_BARRING_DONE: case EVENT_SET_CALL_WAITING_DONE: sendResponse((Message) ar.userObj, null, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, null); } break; case EVENT_DEFAULT_PHONE_DATA_STATE_CHANGED: Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneMmiCode.java +15 −7 Original line number Diff line number Diff line Loading @@ -1287,6 +1287,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { return mContext.getText(com.android.internal.R.string.stk_cc_ss_to_ss); } else if (err.getCommandError() == CommandException.Error.SS_MODIFIED_TO_DIAL_VIDEO) { return mContext.getText(com.android.internal.R.string.stk_cc_ss_to_dial_video); } else if (err.getCommandError() == CommandException.Error.INTERNAL_ERR) { return mContext.getText(com.android.internal.R.string.mmiError); } } return null; Loading Loading @@ -1572,8 +1574,11 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { } else { Rlog.d(LOG_TAG, "onSuppSvcQueryComplete: Received Call Barring Response."); // Response for Call Barring queries. int[] cbInfos = (int[]) ar.result; if (cbInfos[0] == 1) { int[] infos = (int[]) ar.result; if (infos == null || infos.length == 0) { sb.append(mContext.getText(com.android.internal.R.string.mmiError)); } else { if (infos[0] == 1) { sb.append(mContext.getText(com.android.internal.R.string.serviceEnabled)); mState = State.COMPLETE; } else { Loading @@ -1582,6 +1587,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { } } } } mMessage = sb; Rlog.d(LOG_TAG, "onSuppSvcQueryComplete mmi=" + this); Loading Loading @@ -1641,6 +1647,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { if (ar.exception != null) { if (ar.exception instanceof ImsException) { sb.append(getImsErrorMessage(ar)); } else { sb.append(getErrorMessage(ar)); } } else { ImsSsInfo ssInfo = (ImsSsInfo) ar.result; Loading Loading @@ -1737,7 +1745,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { } else { int[] ints = (int[])ar.result; if (ints.length != 0) { if (ints != null && ints.length != 0) { if (ints[0] == 0) { sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled)); mState = State.COMPLETE; Loading tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java +22 −7 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +70 −59 Original line number Diff line number Diff line Loading @@ -2073,6 +2073,26 @@ public class GsmCdmaPhone extends Phone { && mImsPhone.isUtEnabled(); } private boolean isCsRetry(Message onComplete) { if (onComplete != null) { return onComplete.getData().getBoolean(CS_FALLBACK_SS, false); } return false; } @Override public boolean useSsOverIms(Message onComplete) { boolean isUtEnabled = isUtEnabled(); Rlog.d(LOG_TAG, "useSsOverIms: isUtEnabled()= " + isUtEnabled + " isCsRetry(onComplete))= " + isCsRetry(onComplete)); if (isUtEnabled && !isCsRetry(onComplete)) { return true; } return false; } @Override public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) { getCallForwardingOption(commandInterfaceCFReason, Loading @@ -2082,16 +2102,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getCallForwardingOption(int commandInterfaceCFReason, int serviceClass, Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { imsPhone.getCallForwardingOption(commandInterfaceCFReason, serviceClass, onComplete); if (useSsOverIms(onComplete)) { imsPhone.getCallForwardingOption(commandInterfaceCFReason, serviceClass, onComplete); return; } if (isPhoneTypeGsm()) { if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) { if (DBG) logd("requesting call forwarding query."); Message resp; Loading Loading @@ -2126,17 +2143,14 @@ public class GsmCdmaPhone extends Phone { int serviceClass, int timerSeconds, Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { imsPhone.setCallForwardingOption(commandInterfaceCFAction, commandInterfaceCFReason, dialingNumber, serviceClass, timerSeconds, onComplete); if (useSsOverIms(onComplete)) { imsPhone.setCallForwardingOption(commandInterfaceCFAction, commandInterfaceCFReason, dialingNumber, serviceClass, timerSeconds, onComplete); return; } if (isPhoneTypeGsm()) { if ((isValidCommandInterfaceCFAction(commandInterfaceCFAction)) && (isValidCommandInterfaceCFReason(commandInterfaceCFReason))) { Loading Loading @@ -2177,12 +2191,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getCallBarring(String facility, String password, Message onComplete, int serviceClass) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && imsPhone.isUtEnabled()) { if (useSsOverIms(onComplete)) { imsPhone.getCallBarring(facility, password, onComplete, serviceClass); return; } if (isPhoneTypeGsm()) { mCi.queryFacilityLock(facility, password, serviceClass, onComplete); } else { loge("getCallBarringOption: not possible in CDMA"); Loading @@ -2192,12 +2207,13 @@ public class GsmCdmaPhone extends Phone { @Override public void setCallBarring(String facility, boolean lockState, String password, Message onComplete, int serviceClass) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && imsPhone.isUtEnabled()) { if (useSsOverIms(onComplete)) { imsPhone.setCallBarring(facility, lockState, password, onComplete, serviceClass); return; } if (isPhoneTypeGsm()) { mCi.setFacilityLock(facility, lockState, password, serviceClass, onComplete); } else { loge("setCallBarringOption: not possible in CDMA"); Loading @@ -2223,14 +2239,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getOutgoingCallerIdDisplay(Message onComplete) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.getOutgoingCallerIdDisplay(onComplete); return; } if (isPhoneTypeGsm()) { mCi.getCLIR(onComplete); } else { loge("getOutgoingCallerIdDisplay: not possible in CDMA"); Loading @@ -2239,14 +2254,13 @@ public class GsmCdmaPhone extends Phone { @Override public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete) { if (isPhoneTypeGsm()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.setOutgoingCallerIdDisplay(commandInterfaceCLIRMode, onComplete); return; } if (isPhoneTypeGsm()) { // Packing CLIR value in the message. This will be required for // SharedPreference caching, if the message comes back as part of // a success response. Loading @@ -2259,15 +2273,13 @@ public class GsmCdmaPhone extends Phone { @Override public void getCallWaiting(Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.getCallWaiting(onComplete); return; } if (isPhoneTypeGsm()) { //As per 3GPP TS 24.083, section 1.6 UE doesn't need to send service //class parameter in call waiting interrogation to network mCi.queryCallWaiting(CommandsInterface.SERVICE_CLASS_NONE, onComplete); Loading @@ -2293,14 +2305,13 @@ public class GsmCdmaPhone extends Phone { @Override public void setCallWaiting(boolean enable, int serviceClass, Message onComplete) { if (isPhoneTypeGsm() || isImsUtEnabledOverCdma()) { Phone imsPhone = mImsPhone; if ((imsPhone != null) && ((imsPhone.getServiceState().getState() == ServiceState.STATE_IN_SERVICE) || imsPhone.isUtEnabled())) { if (useSsOverIms(onComplete)) { imsPhone.setCallWaiting(enable, onComplete); return; } if (isPhoneTypeGsm()) { mCi.setCallWaiting(enable, serviceClass, onComplete); } else { String cwPrefix = CdmaMmiCode.getCallWaitingPrefix(enable); Loading
src/java/com/android/internal/telephony/Phone.java +8 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * TODO: Replace this with a proper exception; {@link CallStateException} doesn't make sense. */ public static final String CS_FALLBACK = "cs_fallback"; // Used for retry over cs for supplementary services public static final String CS_FALLBACK_SS = "cs_fallback_ss"; /** * @deprecated Use {@link android.telephony.ims.ImsManager#EXTRA_WFC_REGISTRATION_FAILURE_TITLE} * instead. Loading Loading @@ -4268,6 +4272,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return mCarrierPrivilegesTracker; } public boolean useSsOverIms(Message onComplete) { return false; } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("Phone: subId=" + getSubId()); pw.println(" mPhoneId=" + mPhoneId); Loading
src/java/com/android/internal/telephony/imsphone/ImsPhone.java +193 −20 Original line number Diff line number Diff line Loading @@ -301,6 +301,85 @@ public class ImsPhone extends ImsPhoneBase { } } // Create SS (Supplementary Service) so that save SS params & // mOnComplete (Message object passed by client) can be packed // given as a single SS object as user data to UtInterface. @VisibleForTesting public static class SS { int mCfAction; int mCfReason; String mDialingNumber; int mTimerSeconds; boolean mEnable; int mClirMode; String mFacility; boolean mLockState; String mPassword; int mServiceClass; @VisibleForTesting public Message mOnComplete; // Default // Query CW, CLIR SS(Message onComplete) { mOnComplete = onComplete; } // Update CLIP SS(boolean enable, Message onComplete) { mEnable = enable; mOnComplete = onComplete; } // Update CLIR SS(int clirMode, Message onComplete) { mClirMode = clirMode; mOnComplete = onComplete; } // Update CW SS(boolean enable, int serviceClass, Message onComplete) { mEnable = enable; mServiceClass = serviceClass; mOnComplete = onComplete; } // Query CF SS(int cfReason, int serviceClass, Message onComplete) { mCfReason = cfReason; mServiceClass = serviceClass; mOnComplete = onComplete; } // Update CF SS(int cfAction, int cfReason, String dialingNumber, int serviceClass, int timerSeconds, Message onComplete) { mCfAction = cfAction; mCfReason = cfReason; mDialingNumber = dialingNumber; mServiceClass = serviceClass; mTimerSeconds = timerSeconds; mOnComplete = onComplete; } // Query CB SS(String facility, String password, int serviceClass, Message onComplete) { mFacility = facility; mPassword = password; mServiceClass = serviceClass; mOnComplete = onComplete; } // Update CB SS(String facility, boolean lockState, String password, int serviceClass, Message onComplete) { mFacility = facility; mLockState = lockState; mPassword = password; mServiceClass = serviceClass; mOnComplete = onComplete; } } // Constructors public ImsPhone(Context context, PhoneNotifier notifier, Phone defaultPhone) { this(context, notifier, defaultPhone, false); Loading Loading @@ -1009,7 +1088,8 @@ public class ImsPhone extends ImsPhoneBase { public void getOutgoingCallerIdDisplay(Message onComplete) { if (DBG) logd("getCLIR"); Message resp; resp = obtainMessage(EVENT_GET_CLIR_DONE, onComplete); SS ss = new SS(onComplete); resp = obtainMessage(EVENT_GET_CLIR_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1026,7 +1106,8 @@ public class ImsPhone extends ImsPhoneBase { // Packing CLIR value in the message. This will be required for // SharedPreference caching, if the message comes back as part of // a success response. resp = obtainMessage(EVENT_SET_CLIR_DONE, clirMode, 0, onComplete); SS ss = new SS(clirMode, onComplete); resp = obtainMessage(EVENT_SET_CLIR_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); ut.updateCLIR(clirMode, resp); Loading @@ -1050,7 +1131,8 @@ public class ImsPhone extends ImsPhoneBase { if (isValidCommandInterfaceCFReason(commandInterfaceCFReason)) { if (DBG) logd("requesting call forwarding query."); Message resp; resp = obtainMessage(EVENT_GET_CALL_FORWARD_DONE, onComplete); SS ss = new SS(commandInterfaceCFReason, serviceClass, onComplete); resp = obtainMessage(EVENT_GET_CALL_FORWARD_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading Loading @@ -1088,10 +1170,9 @@ public class ImsPhone extends ImsPhoneBase { if ((isValidCommandInterfaceCFAction(commandInterfaceCFAction)) && (isValidCommandInterfaceCFReason(commandInterfaceCFReason))) { Message resp; Cf cf = new Cf(dialingNumber, GsmMmiCode.isVoiceUnconditionalForwarding( commandInterfaceCFReason, serviceClass), onComplete); resp = obtainMessage(EVENT_SET_CALL_FORWARD_DONE, isCfEnable(commandInterfaceCFAction) ? 1 : 0, 0, cf); SS ss = new SS(commandInterfaceCFAction, commandInterfaceCFReason, dialingNumber, serviceClass, timerSeconds, onComplete); resp = obtainMessage(EVENT_SET_CALL_FORWARD_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1114,7 +1195,8 @@ public class ImsPhone extends ImsPhoneBase { public void getCallWaiting(Message onComplete) { if (DBG) logd("getCallWaiting"); Message resp; resp = obtainMessage(EVENT_GET_CALL_WAITING_DONE, onComplete); SS ss = new SS(onComplete); resp = obtainMessage(EVENT_GET_CALL_WAITING_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1141,7 +1223,8 @@ public class ImsPhone extends ImsPhoneBase { public void setCallWaiting(boolean enable, int serviceClass, Message onComplete) { if (DBG) logd("setCallWaiting enable=" + enable); Message resp; resp = obtainMessage(EVENT_SET_CALL_WAITING_DONE, onComplete); SS ss = new SS(enable, serviceClass, onComplete); resp = obtainMessage(EVENT_SET_CALL_WAITING_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading Loading @@ -1188,7 +1271,8 @@ public class ImsPhone extends ImsPhoneBase { int serviceClass) { if (DBG) logd("getCallBarring facility=" + facility + ", serviceClass = " + serviceClass); Message resp; resp = obtainMessage(EVENT_GET_CALL_BARRING_DONE, onComplete); SS ss = new SS(facility, password, serviceClass, onComplete); resp = obtainMessage(EVENT_GET_CALL_BARRING_DONE, ss); try { ImsUtInterface ut = mCT.getUtInterface(); Loading @@ -1213,7 +1297,8 @@ public class ImsPhone extends ImsPhoneBase { + ", lockState=" + lockState + ", serviceClass = " + serviceClass); } Message resp; resp = obtainMessage(EVENT_SET_CALL_BARRING_DONE, onComplete); SS ss = new SS(facility, lockState, password, serviceClass, onComplete); resp = obtainMessage(EVENT_SET_CALL_BARRING_DONE, ss); int action; if (lockState) { Loading Loading @@ -1548,18 +1633,96 @@ public class ImsPhone extends ImsPhoneBase { } } boolean isCsRetryException(Throwable e) { if ((e != null) && (e instanceof ImsException) && (((ImsException)e).getCode() == ImsReasonInfo.CODE_LOCAL_CALL_CS_RETRY_REQUIRED)) { return true; } return false; } private Bundle setCsfbBundle(boolean isCsRetry) { Bundle b = new Bundle(); b.putBoolean(CS_FALLBACK_SS, isCsRetry); return b; } private void sendResponseOrRetryOnCsfbSs(SS ss, int what, Throwable e, Object obj) { if (!isCsRetryException(e)) { sendResponse(ss.mOnComplete, obj, e); return; } Rlog.d(LOG_TAG, "Try CSFB: " + what); ss.mOnComplete.setData(setCsfbBundle(true)); switch (what) { case EVENT_GET_CALL_FORWARD_DONE: mDefaultPhone.getCallForwardingOption(ss.mCfReason, ss.mServiceClass, ss.mOnComplete); break; case EVENT_SET_CALL_FORWARD_DONE: mDefaultPhone.setCallForwardingOption(ss.mCfAction, ss.mCfReason, ss.mDialingNumber, ss.mServiceClass, ss.mTimerSeconds, ss.mOnComplete); break; case EVENT_GET_CALL_BARRING_DONE: mDefaultPhone.getCallBarring(ss.mFacility, ss.mPassword, ss.mOnComplete, ss.mServiceClass); break; case EVENT_SET_CALL_BARRING_DONE: mDefaultPhone.setCallBarring(ss.mFacility, ss.mLockState, ss.mPassword, ss.mOnComplete, ss.mServiceClass); break; case EVENT_GET_CALL_WAITING_DONE: mDefaultPhone.getCallWaiting(ss.mOnComplete); break; case EVENT_SET_CALL_WAITING_DONE: mDefaultPhone.setCallWaiting(ss.mEnable, ss.mServiceClass, ss.mOnComplete); break; case EVENT_GET_CLIR_DONE: mDefaultPhone.getOutgoingCallerIdDisplay(ss.mOnComplete); break; case EVENT_SET_CLIR_DONE: mDefaultPhone.setOutgoingCallerIdDisplay(ss.mClirMode, ss.mOnComplete); break; default: break; } } @Override public void handleMessage(Message msg) { AsyncResult ar = (AsyncResult) msg.obj; Message onComplete; SS ss = null; if (ar.userObj instanceof SS) { ss = (SS) ar.userObj; } if (DBG) logd("handleMessage what=" + msg.what); switch (msg.what) { case EVENT_SET_CALL_FORWARD_DONE: Cf cf = (Cf) ar.userObj; if (cf.mIsCfu && ar.exception == null) { setVoiceCallForwardingFlag(getIccRecords(), 1, msg.arg1 == 1, cf.mSetCfNumber); if (ar.exception == null && ss != null && (ss.mCfReason == CF_REASON_UNCONDITIONAL)) { setVoiceCallForwardingFlag(getIccRecords(), 1, isCfEnable(ss.mCfAction), ss.mDialingNumber); } if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, null); } sendResponse(cf.mOnComplete, null, ar.exception); break; case EVENT_GET_CALL_FORWARD_DONE: Loading @@ -1567,7 +1730,9 @@ public class ImsPhone extends ImsPhoneBase { if (ar.exception == null) { cfInfos = handleCfQueryResult((ImsCallForwardInfo[])ar.result); } sendResponse((Message) ar.userObj, cfInfos, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, cfInfos); } break; case EVENT_GET_CALL_BARRING_DONE: Loading @@ -1580,7 +1745,9 @@ public class ImsPhone extends ImsPhoneBase { ssInfos = handleCwQueryResult((ImsSsInfo[])ar.result); } } sendResponse((Message) ar.userObj, ssInfos, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, ssInfos); } break; case EVENT_GET_CLIR_DONE: Loading @@ -1591,17 +1758,23 @@ public class ImsPhone extends ImsPhoneBase { // that for compatibility clirInfo = ssInfo.getCompatArray(ImsSsData.SS_CLIR); } sendResponse((Message) ar.userObj, clirInfo, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, clirInfo); } break; case EVENT_SET_CLIR_DONE: if (ar.exception == null) { saveClirSetting(msg.arg1); if (ss != null) { saveClirSetting(ss.mClirMode); } } // (Intentional fallthrough) case EVENT_SET_CALL_BARRING_DONE: case EVENT_SET_CALL_WAITING_DONE: sendResponse((Message) ar.userObj, null, ar.exception); if (ss != null) { sendResponseOrRetryOnCsfbSs(ss, msg.what, ar.exception, null); } break; case EVENT_DEFAULT_PHONE_DATA_STATE_CHANGED: Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneMmiCode.java +15 −7 Original line number Diff line number Diff line Loading @@ -1287,6 +1287,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { return mContext.getText(com.android.internal.R.string.stk_cc_ss_to_ss); } else if (err.getCommandError() == CommandException.Error.SS_MODIFIED_TO_DIAL_VIDEO) { return mContext.getText(com.android.internal.R.string.stk_cc_ss_to_dial_video); } else if (err.getCommandError() == CommandException.Error.INTERNAL_ERR) { return mContext.getText(com.android.internal.R.string.mmiError); } } return null; Loading Loading @@ -1572,8 +1574,11 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { } else { Rlog.d(LOG_TAG, "onSuppSvcQueryComplete: Received Call Barring Response."); // Response for Call Barring queries. int[] cbInfos = (int[]) ar.result; if (cbInfos[0] == 1) { int[] infos = (int[]) ar.result; if (infos == null || infos.length == 0) { sb.append(mContext.getText(com.android.internal.R.string.mmiError)); } else { if (infos[0] == 1) { sb.append(mContext.getText(com.android.internal.R.string.serviceEnabled)); mState = State.COMPLETE; } else { Loading @@ -1582,6 +1587,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { } } } } mMessage = sb; Rlog.d(LOG_TAG, "onSuppSvcQueryComplete mmi=" + this); Loading Loading @@ -1641,6 +1647,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { if (ar.exception != null) { if (ar.exception instanceof ImsException) { sb.append(getImsErrorMessage(ar)); } else { sb.append(getErrorMessage(ar)); } } else { ImsSsInfo ssInfo = (ImsSsInfo) ar.result; Loading Loading @@ -1737,7 +1745,7 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode { } else { int[] ints = (int[])ar.result; if (ints.length != 0) { if (ints != null && ints.length != 0) { if (ints[0] == 0) { sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled)); mState = State.COMPLETE; Loading
tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneTest.java +22 −7 File changed.Preview size limit exceeded, changes collapsed. Show changes