summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2021-04-26 08:44:50 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-26 08:44:50 +0000
commit778eaaffeb92db2f77c610a30aecd0e818c87536 (patch)
treef9137f29cd97351a19e3170eeda43c29b7755c81
parentf6e3746d04e7e31b345fbba913f544b66b2d16e5 (diff)
parent8a37aa87d329998a8e65ee78db28d33fec14ba82 (diff)
downloadsetupcompat-778eaaffeb92db2f77c610a30aecd0e818c87536.tar.gz
Import updated Android SetupCompat Library 370375132 am: 8a37aa87d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupcompat/+/14295185 Change-Id: If3b2b0efe085c8a0d3adee21de041386f83308a1
-rw-r--r--main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java49
-rw-r--r--main/java/com/google/android/setupcompat/template/FooterBarMixin.java47
-rw-r--r--main/java/com/google/android/setupcompat/template/FooterButton.java57
-rw-r--r--main/java/com/google/android/setupcompat/util/BuildCompatUtils.java66
-rw-r--r--main/res/values/attrs.xml1
-rw-r--r--partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java48
-rw-r--r--partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java9
-rw-r--r--partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java50
8 files changed, 314 insertions, 13 deletions
diff --git a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
index 3f3eb9d..466f036 100644
--- a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
+++ b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
@@ -42,6 +42,7 @@ import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.template.StatusBarMixin;
import com.google.android.setupcompat.template.SystemNavBarMixin;
+import com.google.android.setupcompat.util.BuildCompatUtils;
import com.google.android.setupcompat.util.WizardManagerHelper;
/** A templatization layout with consistent style used in Setup Wizard or app itself. */
@@ -56,6 +57,18 @@ public class PartnerCustomizationLayout extends TemplateLayout {
*/
private boolean usePartnerResourceAttr;
+ /**
+ * Attribute indicating whether using full dynamic colors or not. This corresponds to the {@code
+ * app:sucFullDynamicColor} XML attribute.
+ */
+ private boolean useFullDynamicColorAttr;
+
+ /**
+ * Attribute indicating whether usage of dynamic is allowed. This corresponds to the existence of
+ * {@code app:sucFullDynamicColor} XML attribute.
+ */
+ private boolean useDynamicColor;
+
private Activity activity;
public PartnerCustomizationLayout(Context context) {
@@ -157,6 +170,10 @@ public class PartnerCustomizationLayout extends TemplateLayout {
isSetupFlow
|| a.getBoolean(R.styleable.SucPartnerCustomizationLayout_sucUsePartnerResource, true);
+ useDynamicColor = a.hasValue(R.styleable.SucPartnerCustomizationLayout_sucFullDynamicColor);
+ useFullDynamicColorAttr =
+ a.getBoolean(R.styleable.SucPartnerCustomizationLayout_sucFullDynamicColor, false);
+
a.recycle();
if (Log.isLoggable(TAG, Log.DEBUG)) {
@@ -169,7 +186,11 @@ public class PartnerCustomizationLayout extends TemplateLayout {
+ " enablePartnerResourceLoading="
+ enablePartnerResourceLoading()
+ " usePartnerResourceAttr="
- + usePartnerResourceAttr);
+ + usePartnerResourceAttr
+ + " useDynamicColor="
+ + useDynamicColor
+ + " useFullDynamicColorAttr="
+ + useFullDynamicColorAttr);
}
}
@@ -253,4 +274,30 @@ public class PartnerCustomizationLayout extends TemplateLayout {
}
return true;
}
+
+ /**
+ * Returns {@code true} if the current layout/activity applies dynamic color. Otherwise, returns
+ * {@code false}.
+ */
+ public boolean shouldApplyDynamicColor() {
+ if (!useDynamicColor) {
+ return false;
+ }
+ if (!BuildCompatUtils.isAtLeastS()) {
+ return false;
+ }
+ if (!PartnerConfigHelper.get(getContext()).isAvailable()) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns {@code true} if the current layout/activity applies full dynamic color. Otherwise,
+ * returns {@code false}. This method combines the result of {@link #shouldApplyDynamicColor()}
+ * and the value of the {@code app:sucFullDynamicColor}.
+ */
+ public boolean useFullDynamicColor() {
+ return shouldApplyDynamicColor() && useFullDynamicColorAttr;
+ }
}
diff --git a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
index 0952f0b..7575905 100644
--- a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
+++ b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
@@ -63,6 +63,7 @@ import com.google.android.setupcompat.logging.internal.FooterBarMixinMetrics;
import com.google.android.setupcompat.partnerconfig.PartnerConfig;
import com.google.android.setupcompat.partnerconfig.PartnerConfigHelper;
import com.google.android.setupcompat.template.FooterButton.ButtonType;
+import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
/**
@@ -77,6 +78,7 @@ public class FooterBarMixin implements Mixin {
@Nullable private final ViewStub footerStub;
@VisibleForTesting final boolean applyPartnerResources;
+ @VisibleForTesting final boolean applyDynamicColor;
private LinearLayout buttonContainer;
private FooterButton primaryButton;
@@ -141,6 +143,25 @@ public class FooterBarMixin implements Mixin {
}
}
}
+
+ @Override
+ @TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
+ public void onLocaleChanged(Locale locale) {
+ if (buttonContainer != null) {
+ Button button = buttonContainer.findViewById(id);
+ if (button != null && locale != null) {
+ button.setTextLocale(locale);
+ }
+ }
+ }
+
+ @Override
+ @TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
+ public void onDirectionChanged(int direction) {
+ if (buttonContainer != null && direction != -1) {
+ buttonContainer.setLayoutDirection(direction);
+ }
+ }
};
}
@@ -159,6 +180,10 @@ public class FooterBarMixin implements Mixin {
layout instanceof PartnerCustomizationLayout
&& ((PartnerCustomizationLayout) layout).shouldApplyPartnerResource();
+ applyDynamicColor =
+ layout instanceof PartnerCustomizationLayout
+ && ((PartnerCustomizationLayout) layout).shouldApplyDynamicColor();
+
TypedArray a =
context.obtainStyledAttributes(attrs, R.styleable.SucFooterBarMixin, defStyleAttr, 0);
defaultPadding =
@@ -559,8 +584,20 @@ public class FooterBarMixin implements Mixin {
if (!applyPartnerResources) {
return;
}
- updateButtonTextColorWithPartnerConfig(
- button, footerButtonPartnerConfig.getButtonTextColorConfig());
+
+ // If dynamic color enabled, these colors won't be overrode by partner config.
+ // Instead, these colors align with the current theme colors.
+ if (!applyDynamicColor) {
+ updateButtonTextColorWithPartnerConfig(
+ button, footerButtonPartnerConfig.getButtonTextColorConfig());
+ updateButtonBackgroundWithPartnerConfig(
+ button,
+ footerButtonPartnerConfig.getButtonBackgroundConfig(),
+ footerButtonPartnerConfig.getButtonDisableAlphaConfig(),
+ footerButtonPartnerConfig.getButtonDisableBackgroundConfig());
+ updateButtonRippleColorWithPartnerConfig(button, footerButtonPartnerConfig);
+ }
+
updateButtonTextSizeWithPartnerConfig(
button, footerButtonPartnerConfig.getButtonTextSizeConfig());
updateButtonMinHeightWithPartnerConfig(
@@ -569,14 +606,8 @@ public class FooterBarMixin implements Mixin {
button,
footerButtonPartnerConfig.getButtonTextTypeFaceConfig(),
footerButtonPartnerConfig.getButtonTextStyleConfig());
- updateButtonBackgroundWithPartnerConfig(
- button,
- footerButtonPartnerConfig.getButtonBackgroundConfig(),
- footerButtonPartnerConfig.getButtonDisableAlphaConfig(),
- footerButtonPartnerConfig.getButtonDisableBackgroundConfig());
updateButtonRadiusWithPartnerConfig(button, footerButtonPartnerConfig.getButtonRadiusConfig());
updateButtonIconWithPartnerConfig(button, footerButtonPartnerConfig.getButtonIconConfig());
- updateButtonRippleColorWithPartnerConfig(button, footerButtonPartnerConfig);
}
private void updateButtonTextColorWithPartnerConfig(
diff --git a/main/java/com/google/android/setupcompat/template/FooterButton.java b/main/java/com/google/android/setupcompat/template/FooterButton.java
index b23b1bb..90c13ec 100644
--- a/main/java/com/google/android/setupcompat/template/FooterButton.java
+++ b/main/java/com/google/android/setupcompat/template/FooterButton.java
@@ -34,6 +34,7 @@ import androidx.annotation.StyleRes;
import com.google.android.setupcompat.R;
import com.google.android.setupcompat.logging.CustomEvent;
import java.lang.annotation.Retention;
+import java.util.Locale;
/**
* Definition of a footer button. Clients can use this class to customize attributes like text,
@@ -53,6 +54,8 @@ public final class FooterButton implements OnClickListener {
private OnClickListener onClickListenerWhenDisabled;
private OnButtonEventListener buttonListener;
private int clickCount = 0;
+ private Locale locale;
+ private int direction;
public FooterButton(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SucFooterButton);
@@ -78,11 +81,15 @@ public final class FooterButton implements OnClickListener {
CharSequence text,
@Nullable OnClickListener listener,
@ButtonType int buttonType,
- @StyleRes int theme) {
+ @StyleRes int theme,
+ Locale locale,
+ int direction) {
this.text = text;
onClickListener = listener;
this.buttonType = buttonType;
this.theme = theme;
+ this.locale = locale;
+ this.direction = direction;
}
/** Returns the text that this footer button is displaying. */
@@ -142,6 +149,16 @@ public final class FooterButton implements OnClickListener {
return enabled;
}
+ /** Returns the layout direction for this footer button. */
+ public int getLayoutDirection() {
+ return direction;
+ }
+
+ /** Returns the text locale for this footer button. */
+ public Locale getTextLocale() {
+ return locale;
+ }
+
/**
* Sets the visibility state of this footer button.
*
@@ -172,6 +189,22 @@ public final class FooterButton implements OnClickListener {
}
}
+ /** Sets the text locale to be displayed on footer button. */
+ public void setTextLocale(Locale locale) {
+ this.locale = locale;
+ if (buttonListener != null) {
+ buttonListener.onLocaleChanged(locale);
+ }
+ }
+
+ /** Sets the layout direction to be displayed on footer button. */
+ public void setLayoutDirection(int direction) {
+ this.direction = direction;
+ if (buttonListener != null) {
+ buttonListener.onDirectionChanged(direction);
+ }
+ }
+
/**
* Registers a callback to be invoked when footer button API has set.
*
@@ -201,6 +234,10 @@ public final class FooterButton implements OnClickListener {
void onVisibilityChanged(int visibility);
void onTextChanged(CharSequence text);
+
+ void onLocaleChanged(Locale locale);
+
+ void onDirectionChanged(int direction);
}
/** Maximum valid value of ButtonType */
@@ -308,12 +345,16 @@ public final class FooterButton implements OnClickListener {
* .setListener(primaryButton)
* .setButtonType(ButtonType.NEXT)
* .setTheme(R.style.SuwGlifButton_Primary)
+ * .setTextLocale(Locale.CANADA)
+ * .setLayoutDirection(View.LAYOUT_DIRECTION_LTR)
* .build();
* </pre>
*/
public static class Builder {
private final Context context;
private String text = "";
+ private Locale locale = null;
+ private int direction = -1;
private OnClickListener onClickListener = null;
@ButtonType private int buttonType = ButtonType.OTHER;
private int theme = 0;
@@ -334,6 +375,18 @@ public final class FooterButton implements OnClickListener {
return this;
}
+ /** Sets the {@code locale} of FooterButton. */
+ public Builder setTextLocale(Locale locale) {
+ this.locale = locale;
+ return this;
+ }
+
+ /** Sets the {@code direction} of FooterButton. */
+ public Builder setLayoutDirection(int direction) {
+ this.direction = direction;
+ return this;
+ }
+
/** Sets the {@code listener} of FooterButton. */
public Builder setListener(@Nullable OnClickListener listener) {
onClickListener = listener;
@@ -353,7 +406,7 @@ public final class FooterButton implements OnClickListener {
}
public FooterButton build() {
- return new FooterButton(text, onClickListener, buttonType, theme);
+ return new FooterButton(text, onClickListener, buttonType, theme, locale, direction);
}
}
}
diff --git a/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java b/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
new file mode 100644
index 0000000..ea54745
--- /dev/null
+++ b/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2021 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.setupcompat.util;
+
+import android.os.Build;
+
+/**
+ * An util class to check whether the current OS version is higher or equal to sdk version of
+ * device.
+ */
+public final class BuildCompatUtils {
+
+ /**
+ * Implementation of BuildCompat.isAtLeast*() suitable for use in Setup
+ *
+ * <p>BuildCompat.isAtLeast*() can be changed by Android Release team, and once that is changed it
+ * may take weeks for that to propagate to stable/prerelease/experimental SDKs in Google3. Also it
+ * can be different in all these channels. This can cause random issues, especially with sidecars
+ * (i.e., the code running on R may not know that it runs on R).
+ *
+ * <p>This still should try using BuildCompat.isAtLeastR() as source of truth, but also checking
+ * for VERSION_SDK_INT and VERSION.CODENAME in case when BuildCompat implementation returned
+ * false. Note that both checks should be >= and not = to make sure that when Android version
+ * increases (i.e., from R to S), this does not stop working.
+ *
+ * <p>Supported configurations:
+ *
+ * <ul>
+ * <li>For current Android release: while new API is not finalized yet (CODENAME = "S", SDK_INT
+ * = 30|31)
+ * <li>For current Android release: when new API is finalized (CODENAME = "REL", SDK_INT = 31)
+ * <li>For next Android release (CODENAME = "T", SDK_INT = 30+)
+ * </ul>
+ *
+ * <p>Note that Build.VERSION_CODES.S cannot be used here until final SDK is available in all
+ * Google3 channels, because it is equal to Build.VERSION_CODES.CUR_DEVELOPMENT before API
+ * finalization.
+ *
+ * @return Whether the current OS version is higher or equal to S.
+ */
+ public static boolean isAtLeastS() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
+ return false;
+ }
+ return (Build.VERSION.CODENAME.equals("REL") && Build.VERSION.SDK_INT >= 31)
+ || (Build.VERSION.CODENAME.length() == 1
+ && Build.VERSION.CODENAME.charAt(0) >= 'S'
+ && Build.VERSION.CODENAME.charAt(0) <= 'Z');
+ }
+
+ private BuildCompatUtils() {}
+}
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml
index 585a28a..07f87ed 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -32,6 +32,7 @@
This attribute will be ignored and use partner resource when inside setup wizard flow.
The default value is true. -->
<attr name="sucUsePartnerResource" format="boolean" />
+ <attr name="sucFullDynamicColor" format="boolean" />
</declare-styleable>
<!-- Status bar attributes; only takes effect on M or above -->
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
index 5a71afe..a78e345 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
@@ -233,6 +233,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 +311,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 +340,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 +364,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 +382,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..22cd526 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
@@ -83,6 +83,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 +103,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()?
@@ -296,6 +307,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 +371,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 +394,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 +417,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 +439,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";
}