Import updated Android SetupCompat Library 397257643 am: 46724f6727 am: a7534ee057

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupcompat/+/15897995

Change-Id: If657d869253573a2d4442c3f945ddffc7028cb21
diff --git a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
index 3a03559..52e3dc9 100644
--- a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
+++ b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
@@ -233,7 +233,7 @@
     }
   }
 
-  private boolean isFooterButtonsEvenlyWeighted() {
+  protected boolean isFooterButtonsEvenlyWeighted() {
     if (!isSecondaryButtonInPrimaryStyle) {
       return false;
     }
diff --git a/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java b/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
index 3583b93..7fac760 100644
--- a/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
+++ b/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
@@ -26,6 +26,15 @@
 public final class BuildCompatUtils {
 
   /**
+   * Implementation of BuildCompat.isAtLeastR() suitable for use in Setup
+   *
+   * @return Whether the current OS version is higher or equal to R.
+   */
+  @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R)
+  public static boolean isAtLeastR() {
+    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R;
+  }
+  /**
    * Implementation of BuildCompat.isAtLeastS() suitable for use in Setup
    *
    * @return Whether the current OS version is higher or equal to S.
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
index 27bd521..c0be011 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
@@ -81,6 +81,14 @@
 
   private static int savedOrientation = Configuration.ORIENTATION_PORTRAIT;
 
+  /**
+   * When testing related to fake PartnerConfigHelper instance, should sync the following saved
+   * config with testing environment.
+   */
+  @VisibleForTesting public static int savedScreenHeight = Configuration.SCREEN_HEIGHT_DP_UNDEFINED;
+
+  @VisibleForTesting public static int savedScreenWidth = Configuration.SCREEN_WIDTH_DP_UNDEFINED;
+
   public static synchronized PartnerConfigHelper get(@NonNull Context context) {
     if (!isValidInstance(context)) {
       instance = new PartnerConfigHelper(context);
@@ -93,15 +101,21 @@
     if (instance == null) {
       savedConfigUiMode = currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK;
       savedOrientation = currentConfig.orientation;
+      savedScreenWidth = currentConfig.screenWidthDp;
+      savedScreenHeight = currentConfig.screenHeightDp;
       return false;
     } else {
-      if (isSetupWizardDayNightEnabled(context)
-          && (currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) != savedConfigUiMode) {
+      boolean uiModeChanged =
+          isSetupWizardDayNightEnabled(context)
+              && (currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) != savedConfigUiMode;
+      if (uiModeChanged
+          || currentConfig.orientation != savedOrientation
+          || currentConfig.screenWidthDp != savedScreenWidth
+          || currentConfig.screenHeightDp != savedScreenHeight) {
         savedConfigUiMode = currentConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK;
-        resetInstance();
-        return false;
-      } else if (currentConfig.orientation != savedOrientation) {
         savedOrientation = currentConfig.orientation;
+        savedScreenHeight = currentConfig.screenHeightDp;
+        savedScreenWidth = currentConfig.screenWidthDp;
         resetInstance();
         return false;
       }