diff options
author | Setup Wizard Team <android-setup-team-eng@google.com> | 2020-11-26 11:55:38 +0800 |
---|---|---|
committer | Pasty Chang <pastychang@google.com> | 2020-11-30 02:52:27 +0000 |
commit | e242cd2eafda90478b72dd6894898a612830c5dd (patch) | |
tree | b899b39431bbe35e3e56657c4fe1bf6134da2f36 /partnerconfig | |
parent | 2084d92b1b424a275c673ce8ae830d5fbaa44449 (diff) | |
download | setupcompat-e242cd2eafda90478b72dd6894898a612830c5dd.tar.gz |
Import updated Android SetupCompat Library 344353742
Copied from google3/third_party/java_src/android_libs/setupcompat
Test: mm
Included changes:
- 344353742 Extract subtitle margin top & bottom
- 343455224 [SetupCompact] export API to get BC stencil configs suppo...
- 343202016 [Portal] New API for query is progress service already re...
- 343190222 Extract Header margin top & bottom
PiperOrigin-RevId: 344353742
Change-Id: I6e0ab3c974ceb7183db37048aae6b9f874b82225
Diffstat (limited to 'partnerconfig')
-rw-r--r-- | partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java | 33 |
1 files changed, 33 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 754f462..a29a235 100644 --- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java +++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java @@ -53,8 +53,14 @@ public class PartnerConfigHelper { @VisibleForTesting public static final String IS_SUW_DAY_NIGHT_ENABLED_METHOD = "isSuwDayNightEnabled"; + @VisibleForTesting + public static final String IS_EXTENDED_PARTNER_CONFIG_ENABLED_METHOD = + "isExtendedPartnerConfigEnabled"; + @VisibleForTesting static Bundle suwDayNightEnabledBundle = null; + @VisibleForTesting static Bundle applyExtendedPartnerConfigBundle = null; + private static PartnerConfigHelper instance = null; @VisibleForTesting Bundle resultBundle = null; @@ -443,6 +449,7 @@ public class PartnerConfigHelper { public static synchronized void resetInstance() { instance = null; suwDayNightEnabledBundle = null; + applyExtendedPartnerConfigBundle = null; } /** @@ -473,6 +480,32 @@ public class PartnerConfigHelper { && suwDayNightEnabledBundle.getBoolean(IS_SUW_DAY_NIGHT_ENABLED_METHOD, false)); } + /** Returns true if the SetupWizard supports the extended partner configs during setup flow. */ + public static boolean shouldApplyExtendedPartnerConfig(@NonNull Context context) { + if (applyExtendedPartnerConfigBundle == null) { + try { + applyExtendedPartnerConfigBundle = + context + .getContentResolver() + .call( + getContentUri(), + IS_EXTENDED_PARTNER_CONFIG_ENABLED_METHOD, + /* arg= */ null, + /* extras= */ null); + } catch (IllegalArgumentException | SecurityException exception) { + Log.w( + TAG, + "SetupWizard extended partner configs supporting status unknown; return as false."); + applyExtendedPartnerConfigBundle = null; + return false; + } + } + + return (applyExtendedPartnerConfigBundle != null + && applyExtendedPartnerConfigBundle.getBoolean( + IS_EXTENDED_PARTNER_CONFIG_ENABLED_METHOD, false)); + } + @VisibleForTesting static Uri getContentUri() { return new Uri.Builder() |