am 6f488b6f: Merge "Change default CDMA roaming preference to enabled." into lmp-dev
* commit '6f488b6fda71d73f9b0b9f2c4113613c8496854b':
Change default CDMA roaming preference to enabled.
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 5d00163..014de15 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -37,6 +37,7 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.preference.PreferenceManager;
import android.provider.Settings;
@@ -45,6 +46,7 @@
import android.telephony.NeighboringCellInfo;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
+import android.telephony.SubInfoRecord;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -61,6 +63,7 @@
import com.android.internal.telephony.CallManager;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.dataconnection.DctController;
import com.android.internal.telephony.uicc.AdnRecord;
import com.android.internal.telephony.uicc.IccIoResult;
@@ -237,17 +240,20 @@
break;
case CMD_ANSWER_RINGING_CALL:
- answerRingingCallInternal();
+ request = (MainThreadRequest) msg.obj;
+ long answer_subId = ((Long)request.argument).longValue();
+ answerRingingCallInternal(answer_subId);
break;
case CMD_END_CALL:
request = (MainThreadRequest) msg.obj;
- boolean hungUp;
- int phoneType = mPhone.getPhoneType();
+ long end_subId = ((Long)request.argument).longValue();
+ final boolean hungUp;
+ int phoneType = getPhone(end_subId).getPhoneType();
if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
// CDMA: If the user presses the Power button we treat it as
// ending the complete call session
- hungUp = PhoneUtils.hangupRingingAndActive(mPhone);
+ hungUp = PhoneUtils.hangupRingingAndActive(getPhone(end_subId));
} else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
// GSM: End the call as per the Phone state
hungUp = PhoneUtils.hangup(mCM);
@@ -736,7 +742,6 @@
if (state != PhoneConstants.State.OFFHOOK && state != PhoneConstants.State.RINGING) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(SUBSCRIPTION_KEY, subId);
mApp.startActivity(intent);
}
}
@@ -763,6 +768,18 @@
return;
}
+ boolean isValid = false;
+ List<SubInfoRecord> slist = SubscriptionManager.getActiveSubInfoList();
+ for (SubInfoRecord subInfoRecord : slist) {
+ if (subInfoRecord.subId == subId) {
+ isValid = true;
+ break;
+ }
+ }
+ if (isValid == false) {
+ return;
+ }
+
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
intent.putExtra(SUBSCRIPTION_KEY, subId);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -783,7 +800,7 @@
*/
public boolean endCallForSubscriber(long subId) {
enforceCallPermission();
- return (Boolean) sendRequest(CMD_END_CALL, subId, null);
+ return (Boolean) sendRequest(CMD_END_CALL, new Long(subId), null);
}
public void answerRingingCall() {
@@ -796,7 +813,7 @@
// but that can probably wait till the big TelephonyManager API overhaul.
// For now, protect this call with the MODIFY_PHONE_STATE permission.
enforceModifyPermission();
- sendRequestAsync(CMD_ANSWER_RINGING_CALL);
+ sendRequest(CMD_ANSWER_RINGING_CALL, new Long(subId), null);
}
/**
@@ -812,11 +829,11 @@
* than sendRequestAsync(), and right now we don't actually *need* that
* return value, so let's just return void for now.
*/
- private void answerRingingCallInternal() {
- final boolean hasRingingCall = !mPhone.getRingingCall().isIdle();
+ private void answerRingingCallInternal(long subId) {
+ final boolean hasRingingCall = !getPhone(subId).getRingingCall().isIdle();
if (hasRingingCall) {
- final boolean hasActiveCall = !mPhone.getForegroundCall().isIdle();
- final boolean hasHoldingCall = !mPhone.getBackgroundCall().isIdle();
+ final boolean hasActiveCall = !getPhone(subId).getForegroundCall().isIdle();
+ final boolean hasHoldingCall = !getPhone(subId).getBackgroundCall().isIdle();
if (hasActiveCall && hasHoldingCall) {
// Both lines are in use!
// TODO: provide a flag to let the caller specify what
@@ -1805,7 +1822,7 @@
@Override
public int getCalculatedPreferredNetworkType() {
enforceReadPermission();
- return PhoneFactory.calculatePreferredNetworkType(mPhone.getContext());
+ return PhoneFactory.calculatePreferredNetworkType(mPhone.getContext(), 0); // wink FIXME: need to get PhoneId from somewhere.
}
/**