diff options
Diffstat (limited to 'src/com/android/messaging')
-rw-r--r-- | src/com/android/messaging/ui/conversation/ComposeMessageView.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/messaging/ui/conversation/ComposeMessageView.java b/src/com/android/messaging/ui/conversation/ComposeMessageView.java index cb6562f..ae1bbec 100644 --- a/src/com/android/messaging/ui/conversation/ComposeMessageView.java +++ b/src/com/android/messaging/ui/conversation/ComposeMessageView.java @@ -87,6 +87,7 @@ import com.cyanogenmod.messaging.util.PrefsUtils; import java.util.ArrayList; import java.util.Collection; +import java.util.Iterator; import java.util.List; /** @@ -244,7 +245,20 @@ public class ComposeMessageView extends LinearLayout @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, boolean setDefault) { - cb.onSimSelected(Integer.valueOf(selectedAccountHandle.getId())); + // we need the subId and we only have a PhoneAccountHandle + TelephonyManager telephonyManager = + (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); + Iterator<PhoneAccountHandle> phoneAccounts = + telecomMgr.getCallCapablePhoneAccounts().listIterator(); + int subId = 0; // defaulting to 0, just in case + while (phoneAccounts.hasNext()) { + PhoneAccountHandle p = phoneAccounts.next(); + if (p.getId() == selectedAccountHandle.getId()) { + PhoneAccount phoneAccount = telecomMgr.getPhoneAccount(p); + subId = telephonyManager.getSubIdForPhoneAccount(phoneAccount); + } + } + cb.onSimSelected(subId); } @Override public void onDialogDismissed() { |