Import updated Android SetupCompat Library 349536308

Copied from google3/third_party/java_src/android_libs/setupcompat

Test: mm

Included changes:
  - 349536308 [BC][Stencil] Add partner resource for the item padding t...
  - 349360486 [SetupDesign] issue fix and refactoring
  - 349265027 Update language to comply with Android’s inclusive langua...
  - 349006680 [BC][Stencil] Add partner resource for the item title tex...
  - 348729496 Cloned from CL 348561620 by 'g4 patch' and removed using ...
  - 348580285 [SUW][SetupDesign] Enable stencil config for auto text si...
  - 348565251 Automated g4 rollback of changelist 348561620.
  - 348561620 [BC][Stencil] Add partner resource for the icon margin to...
  - 347789412 [BC][Stencil] Add partner resource for the layout margin ...
  - 347721164 Adds partner config key for transition type
  - 346894262 [BC][Stencil] Add partner resource for the description te...
  - 345997245 [BC][Stencil] Add partner resource for the header text ma...
  - 345388161 [BC][Stencil] Add partner resource for the header contain...
  - 345182340 Create subtitle mixin for BC layout
  - 345174090 [SetupDesign] Enable auto text size based on attr

PiperOrigin-RevId: 349536308
Change-Id: I107bbbdfc2f8720902a5e31eee524199afc10b5e
diff --git a/grandfathered_lint_checks.txt b/exempting_lint_checks.txt
similarity index 100%
rename from grandfathered_lint_checks.txt
rename to exempting_lint_checks.txt
diff --git a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
index 896840c..e3f608b 100644
--- a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
+++ b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
@@ -214,7 +214,7 @@
     }
   }
 
-  private static Activity lookupActivityFromContext(Context context) {
+  public static Activity lookupActivityFromContext(Context context) {
     if (context instanceof Activity) {
       return (Activity) context;
     } else if (context instanceof ContextWrapper) {
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml
index 147e0d8..516dfcb 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -98,15 +98,10 @@
     <declare-styleable name="SucHeaderMixin">
         <attr name="sucHeaderText" format="string" localization="suggested" />
         <attr name="sucHeaderTextColor" format="reference|color" />
-        <attr name="sucGlifIconMarginTop" format="dimension" />
         <attr name="sucGlifHeaderMarginTop" format="dimension" />
         <attr name="sucGlifHeaderMarginBottom" format="dimension" />
+        <attr name="sucGlifIconMarginTop" format="dimension" />
+        <attr name="sucHeaderContainerMarginBottom" format="dimension" />
     </declare-styleable>
 
-    <declare-styleable name="SucSubtitleMixin">
-        <attr name="sucSubtitleText" format="string" localization="suggested" />
-        <attr name="sucSubtitleTextColor" format="reference|color" />
-        <attr name="sucGlifSubtitleMarginTop" format="dimension" />
-        <attr name="sucGlifSubtitleMarginBottom" format="dimension" />
-    </declare-styleable>
 </resources>
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
index f0baef3..82e353c 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
@@ -124,6 +124,12 @@
   // Background color of layout
   CONFIG_LAYOUT_BACKGROUND_COLOR(PartnerConfigKey.KEY_LAYOUT_BACKGROUND_COLOR, ResourceType.COLOR),
 
+  // Margin start of the layout
+  CONFIG_LAYOUT_MARGIN_START(PartnerConfigKey.KEY_LAYOUT_MARGIN_START, ResourceType.DIMENSION),
+
+  // Margin end of the layout
+  CONFIG_LAYOUT_MARGIN_END(PartnerConfigKey.KEY_LAYOUT_MARGIN_END, ResourceType.DIMENSION),
+
   // Text color of the header
   CONFIG_HEADER_TEXT_COLOR(PartnerConfigKey.KEY_HEADER_TEXT_COLOR, ResourceType.COLOR),
 
@@ -133,13 +139,50 @@
   // Font family of the header
   CONFIG_HEADER_FONT_FAMILY(PartnerConfigKey.KEY_HEADER_FONT_FAMILY, ResourceType.STRING),
 
+  // Margin top size of the header text
+  CONFIG_HEADER_TEXT_MARGIN_TOP(
+      PartnerConfigKey.KEY_HEADER_TEXT_MARGIN_TOP, ResourceType.DIMENSION),
+
+  // Margin bottom size of the header text
+  CONFIG_HEADER_TEXT_MARGIN_BOTTOM(
+      PartnerConfigKey.KEY_HEADER_TEXT_MARGIN_BOTTOM, ResourceType.DIMENSION),
+
   // Gravity of the header, icon and description
   CONFIG_LAYOUT_GRAVITY(PartnerConfigKey.KEY_LAYOUT_GRAVITY, ResourceType.STRING),
 
+  // Margin top of the icon
+  CONFIG_ICON_MARGIN_TOP(PartnerConfigKey.KEY_ICON_MARGIN_TOP, ResourceType.DIMENSION),
+
+  // Size of the icon
+  CONFIG_ICON_SIZE(PartnerConfigKey.KEY_ICON_SIZE, ResourceType.DIMENSION),
+
   // Background color of the header area
   CONFIG_HEADER_AREA_BACKGROUND_COLOR(
       PartnerConfigKey.KEY_HEADER_AREA_BACKGROUND_COLOR, ResourceType.COLOR),
 
+  // Margin bottom size of the header container
+  CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM(
+      PartnerConfigKey.KEY_HEADER_CONTAINER_MARGIN_BOTTOM, ResourceType.DIMENSION),
+
+  // Auto text size enabled status
+  CONFIG_HEADER_AUTO_SIZE_ENABLED(PartnerConfigKey.KEY_HEADER_AUTO_SIZE_ENABLED, ResourceType.BOOL),
+
+  // Max text size of header when auto size enabled. Ignored if auto size is false.
+  CONFIG_HEADER_AUTO_SIZE_MAX_TEXT_SIZE(
+      PartnerConfigKey.KEY_HEADER_AUTO_SIZE_MAX_TEXT_SIZE, ResourceType.DIMENSION),
+
+  // Min text size of header when auto size enabled. Ignored if auto size is false.
+  CONFIG_HEADER_AUTO_SIZE_MIN_TEXT_SIZE(
+      PartnerConfigKey.KEY_HEADER_AUTO_SIZE_MIN_TEXT_SIZE, ResourceType.DIMENSION),
+
+  // The max lines of the max text size when auto size enabled. Ignored if auto size is false.
+  CONFIG_HEADER_AUTO_SIZE_MAX_LINE_OF_MAX_SIZE(
+      PartnerConfigKey.KEY_HEADER_AUTO_SIZE_MAX_LINE_OF_MAX_SIZE, ResourceType.INTEGER),
+
+  // Extra line spacing of header when auto size enabled. Ignored if auto size is false.
+  CONFIG_HEADER_AUTO_SIZE_LINE_SPACING_EXTRA(
+      PartnerConfigKey.KEY_HEADER_AUTO_SIZE_LINE_SPACING_EXTRA, ResourceType.DIMENSION),
+
   // Text size of the description
   CONFIG_DESCRIPTION_TEXT_SIZE(PartnerConfigKey.KEY_DESCRIPTION_TEXT_SIZE, ResourceType.DIMENSION),
 
@@ -153,6 +196,14 @@
   // Font family of the description
   CONFIG_DESCRIPTION_FONT_FAMILY(PartnerConfigKey.KEY_DESCRIPTION_FONT_FAMILY, ResourceType.STRING),
 
+  // Margin top size of the description text
+  CONFIG_DESCRIPTION_TEXT_MARGIN_TOP(
+      PartnerConfigKey.KEY_DESCRIPTION_TEXT_MARGIN_TOP, ResourceType.DIMENSION),
+
+  // Margin bottom size of the description text
+  CONFIG_DESCRIPTION_TEXT_MARGIN_BOTTOM(
+      PartnerConfigKey.KEY_DESCRIPTION_TEXT_MARGIN_BOTTOM, ResourceType.DIMENSION),
+
   // Text size of the body content text
   CONFIG_CONTENT_TEXT_SIZE(PartnerConfigKey.KEY_CONTENT_TEXT_SIZE, ResourceType.DIMENSION),
 
@@ -168,6 +219,29 @@
   // Gravity of the body content text
   CONFIG_CONTENT_LAYOUT_GRAVITY(PartnerConfigKey.KEY_CONTENT_LAYOUT_GRAVITY, ResourceType.STRING),
 
+  // The title text size of list items.
+  CONFIG_ITEMS_TITLE_TEXT_SIZE(PartnerConfigKey.KEY_ITEMS_TITLE_TEXT_SIZE, ResourceType.DIMENSION),
+
+  // The summary text size of list items.
+  CONFIG_ITEMS_SUMMARY_TEXT_SIZE(
+      PartnerConfigKey.KEY_ITEMS_SUMMARY_TEXT_SIZE, ResourceType.DIMENSION),
+
+  // The summary margin top of list items.
+  CONFIG_ITEMS_SUMMARY_MARGIN_TOP(
+      PartnerConfigKey.KEY_ITEMS_SUMMARY_MARGIN_TOP, ResourceType.DIMENSION),
+
+  // The font family of list items.
+  CONFIG_ITEMS_FONT_FAMILY(PartnerConfigKey.KEY_ITEMS_FONT_FAMILY, ResourceType.STRING),
+
+  // The padding top of list items.
+  CONFIG_ITEMS_PADDING_TOP(PartnerConfigKey.KEY_ITEMS_PADDING_TOP, ResourceType.DIMENSION),
+
+  // The padding bottom of list items.
+  CONFIG_ITEMS_PADDING_BOTTOM(PartnerConfigKey.KEY_ITEMS_PADDING_BOTTOM, ResourceType.DIMENSION),
+
+  // The minimum height of list items.
+  CONFIG_ITEMS_MIN_HEIGHT(PartnerConfigKey.KEY_ITEMS_MIN_HEIGHT, ResourceType.DIMENSION),
+
   // The animation of loading screen used in those activities which is non of below type.
   CONFIG_PROGRESS_ILLUSTRATION_DEFAULT(
       PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_DEFAULT, ResourceType.ILLUSTRATION),
@@ -188,9 +262,14 @@
   CONFIG_PROGRESS_ILLUSTRATION_UPDATE(
       PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_UPDATE, ResourceType.ILLUSTRATION),
 
+  // The animation of loading screen to define how long showing on the pages.
   CONFIG_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS(
-      PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS, ResourceType.INTEGER);
+      PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS, ResourceType.INTEGER),
 
+  // The transition type to decide the transition between activities or fragments.
+  CONFIG_TRANSITION_TYPE(PartnerConfigKey.KEY_TRANSITION_TYPE, ResourceType.INTEGER);
+
+  /** Resource type of the partner resources type. */
   public enum ResourceType {
     INTEGER,
     BOOL,
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
index a29a235..9b5b592 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
@@ -261,8 +261,8 @@
   }
 
   /**
-   * Returns the dimension of given {@code resourceConfig}. If the given {@code resourceConfig} not
-   * found, will return {@code defaultValue}. If the {@code ResourceType} of given {@code
+   * Returns the dimension of given {@code resourceConfig}. If the given {@code resourceConfig} is
+   * not found, will return {@code defaultValue}. If the {@code ResourceType} of given {@code
    * resourceConfig} is not dimension, will throw IllegalArgumentException.
    *
    * @param context The context of client activity
@@ -344,6 +344,39 @@
   }
 
   /**
+   * Returns the integer of given {@code resourceConfig}. If the given {@code resourceConfig} is not
+   * found, will return {@code defaultValue}. If the {@code ResourceType} of given {@code
+   * resourceConfig} is not dimension, will throw IllegalArgumentException.
+   *
+   * @param context The context of client activity
+   * @param resourceConfig The {@code PartnerConfig} of target resource
+   * @param defaultValue The default value
+   */
+  public int getInteger(@NonNull Context context, PartnerConfig resourceConfig, int defaultValue) {
+    if (resourceConfig.getResourceType() != ResourceType.INTEGER) {
+      throw new IllegalArgumentException("Not a integer resource");
+    }
+
+    if (partnerResourceCache.containsKey(resourceConfig)) {
+      return (int) partnerResourceCache.get(resourceConfig);
+    }
+
+    int result = defaultValue;
+    try {
+      ResourceEntry resourceEntry =
+          getResourceEntryFromKey(context, resourceConfig.getResourceName());
+      Resources resource = resourceEntry.getResources();
+      int resId = resourceEntry.getResourceId();
+
+      result = resource.getInteger(resId);
+      partnerResourceCache.put(resourceConfig, result);
+    } catch (NullPointerException exception) {
+      // fall through
+    }
+    return result;
+  }
+
+  /**
    * Returns the {@link ResourceEntry} of given {@code resourceConfig}, or {@code null} if the given
    * {@code resourceConfig} is not found. If the {@link ResourceType} of the given {@code
    * resourceConfig} is not illustration, IllegalArgumentException will be thrown.
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
index 840472e..d2fd1a5 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
@@ -51,25 +51,47 @@
   PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_BG_COLOR,
   PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_TEXT_COLOR,
   PartnerConfigKey.KEY_LAYOUT_BACKGROUND_COLOR,
+  PartnerConfigKey.KEY_LAYOUT_MARGIN_START,
+  PartnerConfigKey.KEY_LAYOUT_MARGIN_END,
   PartnerConfigKey.KEY_HEADER_TEXT_SIZE,
   PartnerConfigKey.KEY_HEADER_TEXT_COLOR,
   PartnerConfigKey.KEY_HEADER_FONT_FAMILY,
   PartnerConfigKey.KEY_HEADER_AREA_BACKGROUND_COLOR,
+  PartnerConfigKey.KEY_HEADER_TEXT_MARGIN_TOP,
+  PartnerConfigKey.KEY_HEADER_TEXT_MARGIN_BOTTOM,
+  PartnerConfigKey.KEY_HEADER_CONTAINER_MARGIN_BOTTOM,
+  PartnerConfigKey.KEY_HEADER_AUTO_SIZE_ENABLED,
+  PartnerConfigKey.KEY_HEADER_AUTO_SIZE_MAX_TEXT_SIZE,
+  PartnerConfigKey.KEY_HEADER_AUTO_SIZE_MIN_TEXT_SIZE,
+  PartnerConfigKey.KEY_HEADER_AUTO_SIZE_MAX_LINE_OF_MAX_SIZE,
+  PartnerConfigKey.KEY_HEADER_AUTO_SIZE_LINE_SPACING_EXTRA,
   PartnerConfigKey.KEY_LAYOUT_GRAVITY,
+  PartnerConfigKey.KEY_ICON_MARGIN_TOP,
+  PartnerConfigKey.KEY_ICON_SIZE,
   PartnerConfigKey.KEY_DESCRIPTION_TEXT_SIZE,
   PartnerConfigKey.KEY_DESCRIPTION_TEXT_COLOR,
   PartnerConfigKey.KEY_DESCRIPTION_LINK_TEXT_COLOR,
   PartnerConfigKey.KEY_DESCRIPTION_FONT_FAMILY,
+  PartnerConfigKey.KEY_DESCRIPTION_TEXT_MARGIN_TOP,
+  PartnerConfigKey.KEY_DESCRIPTION_TEXT_MARGIN_BOTTOM,
   PartnerConfigKey.KEY_CONTENT_TEXT_SIZE,
   PartnerConfigKey.KEY_CONTENT_TEXT_COLOR,
   PartnerConfigKey.KEY_CONTENT_LINK_TEXT_COLOR,
   PartnerConfigKey.KEY_CONTENT_FONT_FAMILY,
   PartnerConfigKey.KEY_CONTENT_LAYOUT_GRAVITY,
+  PartnerConfigKey.KEY_ITEMS_TITLE_TEXT_SIZE,
+  PartnerConfigKey.KEY_ITEMS_SUMMARY_TEXT_SIZE,
+  PartnerConfigKey.KEY_ITEMS_SUMMARY_MARGIN_TOP,
+  PartnerConfigKey.KEY_ITEMS_FONT_FAMILY,
+  PartnerConfigKey.KEY_ITEMS_PADDING_TOP,
+  PartnerConfigKey.KEY_ITEMS_PADDING_BOTTOM,
+  PartnerConfigKey.KEY_ITEMS_MIN_HEIGHT,
   PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_DEFAULT,
   PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_ACCOUNT,
   PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_CONNECTION,
   PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_UPDATE,
   PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS,
+  PartnerConfigKey.KEY_TRANSITION_TYPE,
 })
 // TODO: can be removed and always reference PartnerConfig.getResourceName()?
 @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
@@ -158,6 +180,12 @@
   // Background color of layout
   String KEY_LAYOUT_BACKGROUND_COLOR = "setup_design_layout_bg_color";
 
+  // Margin start of the layout
+  String KEY_LAYOUT_MARGIN_START = "setup_design_layout_margin_start";
+
+  // Margin end of the layout
+  String KEY_LAYOUT_MARGIN_END = "setup_design_layout_margin_end";
+
   // Text size of the header
   String KEY_HEADER_TEXT_SIZE = "setup_design_header_text_size";
 
@@ -167,12 +195,44 @@
   // Font family of the header
   String KEY_HEADER_FONT_FAMILY = "setup_design_header_font_family";
 
+  // Margin top size of the header text
+  String KEY_HEADER_TEXT_MARGIN_TOP = "setup_design_header_text_margin_top";
+
+  // Margin bottom size of the header text
+  String KEY_HEADER_TEXT_MARGIN_BOTTOM = "setup_design_header_text_margin_bottom";
+
   // Gravity of the header, icon and description
   String KEY_LAYOUT_GRAVITY = "setup_design_layout_gravity";
 
+  // Margin top of the icon
+  String KEY_ICON_MARGIN_TOP = "setup_design_icon_margin_top";
+
+  // Size of the icon
+  String KEY_ICON_SIZE = "setup_design_icon_size";
+
   // Background color of the header area
   String KEY_HEADER_AREA_BACKGROUND_COLOR = "setup_design_header_area_background_color";
 
+  // Margin bottom size of the header container
+  String KEY_HEADER_CONTAINER_MARGIN_BOTTOM = "setup_design_header_container_margin_bottom";
+
+  // Auto text size enabled status
+  String KEY_HEADER_AUTO_SIZE_ENABLED = "setup_design_header_auto_size_enabled";
+
+  // Max text size of header when auto size enabled. Ignored if auto size is false.
+  String KEY_HEADER_AUTO_SIZE_MAX_TEXT_SIZE = "setup_design_header_auto_size_max_text_size";
+
+  // Min text size of header when auto size enabled. Ignored if auto size is false.
+  String KEY_HEADER_AUTO_SIZE_MIN_TEXT_SIZE = "setup_design_header_auto_size_min_text_size";
+
+  // The max lines of the max text size when auto size enabled. Ignored if auto size is false.
+  String KEY_HEADER_AUTO_SIZE_MAX_LINE_OF_MAX_SIZE =
+      "setup_design_header_auto_size_max_line_of_max_size";
+
+  // Extra line spacing of header when auto size enabled. Ignored if auto size is false.
+  String KEY_HEADER_AUTO_SIZE_LINE_SPACING_EXTRA =
+      "setup_design_header_auto_size_line_spacing_extra";
+
   // Text size of the description
   String KEY_DESCRIPTION_TEXT_SIZE = "setup_design_description_text_size";
 
@@ -185,6 +245,12 @@
   // Font family of the description
   String KEY_DESCRIPTION_FONT_FAMILY = "setup_design_description_font_family";
 
+  // Margin top size of the header text
+  String KEY_DESCRIPTION_TEXT_MARGIN_TOP = "setup_design_description_text_margin_top";
+
+  // Margin bottom size of the header text
+  String KEY_DESCRIPTION_TEXT_MARGIN_BOTTOM = "setup_design_description_text_margin_bottom";
+
   // Text size of the body content text
   String KEY_CONTENT_TEXT_SIZE = "setup_design_content_text_size";
 
@@ -200,6 +266,27 @@
   // Gravity of the body content text
   String KEY_CONTENT_LAYOUT_GRAVITY = "setup_design_content_layout_gravity";
 
+  // The title text size of list items.
+  String KEY_ITEMS_TITLE_TEXT_SIZE = "setup_design_items_title_text_size";
+
+  // The summary text size of list items.
+  String KEY_ITEMS_SUMMARY_TEXT_SIZE = "setup_design_items_summary_text_size";
+
+  // The summary margin top of list items.
+  String KEY_ITEMS_SUMMARY_MARGIN_TOP = "setup_design_items_summary_margin_top";
+
+  // The font family of list items.
+  String KEY_ITEMS_FONT_FAMILY = "setup_design_items_font_family";
+
+  // The padding top of list items.
+  String KEY_ITEMS_PADDING_TOP = "setup_design_items_padding_top";
+
+  // The padding bottom of list items.
+  String KEY_ITEMS_PADDING_BOTTOM = "setup_design_items_padding_bottom";
+
+  // The minimum height of list items.
+  String KEY_ITEMS_MIN_HEIGHT = "setup_design_items_min_height";
+
   // The animation of loading screen used in those activities which is non of below type.
   String KEY_PROGRESS_ILLUSTRATION_DEFAULT = "progress_illustration_custom_default";
 
@@ -218,4 +305,7 @@
 
   // The minimum illustration display time, set to 0 may cause the illustration stuck
   String KEY_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS = "progress_illustration_display_minimum_ms";
+
+  // The transition type between activities
+  String KEY_TRANSITION_TYPE = "setup_design_transition_type";
 }