Loading src/java/com/android/internal/telephony/CallManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ public class CallManager { protected String mDialString; private boolean mSpeedUpAudioForMtCall = false; protected boolean mSpeedUpAudioForMtCall = false; protected CmHandler mHandler; Loading src/java/com/android/internal/telephony/ExtCallManager.java +52 −14 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ public class ExtCallManager extends CallManager { private static final int EVENT_LOCAL_CALL_HOLD = 202; private static final int LOCAL_CALL_HOLD = 1; // Holds the current active SUB, all actions would be // taken on this sub. private static int mActiveSub = 0; Loading Loading @@ -274,8 +276,9 @@ public class ExtCallManager extends CallManager { } Call.State state = call.getState(); if (((state == Call.State.ACTIVE) || (state == Call.State.DIALING) || (state == Call.State.ALERTING)) && (sub != getActiveSubscription())) { if (((state == Call.State.ACTIVE) || (state == Call.State.DIALING) || (state == Call.State.HOLDING) || (state == Call.State.ALERTING)) && (sub != getActiveSubscription())) { // if sub is not an active sub and if it has an active // voice call then update lchStatus as 1 lchStatus = 1; Loading @@ -300,15 +303,22 @@ public class ExtCallManager extends CallManager { switch (getState()) { case RINGING: if (VDBG) Rlog.d(LOG_TAG, "setAudioMode RINGING"); if (mAudioManager.getMode() != AudioManager.MODE_RINGTONE) { int curAudioMode = mAudioManager.getMode(); if (curAudioMode != AudioManager.MODE_RINGTONE) { // only request audio focus if the ringtone is going to be heard if (mAudioManager.getStreamVolume(AudioManager.STREAM_RING) > 0) { Rlog.d(LOG_TAG, "requestAudioFocus on STREAM_RING"); mAudioManager.requestAudioFocusForCall(AudioManager.STREAM_RING, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); } mAudioManager.setMode(AudioManager.MODE_RINGTONE); if (!mSpeedUpAudioForMtCall) { if (DBG) Rlog.d(LOG_TAG, "setAudioMode RINGING"); mAudioManager.setMode(AudioManager.MODE_RINGTONE); } } if (mSpeedUpAudioForMtCall && (curAudioMode != AudioManager.MODE_IN_CALL)) { if (DBG) Rlog.d(LOG_TAG, "setAudioMode IN_CALL"); mAudioManager.setMode(AudioManager.MODE_IN_CALL); } break; case OFFHOOK: Loading @@ -330,7 +340,7 @@ public class ExtCallManager extends CallManager { if (VDBG) Rlog.d(LOG_TAG, "setAudioMode OFFHOOK mode=" + newAudioMode); //Need to discuss with Linux audio on getMode per sub capability? int currMode = mAudioManager.getMode(); if (currMode != newAudioMode) { if (currMode != newAudioMode || mSpeedUpAudioForMtCall) { // request audio focus before setting the new mode mAudioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); Loading @@ -338,6 +348,7 @@ public class ExtCallManager extends CallManager { + currMode + " to " + newAudioMode); mAudioManager.setMode(newAudioMode); } mSpeedUpAudioForMtCall = false; break; case IDLE: if (VDBG) Rlog.d(LOG_TAG, "in setAudioMode before setmode IDLE"); Loading @@ -352,6 +363,7 @@ public class ExtCallManager extends CallManager { // abandon audio focus after the mode has been set back to normal mAudioManager.abandonAudioFocusForCall(); } mSpeedUpAudioForMtCall = false; break; } Rlog.d(LOG_TAG, "setAudioMode State = " + getState()); Loading @@ -363,7 +375,7 @@ public class ExtCallManager extends CallManager { * @return subscription which is active. */ public int getOtherActiveSub(int subscription) { int otherSub = -1; int otherSub = MSimConstants.INVALID_SUBSCRIPTION;; int count = MSimTelephonyManager.getDefault().getPhoneCount(); Rlog.d(LOG_TAG, "is other sub active = " + subscription + count); Loading @@ -378,17 +390,33 @@ public class ExtCallManager extends CallManager { return otherSub; } @Override public void switchToLocalHold(int subscription, boolean switchTo) { Phone activePhone = null; Phone heldPhone = null; public void updateLchOnOtherSub(int subscription) { Phone bgPhone = null; int otherActiveSub = getOtherActiveSub(subscription); Rlog.d(LOG_TAG, " switchToLocalHold update audio state"); setAudioMode(); Rlog.d(LOG_TAG, " updateLchOnOtherSub subscription: " + subscription); if (otherActiveSub != MSimConstants.INVALID_SUBSCRIPTION) { if (getActiveFgCallState(otherActiveSub) == Call.State.IDLE) { // if there is active bg call, set the phone to bgPhone. if (hasActiveBgCall(otherActiveSub)) { bgPhone = getBgPhone(otherActiveSub); } } else { bgPhone = getFgPhone(otherActiveSub); } //TODO Inform LCH sub to modem // Update state only if the new state is different if ((LOCAL_CALL_HOLD != mLchStatus[otherActiveSub]) && (bgPhone != null)) { Rlog.d(LOG_TAG, " setLocal Call Hold on sub: " + otherActiveSub); bgPhone.setLocalCallHold(LOCAL_CALL_HOLD, mHandler.obtainMessage(EVENT_LOCAL_CALL_HOLD)); mLchStatus[otherActiveSub] = LOCAL_CALL_HOLD; } } } /** * Whether or not the phone can conference in the current phone * state--that is, one call holding and one call active. Loading Loading @@ -445,6 +473,14 @@ public class ExtCallManager extends CallManager { } } @Override public void acceptCall(Call ringingCall, int callType) throws CallStateException { updateLchOnOtherSub(ringingCall.getPhone().getSubscription()); super.acceptCall(ringingCall, callType); } /** * Initiate a new voice connection. This happens asynchronously, so you * cannot assume the audio path is connected (or a call index has been Loading Loading @@ -493,6 +529,8 @@ public class ExtCallManager extends CallManager { } } updateLchOnOtherSub(subscription); if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) { result = basePhone.dial(dialString, callType, extras); } else { Loading src/java/com/android/internal/telephony/PhoneBase.java +10 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,11 @@ import static com.android.internal.telephony.MSimConstants.DEFAULT_SUBSCRIPTION; public abstract class PhoneBase extends Handler implements Phone { private static final String LOG_TAG = "PhoneBase"; /** * Indicates whether Out Of Service is considered as data call disconnect. */ protected static final String PROPERTY_OOS_IS_DISCONNECT = "persist.telephony.oosisdc"; // Key used to read and write the saved network selection numeric value public static final String NETWORK_SELECTION_KEY = "network_selection_key"; // Key used to read and write the saved network selection operator name Loading Loading @@ -182,6 +187,10 @@ public abstract class PhoneBase extends Handler implements Phone { return mActionAttached; } // Flag that indicates that Out Of Service is considered as data call disconnect protected boolean mOosIsDisconnect = SystemProperties.getBoolean( PROPERTY_OOS_IS_DISCONNECT, false); /** * Set a system property, unless we're in unit test mode */ Loading Loading @@ -320,6 +329,7 @@ public abstract class PhoneBase extends Handler implements Phone { mSmsUsageMonitor = new SmsUsageMonitor(context); mUiccController = UiccController.getInstance(); mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null); Rlog.d(LOG_TAG, "mOosIsDisconnect=" + mOosIsDisconnect); } @Override Loading src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java +13 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Message; import android.preference.PreferenceManager; import android.provider.Telephony; import android.telephony.Rlog; import android.telephony.ServiceState; import com.android.internal.telephony.CommandsInterface; Loading Loading @@ -112,6 +113,10 @@ public class CDMALTEPhone extends CDMAPhone { // removeReferences() have already been called ret = PhoneConstants.DataState.DISCONNECTED; } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE && mOosIsDisconnect) { ret = PhoneConstants.DataState.DISCONNECTED; log("getDataConnectionState: Data is Out of Service. ret = " + ret); } else if (mDcTracker.isApnTypeEnabled(apnType) == false) { ret = PhoneConstants.DataState.DISCONNECTED; } else { Loading Loading @@ -237,11 +242,14 @@ public class CDMALTEPhone extends CDMAPhone { return false; } // return IMSI from USIM as subscriber ID. @Override public String getSubscriberId() { if ((super.getSubscriberId()) != null) { return super.getSubscriberId(); } else { return (mSimRecords != null) ? mSimRecords.getIMSI() : ""; } } // return GID1 from USIM @Override Loading src/java/com/android/internal/telephony/cdma/CDMAPhone.java +12 −2 Original line number Diff line number Diff line Loading @@ -532,7 +532,15 @@ public class CDMAPhone extends PhoneBase { @Override public String getSubscriberId() { return mSST.getImsi(); if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) { return mSST.getNvImsi(); } else { IccRecords r = mIccRecords.get(); if (r != null) { return r.getIMSI(); } } return null; } @Override Loading Loading @@ -715,10 +723,12 @@ public class CDMAPhone extends PhoneBase { // already been called ret = PhoneConstants.DataState.DISCONNECTED; } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE) { } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE && mOosIsDisconnect) { // If we're out of service, open TCP sockets may still work // but no data will flow ret = PhoneConstants.DataState.DISCONNECTED; log("getDataConnectionState: Data is Out of Service. ret = " + ret); } else if (mDcTracker.isApnTypeEnabled(apnType) == false || mDcTracker.isApnTypeActive(apnType) == false) { ret = PhoneConstants.DataState.DISCONNECTED; Loading Loading
src/java/com/android/internal/telephony/CallManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ public class CallManager { protected String mDialString; private boolean mSpeedUpAudioForMtCall = false; protected boolean mSpeedUpAudioForMtCall = false; protected CmHandler mHandler; Loading
src/java/com/android/internal/telephony/ExtCallManager.java +52 −14 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ public class ExtCallManager extends CallManager { private static final int EVENT_LOCAL_CALL_HOLD = 202; private static final int LOCAL_CALL_HOLD = 1; // Holds the current active SUB, all actions would be // taken on this sub. private static int mActiveSub = 0; Loading Loading @@ -274,8 +276,9 @@ public class ExtCallManager extends CallManager { } Call.State state = call.getState(); if (((state == Call.State.ACTIVE) || (state == Call.State.DIALING) || (state == Call.State.ALERTING)) && (sub != getActiveSubscription())) { if (((state == Call.State.ACTIVE) || (state == Call.State.DIALING) || (state == Call.State.HOLDING) || (state == Call.State.ALERTING)) && (sub != getActiveSubscription())) { // if sub is not an active sub and if it has an active // voice call then update lchStatus as 1 lchStatus = 1; Loading @@ -300,15 +303,22 @@ public class ExtCallManager extends CallManager { switch (getState()) { case RINGING: if (VDBG) Rlog.d(LOG_TAG, "setAudioMode RINGING"); if (mAudioManager.getMode() != AudioManager.MODE_RINGTONE) { int curAudioMode = mAudioManager.getMode(); if (curAudioMode != AudioManager.MODE_RINGTONE) { // only request audio focus if the ringtone is going to be heard if (mAudioManager.getStreamVolume(AudioManager.STREAM_RING) > 0) { Rlog.d(LOG_TAG, "requestAudioFocus on STREAM_RING"); mAudioManager.requestAudioFocusForCall(AudioManager.STREAM_RING, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); } mAudioManager.setMode(AudioManager.MODE_RINGTONE); if (!mSpeedUpAudioForMtCall) { if (DBG) Rlog.d(LOG_TAG, "setAudioMode RINGING"); mAudioManager.setMode(AudioManager.MODE_RINGTONE); } } if (mSpeedUpAudioForMtCall && (curAudioMode != AudioManager.MODE_IN_CALL)) { if (DBG) Rlog.d(LOG_TAG, "setAudioMode IN_CALL"); mAudioManager.setMode(AudioManager.MODE_IN_CALL); } break; case OFFHOOK: Loading @@ -330,7 +340,7 @@ public class ExtCallManager extends CallManager { if (VDBG) Rlog.d(LOG_TAG, "setAudioMode OFFHOOK mode=" + newAudioMode); //Need to discuss with Linux audio on getMode per sub capability? int currMode = mAudioManager.getMode(); if (currMode != newAudioMode) { if (currMode != newAudioMode || mSpeedUpAudioForMtCall) { // request audio focus before setting the new mode mAudioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); Loading @@ -338,6 +348,7 @@ public class ExtCallManager extends CallManager { + currMode + " to " + newAudioMode); mAudioManager.setMode(newAudioMode); } mSpeedUpAudioForMtCall = false; break; case IDLE: if (VDBG) Rlog.d(LOG_TAG, "in setAudioMode before setmode IDLE"); Loading @@ -352,6 +363,7 @@ public class ExtCallManager extends CallManager { // abandon audio focus after the mode has been set back to normal mAudioManager.abandonAudioFocusForCall(); } mSpeedUpAudioForMtCall = false; break; } Rlog.d(LOG_TAG, "setAudioMode State = " + getState()); Loading @@ -363,7 +375,7 @@ public class ExtCallManager extends CallManager { * @return subscription which is active. */ public int getOtherActiveSub(int subscription) { int otherSub = -1; int otherSub = MSimConstants.INVALID_SUBSCRIPTION;; int count = MSimTelephonyManager.getDefault().getPhoneCount(); Rlog.d(LOG_TAG, "is other sub active = " + subscription + count); Loading @@ -378,17 +390,33 @@ public class ExtCallManager extends CallManager { return otherSub; } @Override public void switchToLocalHold(int subscription, boolean switchTo) { Phone activePhone = null; Phone heldPhone = null; public void updateLchOnOtherSub(int subscription) { Phone bgPhone = null; int otherActiveSub = getOtherActiveSub(subscription); Rlog.d(LOG_TAG, " switchToLocalHold update audio state"); setAudioMode(); Rlog.d(LOG_TAG, " updateLchOnOtherSub subscription: " + subscription); if (otherActiveSub != MSimConstants.INVALID_SUBSCRIPTION) { if (getActiveFgCallState(otherActiveSub) == Call.State.IDLE) { // if there is active bg call, set the phone to bgPhone. if (hasActiveBgCall(otherActiveSub)) { bgPhone = getBgPhone(otherActiveSub); } } else { bgPhone = getFgPhone(otherActiveSub); } //TODO Inform LCH sub to modem // Update state only if the new state is different if ((LOCAL_CALL_HOLD != mLchStatus[otherActiveSub]) && (bgPhone != null)) { Rlog.d(LOG_TAG, " setLocal Call Hold on sub: " + otherActiveSub); bgPhone.setLocalCallHold(LOCAL_CALL_HOLD, mHandler.obtainMessage(EVENT_LOCAL_CALL_HOLD)); mLchStatus[otherActiveSub] = LOCAL_CALL_HOLD; } } } /** * Whether or not the phone can conference in the current phone * state--that is, one call holding and one call active. Loading Loading @@ -445,6 +473,14 @@ public class ExtCallManager extends CallManager { } } @Override public void acceptCall(Call ringingCall, int callType) throws CallStateException { updateLchOnOtherSub(ringingCall.getPhone().getSubscription()); super.acceptCall(ringingCall, callType); } /** * Initiate a new voice connection. This happens asynchronously, so you * cannot assume the audio path is connected (or a call index has been Loading Loading @@ -493,6 +529,8 @@ public class ExtCallManager extends CallManager { } } updateLchOnOtherSub(subscription); if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) { result = basePhone.dial(dialString, callType, extras); } else { Loading
src/java/com/android/internal/telephony/PhoneBase.java +10 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,11 @@ import static com.android.internal.telephony.MSimConstants.DEFAULT_SUBSCRIPTION; public abstract class PhoneBase extends Handler implements Phone { private static final String LOG_TAG = "PhoneBase"; /** * Indicates whether Out Of Service is considered as data call disconnect. */ protected static final String PROPERTY_OOS_IS_DISCONNECT = "persist.telephony.oosisdc"; // Key used to read and write the saved network selection numeric value public static final String NETWORK_SELECTION_KEY = "network_selection_key"; // Key used to read and write the saved network selection operator name Loading Loading @@ -182,6 +187,10 @@ public abstract class PhoneBase extends Handler implements Phone { return mActionAttached; } // Flag that indicates that Out Of Service is considered as data call disconnect protected boolean mOosIsDisconnect = SystemProperties.getBoolean( PROPERTY_OOS_IS_DISCONNECT, false); /** * Set a system property, unless we're in unit test mode */ Loading Loading @@ -320,6 +329,7 @@ public abstract class PhoneBase extends Handler implements Phone { mSmsUsageMonitor = new SmsUsageMonitor(context); mUiccController = UiccController.getInstance(); mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null); Rlog.d(LOG_TAG, "mOosIsDisconnect=" + mOosIsDisconnect); } @Override Loading
src/java/com/android/internal/telephony/cdma/CDMALTEPhone.java +13 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Message; import android.preference.PreferenceManager; import android.provider.Telephony; import android.telephony.Rlog; import android.telephony.ServiceState; import com.android.internal.telephony.CommandsInterface; Loading Loading @@ -112,6 +113,10 @@ public class CDMALTEPhone extends CDMAPhone { // removeReferences() have already been called ret = PhoneConstants.DataState.DISCONNECTED; } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE && mOosIsDisconnect) { ret = PhoneConstants.DataState.DISCONNECTED; log("getDataConnectionState: Data is Out of Service. ret = " + ret); } else if (mDcTracker.isApnTypeEnabled(apnType) == false) { ret = PhoneConstants.DataState.DISCONNECTED; } else { Loading Loading @@ -237,11 +242,14 @@ public class CDMALTEPhone extends CDMAPhone { return false; } // return IMSI from USIM as subscriber ID. @Override public String getSubscriberId() { if ((super.getSubscriberId()) != null) { return super.getSubscriberId(); } else { return (mSimRecords != null) ? mSimRecords.getIMSI() : ""; } } // return GID1 from USIM @Override Loading
src/java/com/android/internal/telephony/cdma/CDMAPhone.java +12 −2 Original line number Diff line number Diff line Loading @@ -532,7 +532,15 @@ public class CDMAPhone extends PhoneBase { @Override public String getSubscriberId() { return mSST.getImsi(); if (mCdmaSubscriptionSource == CDMA_SUBSCRIPTION_NV) { return mSST.getNvImsi(); } else { IccRecords r = mIccRecords.get(); if (r != null) { return r.getIMSI(); } } return null; } @Override Loading Loading @@ -715,10 +723,12 @@ public class CDMAPhone extends PhoneBase { // already been called ret = PhoneConstants.DataState.DISCONNECTED; } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE) { } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE && mOosIsDisconnect) { // If we're out of service, open TCP sockets may still work // but no data will flow ret = PhoneConstants.DataState.DISCONNECTED; log("getDataConnectionState: Data is Out of Service. ret = " + ret); } else if (mDcTracker.isApnTypeEnabled(apnType) == false || mDcTracker.isApnTypeActive(apnType) == false) { ret = PhoneConstants.DataState.DISCONNECTED; Loading