Merge "Fix enterprise contacts APIs naming and docs" into nyc-dev
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 3e3926b..d0762fd 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -249,7 +249,6 @@
                 Call.areSameNumber(mPrimary, primary));
         final boolean secondaryChanged = !(Call.areSame(mSecondary, secondary) &&
                 Call.areSameNumber(mSecondary, secondary));
-        final boolean shouldShowCallSubject = shouldShowCallSubject(mPrimary);
 
         mSecondary = secondary;
         Call previousPrimary = mPrimary;
@@ -262,9 +261,8 @@
         // Refresh primary call information if either:
         // 1. Primary call changed.
         // 2. The call's ability to manage conference has changed.
-        if (mPrimary != null && (primaryChanged ||
-                ui.isManageConferenceVisible() != shouldShowManageConference()) ||
-                ui.isCallSubjectVisible() != shouldShowCallSubject) {
+        // 3. The call subject should be shown or hidden.
+        if (shouldRefreshPrimaryInfo(primaryChanged, ui, shouldShowCallSubject(mPrimary))) {
             // primary call has changed
             if (previousPrimary != null) {
                 //clear progess spinner (if any) related to previous primary call
@@ -402,6 +400,16 @@
         updatePrimaryDisplayInfo();
     }
 
+    private boolean shouldRefreshPrimaryInfo(boolean primaryChanged, CallCardUi ui,
+            boolean shouldShowCallSubject) {
+        if (mPrimary == null) {
+            return false;
+        }
+        return primaryChanged ||
+                ui.isManageConferenceVisible() != shouldShowManageConference() ||
+                ui.isCallSubjectVisible() != shouldShowCallSubject;
+    }
+
     private String getSubscriptionNumber() {
         // If it's an emergency call, and they're not populating the callback number,
         // then try to fall back to the phone sub info (to hopefully get the SIM's
diff --git a/res/values-uz-rUZ/strings.xml b/res/values-uz-rUZ/strings.xml
index 20f931b..01b73d6 100644
--- a/res/values-uz-rUZ/strings.xml
+++ b/res/values-uz-rUZ/strings.xml
@@ -126,7 +126,7 @@
     <string name="menu_callNumber" msgid="997146291983360266">"Qo‘ng‘iroq: <xliff:g id="NUMBER">%s</xliff:g>"</string>
     <string name="unknown" msgid="740067747858270469">"Noma’lum"</string>
     <string name="voicemail" msgid="3851469869202611441">"Ovozli xabar"</string>
-    <string name="private_num" msgid="6374339738119166953">"Shaxsiy raqam"</string>
+    <string name="private_num" msgid="6374339738119166953">"Yashirin raqam"</string>
     <string name="payphone" msgid="7726415831153618726">"Taksofon"</string>
     <string name="callDetailsShortDurationFormat" msgid="3988146235579303592">"<xliff:g id="SECONDS">%s</xliff:g> soniya"</string>
     <string name="callDetailsDurationFormat" msgid="6061406028764382234">"<xliff:g id="MINUTES">%s</xliff:g> daq <xliff:g id="SECONDS">%s</xliff:g> son"</string>
diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java
index cfd8f97..1474843 100644
--- a/src/com/android/dialer/calllog/CallTypeIconsView.java
+++ b/src/com/android/dialer/calllog/CallTypeIconsView.java
@@ -42,17 +42,20 @@
 public class CallTypeIconsView extends View {
     private List<Integer> mCallTypes = Lists.newArrayListWithCapacity(3);
     private boolean mShowVideo = false;
-    private Resources mResources;
     private int mWidth;
     private int mHeight;
 
+    private static Resources sResources;
+
     public CallTypeIconsView(Context context) {
         this(context, null);
     }
 
     public CallTypeIconsView(Context context, AttributeSet attrs) {
         super(context, attrs);
-        mResources = new Resources(context);
+        if (sResources == null) {
+          sResources = new Resources(context);
+        }
     }
 
     public void clear() {
@@ -66,7 +69,7 @@
         mCallTypes.add(callType);
 
         final Drawable drawable = getCallTypeDrawable(callType);
-        mWidth += drawable.getIntrinsicWidth() + mResources.iconMargin;
+        mWidth += drawable.getIntrinsicWidth() + sResources.iconMargin;
         mHeight = Math.max(mHeight, drawable.getIntrinsicHeight());
         invalidate();
     }
@@ -79,8 +82,8 @@
     public void setShowVideo(boolean showVideo) {
         mShowVideo = showVideo;
         if (showVideo) {
-            mWidth += mResources.videoCall.getIntrinsicWidth();
-            mHeight = Math.max(mHeight, mResources.videoCall.getIntrinsicHeight());
+            mWidth += sResources.videoCall.getIntrinsicWidth();
+            mHeight = Math.max(mHeight, sResources.videoCall.getIntrinsicHeight());
             invalidate();
         }
     }
@@ -107,21 +110,21 @@
     private Drawable getCallTypeDrawable(int callType) {
         switch (callType) {
             case AppCompatConstants.CALLS_INCOMING_TYPE:
-                return mResources.incoming;
+                return sResources.incoming;
             case AppCompatConstants.CALLS_OUTGOING_TYPE:
-                return mResources.outgoing;
+                return sResources.outgoing;
             case AppCompatConstants.CALLS_MISSED_TYPE:
-                return mResources.missed;
+                return sResources.missed;
             case AppCompatConstants.CALLS_VOICEMAIL_TYPE:
-                return mResources.voicemail;
+                return sResources.voicemail;
             case AppCompatConstants.CALLS_BLOCKED_TYPE:
-                return mResources.blocked;
+                return sResources.blocked;
             default:
                 // It is possible for users to end up with calls with unknown call types in their
                 // call history, possibly due to 3rd party call log implementations (e.g. to
                 // distinguish between rejected and missed calls). Instead of crashing, just
                 // assume that all unknown call types are missed calls.
-                return mResources.missed;
+                return sResources.missed;
         }
     }
 
@@ -138,14 +141,14 @@
             final int right = left + drawable.getIntrinsicWidth();
             drawable.setBounds(left, 0, right, drawable.getIntrinsicHeight());
             drawable.draw(canvas);
-            left = right + mResources.iconMargin;
+            left = right + sResources.iconMargin;
         }
 
         // If showing the video call icon, draw it scaled appropriately.
         if (mShowVideo) {
-            final Drawable drawable = mResources.videoCall;
-            final int right = left + mResources.videoCall.getIntrinsicWidth();
-            drawable.setBounds(left, 0, right, mResources.videoCall.getIntrinsicHeight());
+            final Drawable drawable = sResources.videoCall;
+            final int right = left + sResources.videoCall.getIntrinsicWidth();
+            drawable.setBounds(left, 0, right, sResources.videoCall.getIntrinsicHeight());
             drawable.draw(canvas);
         }
     }