Snap for 9470583 from ff1efb9d28add86a03718854ee6894b9de269456 to tm-qpr3-release

Change-Id: I4f534942405ab3a026b403b34b42fc3cd9a284f8
diff --git a/main/res/drawable/sud_dialog_background_dark.xml b/main/res/drawable/sud_dialog_background_dark.xml
index 914cfec..38f727d 100644
--- a/main/res/drawable/sud_dialog_background_dark.xml
+++ b/main/res/drawable/sud_dialog_background_dark.xml
@@ -19,10 +19,6 @@
      copy from abc_dialog_material_background.xml of
      Base.V7.Theme.AppCompat.Light.Dialog. -->
 <inset xmlns:android="http://schemas.android.com/apk/res/android">
-    android:insetLeft="16dp"
-    android:insetTop="16dp"
-    android:insetRight="16dp"
-    android:insetBottom="16dp">
     <shape android:shape="rectangle">
         <corners android:radius="?attr/dialogCornerRadius" />
         <solid android:color="@color/sud_glif_window_bg_dark_color" />
diff --git a/main/res/drawable/sud_dialog_background_light.xml b/main/res/drawable/sud_dialog_background_light.xml
index 0302783..49280f4 100644
--- a/main/res/drawable/sud_dialog_background_light.xml
+++ b/main/res/drawable/sud_dialog_background_light.xml
@@ -19,10 +19,6 @@
      copy from abc_dialog_material_background.xml of
      Base.V7.Theme.AppCompat.Light.Dialog. -->
 <inset xmlns:android="http://schemas.android.com/apk/res/android">
-    android:insetLeft="16dp"
-    android:insetTop="16dp"
-    android:insetRight="16dp"
-    android:insetBottom="16dp">
     <shape android:shape="rectangle">
         <corners android:radius="?attr/dialogCornerRadius" />
         <solid android:color="@color/sud_glif_window_bg_light_color" />
diff --git a/main/res/layout/sud_glif_header.xml b/main/res/layout/sud_glif_header.xml
index 70b8daa..accb3c0 100644
--- a/main/res/layout/sud_glif_header.xml
+++ b/main/res/layout/sud_glif_header.xml
@@ -43,6 +43,8 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
+    <include layout="@layout/sud_glif_profile" />
+
     <ViewStub
         android:id="@+id/sud_layout_progress_stub"
         android:layout_width="match_parent"
diff --git a/main/res/layout/sud_glif_profile.xml b/main/res/layout/sud_glif_profile.xml
new file mode 100644
index 0000000..dbbf813
--- /dev/null
+++ b/main/res/layout/sud_glif_profile.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (C) 2022 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.
+-->
+
+<!-- TODO: Change LinearLayout to a TextView include drawable -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/sud_layout_profile"
+    style="?attr/sudGlifAccountContainerStyle"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:visibility="gone"
+    android:orientation="horizontal">
+
+    <ImageView
+        android:id="@+id/sud_account_avatar"
+        style="?attr/sudGlifAccountAvatarStyle"
+        android:contentDescription="@null"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/sud_account_name"
+        style="?attr/sudGlifAccountNameStyle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:gravity="left" />
+
+</LinearLayout>
diff --git a/main/res/values-night-v33/colors.xml b/main/res/values-night-v33/colors.xml
index 79ed31a..5bb3d39 100644
--- a/main/res/values-night-v33/colors.xml
+++ b/main/res/values-night-v33/colors.xml
@@ -17,9 +17,5 @@
 
 <resources>
 
-  <color name="sud_system_primary_text">@color/sud_system_neutral1_0</color>
-  <color name="sud_system_secondary_text">@color/sud_system_neutral1_200</color>
-  <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral1_300</color>
-  <color name="sud_system_background_surface">@color/sud_system_neutral1_1000</color>
-  <color name="sud_system_dividing_line">@color/sud_system_neutral1_600</color>
-</resources>
\ No newline at end of file
+  <color name="sud_system_dividing_line">@color/sud_system_neutral2_700</color>
+</resources>
diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml
index df86de7..5fab1c1 100644
--- a/main/res/values-v31/styles.xml
+++ b/main/res/values-v31/styles.xml
@@ -19,6 +19,7 @@
   <!-- Main theme for dynamic color -->
   <style name="SudDynamicColorBaseTheme">
     <item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_dark</item>
+    <item name="android:colorAccent">?attr/colorAccent</item>
     <item name="android:textColorLink">@color/sud_system_hyperlink_text</item>
     <item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat</item>
     <item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme</item>
@@ -33,6 +34,7 @@
 
   <style name="SudDynamicColorBaseTheme.Light">
     <item name="colorAccent">@color/sud_dynamic_color_accent_glif_v3_light</item>
+    <item name="android:colorAccent">?attr/colorAccent</item>
     <item name="android:textColorLink">@color/sud_system_hyperlink_text</item>
     <item name="alertDialogTheme">@style/SudDynamicColorAlertDialogThemeCompat.Light</item>
     <item name="android:datePickerDialogTheme">@style/SudDynamicColorDateTimePickerDialogTheme.Light</item>
@@ -196,6 +198,8 @@
   </style>
 
   <style name="SudAppCompatButtonButtonBarAlertDialog" parent="Widget.AppCompat.ButtonBar.AlertDialog">
+    <item name="android:layout_marginStart">@dimen/sud_glif_alert_dialog_footer_bar_padding_start</item>
+    <item name="android:layout_marginLeft">@dimen/sud_glif_alert_dialog_footer_bar_padding_start</item>
     <item name="android:textAppearance">@style/SudTextAppearanceDeviceDefaultMedium</item>
     <item name="android:minWidth">@dimen/sud_alert_dialog_button_bar_width</item>
     <item name="android:minHeight">@dimen/sud_alert_dialog_button_bar_height</item>
diff --git a/main/res/values-v33/colors.xml b/main/res/values-v33/colors.xml
index c46c6fc..37e3b37 100644
--- a/main/res/values-v33/colors.xml
+++ b/main/res/values-v33/colors.xml
@@ -18,11 +18,10 @@
 
 <resources>
 
-  <color name="sud_system_secondary_text">@color/sud_system_neutral1_700</color>
-  <color name="sud_system_tertiary_text_inactive">@color/sud_system_neutral1_600</color>
-  <color name="sud_system_background_surface">@color/sud_system_neutral1_0</color>
   <color name="sud_system_button_surface">@color/sud_system_accent1_600</color>
-  <color name="sud_system_dividing_line">@color/sud_system_neutral1_500</color>
+  <color name="sud_system_button_text">@color/sud_system_neutral1_50</color>
+  <!-- used by other 1p-->
+  <color name="sud_system_dividing_line">@color/sud_system_neutral2_200</color>
 
   <color name="sud_glif_v3_nav_bar_divider_color_light">@android:color/transparent</color>
 </resources>
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml
index 22aee0d..4600bcc 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -61,11 +61,14 @@
     <attr name="sudGlifIconSize" format="dimension" />
 
     <attr name="sudGlifDescriptionStyle" format="reference" />
+    <attr name="sudGlifAccountNameStyle" format="reference" />
+    <attr name="sudGlifAccountAvatarStyle" format="reference" />
+    <attr name="sudGlifAccountContainerStyle" format="reference" />
+    <attr name="sudGlifAccountAvatarSize" format="dimension" />
 
     <attr name="sudButtonAllCaps" format="boolean" />
     <attr name="sudButtonCornerRadius" format="dimension" />
     <attr name="sudButtonFontFamily" format="string|reference" />
-    <!-- Values copied from frameworks/base/core/res/res/values/attrs.xml -->
     <attr name="sudButtonTertiaryGravity">
         <!-- Push object to the left of its container, not changing its size. -->
         <flag name="left" value="0x03" />
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index 4b821a4..d3f0d02 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -56,6 +56,7 @@
     <dimen name="sud_horizontal_icon_height">32dp</dimen>
 
     <dimen name="sud_glif_alert_dialog_corner_radius">8dp</dimen>
+    <dimen name="sud_glif_alert_dialog_footer_bar_padding_start">8dp</dimen>
     <dimen name="sud_glif_v3_button_corner_radius">4dp</dimen>
     <dimen name="sud_glif_device_default_dialog_corner_radius">28dp</dimen>
     <dimen name="sud_glif_land_header_area_weight">1</dimen>
@@ -152,6 +153,11 @@
     <dimen name="sud_glif_header_title_margin_bottom">2dp</dimen>
     <dimen name="sud_header_container_margin_bottom">0dp</dimen>
 
+    <!-- Account information -->
+    <dimen name="sud_account_name_text_size">14sp</dimen>
+    <dimen name="sud_account_avatar_margin_end">8dp</dimen>
+    <dimen name="sud_account_avatar_max_height">24dp</dimen>
+
     <!-- This value leverages sud_description_glif_margin_top -->
     <dimen name="sud_glif_description_margin_top">3dp</dimen>
     <dimen name="sud_glif_description_margin_bottom">12dp</dimen>
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index e33b305..e3b3489 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -168,6 +168,10 @@
         <item name="sudDividerInsetStart">@dimen/sud_items_glif_icon_divider_inset</item>
         <item name="sudDividerInsetStartNoIcon">@dimen/sud_items_glif_text_divider_inset</item>
         <item name="sudDividerShown">true</item>
+        <item name="sudGlifAccountContainerStyle">@style/SudGlifAccountContainer</item>
+        <item name="sudGlifAccountNameStyle">@style/SudGlifAccountName</item>
+        <item name="sudGlifAccountAvatarSize">@dimen/sud_account_avatar_max_height</item>
+        <item name="sudGlifAccountAvatarStyle">@style/SudGlifAccountAvatar</item>
         <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitle</item>
         <item name="sudGlifHeaderGravity">start</item>
         <item name="sudGlifSubtitleGravity">start</item>
@@ -262,6 +266,10 @@
         <item name="sudDividerInsetStart">@dimen/sud_items_glif_icon_divider_inset</item>
         <item name="sudDividerInsetStartNoIcon">@dimen/sud_items_glif_text_divider_inset</item>
         <item name="sudDividerShown">true</item>
+        <item name="sudGlifAccountContainerStyle">@style/SudGlifAccountContainer</item>
+        <item name="sudGlifAccountNameStyle">@style/SudGlifAccountName</item>
+        <item name="sudGlifAccountAvatarSize">@dimen/sud_account_avatar_max_height</item>
+        <item name="sudGlifAccountAvatarStyle">@style/SudGlifAccountAvatar</item>
         <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitle</item>
         <item name="sudGlifHeaderGravity">start</item>
         <item name="sudGlifSubtitleGravity">start</item>
@@ -397,6 +405,7 @@
         <item name="sudButtonCornerRadius">@dimen/sud_footer_bar_button_radius_material_you</item>
         <item name="sudButtonTertiaryGravity">center_horizontal</item>
         <item name="sudGlifIconSize">@dimen/sud_glif_icon_max_height_material_you</item>
+        <item name="sudGlifAccountContainerStyle">@style/SudGlifAccountContainerMaterialYou</item>
         <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitleMaterialYou</item>
         <item name="sudGlifHeaderGravity">start</item>
         <item name="sucGlifHeaderMarginTop">@dimen/sud_glif_header_title_margin_top_material_you</item>
@@ -415,7 +424,7 @@
         <item name="sudItemDescriptionStyle">@style/SudItemContainerMaterialYou.Description</item>
         <item name="sudItemVerboseTitleStyle">@style/SudMaterialYouItemTitle.Verbose</item>
         <item name="alertDialogTheme">@style/SudMaterialYouAlertDialogThemeCompat</item>
-        <item name="android:alertDialogTheme" >@style/SudMaterialYouAlertDialogTheme</item>
+        <item name="android:alertDialogTheme">@style/SudMaterialYouAlertDialogTheme</item>
     </style>
 
     <style name="SudThemeGlifV4.Light" parent="SudThemeGlifV3.Light">
@@ -431,6 +440,7 @@
         <item name="sudButtonCornerRadius">@dimen/sud_footer_bar_button_radius_material_you</item>
         <item name="sudButtonTertiaryGravity">center_horizontal</item>
         <item name="sudGlifIconSize">@dimen/sud_glif_icon_max_height_material_you</item>
+        <item name="sudGlifAccountContainerStyle">@style/SudGlifAccountContainerMaterialYou</item>
         <item name="sudGlifHeaderTitleStyle">@style/SudGlifHeaderTitleMaterialYou</item>
         <item name="sudGlifHeaderGravity">start</item>
         <item name="sucGlifHeaderMarginTop">@dimen/sud_glif_header_title_margin_top_material_you</item>
@@ -449,7 +459,7 @@
         <item name="sudItemDescriptionStyle">@style/SudItemContainerMaterialYou.Description</item>
         <item name="sudItemVerboseTitleStyle">@style/SudMaterialYouItemTitle.Verbose</item>
         <item name="alertDialogTheme">@style/SudMaterialYouAlertDialogThemeCompat.Light</item>
-        <item name="android:alertDialogTheme" >@style/SudMaterialYouAlertDialogTheme.Light</item>
+        <item name="android:alertDialogTheme">@style/SudMaterialYouAlertDialogTheme.Light</item>
     </style>
 
     <style name="SudDynamicColorTheme" />
@@ -877,6 +887,7 @@
         <item name="android:textColor">?android:attr/textColorPrimary</item>
         <item name="android:textDirection" tools:targetApi="jelly_bean_mr1">locale</item>
         <item name="android:accessibilityHeading" tools:targetApi="p">true</item>
+        <item name="android:hyphenationFrequency" tools:targetApi="23">full</item>
     </style>
 
     <style name="SudGlifHeaderTitleMaterialYou">
@@ -895,6 +906,7 @@
         <item name="android:textDirection" tools:targetApi="jelly_bean_mr1">locale</item>
         <item name="android:accessibilityHeading" tools:targetApi="p">true</item>
         <item name="android:textSize">@dimen/sud_glif_header_title_size_material_you</item>
+        <item name="android:hyphenationFrequency" tools:targetApi="23">full</item>
     </style>
 
     <style name="SudGlifDescription" parent="SudDescription.Glif">
@@ -926,16 +938,51 @@
         <item name="android:textSize">@dimen/sud_glif_description_text_size_material_you</item>
     </style>
 
+    <style name="SudGlifAccountContainerMaterialYou">
+        <item name="android:layout_marginBottom">@dimen/sud_glif_header_title_margin_bottom_material_you</item>
+        <item name="android:layout_marginTop">@dimen/sud_glif_header_title_margin_top_material_you</item>
+        <item name="android:layout_marginLeft">?attr/sudMarginStart</item>
+        <item name="android:layout_marginStart" tools:ignore="NewApi">?attr/sudMarginStart</item>
+        <item name="android:layout_marginRight">?attr/sudMarginEnd</item>
+        <item name="android:layout_marginEnd" tools:ignore="NewApi">?attr/sudMarginEnd</item>
+        <item name="android:gravity">?attr/sudGlifHeaderGravity</item>
+    </style>
+
+    <style name="SudGlifAccountAvatar">
+        <item name="android:layout_marginRight">@dimen/sud_account_avatar_margin_end</item>
+        <item name="android:layout_marginEnd">@dimen/sud_account_avatar_margin_end</item>
+        <item name="android:adjustViewBounds">true</item>
+        <item name="android:maxHeight">@dimen/sud_account_avatar_max_height</item>
+        <item name="android:layout_gravity">center_vertical</item>
+    </style>
+
+    <style name="SudGlifAccountName">
+        <item name="android:fontFamily" tools:targetApi="jelly_bean">@string/sudFontSecondary</item>
+        <item name="android:textColor">?android:attr/textColorPrimary</item>
+        <item name="android:textSize">@dimen/sud_account_name_text_size</item>
+        <item name="android:layout_gravity">center_vertical</item>
+    </style>
+
     <style name="SudGlifHeaderContainer">
         <item name="android:gravity">?attr/sudGlifHeaderGravity</item>
         <item name="android:layout_marginBottom">?attr/sucHeaderContainerMarginBottom</item>
     </style>
 
+    <style name="SudGlifAccountContainer">
+        <item name="android:layout_marginBottom">@dimen/sud_glif_header_title_margin_bottom_material_you</item>
+        <item name="android:layout_marginTop">@dimen/sud_glif_header_title_margin_top_material_you</item>
+        <item name="android:layout_marginLeft">?attr/sudMarginStart</item>
+        <item name="android:layout_marginStart" tools:ignore="NewApi">?attr/sudMarginStart</item>
+        <item name="android:layout_marginRight">?attr/sudMarginEnd</item>
+        <item name="android:layout_marginEnd" tools:ignore="NewApi">?attr/sudMarginEnd</item>
+        <item name="android:gravity">?attr/sudGlifHeaderGravity</item>
+    </style>
+
     <style name="SudGlifIconContainer">
         <item name="android:layout_marginLeft">?attr/sudMarginStart</item>
-      <item name="android:layout_marginStart" tools:ignore="NewApi">?attr/sudMarginStart</item>
+        <item name="android:layout_marginStart" tools:ignore="NewApi">?attr/sudMarginStart</item>
         <item name="android:layout_marginRight">?attr/sudMarginEnd</item>
-      <item name="android:layout_marginEnd" tools:ignore="NewApi">?attr/sudMarginEnd</item>
+        <item name="android:layout_marginEnd" tools:ignore="NewApi">?attr/sudMarginEnd</item>
         <item name="android:layout_marginTop">?attr/sucGlifIconMarginTop</item>
         <item name="android:maxHeight">?attr/sudGlifIconSize</item>
     </style>
diff --git a/main/src/com/google/android/setupdesign/GlifLayout.java b/main/src/com/google/android/setupdesign/GlifLayout.java
index 1b8c8f8..3f0d243 100644
--- a/main/src/com/google/android/setupdesign/GlifLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifLayout.java
@@ -45,6 +45,7 @@
 import com.google.android.setupdesign.template.HeaderMixin;
 import com.google.android.setupdesign.template.IconMixin;
 import com.google.android.setupdesign.template.IllustrationProgressMixin;
+import com.google.android.setupdesign.template.ProfileMixin;
 import com.google.android.setupdesign.template.ProgressBarMixin;
 import com.google.android.setupdesign.template.RequireScrollMixin;
 import com.google.android.setupdesign.template.ScrollViewScrollHandlingDelegate;
@@ -121,6 +122,7 @@
     registerMixin(HeaderMixin.class, new HeaderMixin(this, attrs, defStyleAttr));
     registerMixin(DescriptionMixin.class, new DescriptionMixin(this, attrs, defStyleAttr));
     registerMixin(IconMixin.class, new IconMixin(this, attrs, defStyleAttr));
+    registerMixin(ProfileMixin.class, new ProfileMixin(this, attrs, defStyleAttr));
     registerMixin(ProgressBarMixin.class, new ProgressBarMixin(this, attrs, defStyleAttr));
     registerMixin(IllustrationProgressMixin.class, new IllustrationProgressMixin(this));
     final RequireScrollMixin requireScrollMixin = new RequireScrollMixin(this);
@@ -184,6 +186,7 @@
     getMixin(HeaderMixin.class).tryApplyPartnerCustomizationStyle();
     getMixin(DescriptionMixin.class).tryApplyPartnerCustomizationStyle();
     getMixin(ProgressBarMixin.class).tryApplyPartnerCustomizationStyle();
+    getMixin(ProfileMixin.class).tryApplyPartnerCustomizationStyle();
     tryApplyPartnerCustomizationStyleToShortDescription();
   }
 
diff --git a/main/src/com/google/android/setupdesign/span/LinkSpan.java b/main/src/com/google/android/setupdesign/span/LinkSpan.java
index 7d91012..3bb1617 100644
--- a/main/src/com/google/android/setupdesign/span/LinkSpan.java
+++ b/main/src/com/google/android/setupdesign/span/LinkSpan.java
@@ -73,10 +73,10 @@
 
   /* non-static section */
 
-  private final String id;
+  private final String link;
 
-  public LinkSpan(String id) {
-    this.id = id;
+  public LinkSpan(String link) {
+    this.link = link;
   }
 
   @Override
@@ -137,7 +137,7 @@
     drawState.setUnderlineText(false);
   }
 
-  public String getId() {
-    return id;
+  public String getLink() {
+    return link;
   }
 }
diff --git a/main/src/com/google/android/setupdesign/template/HeaderMixin.java b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
index 814f873..2a6114d 100644
--- a/main/src/com/google/android/setupdesign/template/HeaderMixin.java
+++ b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
@@ -27,6 +27,7 @@
 import android.view.ViewGroup;
 import android.view.ViewParent;
 import android.view.ViewTreeObserver;
+import android.view.ViewTreeObserver.OnPreDrawListener;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 import androidx.annotation.AttrRes;
@@ -42,6 +43,7 @@
 import com.google.android.setupdesign.util.LayoutStyler;
 import com.google.android.setupdesign.util.PartnerStyleHelper;
 import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.util.ArrayList;
 
 /**
  * A {@link com.google.android.setupcompat.template.Mixin} for setting and getting the header text.
@@ -54,7 +56,10 @@
   private float headerAutoSizeMinTextSizeInPx;
   private float headerAutoSizeLineExtraSpacingInPx;
   private int headerAutoSizeMaxLineOfMaxSize;
+  private float defaultTextSize = 0;
+  private int defaultLineHeight = 0;
   private static final int AUTO_SIZE_DEFAULT_MAX_LINES = 6;
+  ArrayList<OnPreDrawListener> titlePreDrawListeners = new ArrayList<>();
 
   /**
    * A {@link com.google.android.setupcompat.template.Mixin} for setting and getting the Header.
@@ -78,8 +83,11 @@
         a.getColorStateList(R.styleable.SucHeaderMixin_sucHeaderTextColor);
 
     a.recycle();
-
-    // Try to update the flag of the uto size config settings
+    if (getTextView() != null) {
+      defaultTextSize = getTextView().getTextSize();
+      defaultLineHeight = getTextView().getLineHeight();
+    }
+    // Try to update the flag of the auto size config settings
     tryUpdateAutoTextSizeFlagWithPartnerConfig();
 
     // Set the header text
@@ -109,7 +117,11 @@
     if (!autoTextSizeEnabled) {
       return;
     }
+    tryUpdateAutoTextConfigWithPartnerConfig();
+  }
 
+  private void tryUpdateAutoTextConfigWithPartnerConfig() {
+    Context context = templateLayout.getContext();
     if (PartnerConfigHelper.get(context)
         .isPartnerConfigAvailable(PartnerConfig.CONFIG_HEADER_AUTO_SIZE_MAX_TEXT_SIZE)) {
       headerAutoSizeMaxTextSizeInPx =
@@ -207,36 +219,66 @@
     }
     // preset as the max size
     titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, headerAutoSizeMaxTextSizeInPx);
+    defaultTextSize = titleView.getTextSize();
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
       titleView.setLineHeight(
           Math.round(headerAutoSizeLineExtraSpacingInPx + headerAutoSizeMaxTextSizeInPx));
+      defaultLineHeight = titleView.getLineHeight();
     }
     titleView.setMaxLines(AUTO_SIZE_DEFAULT_MAX_LINES);
-
     // reset text size if the line count for max text size > headerAutoSizeMaxLineOfMaxTextSize
-    titleView
-        .getViewTreeObserver()
-        .addOnPreDrawListener(
-            new ViewTreeObserver.OnPreDrawListener() {
-              @Override
-              public boolean onPreDraw() {
-                // Remove listener to avoid this called every frame
-                titleView.getViewTreeObserver().removeOnPreDrawListener(this);
-                int lineCount = titleView.getLineCount();
-                if (lineCount > headerAutoSizeMaxLineOfMaxSize) {
-                  // reset text size
-                  titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, headerAutoSizeMinTextSizeInPx);
-                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
-                    titleView.setLineHeight(
-                        Math.round(
-                            headerAutoSizeLineExtraSpacingInPx + headerAutoSizeMinTextSizeInPx));
-                  }
-                  titleView.invalidate();
-                  return false; // false to skip this frame
-                }
-                return true;
+    OnPreDrawListener titlePreDrawListener =
+        new ViewTreeObserver.OnPreDrawListener() {
+          @Override
+          public boolean onPreDraw() {
+            // Remove listener to avoid this called every frame
+            titleView.getViewTreeObserver().removeOnPreDrawListener(this);
+            int lineCount = titleView.getLineCount();
+            if (lineCount > headerAutoSizeMaxLineOfMaxSize) {
+              // reset text size
+              titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, headerAutoSizeMinTextSizeInPx);
+              if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+                titleView.setLineHeight(
+                    Math.round(headerAutoSizeLineExtraSpacingInPx + headerAutoSizeMinTextSizeInPx));
               }
-            });
+              titleView.invalidate();
+              return false; // false to skip this frame
+            }
+            return true;
+          }
+        };
+    titleView.getViewTreeObserver().addOnPreDrawListener(titlePreDrawListener);
+    titlePreDrawListeners.add(titlePreDrawListener);
+  }
+
+  private void resetTextSize(TextView titleView) {
+    if (titleView == null) {
+      return;
+    }
+    titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, defaultTextSize);
+    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+      titleView.setLineHeight(defaultLineHeight);
+    }
+    for (OnPreDrawListener titlePreDrawListener : titlePreDrawListeners) {
+      titleView.getViewTreeObserver().removeOnPreDrawListener(titlePreDrawListener);
+    }
+    titlePreDrawListeners.clear();
+  }
+
+  /**
+   * Enable or disable the auto size for header string. Which will adjust the font size of header
+   * string to fit the limitation of headerAutoSizeMaxLineOfMaxSize.
+   */
+  public void setAutoTextSizeEnabled(boolean autoTextSizeEnabled) {
+    this.autoTextSizeEnabled = autoTextSizeEnabled;
+    if (autoTextSizeEnabled) {
+      tryUpdateAutoTextConfigWithPartnerConfig();
+      if (autoTextSizeEnabled) {
+        autoAdjustTextSize(getTextView());
+      }
+    } else {
+      resetTextSize(getTextView());
+    }
   }
 
   /** Returns the current header text. */
diff --git a/main/src/com/google/android/setupdesign/template/ProfileMixin.java b/main/src/com/google/android/setupdesign/template/ProfileMixin.java
new file mode 100644
index 0000000..2970d0e
--- /dev/null
+++ b/main/src/com/google/android/setupdesign/template/ProfileMixin.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.google.android.setupdesign.template;
+
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import androidx.annotation.DrawableRes;
+import com.google.android.setupcompat.internal.TemplateLayout;
+import com.google.android.setupcompat.template.Mixin;
+import com.google.android.setupdesign.R;
+import com.google.android.setupdesign.util.HeaderAreaStyler;
+import com.google.android.setupdesign.util.LayoutStyler;
+import com.google.android.setupdesign.util.PartnerStyleHelper;
+import com.google.errorprone.annotations.CheckReturnValue;
+
+/** A {@link Mixin} for setting an account name and account avatar on the template layout. */
+@CheckReturnValue // see go/why-crv
+public class ProfileMixin implements Mixin {
+
+  private final TemplateLayout templateLayout;
+  private static final String TAG = "ProfileMixin";
+  public static final int RIGHT = 5;
+  public static final int CENTER = 17;
+  public static final int LEFT = 3;
+
+  /**
+   * A {@link Mixin} for setting and getting the Account.
+   *
+   * @param layout The template layout that this Mixin is a part of
+   * @param attrs XML attributes given to the layout
+   * @param defStyleAttr The default style attribute as given to the constructor of the layout
+   */
+  public ProfileMixin(TemplateLayout layout, AttributeSet attrs, int defStyleAttr) {
+    templateLayout = layout;
+  }
+
+  /**
+   * Sets the Account name.
+   *
+   * @param accountName The text to be set as account name
+   */
+  public void setAccountName(CharSequence accountName) {
+    final TextView accountView = getAccountNameView();
+    final ImageView iconView = getAccountAvatarView();
+    final LinearLayout container = getContainerView();
+    if (accountView != null && accountName != null) {
+      accountView.setText(accountName);
+      container.setVisibility(View.VISIBLE);
+      if (iconView != null && getAccountAvatar() == null) {
+        iconView.setVisibility(View.GONE);
+      }
+    } else {
+      Log.w(TAG, "Didn't get the account name");
+    }
+  }
+
+  /**
+   * Sets the icon on this layout.
+   *
+   * @param icon A drawable icon to set, or {@code null} to hide the icon
+   */
+  public void setAccountAvatar(Drawable icon) {
+    final ImageView iconView = getAccountAvatarView();
+    final LinearLayout container = getContainerView();
+    if (iconView != null && icon != null) {
+      iconView.setImageDrawable(icon);
+      container.setVisibility(View.VISIBLE);
+      iconView.setVisibility(View.VISIBLE);
+    } else if (iconView != null) {
+      iconView.setVisibility(View.GONE);
+      Log.w(TAG, "Didn't get the account avatar");
+    }
+  }
+
+  /**
+   * Sets the icon on this layout.
+   *
+   * @param icon A drawable icon resource to set, or {@code null} to hide the icon
+   */
+  public void setAccountAvatar(@DrawableRes int icon) {
+    final ImageView iconView = getAccountAvatarView();
+    final LinearLayout container = getContainerView();
+    if (iconView != null && icon != 0) {
+      // Note: setImageResource on the ImageView is overridden in AppCompatImageView for
+      // support lib users, which enables vector drawable compat to work on versions pre-L.
+      iconView.setImageResource(icon);
+      container.setVisibility(View.VISIBLE);
+      iconView.setVisibility(View.VISIBLE);
+    } else if (iconView != null) {
+      iconView.setVisibility(View.GONE);
+      Log.w(TAG, "Didn't get the account avatar");
+    }
+  }
+
+  /**
+   * Sets the account name icon on this layout.
+   *
+   * @param accountName The text to be set as account name
+   * @param icon A drawable icon
+   */
+  public void setAccount(CharSequence accountName, Drawable icon) {
+    setAccountName(accountName);
+    setAccountAvatar(icon);
+  }
+
+  /**
+   * Sets the account name icon on this layout.
+   *
+   * @param accountName The text to be set as account name
+   * @param icon A drawable icon resource
+   */
+  public void setAccount(CharSequence accountName, @DrawableRes int icon) {
+    setAccountName(accountName);
+    setAccountAvatar(icon);
+  }
+
+  /**
+   * Sets the visibility of the account. gone map to 8 invisible map to 4 visible map to 0
+   *
+   * @param visibility Set it visible or not
+   */
+  public void setVisibility(int visibility) {
+    getContainerView().setVisibility(visibility);
+  }
+
+  /**
+   * Makes account align to left, center or right.
+   *
+   * @param gravity the number or the gravity
+   */
+  public void setAccountAlignment(int gravity) {
+    final LinearLayout container = getContainerView();
+    if (gravity == RIGHT || gravity == CENTER || gravity == LEFT) {
+      container.setGravity(gravity);
+    } else {
+      Log.w(TAG, "Unsupported alignment");
+    }
+  }
+
+  /** Tries to apply the partner customization to the account photo. */
+  public void tryApplyPartnerCustomizationStyle() {
+    if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
+      final ImageView iconView = getAccountAvatarView();
+      final TextView accountView = getAccountNameView();
+      final LinearLayout container = getContainerView();
+      View iconAreaView = templateLayout.findManagedViewById(R.id.sud_layout_header);
+      LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(iconAreaView);
+      HeaderAreaStyler.applyPartnerCustomizationAccountStyle(iconView, accountView, container);
+    }
+  }
+
+  /** Returns the current account name. */
+  public CharSequence getAccountName() {
+    final TextView accountView = getAccountNameView();
+    return accountView.getText();
+  }
+
+  /** Returns the current account avatar. */
+  public Drawable getAccountAvatar() {
+    final ImageView iconView = getAccountAvatarView();
+    return iconView.getDrawable();
+  }
+
+  /** Returns the current account name text. */
+  private TextView getAccountNameView() {
+    return (TextView) templateLayout.findManagedViewById(R.id.sud_account_name);
+  }
+
+  /** Returns the current account icon image. */
+  private ImageView getAccountAvatarView() {
+    return (ImageView) templateLayout.findManagedViewById(R.id.sud_account_avatar);
+  }
+
+  private LinearLayout getContainerView() {
+    return (LinearLayout) templateLayout.findManagedViewById(R.id.sud_layout_profile);
+  }
+
+  /** Returns the current account visibility. */
+  public int getVisibility() {
+    return getContainerView().getVisibility();
+  }
+}
diff --git a/main/src/com/google/android/setupdesign/util/DeviceHelper.java b/main/src/com/google/android/setupdesign/util/DeviceHelper.java
new file mode 100644
index 0000000..37c5144
--- /dev/null
+++ b/main/src/com/google/android/setupdesign/util/DeviceHelper.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.google.android.setupdesign.util;
+
+import android.annotation.SuppressLint;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources.NotFoundException;
+import android.net.Uri;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
+import com.google.android.setupcompat.util.Logger;
+import com.google.android.setupdesign.R;
+
+/** Helper class to get attributes of the device, like a friendly display name. */
+public final class DeviceHelper {
+
+  private static final Logger LOG = new Logger("DeviceHelper");
+  private static final String TAG = DeviceHelper.class.getSimpleName();
+
+  @VisibleForTesting
+  public static final String SUW_AUTHORITY = "com.google.android.setupwizard.partner";
+
+  @VisibleForTesting public static final String DEVICE_NAME = "device_name";
+  private static final String STRING = "string";
+  @VisibleForTesting public static final String GET_DEVICE_NAME_METHOD = "getDeviceName";
+
+  @VisibleForTesting public static Bundle deviceName = null;
+
+  /**
+   * Get the device name text from these resources, if they are unavailable or setupwizard apk is
+   * older which does not contains {@link DeviceHelper#GET_DEVICE_NAME_METHOD} method, return the
+   * device name as default value "device".
+   *
+   * <p>Priority: partner config ({@link
+   * com.google.android.setupwizard.util.PartnerResource#DEVICE_NAME}) > {@link
+   * android.provider.Settings.Global#DEVICE_NAME} > system property ro.product.model)
+   */
+  @NonNull
+  @SuppressLint("DiscouragedApi")
+  public static CharSequence getDeviceName(@NonNull Context context) {
+    if (deviceName == null || deviceName.isEmpty()) {
+      try {
+        deviceName =
+            context
+                .getContentResolver()
+                .call(
+                    new Uri.Builder()
+                        .scheme(ContentResolver.SCHEME_CONTENT)
+                        .authority(SUW_AUTHORITY)
+                        .build(),
+                    GET_DEVICE_NAME_METHOD,
+                    /* arg= */ null,
+                    /* extras= */ null);
+      } catch (IllegalArgumentException | SecurityException exception) {
+        Log.w(TAG, "device name unknown; return the device name as default value");
+      }
+    }
+
+    if (deviceName != null && !deviceName.isEmpty()) {
+      return deviceName.getCharSequence(GET_DEVICE_NAME_METHOD, null);
+    }
+
+    Partner partner = Partner.get(context);
+    if (partner != null) {
+      try {
+        int resId =
+            partner.getResources().getIdentifier(DEVICE_NAME, STRING, partner.getPackageName());
+        String overlayDeviceName = partner.getResources().getString(resId);
+        if (!TextUtils.isEmpty(overlayDeviceName)) {
+          return overlayDeviceName;
+        } else {
+          LOG.w("The overlayDeviceName is null!");
+        }
+      } catch (NotFoundException ex) {
+        // fall through
+      }
+    }
+
+    return context.getString(R.string.sud_default_device_name);
+  }
+
+  private DeviceHelper() {}
+}
diff --git a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
index e233219..bb1c667 100644
--- a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
+++ b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
@@ -19,18 +19,21 @@
 import static com.google.android.setupcompat.util.BuildCompatUtils.isAtLeastS;
 
 import android.content.Context;
+import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.VectorDrawable;
 import android.os.Build;
 import android.os.Build.VERSION;
 import android.os.Build.VERSION_CODES;
 import android.util.Log;
+import android.util.TypedValue;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
 import android.view.ViewTreeObserver;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.ImageView.ScaleType;
+import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 import androidx.annotation.Nullable;
@@ -100,6 +103,53 @@
             PartnerStyleHelper.getLayoutGravity(description.getContext())));
   }
 
+  public static void applyPartnerCustomizationAccountStyle(
+      ImageView avatar, TextView name, LinearLayout container) {
+    if (avatar == null || name == null) {
+      return;
+    }
+
+    Context context = avatar.getContext();
+
+    ViewGroup.LayoutParams lpIcon = avatar.getLayoutParams();
+    if (lpIcon instanceof ViewGroup.MarginLayoutParams) {
+      ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lpIcon;
+
+      int rightMargin =
+          (int)
+              PartnerConfigHelper.get(context)
+                  .getDimension(context, PartnerConfig.CONFIG_ACCOUNT_AVATAR_MARGIN_END);
+      mlp.setMargins(mlp.leftMargin, mlp.topMargin, rightMargin, mlp.bottomMargin);
+    }
+
+    int maxHeight =
+        (int)
+            PartnerConfigHelper.get(context)
+                .getDimension(context, PartnerConfig.CONFIG_ACCOUNT_AVATAR_SIZE,
+                context.getResources().getDimension(R.dimen.sud_account_avatar_max_height));
+    avatar.setMaxHeight(maxHeight);
+
+    int textSize =
+        (int)
+            PartnerConfigHelper.get(context)
+                .getDimension(
+                    context,
+                    PartnerConfig.CONFIG_ACCOUNT_NAME_TEXT_SIZE,
+                    context.getResources().getDimension(R.dimen.sud_account_name_text_size));
+    name.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+
+    String textFamily =
+            PartnerConfigHelper.get(context)
+                .getString(context, PartnerConfig.CONFIG_ACCOUNT_NAME_FONT_FAMILY);
+    Typeface font = Typeface.create(textFamily, Typeface.NORMAL);
+    if (font != null) {
+      name.setTypeface(font);
+    }
+
+    int gravity = PartnerStyleHelper.getLayoutGravity(container.getContext());
+    container.setGravity(gravity);
+  }
+
   /**
    * Applies the partner style of header area to the given layout {@code headerArea}. The theme
    * should set partner heavy theme first, and then the partner style of header would be applied. As
diff --git a/main/src/com/google/android/setupdesign/util/Partner.java b/main/src/com/google/android/setupdesign/util/Partner.java
index cf26f16..2052afb 100644
--- a/main/src/com/google/android/setupdesign/util/Partner.java
+++ b/main/src/com/google/android/setupdesign/util/Partner.java
@@ -33,6 +33,7 @@
 import androidx.annotation.ArrayRes;
 import androidx.annotation.BoolRes;
 import androidx.annotation.ColorRes;
+import androidx.annotation.DimenRes;
 import androidx.annotation.DrawableRes;
 import androidx.annotation.Nullable;
 import androidx.annotation.RequiresApi;
@@ -84,6 +85,28 @@
   }
 
   /**
+   * Gets a dimension value from partner overlay, or if not available, gets the value from the
+   * original context instead.
+   *
+   * @see #getResourceEntry(Context, int)
+   */
+  public static int getDimensionPixelSize(Context context, @DimenRes int id) {
+    final ResourceEntry entry = getResourceEntry(context, id);
+    return entry.resources.getDimensionPixelSize(entry.id);
+  }
+
+  /**
+   * Gets a dimension value from partner overlay, or if not available, gets the value from the
+   * original context instead.
+   *
+   * @see #getResourceEntry(Context, int)
+   */
+  public static float getDimension(Context context, @DimenRes int id) {
+    final ResourceEntry entry = getResourceEntry(context, id);
+    return entry.resources.getDimension(entry.id);
+  }
+
+  /**
    * Gets a drawable from partner overlay, or if not available, the drawable from the original
    * context.
    *
diff --git a/main/src/com/google/android/setupdesign/util/ThemeHelper.java b/main/src/com/google/android/setupdesign/util/ThemeHelper.java
index eeee7dd..57a8278 100644
--- a/main/src/com/google/android/setupdesign/util/ThemeHelper.java
+++ b/main/src/com/google/android/setupdesign/util/ThemeHelper.java
@@ -19,6 +19,8 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
 import androidx.annotation.NonNull;
 import androidx.annotation.StyleRes;
 import com.google.android.setupcompat.PartnerCustomizationLayout;
@@ -235,6 +237,39 @@
     return resId;
   }
 
+  /** Returns a default theme resource id which provides by setup wizard. */
+  @StyleRes
+  public static int getSuwDefaultTheme(@NonNull Context context) {
+    String themeName = PartnerConfigHelper.getSuwDefaultThemeString(context);
+    @StyleRes int defaultTheme;
+    if (VERSION.SDK_INT < VERSION_CODES.O) {
+      defaultTheme =
+          ThemeHelper.isSetupWizardDayNightEnabled(context)
+              ? R.style.SudThemeGlif_DayNight
+              : R.style.SudThemeGlif_Light;
+    } else if (VERSION.SDK_INT < VERSION_CODES.P) {
+      defaultTheme =
+          ThemeHelper.isSetupWizardDayNightEnabled(context)
+              ? R.style.SudThemeGlifV2_DayNight
+              : R.style.SudThemeGlifV2_Light;
+    } else if (VERSION.SDK_INT < VERSION_CODES.TIRAMISU) {
+      defaultTheme =
+          ThemeHelper.isSetupWizardDayNightEnabled(context)
+              ? R.style.SudThemeGlifV3_DayNight
+              : R.style.SudThemeGlifV3_Light;
+    } else {
+      defaultTheme =
+          ThemeHelper.isSetupWizardDayNightEnabled(context)
+              ? R.style.SudThemeGlifV4_DayNight
+              : R.style.SudThemeGlifV4_Light;
+    }
+    return new ThemeResolver.Builder()
+        .setDefaultTheme(defaultTheme)
+        .setUseDayNight(isSetupWizardDayNightEnabled(context))
+        .build()
+        .resolve(themeName, /* suppressDayNight= */ !isSetupWizardDayNightEnabled(context));
+  }
+
   /** Returns {@code true} if the dynamic color is set. */
   public static boolean trySetDynamicColor(@NonNull Context context) {
     if (!BuildCompatUtils.isAtLeastS()) {
diff --git a/strings/res/values/strings.xml b/strings/res/values/strings.xml
index 7608716..0b976a5 100644
--- a/strings/res/values/strings.xml
+++ b/strings/res/values/strings.xml
@@ -22,6 +22,12 @@
     <!-- Button for going to the previous screen or step [CHAR LIMIT=20] -->
     <string name="sud_back_button_label">Back</string>
 
+    <!-- Button for skipping the action on the current screen [CHAR LIMIT=20] -->
+    <string name="sud_skip_button_label">Skip</string>
+
     <!-- Button for scrolling down to reveal more content on the screen [CHAR LIMIT=20] -->
     <string name="sud_more_button_label">More</string>
+
+    <!-- The default device name when other resources get the device name are not available [CHAR LIMIT=20] -->
+    <string name="sud_default_device_name">device</string>
 </resources>