Loading telephony/java/android/telephony/PhoneNumberUtils.java +9 −0 Original line number Diff line number Diff line Loading @@ -1648,6 +1648,15 @@ public class PhoneNumberUtils return retVal; } /** * @hide * @param number * @return true if number contains @ */ public static boolean isUriNumber(String number) { return number != null && number.contains("@"); } /** * This function handles the plus code conversion within NANP CDMA network * If the number format is Loading telephony/java/com/android/internal/telephony/CallManager.java +111 −8 Original line number Diff line number Diff line Loading @@ -21,12 +21,18 @@ import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.RegistrantList; import android.util.Log; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * @hide * Loading @@ -46,6 +52,9 @@ import java.util.List; */ public final class CallManager { private static final String LOG_TAG ="GSM"; private static final boolean LOCAL_DEBUG = true; private static final int EVENT_DISCONNECT = 100; private static final int EVENT_PRECISE_CALL_STATE_CHANGED = 101; private static final int EVENT_NEW_RINGING_CONNECTION = 102; Loading Loading @@ -190,6 +199,41 @@ public final class CallManager { return s; } /** * @return the service state of CallManager, which represents the * highest priority state of all the service states of phones * * The priority is defined as * * STATE_IN_SERIVCE > STATE_OUT_OF_SERIVCE > STATE_EMERGENCY > STATE_POWER_OFF * */ public int getServiceState() { int resultState = ServiceState.STATE_OUT_OF_SERVICE; for (Phone phone : mPhones) { int serviceState = phone.getServiceState().getState(); if (serviceState == ServiceState.STATE_IN_SERVICE) { // IN_SERVICE has the highest priority resultState = serviceState; break; } else if (serviceState == ServiceState.STATE_OUT_OF_SERVICE) { // OUT_OF_SERVICE replaces EMERGENCY_ONLY and POWER_OFF // Note: EMERGENCY_ONLY is not in use at this moment if ( resultState == ServiceState.STATE_EMERGENCY_ONLY || resultState == ServiceState.STATE_POWER_OFF) { resultState = serviceState; } } else if (serviceState == ServiceState.STATE_EMERGENCY_ONLY) { if (resultState == ServiceState.STATE_POWER_OFF) { resultState = serviceState; } } } return resultState; } /** * Register phone to CallManager * @param phone Loading @@ -210,6 +254,34 @@ public final class CallManager { return false; } /** * return the default phone or null if no phone available */ public Phone getDefaultPhone() { return mDefaultPhone; } /** * @return the phone associated with the foreground call */ public Phone getFgPhone() { return getActiveFgCall().getPhone(); } /** * @return the phone associated with the background call */ public Phone getBgPhone() { return getFirstActiveBgCall().getPhone(); } /** * @return the phone associated with the ringing call */ public Phone getRingingPhone() { return getFirstActiveRingingCall().getPhone(); } /** * unregister phone from CallManager * @param phone Loading Loading @@ -291,9 +363,13 @@ public final class CallManager { if ( hasActiveFgCall() ) { Phone activePhone = getActiveFgCall().getPhone(); boolean hasBgCall = activePhone.getBackgroundCall().isIdle(); boolean hasBgCall = ! (activePhone.getBackgroundCall().isIdle()); boolean sameChannel = (activePhone == ringingPhone); if (LOCAL_DEBUG) { Log.d(LOG_TAG, "hasBgCall: "+ hasBgCall + "sameChannel:" + sameChannel); } if (sameChannel && hasBgCall) { getActiveFgCall().hangup(); } else if (!sameChannel && !hasBgCall) { Loading Loading @@ -322,14 +398,21 @@ public final class CallManager { } /** * Places any active calls on hold, and makes any held calls * active. Switch occurs asynchronously and may fail. * Places active call on hold, and makes held call active. * Switch occurs asynchronously and may fail. * * There are 4 scenarios * 1. only active call but no held call, aka, hold * 2. no active call but only held call, aka, unhold * 3. both active and held calls from same phone, aka, swap * 4. active and held calls from different phones, aka, phone swap * * Final notification occurs via * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, * java.lang.Object) registerForPreciseCallStateChanged()}. * * @exception CallStateException if active call is ringing, waiting, or * dialing/alerting, or heldCall can�t be active. * dialing/alerting, or heldCall can't be active. * In these cases, this operation may not be performed. */ public void switchHoldingAndActive(Call heldCall) throws CallStateException { Loading @@ -344,12 +427,14 @@ public final class CallManager { heldPhone = heldCall.getPhone(); } if (activePhone != heldPhone) { if (activePhone != null) { activePhone.switchHoldingAndActive(); } if (heldPhone != null && heldPhone != activePhone) { heldPhone.switchHoldingAndActive(); } } /** * Whether or not the phone can conference in the current phone Loading Loading @@ -398,6 +483,24 @@ public final class CallManager { * handled asynchronously. */ public Connection dial(Phone phone, String dialString) throws CallStateException { if ( hasActiveFgCall() ) { Phone activePhone = getActiveFgCall().getPhone(); boolean hasBgCall = !(activePhone.getBackgroundCall().isIdle()); if (LOCAL_DEBUG) { Log.d(LOG_TAG, "hasBgCall: "+ hasBgCall + "sameChannel:" + (activePhone != phone)); } if (activePhone != phone) { if (hasBgCall) { Log.d(LOG_TAG, "Hangup"); getActiveFgCall().hangup(); } else { Log.d(LOG_TAG, "Switch"); activePhone.switchHoldingAndActive(); } } } return phone.dial(dialString); } Loading Loading @@ -975,7 +1078,7 @@ public final class CallManager { * @return list of ringing calls */ public ArrayList<Call> getRingingCalls() { return mBackgroundCalls; return mRingingCalls; } /** Loading telephony/java/com/android/internal/telephony/Phone.java +1 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,7 @@ public interface Phone { static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE; static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE; static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE; static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; // Used for preferred network type // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone Loading telephony/java/com/android/internal/telephony/RILConstants.java +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public interface RILConstants { int NO_PHONE = 0; int GSM_PHONE = 1; int CDMA_PHONE = 2; int SIP_PHONE = 3; int CDM_TTY_MODE_DISABLED = 0; int CDM_TTY_MODE_ENABLED = 1; Loading Loading
telephony/java/android/telephony/PhoneNumberUtils.java +9 −0 Original line number Diff line number Diff line Loading @@ -1648,6 +1648,15 @@ public class PhoneNumberUtils return retVal; } /** * @hide * @param number * @return true if number contains @ */ public static boolean isUriNumber(String number) { return number != null && number.contains("@"); } /** * This function handles the plus code conversion within NANP CDMA network * If the number format is Loading
telephony/java/com/android/internal/telephony/CallManager.java +111 −8 Original line number Diff line number Diff line Loading @@ -21,12 +21,18 @@ import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.RegistrantList; import android.util.Log; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * @hide * Loading @@ -46,6 +52,9 @@ import java.util.List; */ public final class CallManager { private static final String LOG_TAG ="GSM"; private static final boolean LOCAL_DEBUG = true; private static final int EVENT_DISCONNECT = 100; private static final int EVENT_PRECISE_CALL_STATE_CHANGED = 101; private static final int EVENT_NEW_RINGING_CONNECTION = 102; Loading Loading @@ -190,6 +199,41 @@ public final class CallManager { return s; } /** * @return the service state of CallManager, which represents the * highest priority state of all the service states of phones * * The priority is defined as * * STATE_IN_SERIVCE > STATE_OUT_OF_SERIVCE > STATE_EMERGENCY > STATE_POWER_OFF * */ public int getServiceState() { int resultState = ServiceState.STATE_OUT_OF_SERVICE; for (Phone phone : mPhones) { int serviceState = phone.getServiceState().getState(); if (serviceState == ServiceState.STATE_IN_SERVICE) { // IN_SERVICE has the highest priority resultState = serviceState; break; } else if (serviceState == ServiceState.STATE_OUT_OF_SERVICE) { // OUT_OF_SERVICE replaces EMERGENCY_ONLY and POWER_OFF // Note: EMERGENCY_ONLY is not in use at this moment if ( resultState == ServiceState.STATE_EMERGENCY_ONLY || resultState == ServiceState.STATE_POWER_OFF) { resultState = serviceState; } } else if (serviceState == ServiceState.STATE_EMERGENCY_ONLY) { if (resultState == ServiceState.STATE_POWER_OFF) { resultState = serviceState; } } } return resultState; } /** * Register phone to CallManager * @param phone Loading @@ -210,6 +254,34 @@ public final class CallManager { return false; } /** * return the default phone or null if no phone available */ public Phone getDefaultPhone() { return mDefaultPhone; } /** * @return the phone associated with the foreground call */ public Phone getFgPhone() { return getActiveFgCall().getPhone(); } /** * @return the phone associated with the background call */ public Phone getBgPhone() { return getFirstActiveBgCall().getPhone(); } /** * @return the phone associated with the ringing call */ public Phone getRingingPhone() { return getFirstActiveRingingCall().getPhone(); } /** * unregister phone from CallManager * @param phone Loading Loading @@ -291,9 +363,13 @@ public final class CallManager { if ( hasActiveFgCall() ) { Phone activePhone = getActiveFgCall().getPhone(); boolean hasBgCall = activePhone.getBackgroundCall().isIdle(); boolean hasBgCall = ! (activePhone.getBackgroundCall().isIdle()); boolean sameChannel = (activePhone == ringingPhone); if (LOCAL_DEBUG) { Log.d(LOG_TAG, "hasBgCall: "+ hasBgCall + "sameChannel:" + sameChannel); } if (sameChannel && hasBgCall) { getActiveFgCall().hangup(); } else if (!sameChannel && !hasBgCall) { Loading Loading @@ -322,14 +398,21 @@ public final class CallManager { } /** * Places any active calls on hold, and makes any held calls * active. Switch occurs asynchronously and may fail. * Places active call on hold, and makes held call active. * Switch occurs asynchronously and may fail. * * There are 4 scenarios * 1. only active call but no held call, aka, hold * 2. no active call but only held call, aka, unhold * 3. both active and held calls from same phone, aka, swap * 4. active and held calls from different phones, aka, phone swap * * Final notification occurs via * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, * java.lang.Object) registerForPreciseCallStateChanged()}. * * @exception CallStateException if active call is ringing, waiting, or * dialing/alerting, or heldCall can�t be active. * dialing/alerting, or heldCall can't be active. * In these cases, this operation may not be performed. */ public void switchHoldingAndActive(Call heldCall) throws CallStateException { Loading @@ -344,12 +427,14 @@ public final class CallManager { heldPhone = heldCall.getPhone(); } if (activePhone != heldPhone) { if (activePhone != null) { activePhone.switchHoldingAndActive(); } if (heldPhone != null && heldPhone != activePhone) { heldPhone.switchHoldingAndActive(); } } /** * Whether or not the phone can conference in the current phone Loading Loading @@ -398,6 +483,24 @@ public final class CallManager { * handled asynchronously. */ public Connection dial(Phone phone, String dialString) throws CallStateException { if ( hasActiveFgCall() ) { Phone activePhone = getActiveFgCall().getPhone(); boolean hasBgCall = !(activePhone.getBackgroundCall().isIdle()); if (LOCAL_DEBUG) { Log.d(LOG_TAG, "hasBgCall: "+ hasBgCall + "sameChannel:" + (activePhone != phone)); } if (activePhone != phone) { if (hasBgCall) { Log.d(LOG_TAG, "Hangup"); getActiveFgCall().hangup(); } else { Log.d(LOG_TAG, "Switch"); activePhone.switchHoldingAndActive(); } } } return phone.dial(dialString); } Loading Loading @@ -975,7 +1078,7 @@ public final class CallManager { * @return list of ringing calls */ public ArrayList<Call> getRingingCalls() { return mBackgroundCalls; return mRingingCalls; } /** Loading
telephony/java/com/android/internal/telephony/Phone.java +1 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,7 @@ public interface Phone { static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE; static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE; static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE; static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; // Used for preferred network type // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone Loading
telephony/java/com/android/internal/telephony/RILConstants.java +1 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public interface RILConstants { int NO_PHONE = 0; int GSM_PHONE = 1; int CDMA_PHONE = 2; int SIP_PHONE = 3; int CDM_TTY_MODE_DISABLED = 0; int CDM_TTY_MODE_ENABLED = 1; Loading