diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.java
index 089288b..a7c3504 100644
--- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java
+++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java
@@ -418,9 +418,17 @@
                 DirectoryPartition partition = new DirectoryPartition(false, true);
                 partition.setDirectoryId(id);
                 if (DirectoryCompat.isRemoteDirectory(id)) {
-                    partition.setLabel(mContext.getString(R.string.directory_search_label));
+                    if (DirectoryCompat.isEnterpriseDirectoryId(id)) {
+                        partition.setLabel(mContext.getString(R.string.directory_search_label_work));
+                    } else {
+                        partition.setLabel(mContext.getString(R.string.directory_search_label));
+                    }
                 } else {
-                    partition.setLabel(mDefaultFilterHeaderText.toString());
+                    if (DirectoryCompat.isEnterpriseDirectoryId(id)) {
+                        partition.setLabel(mContext.getString(R.string.list_filter_phones_work));
+                    } else {
+                        partition.setLabel(mDefaultFilterHeaderText.toString());
+                    }
                 }
                 partition.setDirectoryType(cursor.getString(directoryTypeColumnIndex));
                 partition.setDisplayName(cursor.getString(displayNameColumnIndex));
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index bb3fbc9..90b3d60 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -187,6 +187,7 @@
     private ImageView mPresenceIcon;
     private AppCompatCheckBox mCheckBox;
     private ImageView mVideoCallIcon;
+    private ImageView mWorkProfileIcon;
 
     private ColorStateList mSecondaryTextColor;
 
@@ -537,6 +538,14 @@
                     MeasureSpec.makeMeasureSpec(mVideoCallIconSize, MeasureSpec.EXACTLY));
         }
 
+        if (isVisible(mWorkProfileIcon)) {
+            mWorkProfileIcon.measure(
+                    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
+                    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
+            mNameTextViewHeight =
+                    Math.max(mNameTextViewHeight, mWorkProfileIcon.getMeasuredHeight());
+        }
+
         if (isVisible(mStatusView)) {
             // Presence and status are in a same row, so status will be affected by icon size.
             final int statusWidth;
@@ -706,11 +715,32 @@
                 mLabelAndDataViewMaxHeight + mSnippetTextViewHeight + mStatusTextViewHeight;
         int textTopBound = (bottomBound + topBound - totalTextHeight) / 2 + mTextOffsetTop;
 
+        // Work Profile icon align top
+        int workProfileIconWidth = 0;
+        if (isVisible(mWorkProfileIcon)) {
+            workProfileIconWidth = mWorkProfileIcon.getMeasuredWidth();
+            final int distanceFromEnd = mCheckBoxWidth > 0
+                    ? mCheckBoxWidth + mGapBetweenImageAndText : 0;
+            if (mPhotoPosition == PhotoPosition.LEFT) {
+                // When photo is on left, label is placed on the right edge of the list item.
+                mWorkProfileIcon.layout(rightBound - workProfileIconWidth - distanceFromEnd,
+                        textTopBound,
+                        rightBound - distanceFromEnd,
+                        textTopBound + mNameTextViewHeight);
+            } else {
+                // When photo is on right, label is placed on the left of data view.
+                mWorkProfileIcon.layout(leftBound + distanceFromEnd,
+                        textTopBound,
+                        leftBound + workProfileIconWidth + distanceFromEnd,
+                        textTopBound + mNameTextViewHeight);
+            }
+        }
+
         // Layout all text view and presence icon
         // Put name TextView first
         if (isVisible(mNameTextView)) {
-            final int distanceFromEnd = mCheckBoxWidth > 0
-                    ? mCheckBoxWidth + mGapBetweenImageAndText : 0;
+            final int distanceFromEnd = workProfileIconWidth
+                    + (mCheckBoxWidth > 0 ? mCheckBoxWidth + mGapBetweenImageAndText : 0);
             if (mPhotoPosition == PhotoPosition.LEFT) {
                 mNameTextView.layout(leftBound,
                         textTopBound,
@@ -722,6 +752,9 @@
                         rightBound,
                         textTopBound + mNameTextViewHeight);
             }
+        }
+
+        if (isVisible(mNameTextView) || isVisible(mWorkProfileIcon)) {
             textTopBound += mNameTextViewHeight;
         }
 
@@ -1318,6 +1351,23 @@
         }
     }
 
+    /**
+     * Set to display work profile icon or not
+     *
+     * @param enabled set to display work profile icon or not
+     */
+    public void setWorkProfileIconEnabled(boolean enabled) {
+        if (mWorkProfileIcon != null) {
+            mWorkProfileIcon.setVisibility(enabled ? View.VISIBLE : View.GONE);
+        } else if (enabled) {
+            mWorkProfileIcon = new ImageView(getContext());
+            addView(mWorkProfileIcon);
+            mWorkProfileIcon.setImageResource(R.drawable.ic_work_profile);
+            mWorkProfileIcon.setScaleType(ScaleType.CENTER_INSIDE);
+            mWorkProfileIcon.setVisibility(View.VISIBLE);
+        }
+    }
+
     private TruncateAt getTextEllipsis() {
         return TruncateAt.MARQUEE;
     }
diff --git a/src/com/android/contacts/common/list/PhoneNumberListAdapter.java b/src/com/android/contacts/common/list/PhoneNumberListAdapter.java
index fc90fbf..9e886d9 100644
--- a/src/com/android/contacts/common/list/PhoneNumberListAdapter.java
+++ b/src/com/android/contacts/common/list/PhoneNumberListAdapter.java
@@ -35,6 +35,7 @@
 
 import com.android.contacts.common.CallUtil;
 import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
+import com.android.contacts.common.ContactsUtils;
 import com.android.contacts.common.GeoUtil;
 import com.android.contacts.common.R;
 import com.android.contacts.common.compat.CallableCompat;
@@ -321,11 +322,20 @@
     public Uri getDataUri(int partitionIndex, Cursor cursor) {
         final long directoryId =
                 ((DirectoryPartition)getPartition(partitionIndex)).getDirectoryId();
-        if (!DirectoryCompat.isRemoteDirectory(directoryId)) {
+        if (DirectoryCompat.isRemoteDirectory(directoryId)) {
+            return null;
+        } else if (DirectoryCompat.isEnterpriseDirectoryId(directoryId)) {
+            /*
+             * ContentUris.withAppendedId(Data.CONTENT_URI, phoneId), is invalid if
+             * isEnterpriseDirectoryId returns true, because the uri itself will fail since the
+             * ContactsProvider in Android Framework currently doesn't support it. return null until
+             * Android framework has enterprise version of Data.CONTENT_URI
+             */
+            return null;
+        } else {
             final long phoneId = cursor.getLong(PhoneQuery.PHONE_ID);
             return ContentUris.withAppendedId(Data.CONTENT_URI, phoneId);
         }
-        return null;
     }
 
     /**
@@ -427,6 +437,7 @@
 
             view.removePhotoView(true, false);
         }
+        bindWorkProfileIcon(view, partition);
 
         final DirectoryPartition directory = (DirectoryPartition) getPartition(partition);
         bindPhoneNumber(view, cursor, directory.isDisplayNumber(), position);
@@ -485,6 +496,13 @@
         view.hideDisplayName();
     }
 
+    private void bindWorkProfileIcon(final ContactListItemView view, int partition) {
+        final DirectoryPartition directory = (DirectoryPartition) getPartition(partition);
+        final long directoryId = directory.getDirectoryId();
+        final long userType = ContactsUtils.determineUserType(directoryId, null);
+        view.setWorkProfileIconEnabled(userType == ContactsUtils.USER_TYPE_WORK);
+    }
+
     protected void bindPhoto(final ContactListItemView view, int partitionIndex, Cursor cursor) {
         if (!isPhotoSupported(partitionIndex)) {
             view.removePhotoView();
