Merge "Rename from "handle to address"." into lmp-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b78876f..4ef5c12 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1221,5 +1221,5 @@
<!-- Strings used in Settings->Sim cards for each installed Sim. -->
<string name="sim_label_emergency_calls">Emergency calls</string>
<string name="sim_description_emergency_calls">Emergency calling only</string>
- <string name="sim_description_default">SIM card in slot <xliff:g id="slot_id">%d</xliff:g></string>
+ <string name="sim_description_default">SIM card, slot: <xliff:g id="slot_id">%s</xliff:g></string>
</resources>
diff --git a/sip/src/com/android/services/telephony/sip/SipConnection.java b/sip/src/com/android/services/telephony/sip/SipConnection.java
index 52b2183..dc7f720 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnection.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnection.java
@@ -69,16 +69,16 @@
}
@Override
- public void onSetAudioState(AudioState state) {
- if (VERBOSE) log("onSetAudioState: " + state);
+ public void onAudioStateChanged(AudioState state) {
+ if (VERBOSE) log("onAudioStateChanged: " + state);
if (getPhone() != null) {
getPhone().setEchoSuppressionEnabled();
}
}
@Override
- public void onSetState(int state) {
- if (VERBOSE) log("onSetState, state: " + Connection.stateToString(state));
+ public void onStateChanged(int state) {
+ if (VERBOSE) log("onStateChanged, state: " + Connection.stateToString(state));
}
@Override
@@ -183,11 +183,6 @@
// SIP doesn't have post dial support.
}
- @Override
- public void onPhoneAccountClicked() {
- if (VERBOSE) log("onPhoneAccountClicked");
- }
-
private Call getCall() {
if (mOriginalConnection != null) {
return mOriginalConnection.getCall();
diff --git a/sip/src/com/android/services/telephony/sip/SipConnectionService.java b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
index 3a67ad9..74d66f9 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnectionService.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
@@ -68,7 +68,8 @@
if (VERBOSE) log("onCreateOutgoingConnection, request: " + request);
Bundle extras = request.getExtras();
- if (extras != null && extras.getString(SipUtil.GATEWAY_PROVIDER_PACKAGE) != null) {
+ if (extras != null &&
+ extras.getString(TelecommManager.GATEWAY_PROVIDER_PACKAGE) != null) {
return Connection.createFailedConnection(
DisconnectCause.CALL_BARRED, "Cannot make a SIP call with a gateway number.");
}
diff --git a/sip/src/com/android/services/telephony/sip/SipUtil.java b/sip/src/com/android/services/telephony/sip/SipUtil.java
index 340ebda..c16714d 100644
--- a/sip/src/com/android/services/telephony/sip/SipUtil.java
+++ b/sip/src/com/android/services/telephony/sip/SipUtil.java
@@ -39,8 +39,6 @@
"com.android.services.telephony.sip.incoming_call_intent";
static final String EXTRA_PHONE_ACCOUNT =
"com.android.services.telephony.sip.phone_account";
- static final String GATEWAY_PROVIDER_PACKAGE =
- "com.android.phone.extra.GATEWAY_PROVIDER_PACKAGE";
private SipUtil() {
}
diff --git a/src/com/android/services/telephony/CdmaConnection.java b/src/com/android/services/telephony/CdmaConnection.java
index 12ccbce..401f4dc 100644
--- a/src/com/android/services/telephony/CdmaConnection.java
+++ b/src/com/android/services/telephony/CdmaConnection.java
@@ -115,11 +115,11 @@
}
@Override
- public void onSetState(int state) {
+ public void onStateChanged(int state) {
Connection originalConnection = getOriginalConnection();
mIsCallWaiting = originalConnection != null &&
originalConnection.getState() == Call.State.WAITING;
- super.onSetState(state);
+ super.onStateChanged(state);
}
@Override
diff --git a/src/com/android/services/telephony/TelecommAccountRegistry.java b/src/com/android/services/telephony/TelecommAccountRegistry.java
index 7ec2c4e..f6220bb 100644
--- a/src/com/android/services/telephony/TelecommAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecommAccountRegistry.java
@@ -47,14 +47,19 @@
final class TelecommAccountRegistry {
private static final boolean DBG = false; /* STOP SHIP if true */
+ // Slot IDs are zero based indices but the numbered icons represent the first, second,
+ // etc... SIM in the device. So that means that index 0 is SIM 1, index 1 is SIM 2 and so on.
private final static int[] phoneAccountIcons = {
- R.drawable.ic_multi_sim,
R.drawable.ic_multi_sim1,
R.drawable.ic_multi_sim2,
R.drawable.ic_multi_sim3,
R.drawable.ic_multi_sim4
};
+ // This icon is the one that is used when the Slot ID that we have for a particular SIM
+ // is not supported, i.e. SubscriptionManager.INVALID_SLOT_ID or the 5th SIM in a phone.
+ private final static int defaultPhoneAccountIcon = R.drawable.ic_multi_sim;
+
private final class AccountEntry {
private final Phone mPhone;
private final PhoneAccount mAccount;
@@ -85,7 +90,6 @@
// Populate the phone account data.
long subId = mPhone.getSubId();
- int slotId = mPhone.getPhoneId() + 1;
String line1Number = telephonyManager.getLine1NumberForSubscriber(subId);
if (line1Number == null) {
line1Number = "";
@@ -96,16 +100,27 @@
}
String subDisplayName = null;
+ // We can only get the real slotId from the SubInfoRecord, we can't calculate the
+ // slotId from the subId or the phoneId in all instances.
SubInfoRecord record = SubscriptionManager.getSubInfoForSubscriber(subId);
+ int slotId = SubscriptionManager.INVALID_SLOT_ID;
if (record != null) {
subDisplayName = record.displayName;
+ slotId = record.slotId;
+ }
+
+ String slotIdString;
+ if (SubscriptionManager.isValidSlotId(slotId)) {
+ slotIdString = Integer.toString(slotId);
+ } else {
+ slotIdString = mContext.getResources().getString(R.string.unknown);
}
if (TextUtils.isEmpty(subDisplayName)) {
// Either the sub record is not there or it has an empty display name.
Log.w(this, "Could not get a display name for subid: %d", subId);
subDisplayName = mContext.getResources().getString(
- R.string.sim_description_default, slotId);
+ R.string.sim_description_default, slotIdString);
}
// The label is user-visible so let's use the display name that the user may
@@ -116,7 +131,7 @@
String description = isEmergency ?
mContext.getResources().getString(R.string.sim_description_emergency_calls) :
dummyPrefix + mContext.getResources().getString(
- R.string.sim_description_default, slotId);
+ R.string.sim_description_default, slotIdString);
// By default all SIM phone accounts can place emergency calls.
int capabilities = PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
@@ -287,11 +302,13 @@
}
private int getPhoneAccountIcon(int index) {
- if (index < TelecommAccountRegistry.phoneAccountIcons.length) {
+ // A valid slot id doesn't necessarily mean that we have an icon for it.
+ if (SubscriptionManager.isValidSlotId(index) &&
+ index < TelecommAccountRegistry.phoneAccountIcons.length) {
return TelecommAccountRegistry.phoneAccountIcons[index];
}
- // default blank icon
- return TelecommAccountRegistry.phoneAccountIcons[0];
+ // Invalid indices get the default icon that has no number associated with it.
+ return defaultPhoneAccountIcon;
}
private void tearDownAccounts() {
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index f5ae95e..531e1e2 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -174,7 +174,7 @@
}
@Override
- public void onSetAudioState(AudioState audioState) {
+ public void onAudioStateChanged(AudioState audioState) {
// TODO: update TTY mode.
if (getPhone() != null) {
getPhone().setEchoSuppressionEnabled();
@@ -182,8 +182,8 @@
}
@Override
- public void onSetState(int state) {
- Log.v(this, "onSetState, state: " + Connection.stateToString(state));
+ public void onStateChanged(int state) {
+ Log.v(this, "onStateChanged, state: " + Connection.stateToString(state));
}
@Override
@@ -253,11 +253,6 @@
}
}
- @Override
- public void onPhoneAccountClicked() {
- Log.v(this, "onPhoneAccountClicked");
- }
-
public void performHold() {
Log.v(this, "performHold");
// TODO: Can dialing calls be put on hold as well since they take up the