Import updated Android SetupCompat Library 354256040 am: 73b4170435
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupcompat/+/13449611
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I07b4138bba222d6442c8988224593aa146648a0a
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
index 15fc513..77c4149 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfig.java
@@ -294,7 +294,23 @@
PartnerConfigKey.KEY_LOADING_LOTTIE_UPDATE, ResourceType.ILLUSTRATION),
// The transition type to decide the transition between activities or fragments.
- CONFIG_TRANSITION_TYPE(PartnerConfigKey.KEY_TRANSITION_TYPE, ResourceType.INTEGER);
+ CONFIG_TRANSITION_TYPE(PartnerConfigKey.KEY_TRANSITION_TYPE, ResourceType.INTEGER),
+
+ // 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),
+
+ // The list of keypath and color map, applied to account animation when dark theme.
+ CONFIG_LOTTIE_DARK_THEME_CUSTOMIZATION_ACCOUNT(
+ PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_ACCOUNT, ResourceType.STRING_ARRAY),
+
+ // The list of keypath and color map, applied to connection animation when dark theme.
+ CONFIG_LOTTIE_DARK_THEME_CUSTOMIZATION_CONNECTION(
+ PartnerConfigKey.KEY_LOADING_DARK_THEME_CUSTOMIZATION_CONNECTION, ResourceType.STRING_ARRAY),
+
+ // 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);
/** Resource type of the partner resources type. */
public enum ResourceType {
@@ -305,7 +321,8 @@
STRING,
DIMENSION,
FRACTION,
- ILLUSTRATION;
+ ILLUSTRATION,
+ STRING_ARRAY
}
private final String resourceName;
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
index 9b5b592..b5152f3 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
@@ -36,7 +36,10 @@
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.setupcompat.partnerconfig.PartnerConfig.ResourceType;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.EnumMap;
+import java.util.List;
/** The helper reads and caches the partner configurations from SUW. */
public class PartnerConfigHelper {
@@ -217,6 +220,38 @@
}
/**
+ * Returns the string array of the given {@code resourceConfig}, or {@code null} if the given
+ * {@code resourceConfig} is not found. If the {@code ResourceType} of the given {@code
+ * resourceConfig} is not string, IllegalArgumentException will be thrown.
+ *
+ * @param context The context of client activity
+ * @param resourceConfig The {@code PartnerConfig} of target resource
+ */
+ @NonNull
+ public List<String> getStringArray(@NonNull Context context, PartnerConfig resourceConfig) {
+ if (resourceConfig.getResourceType() != ResourceType.STRING_ARRAY) {
+ throw new IllegalArgumentException("Not a string array resource");
+ }
+
+ String[] result;
+ List<String> listResult = new ArrayList<>();
+
+ try {
+ ResourceEntry resourceEntry =
+ getResourceEntryFromKey(context, resourceConfig.getResourceName());
+ Resources resource = resourceEntry.getResources();
+ int resId = resourceEntry.getResourceId();
+
+ result = resource.getStringArray(resId);
+ Collections.addAll(listResult, result);
+ } catch (NullPointerException exception) {
+ // fall through
+ }
+
+ return listResult;
+ }
+
+ /**
* Returns the boolean of given {@code resourceConfig}, or {@code defaultValue} if the given
* {@code resourceName} is not found. If the {@code ResourceType} of the given {@code
* resourceConfig} is not boolean, 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 e604e45..0fe2f7c 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigKey.java
@@ -97,6 +97,10 @@
PartnerConfigKey.KEY_LOADING_LOTTIE_CONNECTION,
PartnerConfigKey.KEY_LOADING_LOTTIE_DEFAULT,
PartnerConfigKey.KEY_LOADING_LOTTIE_UPDATE,
+ 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_TRANSITION_TYPE,
})
// TODO: can be removed and always reference PartnerConfig.getResourceName()?
@@ -334,6 +338,23 @@
// For example:com.google.android.setupwizard.COMPAT_EARLY_UPDATE
String KEY_LOADING_LOTTIE_UPDATE = "loading_animation_custom_update";
+ // A string-array to list all the key path and color map for default animation for dark theme.
+ // For example: background:FFFFFF
+ String KEY_LOADING_DARK_THEME_CUSTOMIZATION_DEFAULT = "loading_dark_theme_customization_default";
+
+ // A string-array to list all the key path and color map for account animation for dark theme.
+ // For example: background:FFFFFF
+ String KEY_LOADING_DARK_THEME_CUSTOMIZATION_ACCOUNT = "loading_dark_theme_customization_account";
+
+ // A string-array to list all the key path and color map for connection animation for dark theme.
+ // For example: background:FFFFFF
+ String KEY_LOADING_DARK_THEME_CUSTOMIZATION_CONNECTION =
+ "loading_dark_theme_customization_connection";
+
+ // A string-array to list all the key path and color map for update animation for dark theme.
+ // For example: background:FFFFFF
+ String KEY_LOADING_DARK_THEME_CUSTOMIZATION_UPDATE = "loading_dark_theme_customization_update";
+
// The transition type between activities
String KEY_TRANSITION_TYPE = "setup_design_transition_type";
}