am 7818c7e9: Merge "Add connection before resetting state of sibling connections" into lmp-dev
* commit '7818c7e9a5031e7689296601359e22af5ce9c2b1':
Add connection before resetting state of sibling connections
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 382d39f..498b632 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -275,6 +275,8 @@
<style name="SimImportTheme" parent="@android:style/Theme.Material.Light">
<item name="android:actionBarStyle">@style/TelephonyActionBarStyle</item>
<item name="android:colorPrimaryDark">@color/dialer_theme_color_dark</item>
+ <item name="android:homeAsUpIndicator">@drawable/ic_back_arrow</item>
+ <item name="android:actionOverflowButtonStyle">@style/DialtactsActionBarOverflow</item>
</style>
<style name="OutgoingCallBroadcasterTheme" parent="@android:style/Theme.Holo.NoActionBar">
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 26e31b0..f9a0989 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -37,14 +37,17 @@
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;
import android.telephony.CellInfo;
import android.telephony.IccOpenLogicalChannelResponse;
import android.telephony.NeighboringCellInfo;
+import android.telephony.RadioAccessFamily;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
+import android.telephony.SubInfoRecord;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -58,9 +61,12 @@
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.PhoneProxy;
+import com.android.internal.telephony.ProxyController;
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 +243,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);
@@ -706,11 +715,8 @@
}
// returns phone associated with the subId.
- // getPhone(0) returns default phone in single SIM mode.
private Phone getPhone(long subId) {
- // FIXME: hack for the moment
- return mPhone;
- // return PhoneUtils.getPhoneForSubscriber(subId);
+ return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
}
//
// Implementation of the ITelephony interface.
@@ -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.
}
/**
@@ -2036,4 +2053,18 @@
return returnValue;
}
+
+ @Override
+ public void setRadioCapability(RadioAccessFamily[] rafs) {
+ try {
+ ProxyController.getInstance().setRadioCapability(rafs);
+ } catch (RuntimeException e) {
+ Log.w(LOG_TAG, "setRadioCapability: Runtime Exception");
+ }
+ }
+
+ @Override
+ public int getRadioAccessFamily(int phoneId) {
+ return ProxyController.getInstance().getRadioAccessFamily(phoneId);
+ }
}
diff --git a/src/com/android/phone/SimContacts.java b/src/com/android/phone/SimContacts.java
index a069e41..8192795 100644
--- a/src/com/android/phone/SimContacts.java
+++ b/src/com/android/phone/SimContacts.java
@@ -39,6 +39,7 @@
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.telecom.PhoneAccount;
+import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.ContextMenu;
@@ -242,8 +243,13 @@
@Override
protected Uri resolveIntent() {
- Intent intent = getIntent();
- intent.setData(Uri.parse("content://icc/adn"));
+ final Intent intent = getIntent();
+ if (intent.hasExtra("subscription_id")) {
+ final long subId = intent.getLongExtra("subscription_id", -1);
+ intent.setData(Uri.parse("content://icc/adn/subId/" + subId));
+ } else {
+ intent.setData(Uri.parse("content://icc/adn"));
+ }
if (Intent.ACTION_PICK.equals(intent.getAction())) {
// "index" is 1-based
mInitialSelection = intent.getIntExtra("index", 0) - 1;
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index b337622..6980df8 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -35,6 +35,7 @@
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneProxy;
+import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyIntents;
import com.android.phone.R;
@@ -92,6 +93,7 @@
// Populate the phone account data.
long subId = mPhone.getSubId();
+ int color = 0;
int slotId = SubscriptionManager.INVALID_SLOT_ID;
String line1Number = mTelephonyManager.getLine1NumberForSubscriber(subId);
if (line1Number == null) {
@@ -121,6 +123,8 @@
if (record != null) {
subDisplayName = record.displayName;
slotId = record.slotId;
+ // Assign a "fake" color while the underlying Telephony stuff is refactored
+ color = makeFakeColor(subId);
}
String slotIdString;
@@ -155,6 +159,7 @@
Uri.fromParts(PhoneAccount.SCHEME_TEL, subNumber, null))
.setCapabilities(capabilities)
.setIconResId(getPhoneAccountIcon(slotId))
+ .setColor(color)
.setShortDescription(description)
.setSupportedUriSchemes(Arrays.asList(
PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))
@@ -170,6 +175,15 @@
}
}
+ private int makeFakeColor(long subId) {
+ int[] colors = new int[] {
+ 0xff0000,
+ 0x00ff00,
+ 0x0000ff,
+ };
+ return colors[((int) subId) % colors.length];
+ }
+
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {