diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index b91f927..fc4ef6a 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -25,12 +25,9 @@
 import android.app.Dialog;
 import android.app.WallpaperManager;
 import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.database.ContentObserver;
-import android.database.Cursor;
 import android.graphics.Color;
 import android.graphics.Point;
 import android.media.AudioManager;
@@ -38,7 +35,6 @@
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Bundle;
-import android.os.Handler;
 import android.os.PersistableBundle;
 import android.provider.Settings;
 import android.telecom.PhoneAccount;
@@ -177,25 +173,6 @@
 
     private boolean mAreEmergencyDialerShortcutsEnabled;
 
-    /** Key of emergency information user name */
-    private static final String KEY_EMERGENCY_INFO_NAME = "name";
-
-    /** Authority of emergency information */
-    private static final String AUTHORITY = "com.android.emergency.info.name";
-
-    /** Content path of emergency information name */
-    private static final String CONTENT_PATH = "name";
-
-    /** Content URI of emergency information */
-    private static final Uri CONTENT_URI = new Uri.Builder()
-            .scheme(ContentResolver.SCHEME_CONTENT)
-            .authority(AUTHORITY)
-            .path(CONTENT_PATH)
-            .build();
-
-    /** ContentObserver for monitoring emergency info name changes */
-    private ContentObserver mEmergencyInfoNameObserver;
-
     @Override
     public void beforeTextChanged(CharSequence s, int start, int count, int after) {
         // Do nothing
@@ -348,10 +325,6 @@
             }
         }
         unregisterReceiver(mBroadcastReceiver);
-        if (mEmergencyInfoNameObserver != null) {
-            getContentResolver().unregisterContentObserver(mEmergencyInfoNameObserver);
-            mEmergencyInfoNameObserver = null;
-        }
     }
 
     @Override
@@ -930,19 +903,6 @@
         setupEmergencyCallShortcutButton();
 
         switchView(mEmergencyShortcutView, mDialpadView, false);
-
-        mEmergencyInfoNameObserver = new ContentObserver(new Handler()) {
-            @Override
-            public void onChange(boolean selfChange) {
-                super.onChange(selfChange);
-                getEmergencyInfoNameAsync();
-            }
-        };
-        // Register ContentProvider for monitoring emergency info name changes.
-        getContentResolver().registerContentObserver(CONTENT_URI, false,
-                mEmergencyInfoNameObserver);
-        // Query emergency info name.
-        getEmergencyInfoNameAsync();
     }
 
     private void setLocationInfo(String country) {
@@ -1063,38 +1023,4 @@
                     }
                 });
     }
-
-    /**
-     * Get emergency info name from EmergencyInfo and then update EmergencyInfoGroup.
-     */
-    private void getEmergencyInfoNameAsync() {
-        new AsyncTask<Void, Void, String>() {
-            @Override
-            protected String doInBackground(Void... params) {
-                String name = "";
-                try (Cursor cursor = getContentResolver().query(CONTENT_URI, null, null, null,
-                        null)) {
-                    if (cursor != null && cursor.moveToFirst()) {
-                        int index = cursor.getColumnIndex(KEY_EMERGENCY_INFO_NAME);
-                        name = index > -1 ? cursor.getString(index) : "";
-                    }
-                } catch (IllegalArgumentException ex) {
-                    Log.w(LOG_TAG, "getEmergencyInfoNameAsync failed", ex);
-                }
-                return name;
-            }
-
-            @Override
-            protected void onPostExecute(String result) {
-                super.onPostExecute(result);
-                if (!isFinishing() && !isDestroyed()) {
-                    // Update emergency info with emergency info name
-                    EmergencyInfoGroup group = findViewById(R.id.emergency_info_button);
-                    if (group != null) {
-                        group.updateEmergencyInfo(result);
-                    }
-                }
-            }
-        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
-    }
 }
diff --git a/src/com/android/phone/EmergencyInfoGroup.java b/src/com/android/phone/EmergencyInfoGroup.java
index 73fa92a..898af32 100644
--- a/src/com/android/phone/EmergencyInfoGroup.java
+++ b/src/com/android/phone/EmergencyInfoGroup.java
@@ -30,6 +30,7 @@
 import android.view.View;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import androidx.core.graphics.drawable.RoundedBitmapDrawable;
@@ -46,6 +47,7 @@
 public class EmergencyInfoGroup extends FrameLayout {
     private ImageView mEmergencyInfoImage;
     private TextView mEmergencyInfoName;
+    private TextView mEmergencyInfoHint;
     private View mEmergencyInfoButton;
 
     public EmergencyInfoGroup(Context context, @Nullable AttributeSet attrs) {
@@ -58,6 +60,7 @@
         mEmergencyInfoButton = findViewById(R.id.emergency_info_button);
         mEmergencyInfoImage = (ImageView) findViewById(R.id.emergency_info_image);
         mEmergencyInfoName = (TextView) findViewById(R.id.emergency_info_name);
+        mEmergencyInfoHint = (TextView) findViewById(R.id.emergency_info_hint);
     }
 
     @Override
@@ -68,6 +71,12 @@
         }
     }
 
+    @Override
+    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+        super.onLayout(changed, left, top, right, bottom);
+        updateLayoutHeight();
+    }
+
     private void setupButtonInfo() {
         List<ResolveInfo> infos;
 
@@ -88,6 +97,7 @@
 
             visible = true;
         }
+        mEmergencyInfoName.setText(getUserName());
 
         setVisibility(visible ? View.VISIBLE : View.GONE);
     }
@@ -95,34 +105,19 @@
     /**
      * Get user icon.
      *
-     * @return user icon, or anonymous avatar if user do not set photo.
+     * @return user icon, or default user icon if user do not set photo.
      */
     private Drawable getCircularUserIcon() {
-        final int userId = UserHandle.getCallingUserId();
-
         final UserManager userManager = (UserManager) getContext().getSystemService(
                 Context.USER_SERVICE);
-
-        // get user icon.
-        Bitmap bitmapUserIcon = userManager.getUserIcon(userId);
+        Bitmap bitmapUserIcon = userManager.getUserIcon(UserHandle.getCallingUserId());
 
         if (bitmapUserIcon == null) {
-            // use anonymous avatar.
-            return getContext().getDrawable(R.drawable.logo_avatar_anonymous_120);
+            // get default user icon.
+            final Drawable defaultUserIcon = UserIcons.getDefaultUserIcon(
+                    getContext().getResources(), UserHandle.myUserId(), false);
+            bitmapUserIcon = UserIcons.convertToBitmap(defaultUserIcon);
         }
-
-        // get default user icon.
-        Drawable drawableDefaultUserIcon = UserIcons.getDefaultUserIcon(
-                getContext().getResources(), userId, false);
-        Bitmap bitmapDefaultUserIcon = UserIcons.convertToBitmap(drawableDefaultUserIcon);
-
-        // User icon is default icon that means user do not set photo, replacing default icon
-        // with anonymous avatar on emergency info button.
-        if (bitmapUserIcon.sameAs(bitmapDefaultUserIcon)) {
-            return getContext().getDrawable(R.drawable.logo_avatar_anonymous_120);
-        }
-
-        // set user icon circular.
         RoundedBitmapDrawable drawableUserIcon = RoundedBitmapDrawableFactory.create(
                 getContext().getResources(), bitmapUserIcon);
         drawableUserIcon.setCircular(true);
@@ -130,14 +125,24 @@
         return drawableUserIcon;
     }
 
-    void updateEmergencyInfo(String emergencyInfoName) {
-        if (TextUtils.isEmpty(emergencyInfoName)) {
-            emergencyInfoName = getContext().getString(R.string.emergency_information_owner_hint);
-        }
-        mEmergencyInfoName.setText(emergencyInfoName);
+    private CharSequence getUserName() {
+        final UserManager userManager = (UserManager) getContext().getSystemService(
+                Context.USER_SERVICE);
+        final String userName = userManager.getUserName();
 
-        final String infoNameDescription = getContext().getString(
-                R.string.emergency_information_owner_content_description, emergencyInfoName);
-        mEmergencyInfoName.setContentDescription(infoNameDescription);
+        return TextUtils.isEmpty(userName) ? getContext().getText(
+                R.string.emergency_information_owner_hint) : userName;
     }
-}
\ No newline at end of file
+
+    private void updateLayoutHeight() {
+        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) getLayoutParams();
+        // Update height if mEmergencyInfoHint text line more than 1.
+        // EmergencyInfoGroup max line is 2, eclipse type "end" will be adopt if string too long.
+        params.height =
+                mEmergencyInfoHint.getLineCount() > 1 ? getResources().getDimensionPixelSize(
+                        R.dimen.emergency_info_button_multiline_height)
+                        : getResources().getDimensionPixelSize(
+                                R.dimen.emergency_info_button_singleline_height);
+        setLayoutParams(params);
+    }
+}
