Loading src/java/com/android/internal/telephony/CallStateException.java +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,10 @@ public class CallStateException extends Exception public static final int ERROR_OUT_OF_SERVICE = 1; public static final int ERROR_POWER_OFF = 2; public static final int ERROR_ALREADY_DIALING = 3; public static final int ERROR_CALL_RINGING = 4; public static final int ERROR_CALLING_DISABLED = 5; public static final int ERROR_TOO_MANY_CALLS = 6; public CallStateException() Loading src/java/com/android/internal/telephony/GsmCdmaCallTracker.java +41 −37 Original line number Diff line number Diff line Loading @@ -274,9 +274,8 @@ public class GsmCdmaCallTracker extends CallTracker { // note that this triggers call state changed notif clearDisconnected(); if (!canDial()) { throw new CallStateException("cannot dial in current state"); } // Check for issues which would preclude dialing and throw a CallStateException. checkForDialIssues(); String origNumber = dialString; dialString = convertNumberIfNecessary(mPhone, dialString); Loading Loading @@ -385,9 +384,8 @@ public class GsmCdmaCallTracker extends CallTracker { // note that this triggers call state changed notif clearDisconnected(); if (!canDial()) { throw new CallStateException("cannot dial in current state"); } // Check for issues which would preclude dialing and throw a CallStateException. checkForDialIssues(); TelephonyManager tm = (TelephonyManager) mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE); Loading Loading @@ -613,41 +611,47 @@ public class GsmCdmaCallTracker extends CallTracker { && !mForegroundCall.isFull(); } private boolean canDial() { boolean ret; /** * Determines if there are issues which would preclude dialing an outgoing call. Throws a * {@link CallStateException} if there is an issue. * @throws CallStateException */ public void checkForDialIssues() throws CallStateException { int serviceState = mPhone.getServiceState().getState(); String disableCall = SystemProperties.get( TelephonyProperties.PROPERTY_DISABLE_CALL, "false"); ret = (serviceState != ServiceState.STATE_POWER_OFF) && mPendingMO == null && !mRingingCall.isRinging() && !disableCall.equals("true") && (!mForegroundCall.getState().isAlive() || !mBackgroundCall.getState().isAlive() || (!isPhoneTypeGsm() && mForegroundCall.getState() == GsmCdmaCall.State.ACTIVE)); if (!ret) { log(String.format("canDial is false\n" + "((serviceState=%d) != ServiceState.STATE_POWER_OFF)::=%s\n" + "&& pendingMO == null::=%s\n" + "&& !ringingCall.isRinging()::=%s\n" + "&& !disableCall.equals(\"true\")::=%s\n" + "&& (!foregroundCall.getState().isAlive()::=%s\n" + " || foregroundCall.getState() == GsmCdmaCall.State.ACTIVE::=%s\n" + " ||!backgroundCall.getState().isAlive())::=%s)", serviceState, serviceState != ServiceState.STATE_POWER_OFF, mPendingMO == null, !mRingingCall.isRinging(), !disableCall.equals("true"), !mForegroundCall.getState().isAlive(), mForegroundCall.getState() == GsmCdmaCall.State.ACTIVE, !mBackgroundCall.getState().isAlive())); } return ret; if (serviceState == ServiceState.STATE_POWER_OFF) { throw new CallStateException(CallStateException.ERROR_POWER_OFF, "Modem not powered"); } if (disableCall.equals("true")) { throw new CallStateException(CallStateException.ERROR_CALLING_DISABLED, "Calling disabled via ro.telephony.disable-call property"); } if (mPendingMO != null) { throw new CallStateException(CallStateException.ERROR_ALREADY_DIALING, "A call is already dialing."); } if (mRingingCall.isRinging()) { throw new CallStateException(CallStateException.ERROR_CALL_RINGING, "Can't call while a call is ringing."); } if (isPhoneTypeGsm() && mForegroundCall.getState().isAlive() && mBackgroundCall.getState().isAlive()) { throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "There is already a foreground and background call."); } if (!isPhoneTypeGsm() // Essentially foreground call state is one of: // HOLDING, DIALING, ALERTING, INCOMING, WAITING && mForegroundCall.getState().isAlive() && mForegroundCall.getState() != GsmCdmaCall.State.ACTIVE && mBackgroundCall.getState().isAlive()) { throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "There is already a foreground and background call."); } } public boolean canTransfer() { Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -1118,7 +1118,7 @@ public class GsmCdmaPhone extends Phone { logi("IMS call failed with Exception: " + e.getMessage() + ". Falling back " + "to CS."); } else { CallStateException ce = new CallStateException(e.getMessage()); CallStateException ce = new CallStateException(e.getError(), e.getMessage()); ce.setStackTrace(e.getStackTrace()); throw ce; } Loading src/java/com/android/internal/telephony/imsphone/ImsPhone.java +6 −1 Original line number Diff line number Diff line Loading @@ -365,7 +365,12 @@ public class ImsPhone extends ImsPhoneBase { } public boolean canDial() { return mCT.canDial(); try { mCT.checkForDialIssues(); } catch (CallStateException cse) { return false; } return true; } @Override Loading src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +28 −15 Original line number Diff line number Diff line Loading @@ -934,9 +934,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { throw new CallStateException("service not available"); } if (!canDial()) { throw new CallStateException("cannot dial in current state"); } // See if there are any issues which preclude placing a call; throw a CallStateException // if there is. checkForDialIssues(); if (isPhoneInEcmMode && isEmergencyNumber) { handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER); Loading @@ -957,8 +957,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { // there on hold if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) { if (mBackgroundCall.getState() != ImsPhoneCall.State.IDLE) { //we should have failed in !canDial() above before we get here throw new CallStateException("cannot dial in current state"); //we should have failed in checkForDialIssues above before we get here throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "Already too many ongoing calls."); } // foreground call is empty for the newly dialed connection holdBeforeDial = true; Loading Loading @@ -1517,18 +1518,30 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { && !mForegroundCall.isFull(); } public boolean canDial() { boolean ret; /** * Determines if there are issues which would preclude dialing an outgoing call. Throws a * {@link CallStateException} if there is an issue. * @throws CallStateException */ public void checkForDialIssues() throws CallStateException { String disableCall = SystemProperties.get( TelephonyProperties.PROPERTY_DISABLE_CALL, "false"); ret = mPendingMO == null && !mRingingCall.isRinging() && !disableCall.equals("true") && (!mForegroundCall.getState().isAlive() || !mBackgroundCall.getState().isAlive()); return ret; if (disableCall.equals("true")) { throw new CallStateException(CallStateException.ERROR_CALLING_DISABLED, "ro.telephony.disable-call has been used to disable calling."); } if (mPendingMO != null) { throw new CallStateException(CallStateException.ERROR_ALREADY_DIALING, "Another outgoing call is already being dialed."); } if (mRingingCall.isRinging()) { throw new CallStateException(CallStateException.ERROR_CALL_RINGING, "Can't place a call while another is ringing."); } if (mForegroundCall.getState().isAlive() & mBackgroundCall.getState().isAlive()) { throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "Already an active foreground and background call."); } } public boolean Loading Loading
src/java/com/android/internal/telephony/CallStateException.java +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,10 @@ public class CallStateException extends Exception public static final int ERROR_OUT_OF_SERVICE = 1; public static final int ERROR_POWER_OFF = 2; public static final int ERROR_ALREADY_DIALING = 3; public static final int ERROR_CALL_RINGING = 4; public static final int ERROR_CALLING_DISABLED = 5; public static final int ERROR_TOO_MANY_CALLS = 6; public CallStateException() Loading
src/java/com/android/internal/telephony/GsmCdmaCallTracker.java +41 −37 Original line number Diff line number Diff line Loading @@ -274,9 +274,8 @@ public class GsmCdmaCallTracker extends CallTracker { // note that this triggers call state changed notif clearDisconnected(); if (!canDial()) { throw new CallStateException("cannot dial in current state"); } // Check for issues which would preclude dialing and throw a CallStateException. checkForDialIssues(); String origNumber = dialString; dialString = convertNumberIfNecessary(mPhone, dialString); Loading Loading @@ -385,9 +384,8 @@ public class GsmCdmaCallTracker extends CallTracker { // note that this triggers call state changed notif clearDisconnected(); if (!canDial()) { throw new CallStateException("cannot dial in current state"); } // Check for issues which would preclude dialing and throw a CallStateException. checkForDialIssues(); TelephonyManager tm = (TelephonyManager) mPhone.getContext().getSystemService(Context.TELEPHONY_SERVICE); Loading Loading @@ -613,41 +611,47 @@ public class GsmCdmaCallTracker extends CallTracker { && !mForegroundCall.isFull(); } private boolean canDial() { boolean ret; /** * Determines if there are issues which would preclude dialing an outgoing call. Throws a * {@link CallStateException} if there is an issue. * @throws CallStateException */ public void checkForDialIssues() throws CallStateException { int serviceState = mPhone.getServiceState().getState(); String disableCall = SystemProperties.get( TelephonyProperties.PROPERTY_DISABLE_CALL, "false"); ret = (serviceState != ServiceState.STATE_POWER_OFF) && mPendingMO == null && !mRingingCall.isRinging() && !disableCall.equals("true") && (!mForegroundCall.getState().isAlive() || !mBackgroundCall.getState().isAlive() || (!isPhoneTypeGsm() && mForegroundCall.getState() == GsmCdmaCall.State.ACTIVE)); if (!ret) { log(String.format("canDial is false\n" + "((serviceState=%d) != ServiceState.STATE_POWER_OFF)::=%s\n" + "&& pendingMO == null::=%s\n" + "&& !ringingCall.isRinging()::=%s\n" + "&& !disableCall.equals(\"true\")::=%s\n" + "&& (!foregroundCall.getState().isAlive()::=%s\n" + " || foregroundCall.getState() == GsmCdmaCall.State.ACTIVE::=%s\n" + " ||!backgroundCall.getState().isAlive())::=%s)", serviceState, serviceState != ServiceState.STATE_POWER_OFF, mPendingMO == null, !mRingingCall.isRinging(), !disableCall.equals("true"), !mForegroundCall.getState().isAlive(), mForegroundCall.getState() == GsmCdmaCall.State.ACTIVE, !mBackgroundCall.getState().isAlive())); } return ret; if (serviceState == ServiceState.STATE_POWER_OFF) { throw new CallStateException(CallStateException.ERROR_POWER_OFF, "Modem not powered"); } if (disableCall.equals("true")) { throw new CallStateException(CallStateException.ERROR_CALLING_DISABLED, "Calling disabled via ro.telephony.disable-call property"); } if (mPendingMO != null) { throw new CallStateException(CallStateException.ERROR_ALREADY_DIALING, "A call is already dialing."); } if (mRingingCall.isRinging()) { throw new CallStateException(CallStateException.ERROR_CALL_RINGING, "Can't call while a call is ringing."); } if (isPhoneTypeGsm() && mForegroundCall.getState().isAlive() && mBackgroundCall.getState().isAlive()) { throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "There is already a foreground and background call."); } if (!isPhoneTypeGsm() // Essentially foreground call state is one of: // HOLDING, DIALING, ALERTING, INCOMING, WAITING && mForegroundCall.getState().isAlive() && mForegroundCall.getState() != GsmCdmaCall.State.ACTIVE && mBackgroundCall.getState().isAlive()) { throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "There is already a foreground and background call."); } } public boolean canTransfer() { Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -1118,7 +1118,7 @@ public class GsmCdmaPhone extends Phone { logi("IMS call failed with Exception: " + e.getMessage() + ". Falling back " + "to CS."); } else { CallStateException ce = new CallStateException(e.getMessage()); CallStateException ce = new CallStateException(e.getError(), e.getMessage()); ce.setStackTrace(e.getStackTrace()); throw ce; } Loading
src/java/com/android/internal/telephony/imsphone/ImsPhone.java +6 −1 Original line number Diff line number Diff line Loading @@ -365,7 +365,12 @@ public class ImsPhone extends ImsPhoneBase { } public boolean canDial() { return mCT.canDial(); try { mCT.checkForDialIssues(); } catch (CallStateException cse) { return false; } return true; } @Override Loading
src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java +28 −15 Original line number Diff line number Diff line Loading @@ -934,9 +934,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { throw new CallStateException("service not available"); } if (!canDial()) { throw new CallStateException("cannot dial in current state"); } // See if there are any issues which preclude placing a call; throw a CallStateException // if there is. checkForDialIssues(); if (isPhoneInEcmMode && isEmergencyNumber) { handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER); Loading @@ -957,8 +957,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { // there on hold if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) { if (mBackgroundCall.getState() != ImsPhoneCall.State.IDLE) { //we should have failed in !canDial() above before we get here throw new CallStateException("cannot dial in current state"); //we should have failed in checkForDialIssues above before we get here throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "Already too many ongoing calls."); } // foreground call is empty for the newly dialed connection holdBeforeDial = true; Loading Loading @@ -1517,18 +1518,30 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall { && !mForegroundCall.isFull(); } public boolean canDial() { boolean ret; /** * Determines if there are issues which would preclude dialing an outgoing call. Throws a * {@link CallStateException} if there is an issue. * @throws CallStateException */ public void checkForDialIssues() throws CallStateException { String disableCall = SystemProperties.get( TelephonyProperties.PROPERTY_DISABLE_CALL, "false"); ret = mPendingMO == null && !mRingingCall.isRinging() && !disableCall.equals("true") && (!mForegroundCall.getState().isAlive() || !mBackgroundCall.getState().isAlive()); return ret; if (disableCall.equals("true")) { throw new CallStateException(CallStateException.ERROR_CALLING_DISABLED, "ro.telephony.disable-call has been used to disable calling."); } if (mPendingMO != null) { throw new CallStateException(CallStateException.ERROR_ALREADY_DIALING, "Another outgoing call is already being dialed."); } if (mRingingCall.isRinging()) { throw new CallStateException(CallStateException.ERROR_CALL_RINGING, "Can't place a call while another is ringing."); } if (mForegroundCall.getState().isAlive() & mBackgroundCall.getState().isAlive()) { throw new CallStateException(CallStateException.ERROR_TOO_MANY_CALLS, "Already an active foreground and background call."); } } public boolean Loading