From 56ea8be381e308b6ff129adfb69ba6f848b01f51 Mon Sep 17 00:00:00 2001 From: Setup Wizard Team Date: Tue, 20 Apr 2021 20:40:15 +0800 Subject: Import updated Android SetupCompat Library 369420590 Copied from google3/third_party/java_src/android_libs/setupcompat Test: mm Bug: 185557130 Included changes: - 369420590 [SetupWizard][AnythingElse] Adds intent extras to make 1P... - 369348844 [Portal] Checking deferred available before change to por... - 368765515 Move BuildCompatUtils to setupcompat library - 368568389 Add PROGRESS_REQUEST_REMOVED for client to request added ... - 368202592 Make FooterBarMixin support dynamic color(inside setup fl... - 368155363 Support SetTextLocale and setLayoutDirection in SetupCompat - 367973603 [BC][Stencil] Created ContentInfoStyler for applying styl... - 367259726 Migrate annotation classes to androidx - 366165064 Add new theme for dynamic color - 365976791 [GlifLoadingLayout] Add new illustration type final hold. - 365761892 [Portal] New interface for GmsCore to remove task. - 364981721 [Portal] Disable auto rebind. PiperOrigin-RevId: 369420590 Change-Id: I8ce1763c6a9e42c1b8a942ab495a81e510d81cde --- .../setupcompat/partnerconfig/PartnerConfig.java | 56 +++++++++++++++++++- .../partnerconfig/PartnerConfigHelper.java | 9 +++- .../partnerconfig/PartnerConfigKey.java | 60 ++++++++++++++++++++++ 3 files changed, 123 insertions(+), 2 deletions(-) (limited to 'partnerconfig') diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java index 5a71afe..cacbf80 100644 --- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java +++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java @@ -120,6 +120,10 @@ public enum PartnerConfig { CONFIG_FOOTER_PRIMARY_BUTTON_BG_COLOR( PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_BG_COLOR, ResourceType.COLOR), + // Dynamic background color of the primary footer button + CONFIG_FOOTER_PRIMARY_BUTTON_BG_DYNAMIC_COLOR( + PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_BG_DYNAMIC_COLOR, ResourceType.COLOR), + // Text color of the primary footer button CONFIG_FOOTER_PRIMARY_BUTTON_TEXT_COLOR( PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_TEXT_COLOR, ResourceType.COLOR), @@ -132,6 +136,10 @@ public enum PartnerConfig { CONFIG_FOOTER_SECONDARY_BUTTON_TEXT_COLOR( PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_TEXT_COLOR, ResourceType.COLOR), + // Dynamic text color of the secondary footer button + CONFIG_FOOTER_SECONDARY_BUTTON_TEXT_DYNAMIC_COLOR( + PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_TEXT_DYNAMIC_COLOR, ResourceType.COLOR), + // Background color of layout CONFIG_LAYOUT_BACKGROUND_COLOR(PartnerConfigKey.KEY_LAYOUT_BACKGROUND_COLOR, ResourceType.COLOR), @@ -233,6 +241,34 @@ public enum PartnerConfig { // The padding top of the content CONFIG_CONTENT_PADDING_TOP(PartnerConfigKey.KEY_CONTENT_PADDING_TOP, ResourceType.DIMENSION), + // The text size of the content info. + CONFIG_CONTENT_INFO_TEXT_SIZE( + PartnerConfigKey.KEY_CONTENT_INFO_TEXT_SIZE, ResourceType.DIMENSION), + + // The font family of the content info. + CONFIG_CONTENT_INFO_FONT_FAMILY( + PartnerConfigKey.KEY_CONTENT_INFO_FONT_FAMILY, ResourceType.STRING), + + // The text line spacing extra of the content info. + CONFIG_CONTENT_INFO_LINE_SPACING_EXTRA( + PartnerConfigKey.KEY_CONTENT_INFO_LINE_SPACING_EXTRA, ResourceType.DIMENSION), + + // The icon size of the content info. + CONFIG_CONTENT_INFO_ICON_SIZE( + PartnerConfigKey.KEY_CONTENT_INFO_ICON_SIZE, ResourceType.DIMENSION), + + // The icon margin end of the content info. + CONFIG_CONTENT_INFO_ICON_MARGIN_END( + PartnerConfigKey.KEY_CONTENT_INFO_ICON_MARGIN_END, ResourceType.DIMENSION), + + // The padding top of the content info. + CONFIG_CONTENT_INFO_PADDING_TOP( + PartnerConfigKey.KEY_CONTENT_INFO_PADDING_TOP, ResourceType.DIMENSION), + + // The padding bottom of the content info. + CONFIG_CONTENT_INFO_PADDING_BOTTOM( + PartnerConfigKey.KEY_CONTENT_INFO_PADDING_BOTTOM, ResourceType.DIMENSION), + // The title text size of list items. CONFIG_ITEMS_TITLE_TEXT_SIZE(PartnerConfigKey.KEY_ITEMS_TITLE_TEXT_SIZE, ResourceType.DIMENSION), @@ -283,6 +319,11 @@ public enum PartnerConfig { CONFIG_PROGRESS_ILLUSTRATION_UPDATE( PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_UPDATE, ResourceType.ILLUSTRATION), + // The animation of loading screen used in those activities which is finishing setup. + // For example:com.google.android.setupwizard.FINAL_HOLD + CONFIG_PROGRESS_ILLUSTRATION_FINAL_HOLD( + PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_FINAL_HOLD, 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), @@ -307,6 +348,11 @@ public enum PartnerConfig { CONFIG_LOADING_LOTTIE_UPDATE( PartnerConfigKey.KEY_LOADING_LOTTIE_UPDATE, ResourceType.ILLUSTRATION), + // The animation for S+ devices used in those screens which is updating devices. + // For example:com.google.android.setupwizard.COMPAT_EARLY_UPDATE + CONFIG_LOADING_LOTTIE_FINAL_HOLD( + PartnerConfigKey.KEY_LOADING_LOTTIE_FINAL_HOLD, ResourceType.ILLUSTRATION), + // The transition type to decide the transition between activities or fragments. CONFIG_TRANSITION_TYPE(PartnerConfigKey.KEY_TRANSITION_TYPE, ResourceType.INTEGER), @@ -326,6 +372,10 @@ public enum PartnerConfig { CONFIG_LOTTIE_LIGHT_THEME_CUSTOMIZATION_UPDATE( PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_UPDATE, ResourceType.STRING_ARRAY), + // The list of keypath and color map, applied to update animation when light theme. + CONFIG_LOTTIE_LIGHT_THEME_CUSTOMIZATION_FINAL_HOLD( + PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_FINAL_HOLD, ResourceType.STRING_ARRAY), + // The list of keypath and color map, applied to default animation when dark theme. CONFIG_LOTTIE_DARK_THEME_CUSTOMIZATION_DEFAULT( PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_DEFAULT, ResourceType.STRING_ARRAY), @@ -340,7 +390,11 @@ public enum PartnerConfig { // The list of keypath and color map, applied to update animation when dark theme. CONFIG_LOTTIE_DARK_THEME_CUSTOMIZATION_UPDATE( - PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_UPDATE, ResourceType.STRING_ARRAY); + PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_UPDATE, ResourceType.STRING_ARRAY), + + // The list of keypath and color map, applied to final hold animation when dark theme. + CONFIG_LOTTIE_DARK_THEME_CUSTOMIZATION_FINAL_HOLD( + PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_FINAL_HOLD, ResourceType.STRING_ARRAY); /** Resource type of the partner resources type. */ public enum ResourceType { diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java index f53ee40..dd43989 100644 --- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java +++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java @@ -66,7 +66,7 @@ public class PartnerConfigHelper { @VisibleForTesting public static Bundle applyExtendedPartnerConfigBundle = null; - @VisibleForTesting static Bundle applyDynamicColorBundle = null; + @VisibleForTesting public static Bundle applyDynamicColorBundle = null; private static PartnerConfigHelper instance = null; @@ -159,6 +159,13 @@ public class PartnerConfigHelper { Resources resource = resourceEntry.getResources(); int resId = resourceEntry.getResourceId(); + // for @null + TypedValue outValue = new TypedValue(); + resource.getValue(resId, outValue, true); + if (outValue.type == TypedValue.TYPE_REFERENCE && outValue.data == 0) { + return result; + } + if (Build.VERSION.SDK_INT >= VERSION_CODES.M) { result = resource.getColor(resId, null); } else { diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java index 4f21ae2..aa77ee8 100644 --- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java +++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java @@ -50,9 +50,11 @@ import java.lang.annotation.RetentionPolicy; PartnerConfigKey.KEY_FOOTER_BUTTON_DISABLED_ALPHA, PartnerConfigKey.KEY_FOOTER_BUTTON_DISABLED_BG_COLOR, PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_BG_COLOR, + PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_BG_DYNAMIC_COLOR, PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_TEXT_COLOR, PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_BG_COLOR, PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_TEXT_COLOR, + PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_TEXT_DYNAMIC_COLOR, PartnerConfigKey.KEY_LAYOUT_BACKGROUND_COLOR, PartnerConfigKey.KEY_LAYOUT_MARGIN_START, PartnerConfigKey.KEY_LAYOUT_MARGIN_END, @@ -83,6 +85,13 @@ import java.lang.annotation.RetentionPolicy; PartnerConfigKey.KEY_CONTENT_FONT_FAMILY, PartnerConfigKey.KEY_CONTENT_LAYOUT_GRAVITY, PartnerConfigKey.KEY_CONTENT_PADDING_TOP, + PartnerConfigKey.KEY_CONTENT_INFO_TEXT_SIZE, + PartnerConfigKey.KEY_CONTENT_INFO_FONT_FAMILY, + PartnerConfigKey.KEY_CONTENT_INFO_LINE_SPACING_EXTRA, + PartnerConfigKey.KEY_CONTENT_INFO_ICON_SIZE, + PartnerConfigKey.KEY_CONTENT_INFO_ICON_MARGIN_END, + PartnerConfigKey.KEY_CONTENT_INFO_PADDING_TOP, + PartnerConfigKey.KEY_CONTENT_INFO_PADDING_BOTTOM, PartnerConfigKey.KEY_ITEMS_TITLE_TEXT_SIZE, PartnerConfigKey.KEY_ITEMS_SUMMARY_TEXT_SIZE, PartnerConfigKey.KEY_ITEMS_SUMMARY_MARGIN_TOP, @@ -96,19 +105,23 @@ import java.lang.annotation.RetentionPolicy; PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_ACCOUNT, PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_CONNECTION, PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_UPDATE, + PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_FINAL_HOLD, PartnerConfigKey.KEY_PROGRESS_ILLUSTRATION_DISPLAY_MINIMUM_MS, PartnerConfigKey.KEY_LOADING_LOTTIE_ACCOUNT, PartnerConfigKey.KEY_LOADING_LOTTIE_CONNECTION, PartnerConfigKey.KEY_LOADING_LOTTIE_DEFAULT, PartnerConfigKey.KEY_LOADING_LOTTIE_UPDATE, + PartnerConfigKey.KEY_LOADING_LOTTIE_FINAL_HOLD, PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_DEFAULT, PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_ACCOUNT, PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_CONNECTION, PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_UPDATE, + PartnerConfigKey.KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_FINAL_HOLD, PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_DEFAULT, PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_ACCOUNT, PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_CONNECTION, PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_UPDATE, + PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_FINAL_HOLD, PartnerConfigKey.KEY_TRANSITION_TYPE, }) // TODO: can be removed and always reference PartnerConfig.getResourceName()? @@ -195,6 +208,10 @@ public @interface PartnerConfigKey { // Background color of the primary footer button String KEY_FOOTER_PRIMARY_BUTTON_BG_COLOR = "setup_compat_footer_primary_button_bg_color"; + // Dynamic background color of the primary footer button + String KEY_FOOTER_PRIMARY_BUTTON_BG_DYNAMIC_COLOR = + "setup_compat_footer_1st_button_bg_dynamic_color"; + // Text color of the primary footer button String KEY_FOOTER_PRIMARY_BUTTON_TEXT_COLOR = "setup_compat_footer_primary_button_text_color"; @@ -204,6 +221,10 @@ public @interface PartnerConfigKey { // Text color of the secondary footer button String KEY_FOOTER_SECONDARY_BUTTON_TEXT_COLOR = "setup_compat_footer_secondary_button_text_color"; + // Dynamic text color of the secondary footer button + String KEY_FOOTER_SECONDARY_BUTTON_TEXT_DYNAMIC_COLOR = + "setup_compat_footer_2nd_button_text_dynamic_color"; + // Background color of layout String KEY_LAYOUT_BACKGROUND_COLOR = "setup_design_layout_bg_color"; @@ -296,6 +317,27 @@ public @interface PartnerConfigKey { // The padding top of the content String KEY_CONTENT_PADDING_TOP = "setup_design_content_padding_top"; + // The text size of the content info. + String KEY_CONTENT_INFO_TEXT_SIZE = "setup_design_content_info_text_size"; + + // The font family of the content info. + String KEY_CONTENT_INFO_FONT_FAMILY = "setup_design_content_info_font_family"; + + // The text line spacing extra of the content info. + String KEY_CONTENT_INFO_LINE_SPACING_EXTRA = "setup_design_content_info_line_spacing_extra"; + + // The icon size of the content info. + String KEY_CONTENT_INFO_ICON_SIZE = "setup_design_content_info_icon_size"; + + // The icon margin end of the content info. + String KEY_CONTENT_INFO_ICON_MARGIN_END = "setup_design_content_info_icon_margin_end"; + + // The padding top of the content info. + String KEY_CONTENT_INFO_PADDING_TOP = "setup_design_content_info_padding_top"; + + // The padding bottom of the content info. + String KEY_CONTENT_INFO_PADDING_BOTTOM = "setup_design_content_info_padding_bottom"; + // The title text size of list items. String KEY_ITEMS_TITLE_TEXT_SIZE = "setup_design_items_title_text_size"; @@ -339,6 +381,10 @@ public @interface PartnerConfigKey { // For example:com.google.android.setupwizard.COMPAT_EARLY_UPDATE String KEY_PROGRESS_ILLUSTRATION_UPDATE = "progress_illustration_custom_update"; + // The animation of loading screen used in those activities which is updating device. + // For example:com.google.android.setupwizard.FINAL_HOLD + String KEY_PROGRESS_ILLUSTRATION_FINAL_HOLD = "final_hold_custom_illustration"; + // 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"; @@ -358,6 +404,10 @@ public @interface PartnerConfigKey { // For example:com.google.android.setupwizard.COMPAT_EARLY_UPDATE String KEY_LOADING_LOTTIE_UPDATE = "loading_animation_custom_update"; + // The animation for S+ devices used in those screens which is updating devices. + // For example:com.google.android.setupwizard.FINAL_HOLD + String KEY_LOADING_LOTTIE_FINAL_HOLD = "loading_animation_custom_final_hold"; + // A string-array to list all the key path and color map for default animation for light theme. // For example: background:#FFFFFF String KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_DEFAULT = @@ -377,6 +427,11 @@ public @interface PartnerConfigKey { // For example: background:#FFFFFF String KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_UPDATE = "loading_light_theme_customization_update"; + // A string-array to list all the key path and color map for final hold animation for light theme. + // For example: background:#FFFFFF + String KEY_LOADING_LIGHT_THEME_CUSTOMIZATION_FINAL_HOLD = + "loading_light_theme_customization_final_hold"; + // A string-array to list all the key path and color map for default animation for dark theme. // For example: background:#000000 String KEY_LOADING_DARK_THEME_CUSTOMIZATION_DEFAULT = "loading_dark_theme_customization_default"; @@ -394,6 +449,11 @@ public @interface PartnerConfigKey { // For example: background:#000000 String KEY_LOADING_DARK_THEME_CUSTOMIZATION_UPDATE = "loading_dark_theme_customization_update"; + // A string-array to list all the key path and color map for final hold animation for dark theme. + // For example: background:#000000 + String KEY_LOADING_DARK_THEME_CUSTOMIZATION_FINAL_HOLD = + "loading_dark_theme_customization_final_hold"; + // The transition type between activities String KEY_TRANSITION_TYPE = "setup_design_transition_type"; } -- cgit v1.2.3