Merge "Set network type to ro.telephony.default_network if hiding preferred network type" into mnc-dr-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6eaf051..d71025d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -260,7 +260,7 @@
<!-- Toast in Call settings when asked to launch settings for a secondary user -->
<string name="call_settings_primary_user_only">Call settings can only be changed by the primary user.</string>
<!-- Title of the "Call settings" settings screen, with a text label identifying which SIM the settings are for. -->
- <string name="call_settings_with_label">Call settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
+ <string name="call_settings_with_label">Settings (<xliff:g id="subscriptionlabel" example="Mock Carrier">%s</xliff:g>)</string>
<!-- Title of the alert dialog displayed if an error occurs while updating Call settings -->
<string name="error_updating_title">Call settings error</string>
<!-- Toast in Call settings dialog while settings are being read -->
diff --git a/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java b/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
index 0b701ce..545854d 100644
--- a/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
+++ b/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
@@ -58,7 +58,13 @@
private void takeCall(Context context, Intent intent) {
if (VERBOSE) log("takeCall, intent: " + intent);
- PhoneAccountHandle accountHandle = intent.getParcelableExtra(SipUtil.EXTRA_PHONE_ACCOUNT);
+ PhoneAccountHandle accountHandle = null;
+ try {
+ accountHandle = intent.getParcelableExtra(SipUtil.EXTRA_PHONE_ACCOUNT);
+ } catch (ClassCastException e) {
+ log("takeCall, Bad account handle detected. Bailing!");
+ return;
+ }
if (accountHandle != null) {
Bundle extras = new Bundle();
extras.putParcelable(SipUtil.EXTRA_INCOMING_CALL_INTENT, intent);
diff --git a/sip/src/com/android/services/telephony/sip/SipConnection.java b/sip/src/com/android/services/telephony/sip/SipConnection.java
index e9f8e05..0d8a6f8 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnection.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnection.java
@@ -134,7 +134,14 @@
try {
if (getPhone() != null && getState() == STATE_ACTIVE
&& getPhone().getRingingCall().getState() != Call.State.WAITING) {
- getPhone().switchHoldingAndActive();
+ // Double check with the internal state since a discrepancy in states could mean
+ // that the transactions is already in progress from a previous request.
+ if (mOriginalConnection != null &&
+ mOriginalConnection.getState() == Call.State.ACTIVE) {
+ getPhone().switchHoldingAndActive();
+ } else {
+ log("skipping switch from onHold due to internal state:");
+ }
}
} catch (CallStateException e) {
log("onHold, exception: " + e);
@@ -145,8 +152,16 @@
public void onUnhold() {
if (VERBOSE) log("onUnhold");
try {
- if (getPhone() != null && getState() == STATE_HOLDING) {
- getPhone().switchHoldingAndActive();
+ if (getPhone() != null && getState() == STATE_HOLDING &&
+ getPhone().getForegroundCall().getState() != Call.State.DIALING) {
+ // Double check with the internal state since a discrepancy in states could mean
+ // that the transaction is already in progress from a previous request.
+ if (mOriginalConnection != null &&
+ mOriginalConnection.getState() == Call.State.HOLDING) {
+ getPhone().switchHoldingAndActive();
+ } else {
+ log("skipping switch from onUnHold due to internal state.");
+ }
}
} catch (CallStateException e) {
log("onUnhold, exception: " + e);