summaryrefslogtreecommitdiff
path: root/partnerconfig
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2022-01-06 23:50:39 +0800
committerNicole Huang <nicolehuang@google.com>2022-01-18 12:30:48 +0000
commit55addcd9202d816ca959f7596b1e771dd76f5e6f (patch)
treecc03221c38ee5d483d9545c764fcc9074d11c5cd /partnerconfig
parent2cf8aac5ece3b4afbe7d0cafd7b97c98457f2f49 (diff)
downloadsetupcompat-55addcd9202d816ca959f7596b1e771dd76f5e6f.tar.gz
Import updated Android SetupCompat Library 420060995
Copied from google3/third_party/java_src/android_libs/setupcompat Test: mm Included changes: - 420060995 [SetupCompat] Add helper to read the MY style flag from s... - 419491667 [Metric-Interruption] InterruptionDetector - 417925473 [Metric-Interruption] report window focus change - 415135618 [BC] Make the radius of the secondary button in the decis... - 414892919 [Metric-Interruption] Define new api in ISetupCompatServi... Bug:213303604 PiperOrigin-RevId: 420060995 Change-Id: Iacbbf357ca6a402189daaa0d8bde61e751462270
Diffstat (limited to 'partnerconfig')
-rw-r--r--partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
index 3525fa1..3c35d29 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
@@ -60,6 +60,9 @@ public class PartnerConfigHelper {
"isExtendedPartnerConfigEnabled";
@VisibleForTesting
+ public static final String IS_MATERIAL_YOU_STYLE_ENABLED_METHOD = "IsMaterialYouStyleEnabled";
+
+ @VisibleForTesting
public static final String IS_DYNAMIC_COLOR_ENABLED_METHOD = "isDynamicColorEnabled";
@VisibleForTesting
@@ -69,6 +72,8 @@ public class PartnerConfigHelper {
@VisibleForTesting public static Bundle applyExtendedPartnerConfigBundle = null;
+ @VisibleForTesting public static Bundle applyMaterialYouConfigBundle = null;
+
@VisibleForTesting public static Bundle applyDynamicColorBundle = null;
@VisibleForTesting public static Bundle applyNeutralButtonStyleBundle = null;
@@ -570,6 +575,7 @@ public class PartnerConfigHelper {
instance = null;
suwDayNightEnabledBundle = null;
applyExtendedPartnerConfigBundle = null;
+ applyMaterialYouConfigBundle = null;
applyDynamicColorBundle = null;
applyNeutralButtonStyleBundle = null;
}
@@ -628,6 +634,29 @@ public class PartnerConfigHelper {
IS_EXTENDED_PARTNER_CONFIG_ENABLED_METHOD, false));
}
+ /** Returns true if the SetupWizard is flow enabled "Material You(Glifv4)" style. */
+ public static boolean shouldApplyMaterialYouStyle(@NonNull Context context) {
+ if (applyMaterialYouConfigBundle == null) {
+ try {
+ applyMaterialYouConfigBundle =
+ context
+ .getContentResolver()
+ .call(
+ getContentUri(),
+ IS_MATERIAL_YOU_STYLE_ENABLED_METHOD,
+ /* arg= */ null,
+ /* extras= */ null);
+ } catch (IllegalArgumentException | SecurityException exception) {
+ Log.w(TAG, "SetupWizard Material You configs supporting status unknown; return as false.");
+ applyMaterialYouConfigBundle = null;
+ return false;
+ }
+ }
+
+ return (applyMaterialYouConfigBundle != null
+ && applyMaterialYouConfigBundle.getBoolean(IS_MATERIAL_YOU_STYLE_ENABLED_METHOD, false));
+ }
+
/** Returns true if the SetupWizard supports the dynamic color during setup flow. */
public static boolean isSetupWizardDynamicColorEnabled(@NonNull Context context) {
if (applyDynamicColorBundle == null) {