Add attribution labels and icons to test app.

Bug: 5095755
Change-Id: I520b3fc632056da7cdc2bd9eccc540f3e9ab8874
diff --git a/tests/res/values/donottranslate_strings.xml b/tests/res/values/donottranslate_strings.xml
index 528b129..194b6ca 100644
--- a/tests/res/values/donottranslate_strings.xml
+++ b/tests/res/values/donottranslate_strings.xml
@@ -107,4 +107,9 @@
         <item>Two short sections with headers</item>
         <item>Five short sections with headers</item>
     </string-array>
+
+    <string name="attribution_google_plus">Google+</string>
+    <string name="attribution_google_talk">Google Talk</string>
+    <string name="attribution_flicker">Flicker</string>
+    <string name="attribution_twitter">Twitter</string>
 </resources>
diff --git a/tests/src/com/android/contacts/tests/streamitems/StreamItemPopulatorActivity.java b/tests/src/com/android/contacts/tests/streamitems/StreamItemPopulatorActivity.java
index c984418..e27c767 100644
--- a/tests/src/com/android/contacts/tests/streamitems/StreamItemPopulatorActivity.java
+++ b/tests/src/com/android/contacts/tests/streamitems/StreamItemPopulatorActivity.java
@@ -83,6 +83,17 @@
             "<i>24567</i> <font color='blue' size='+1'><b>likes</b></font>"
     };
 
+    private Integer[] labelIds = new Integer[] {
+            R.string.attribution_google_plus,
+            R.string.attribution_google_talk,
+            R.string.attribution_flicker,
+            R.string.attribution_twitter
+    };
+
+    public Integer[] iconIds = new Integer[] {
+            R.drawable.default_icon,
+    };
+
     // Photos to randomly select from.
     private Integer[] imageIds = new Integer[]{
             R.drawable.android,
@@ -242,6 +253,7 @@
     }
 
     private ContentValues buildStreamItemValues(String accountType, String accountName) {
+        boolean includeAttribution = randInt(100) < 70;
         boolean includeComments = randInt(100) < 30;
         boolean includeAction = randInt(100) < 30;
         ContentValues values = new ContentValues();
@@ -250,6 +262,14 @@
                 String.format(pickRandom(snippetStrings) , place)
                 + (includeComments ? " [c]" : "")
                 + (includeAction ? " [a]" : ""));
+        if (includeAttribution) {
+            values.put(StreamItems.RES_PACKAGE, "com.android.contacts.tests");
+            int sourceIndex = randInt(labelIds.length);
+            values.put(StreamItems.RES_LABEL, labelIds[sourceIndex]);
+            if (sourceIndex < iconIds.length) {
+                values.put(StreamItems.RES_ICON, iconIds[sourceIndex]);
+            }
+        }
         if (includeComments) {
             values.put(StreamItems.COMMENTS, pickRandom(commentStrings));
         } else {