MAP: Get first recipient name of multiple recipients for SMS Drafts.
Fetch only first recipeint name for multiple recipeint names
use case while composing GetMessageListing response for
SMS Drafts folder.
Change-Id: Ieb29ad6b88a394d05fc2c9ad9b6f601d0a0b65b2
CRs-fixed: 538861
diff --git a/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java b/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java
index 68fa1e6..4dd9032 100644
--- a/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java
+++ b/src/org/codeaurora/bluetooth/map/BluetoothMasAppSmsMms.java
@@ -2004,8 +2004,17 @@
String recipientName = null;
if (isOutgoingSMSMessage(msgType) == false) {
recipientName = getOwnerName();
- } else {
- recipientName = getContactName(address);
+ } else if( address != null) {
+ String firstRecipient = address;
+ // Get first Recipient Name for multiple recipient addressing
+ if(firstRecipient.contains(";") ){
+ firstRecipient = firstRecipient.split(";")[0];
+ }
+ else if (firstRecipient.contains(",")){
+ firstRecipient = firstRecipient.split(",")[0];
+ }
+
+ recipientName = getContactName(firstRecipient);
}
ml.setRecepient_name(recipientName);
}