Merge "Create new layout file for list fragments." into pi-car-dev
diff --git a/res/layout-h610dp/contact_details_action_bar.xml b/res/layout-h610dp/contact_details_action_bar.xml
deleted file mode 100644
index d077bbe..0000000
--- a/res/layout-h610dp/contact_details_action_bar.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<Space
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
-</Space>
\ No newline at end of file
diff --git a/res/layout-h610dp/contact_details_name_image.xml b/res/layout-h610dp/contact_details_name_image.xml
deleted file mode 100644
index 970faad..0000000
--- a/res/layout-h610dp/contact_details_name_image.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright (C) 2019 The Android Open Source Project
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-<androidx.constraintlayout.widget.ConstraintLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-
-    <com.android.car.apps.common.BackgroundImageView
-        android:id="@+id/background_image"
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:visibility="gone"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"/>
-
-    <ImageView
-        android:id="@+id/avatar"
-        android:layout_width="@dimen/contact_details_avatar_size"
-        android:layout_height="@dimen/contact_details_avatar_size"
-        android:layout_marginTop="@dimen/contact_details_avatar_margin_top"
-        app:layout_constraintVertical_chainStyle="packed"
-        app:layout_constraintBottom_toTopOf="@+id/title"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent"/>
-
-    <TextView
-        android:id="@id/title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:singleLine="true"
-        android:layout_marginTop="@dimen/contact_details_title_margin_top"
-        android:layout_marginBottom="@dimen/contact_details_title_margin_bottom"
-        android:textAppearance="@style/TextAppearance.ContactDetailsTitle"
-        app:layout_constraintTop_toBottomOf="@id/avatar"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"/>
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/contact_details_action_bar.xml b/res/layout/contact_details_action_bar.xml
index 59ad063..c874913 100644
--- a/res/layout/contact_details_action_bar.xml
+++ b/res/layout/contact_details_action_bar.xml
@@ -23,8 +23,8 @@
 
     <ImageView
         android:id="@+id/contact_details_action_bar_avatar"
-        android:layout_height="@dimen/contact_details_avatar_size"
-        android:layout_width="@dimen/contact_details_avatar_size"/>
+        android:layout_height="@dimen/contact_details_action_bar_avatar_size"
+        android:layout_width="@dimen/contact_details_action_bar_avatar_size"/>
 
     <TextView
         android:id="@+id/contact_details_action_bar_name"
diff --git a/res/layout/contact_details_name_image.xml b/res/layout/contact_details_name_image.xml
index f03f093..970faad 100644
--- a/res/layout/contact_details_name_image.xml
+++ b/res/layout/contact_details_name_image.xml
@@ -14,8 +14,41 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
-
-<Space
+<androidx.constraintlayout.widget.ConstraintLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"/>
+    android:layout_height="wrap_content">
+
+    <com.android.car.apps.common.BackgroundImageView
+        android:id="@+id/background_image"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:visibility="gone"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
+
+    <ImageView
+        android:id="@+id/avatar"
+        android:layout_width="@dimen/contact_details_avatar_size"
+        android:layout_height="@dimen/contact_details_avatar_size"
+        android:layout_marginTop="@dimen/contact_details_avatar_margin_top"
+        app:layout_constraintVertical_chainStyle="packed"
+        app:layout_constraintBottom_toTopOf="@+id/title"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"/>
+
+    <TextView
+        android:id="@id/title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:layout_marginTop="@dimen/contact_details_title_margin_top"
+        android:layout_marginBottom="@dimen/contact_details_title_margin_bottom"
+        android:textAppearance="@style/TextAppearance.ContactDetailsTitle"
+        app:layout_constraintTop_toBottomOf="@id/avatar"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"/>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/values-h1200dp/bools.xml b/res/values-h1200dp/bools.xml
deleted file mode 100644
index b737bbc..0000000
--- a/res/values-h1200dp/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright (C) 2019 The Android Open Source Project
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<resources>
-    <bool name="screen_size_tall">true</bool>
-</resources>
diff --git a/res/values-h1200dp/dimens.xml b/res/values-h1200dp/dimens.xml
index 9842357..b4b512f 100644
--- a/res/values-h1200dp/dimens.xml
+++ b/res/values-h1200dp/dimens.xml
@@ -20,6 +20,4 @@
     <dimen name="keypad_margin_x">48dp</dimen>
     <dimen name="keypad_margin_y">@*android:dimen/car_padding_4</dimen>
     <dimen name="keypad_margin">@*android:dimen/car_padding_6</dimen>
-
-    <dimen name="contact_details_title_margin_bottom">@*android:dimen/car_padding_5</dimen>
 </resources>
diff --git a/res/values-h610dp/bools.xml b/res/values-h610dp/bools.xml
deleted file mode 100644
index ab691bc..0000000
--- a/res/values-h610dp/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright (C) 2019 The Android Open Source Project
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<resources>
-    <bool name="screen_size_short">false</bool>
-</resources>
diff --git a/res/values-h610dp/dimens.xml b/res/values-h610dp/dimens.xml
index 9dba83d..23a9548 100644
--- a/res/values-h610dp/dimens.xml
+++ b/res/values-h610dp/dimens.xml
@@ -27,8 +27,6 @@
     <dimen name="fab_outline_size">104dp</dimen>
     <dimen name="fab_ripple_radius">52dp</dimen>
 
-    <dimen name="contact_details_avatar_size">126dp</dimen>
-
     <!-- Components -->
     <dimen name="control_bar_height">128dp</dimen>
 </resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
deleted file mode 100644
index 6cc068d..0000000
--- a/res/values/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <bool name="screen_size_short">true</bool>
-    <bool name="screen_size_tall">false</bool>
-</resources>
\ No newline at end of file
diff --git a/res/values/configs.xml b/res/values/configs.xml
index 204437b..531b0fd 100644
--- a/res/values/configs.xml
+++ b/res/values/configs.xml
@@ -30,4 +30,7 @@
     that are not stored as contacts. "true" will show divider and button as disable state and
     "false" will make divider and button invisible for non contacts. -->
     <bool name="config_show_calllog_action_button_for_non_contact">false</bool>
+
+    <!-- A config determines if to show the action bar view in the contact details page.-->
+    <bool name="config_show_contact_details_action_bar_view">false</bool>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 3bf7713..83da788 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -37,12 +37,13 @@
     <!-- Contact details dimensions -->
     <dimen name="contact_details_avatar_margin_top">@*android:dimen/car_padding_4</dimen>
     <dimen name="contact_details_title_margin_top">@*android:dimen/car_padding_4</dimen>
-    <dimen name="contact_details_title_margin_bottom">48dp</dimen>
-    <dimen name="contact_details_avatar_size">@dimen/primary_icon_size</dimen>
+    <dimen name="contact_details_title_margin_bottom">@*android:dimen/car_padding_5</dimen>
+    <dimen name="contact_details_avatar_size">126dp</dimen>
     <dimen name="contact_details_item_height">@dimen/list_item_height</dimen>
     <dimen name="contact_details_number_padding_start">@*android:dimen/car_keyline_1</dimen>
     <dimen name="contact_details_number_padding_end">@*android:dimen/car_padding_2</dimen>
     <dimen name="contact_details_text_button_guideline">@*android:dimen/car_keyline_3</dimen>
+    <dimen name="contact_details_action_bar_avatar_size">@dimen/primary_icon_size</dimen>
     <dimen name="contact_details_action_bar_name_margin">@*android:dimen/car_padding_2</dimen>
 
     <!-- Contact list dimensions -->
diff --git a/src/com/android/car/dialer/notification/NotificationUtils.java b/src/com/android/car/dialer/notification/NotificationUtils.java
index 1812c3f..b185911 100644
--- a/src/com/android/car/dialer/notification/NotificationUtils.java
+++ b/src/com/android/car/dialer/notification/NotificationUtils.java
@@ -48,7 +48,8 @@
                             .getDimensionPixelSize(R.dimen.avatar_icon_size);
                     Icon largeIcon = loadContactAvatar(context, info.getAvatarUri(), size);
                     if (largeIcon == null) {
-                        largeIcon = createLetterTile(context, info.getDisplayName(), size);
+                        largeIcon = createLetterTile(context, info.getInitials(),
+                                /* identifier */ info.getDisplayName(), size);
                     }
 
                     return new Pair<>(info.getDisplayName(), largeIcon);
@@ -74,8 +75,10 @@
         return null;
     }
 
-    private static Icon createLetterTile(Context context, String displayName, int avatarSize) {
-        LetterTileDrawable letterTileDrawable = TelecomUtils.createLetterTile(context, displayName);
+    private static Icon createLetterTile(Context context, @Nullable String initials,
+            String identifier, int avatarSize) {
+        LetterTileDrawable letterTileDrawable = TelecomUtils.createLetterTile(context, initials,
+                identifier);
         RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(
                 context.getResources(), letterTileDrawable.toBitmap(avatarSize));
         return createFromRoundedBitmapDrawable(context, roundedBitmapDrawable, avatarSize);
diff --git a/src/com/android/car/dialer/ui/activecall/InCallFragment.java b/src/com/android/car/dialer/ui/activecall/InCallFragment.java
index 81e2b68..b16fe06 100644
--- a/src/com/android/car/dialer/ui/activecall/InCallFragment.java
+++ b/src/com/android/car/dialer/ui/activecall/InCallFragment.java
@@ -63,7 +63,7 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        mDefaultAvatar = TelecomUtils.createLetterTile(getContext(), null);
+        mDefaultAvatar = TelecomUtils.createLetterTile(getContext(), null, null);
     }
 
     /**
@@ -125,7 +125,7 @@
                 }
 
                 LetterTileDrawable letterTile = TelecomUtils.createLetterTile(
-                        getContext(), info.getDisplayName());
+                        getContext(), info.getInitials(), info.getDisplayName());
 
                 Glide.with(this)
                         .load(info.getAvatarUri())
diff --git a/src/com/android/car/dialer/ui/activecall/OnHoldCallUserProfileFragment.java b/src/com/android/car/dialer/ui/activecall/OnHoldCallUserProfileFragment.java
index 1ffebe2..9d6e38e 100644
--- a/src/com/android/car/dialer/ui/activecall/OnHoldCallUserProfileFragment.java
+++ b/src/com/android/car/dialer/ui/activecall/OnHoldCallUserProfileFragment.java
@@ -54,7 +54,7 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        mDefaultAvatar = TelecomUtils.createLetterTile(getContext(), null);
+        mDefaultAvatar = TelecomUtils.createLetterTile(getContext(), null, null);
     }
 
     @Nullable
@@ -91,11 +91,12 @@
         String number = callDetail.getNumber();
         mTitle.setText(TelecomUtils.getFormattedNumber(getContext(), number));
         mAvatarView.setImageDrawable(mDefaultAvatar);
+
         mPhoneNumberInfoFuture = TelecomUtils.getPhoneNumberInfo(getContext(), number)
                 .thenAcceptAsync((info) -> {
                     mTitle.setText(info.getDisplayName());
                     TelecomUtils.setContactBitmapAsync(getContext(), mAvatarView,
-                            info.getAvatarUri(), info.getDisplayName());
+                            info.getAvatarUri(), info.getInitials(), info.getDisplayName());
                 }, getContext().getMainExecutor());
     }
 
diff --git a/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java b/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java
index f28761a..677f750 100644
--- a/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java
+++ b/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java
@@ -74,6 +74,7 @@
                 mAvatarView.getContext(),
                 mAvatarView,
                 uiCallLog.getAvatarUri(),
+                uiCallLog.getInitials(),
                 uiCallLog.getTitle());
 
         mTitleView.setText(uiCallLog.getTitle());
diff --git a/src/com/android/car/dialer/ui/common/DialerUtils.java b/src/com/android/car/dialer/ui/common/DialerUtils.java
index c4c191e..c6cc857 100644
--- a/src/com/android/car/dialer/ui/common/DialerUtils.java
+++ b/src/com/android/car/dialer/ui/common/DialerUtils.java
@@ -18,7 +18,6 @@
 
 import android.app.AlertDialog;
 import android.content.Context;
-import android.content.res.Resources;
 
 import com.android.car.dialer.R;
 import com.android.car.dialer.log.L;
@@ -107,16 +106,4 @@
             L.w(TAG, "contact %s doesn't have any phone number", contact.getDisplayName());
         }
     }
-
-    /** Returns true if this a short height screen */
-    public static boolean isShortScreen(Context context) {
-        Resources resources = context.getResources();
-        return resources.getBoolean(R.bool.screen_size_short);
-    }
-
-    /** Returns true if this a tall height screen */
-    public static boolean isTallScreen(Context context) {
-        Resources resources = context.getResources();
-        return resources.getBoolean(R.bool.screen_size_tall);
-    }
 }
diff --git a/src/com/android/car/dialer/ui/common/UiCallLogLiveData.java b/src/com/android/car/dialer/ui/common/UiCallLogLiveData.java
index a6fb0cf..5b6d06a 100644
--- a/src/com/android/car/dialer/ui/common/UiCallLogLiveData.java
+++ b/src/com/android/car/dialer/ui/common/UiCallLogLiveData.java
@@ -133,8 +133,8 @@
             String relativeTime = getRelativeTime(phoneCallLog.getLastCallEndTimestamp());
             if (TelecomUtils.isVoicemailNumber(mContext, number)) {
                 String title = mContext.getString(R.string.voicemail);
-                UiCallLog uiCallLog = new UiCallLog(title,
-                        relativeTime, number, null, phoneCallLog.getAllCallRecords());
+                UiCallLog uiCallLog = new UiCallLog(title, relativeTime, number, null, null,
+                        phoneCallLog.getAllCallRecords());
                 uiCallLogs.add(uiCallLog);
                 continue;
             }
@@ -155,6 +155,7 @@
                     title,
                     getSecondaryText(getType(phoneNumber), relativeTime),
                     number,
+                    contact != null ? contact.getInitials() : null,
                     contact != null ? contact.getAvatarUri() : null,
                     phoneCallLog.getAllCallRecords());
 
diff --git a/src/com/android/car/dialer/ui/common/entity/UiCallLog.java b/src/com/android/car/dialer/ui/common/entity/UiCallLog.java
index 999d66e..9de9730 100644
--- a/src/com/android/car/dialer/ui/common/entity/UiCallLog.java
+++ b/src/com/android/car/dialer/ui/common/entity/UiCallLog.java
@@ -18,6 +18,8 @@
 
 import android.net.Uri;
 
+import androidx.annotation.Nullable;
+
 import com.android.car.dialer.livedata.CallHistoryLiveData;
 import com.android.car.telephony.common.PhoneCallLog;
 
@@ -31,20 +33,31 @@
 public class UiCallLog {
     private final String mTitle;
     private final String mNumber;
+    @Nullable
+    private final String mInitials;
     private final Uri mAvatarUri;
     private final List<PhoneCallLog.Record> mCallRecords;
     private String mText;
 
-    public UiCallLog(String title, String text, String number, Uri avatarUri,
-            List<PhoneCallLog.Record> callRecords) {
+    public UiCallLog(String title, String text, String number, @Nullable String initials,
+            Uri avatarUri, List<PhoneCallLog.Record> callRecords) {
         mTitle = title;
         mText = text;
         mNumber = number;
+        mInitials = initials;
         mAvatarUri = avatarUri;
         mCallRecords = new ArrayList<>(callRecords);
     }
 
     /**
+     * Returns the initials of a call log item. Returns null if this item is not a contact.
+     */
+    @Nullable
+    public String getInitials() {
+        return mInitials;
+    }
+
+    /**
      * Returns the title of a call log item.
      */
     public String getTitle() {
@@ -73,6 +86,7 @@
     }
 
     /** Returns the avatar of the contact associated with the number. */
+    @Nullable
     public Uri getAvatarUri() {
         return mAvatarUri;
     }
diff --git a/src/com/android/car/dialer/ui/contact/ContactDetailsFragment.java b/src/com/android/car/dialer/ui/contact/ContactDetailsFragment.java
index e6b7101..33e03a7 100644
--- a/src/com/android/car/dialer/ui/contact/ContactDetailsFragment.java
+++ b/src/com/android/car/dialer/ui/contact/ContactDetailsFragment.java
@@ -31,7 +31,6 @@
 import com.android.car.arch.common.FutureData;
 import com.android.car.dialer.R;
 import com.android.car.dialer.ui.common.DialerListBaseFragment;
-import com.android.car.dialer.ui.common.DialerUtils;
 import com.android.car.dialer.ui.view.ContactAvatarOutputlineProvider;
 import com.android.car.telephony.common.Contact;
 import com.android.car.telephony.common.PhoneNumber;
@@ -52,10 +51,12 @@
 
     private Contact mContact;
     private LiveData<FutureData<Contact>> mContactDetailsLiveData;
+    private ContactDetailsViewModel mContactDetailsViewModel;
+
+    private boolean mShowActionBarView;
     private View mActionBarView;
     private ImageView mAvatarView;
     private TextView mNameView;
-    private ContactDetailsViewModel mContactDetailsViewModel;
 
     /** Creates a new ContactDetailsFragment using a {@link Contact}. */
     public static ContactDetailsFragment newInstance(Contact contact) {
@@ -79,6 +80,8 @@
                 ContactDetailsViewModel.class);
         mContactDetailsLiveData = mContactDetailsViewModel.getContactDetails(mContact);
 
+        mShowActionBarView = getResources().getBoolean(
+                R.bool.config_show_contact_details_action_bar_view);
         mActionBarView = LayoutInflater.from(getContext()).inflate(
                 R.layout.contact_details_action_bar, null);
         mAvatarView = mActionBarView.findViewById(R.id.contact_details_action_bar_avatar);
@@ -96,7 +99,7 @@
         ContactDetailsAdapter contactDetailsAdapter = new ContactDetailsAdapter(getContext(),
                 mContact, this);
         getRecyclerView().setAdapter(contactDetailsAdapter);
-        if (!DialerUtils.isShortScreen(getContext())) {
+        if (mShowActionBarView) {
             getRecyclerView().setScrollBarPadding(getTopBarHeight(), 0);
         }
         mContactDetailsLiveData.observe(this, contact -> {
@@ -114,7 +117,7 @@
         getArguments().clear();
         if (mAvatarView != null) {
             mAvatarView.setOutlineProvider(ContactAvatarOutputlineProvider.get());
-            TelecomUtils.setContactBitmapAsync(getContext(), mAvatarView, contact, null);
+            TelecomUtils.setContactBitmapAsync(getContext(), mAvatarView, contact);
         }
 
         if (mNameView != null) {
@@ -128,19 +131,18 @@
 
     @Override
     public void setupActionBar(@NonNull ActionBar actionBar) {
-        actionBar.setCustomView(mActionBarView);
+        actionBar.setCustomView(mShowActionBarView ? mActionBarView : null);
         actionBar.setTitle(null);
 
-        // Remove the action bar background on non-short screens
-        // On short screens the avatar and name is in the action bar so we keep it
-        if (mAvatarView == null) {
+        // Remove the action bar background if the action bar view is not shown.
+        if (!mShowActionBarView) {
             setActionBarBackground(null);
         }
     }
 
     @Override
     protected int getTopOffset() {
-        if (DialerUtils.isShortScreen(getContext())) {
+        if (mShowActionBarView) {
             return super.getTopOffset();
         } else {
             return 0;
diff --git a/src/com/android/car/dialer/ui/contact/ContactDetailsViewHolder.java b/src/com/android/car/dialer/ui/contact/ContactDetailsViewHolder.java
index 44e6405..fb90eee 100644
--- a/src/com/android/car/dialer/ui/contact/ContactDetailsViewHolder.java
+++ b/src/com/android/car/dialer/ui/contact/ContactDetailsViewHolder.java
@@ -84,7 +84,7 @@
     public void bind(Context context, Contact contact) {
         if (contact == null) {
             ViewUtils.setText(mTitle, R.string.error_contact_deleted);
-            LetterTileDrawable letterTile = TelecomUtils.createLetterTile(context, null);
+            LetterTileDrawable letterTile = TelecomUtils.createLetterTile(context, null, null);
             if (mAvatarView != null) {
                 mAvatarView.setImageDrawable(letterTile);
             }
@@ -103,7 +103,7 @@
         }
 
         LetterTileDrawable letterTile = TelecomUtils.createLetterTile(context,
-                contact.getDisplayName());
+                contact.getInitials(), contact.getDisplayName());
         Glide.with(context)
                 .load(contact.getAvatarUri())
                 .apply(new RequestOptions().centerCrop().error(letterTile))
diff --git a/src/com/android/car/dialer/ui/contact/ContactListViewHolder.java b/src/com/android/car/dialer/ui/contact/ContactListViewHolder.java
index 0596b76..60d909f 100644
--- a/src/com/android/car/dialer/ui/contact/ContactListViewHolder.java
+++ b/src/com/android/car/dialer/ui/contact/ContactListViewHolder.java
@@ -65,7 +65,7 @@
      * Binds the view holder with relevant data.
      */
     public void onBind(Contact contact, boolean showHeader, String header) {
-        TelecomUtils.setContactBitmapAsync(mAvatarView.getContext(), mAvatarView, contact, null);
+        TelecomUtils.setContactBitmapAsync(mAvatarView.getContext(), mAvatarView, contact);
         ViewUtils.setVisible(mHeaderView, showHeader);
         if (showHeader) {
             ViewUtils.setText(mHeaderView, header);
diff --git a/src/com/android/car/dialer/ui/dialpad/DialpadFragment.java b/src/com/android/car/dialer/ui/dialpad/DialpadFragment.java
index aa22ba2..e8f22e2 100644
--- a/src/com/android/car/dialer/ui/dialpad/DialpadFragment.java
+++ b/src/com/android/car/dialer/ui/dialpad/DialpadFragment.java
@@ -258,9 +258,7 @@
                 R.string.primary_number_description, readableLabel) : readableLabel);
         ViewUtils.setVisible(mLabel, true);
 
-        if (mAvatar != null) {
-            TelecomUtils.setContactBitmapAsync(getContext(), mAvatar, contact, null);
-        }
+        TelecomUtils.setContactBitmapAsync(getContext(), mAvatar, contact);
         ViewUtils.setVisible(mAvatar, true);
     }
 
diff --git a/src/com/android/car/dialer/ui/favorite/FavoriteContactViewHolder.java b/src/com/android/car/dialer/ui/favorite/FavoriteContactViewHolder.java
index 93d36e2..137a150 100644
--- a/src/com/android/car/dialer/ui/favorite/FavoriteContactViewHolder.java
+++ b/src/com/android/car/dialer/ui/favorite/FavoriteContactViewHolder.java
@@ -83,6 +83,6 @@
         }
         mText.setText(secondaryText);
 
-        TelecomUtils.setContactBitmapAsync(context, mIcon, contact, null);
+        TelecomUtils.setContactBitmapAsync(context, mIcon, contact);
     }
 }
diff --git a/src/com/android/car/dialer/ui/search/ContactResultViewHolder.java b/src/com/android/car/dialer/ui/search/ContactResultViewHolder.java
index 121be99..ad1d139 100644
--- a/src/com/android/car/dialer/ui/search/ContactResultViewHolder.java
+++ b/src/com/android/car/dialer/ui/search/ContactResultViewHolder.java
@@ -59,7 +59,6 @@
                 v -> mOnShowContactDetailListener.onShowContactDetail(contact));
 
         mContactName.setText(contact.getDisplayName());
-        TelecomUtils.setContactBitmapAsync(mContext, mContactPicture, contact.getAvatarUri(),
-                contact.getDisplayName());
+        TelecomUtils.setContactBitmapAsync(mContext, mContactPicture, contact);
     }
 }
diff --git a/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java b/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java
index b276c63..6034b14 100644
--- a/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java
+++ b/tests/robotests/src/com/android/car/dialer/ui/calllog/CallHistoryFragmentTest.java
@@ -87,8 +87,8 @@
                 CallHistoryLiveData.CallType.INCOMING_TYPE);
         PhoneCallLog.Record record2 = new PhoneCallLog.Record(TIME_STAMP_2,
                 CallHistoryLiveData.CallType.OUTGOING_TYPE);
-        UiCallLog uiCallLog = new UiCallLog(UI_CALLOG_TITLE, UI_CALLOG_TEXT, PHONE_NUMBER, mMockUri,
-                Arrays.asList(record1, record2));
+        UiCallLog uiCallLog = new UiCallLog(UI_CALLOG_TITLE, UI_CALLOG_TEXT, PHONE_NUMBER, null,
+                mMockUri, Arrays.asList(record1, record2));
 
         MutableLiveData<FutureData<List<Object>>> callLog = new MutableLiveData<>();
         callLog.setValue(new FutureData<>(false, Arrays.asList(HEADER, uiCallLog)));