am 5dee1ce6: Merge "On MSIM devices, include account from call log in talkback." into lmp-mr1-dev

* commit '5dee1ce62f9349102d426e7b8285682e22a37152':
  On MSIM devices, include account from call log in talkback.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8c36ec7..1dee644 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -353,14 +353,14 @@
     Note: AccessibilityServices use this attribute to announce what the view represents.
           This is especially valuable for views without textual representation like ImageView.
     -->
-    <string name="description_new_voicemail">New voicemail</string>
+    <string name="description_new_voicemail">New voicemail.</string>
 
     <!-- String indicating the number of calls to/from a caller in the call log.
 
     Note: AccessibilityServices use this attribute to announce what the view represents.
           This is especially valuable for views without textual representation like ImageView.
     -->
-    <string name="description_num_calls"><xliff:g id="numberOfCalls">%1$s</xliff:g> calls</string>
+    <string name="description_num_calls"><xliff:g id="numberOfCalls">%1$s</xliff:g> calls.</string>
 
     <!-- String indicating a call log entry had video capabilities.
 
@@ -368,7 +368,7 @@
           This is especially valuable for views without textual representation like ImageView.
           [CHAR LIMIT=NONE]
     -->
-    <string name="description_video_call">Video call</string>
+    <string name="description_video_call">Video call.</string>
 
     <!-- String describing the button to SMS a number or contact.
 
@@ -578,17 +578,24 @@
     <!-- String describing an incoming missed call entry in the call log.
          Note: AccessibilityServices uses this attribute to announce what the view represents.
          [CHAR LIMIT=NONE] -->
-    <string name="description_incoming_missed_call">Missed call from <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
+    <string name="description_incoming_missed_call">Missed call from <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>, <xliff:g id="phoneAccount" example="on SIM 1">%4$s</xliff:g>.</string>
 
     <!-- String describing an incoming answered call entry in the call log.
          Note: AccessibilityServices uses this attribute to announce what the view represents.
          [CHAR LIMIT=NONE] -->
-    <string name="description_incoming_answered_call">Answered call from <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
+    <string name="description_incoming_answered_call">Answered call from <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>, <xliff:g id="phoneAccount" example="on SIM 1">%4$s</xliff:g>.</string>
 
     <!-- String describing an outgoing call entry in the call log.
          Note: AccessibilityServices uses this attribute to announce what the view represents.
          [CHAR LIMIT=NONE] -->
-    <string name="description_outgoing_call">Call to <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>.</string>
+    <string name="description_outgoing_call">Call to <xliff:g id="nameOrNumber" example="John Smith">%1$s</xliff:g>, <xliff:g id="typeOrLocation" example="Mobile">%2$s</xliff:g>, <xliff:g id="timeOfCall" example="2 min ago">%3$s</xliff:g>, <xliff:g id="phoneAccount" example="on SIM 1">%4$s</xliff:g>.</string>
+
+    <!-- String describing the phone account the call was made on or to. This string will be used
+         in description_incoming_missed_call, description_incoming_answered_call, and
+         description_outgoing_call.
+         Note: AccessibilityServices uses this attribute to announce what the view represents.
+         [CHAR LIMIT=NONE] -->
+    <string name="description_phone_account">on <xliff:g id="phoneAccount" example="SIM 1">%1$s</xliff:g></string>
 
     <!-- String describing the "call back" action for an entry in the call log.  The call back
          action triggers a return call to the named user.
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index 1eb25fb..4ebfb4b 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -105,7 +105,7 @@
      * Returns the accessibility description of the "return call/call" action for a call log
      * entry.
      * Accessibility text is a combination of:
-     * {Voicemail Prefix}. {Number of Calls}. {Caller information}.
+     * {Voicemail Prefix}. {Number of Calls}. {Caller information} {Phone Account}.
      * If most recent call is a voicemail, {Voicemail Prefix} is "New Voicemail.", otherwise "".
      *
      * If more than one call for the caller, {Number of Calls} is:
@@ -124,9 +124,13 @@
      * {Call type} is the contact phone number type (eg mobile) or location.
      * {Call Time} is the time since the last call for the contact occurred.
      *
+     * The {Phone Account} refers to the account/SIM through which the call was placed or received
+     * in multi-SIM devices.
+     *
      * Examples:
-     * 3 calls.  New Voicemail.  Missed call from Joe Smith mobile 2 hours ago.
-     * 2 calls.  Answered call from John Doe mobile.  Last called 1 hour ago.
+     * 3 calls.  New Voicemail.  Missed call from Joe Smith mobile 2 hours ago on SIM 1.
+     *
+     * 2 calls.  Answered call from John Doe mobile 1 hour ago.
      *
      * @param context The application context.
      * @param details Details of call.
@@ -165,13 +169,16 @@
         }
 
         int stringID = getCallDescriptionStringID(details);
+        String accountLabel = PhoneAccountUtils.getAccountLabel(context, details.accountHandle);
 
         // Use chosen string resource to build up the message.
         callDescription.append(mResources.getString(stringID,
                 nameOrNumber,
                 // If no type or location can be determined, sub in empty string.
                 typeOrLocation == null ? "" : typeOrLocation,
-                timeOfCall));
+                timeOfCall,
+                accountLabel == null ? "" :
+                    mResources.getString(R.string.description_phone_account, accountLabel)));
 
         return callDescription;
     }
@@ -187,13 +194,15 @@
         int stringID;
 
         if (lastCallType == Calls.VOICEMAIL_TYPE || lastCallType == Calls.MISSED_TYPE) {
-            //Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>.
+            //Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
+            //<PhoneAccount>.
             stringID = R.string.description_incoming_missed_call;
         } else if (lastCallType == Calls.INCOMING_TYPE) {
-            //Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>.
+            //Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>,
+            //<PhoneAccount>.
             stringID = R.string.description_incoming_answered_call;
         } else {
-            //Message: Call to <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>.
+            //Message: Call to <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, <PhoneAccount>.
             stringID = R.string.description_outgoing_call;
         }
         return stringID;