Use AT_MOST for label when photo is on right

In I269175d9dea97baa86bcb1badc9e6294dcb7883b we introduced EXACTLY,
since AT_MOST requires more calculation and thus made the contacts
listing slower.

In picker screens, however, we need that for email/phone types because
of its layout requirement. This change introduces AT_MOST only in that
exact case, so that it won't cause any performance regression in our
major cases.

Bug: 5527030
Change-Id: I105e8c052e53d9f108c7ca01c6aef2cc5c378462
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index eb31e2a..5617664 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -394,7 +394,11 @@
         }
 
         if (isVisible(mLabelView)) {
-            mLabelView.measure(MeasureSpec.makeMeasureSpec(labelWidth, MeasureSpec.EXACTLY),
+            // For performance reason we don't want AT_MOST usually, but when the picture is
+            // on right, we need to use it anyway because mDataView is next to mLabelView.
+            final int mode = (mPhotoPosition == PhotoPosition.LEFT
+                    ? MeasureSpec.EXACTLY : MeasureSpec.AT_MOST);
+            mLabelView.measure(MeasureSpec.makeMeasureSpec(labelWidth, mode),
                     MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
             mLabelViewHeight = mLabelView.getMeasuredHeight();
         }