Import updated Android SetupCompat Library 408226794 am: 53b7642562 am: 3a998eb9c5

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

Change-Id: I2d5aed46edf1f7bf4133487a65b0046aee036c5c
diff --git a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
index 33747d4..6d92c40 100644
--- a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
+++ b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
@@ -241,8 +241,9 @@
       return false;
     }
     // TODO: Support neutral button style in glif layout for phone and tablet
+    PartnerConfigHelper.get(context);
     return context.getResources().getConfiguration().smallestScreenWidthDp >= 600
-        && PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context);
+        && PartnerConfigHelper.isNeutralButtonStyleEnabled(context);
   }
 
   private View addSpace() {
@@ -513,7 +514,7 @@
     boolean isLandscape =
         context.getResources().getConfiguration().orientation
             == Configuration.ORIENTATION_LANDSCAPE;
-    if (isLandscape && isEvenlyWeightedButtons) {
+    if (isLandscape && isEvenlyWeightedButtons && isFooterButtonAlignedEnd()) {
       addSpace();
     }
 
@@ -530,7 +531,8 @@
       }
       buttonContainer.addView(tempSecondaryButton);
     }
-    if (!isFooterButtonAlignedEnd() && !isEvenlyWeightedButtons) {
+    if (!isFooterButtonAlignedEnd()
+        && (!isEvenlyWeightedButtons || (isEvenlyWeightedButtons && isLandscape))) {
       addSpace();
     }
     if (tempPrimaryButton != null) {
diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
index ef39f9f..3525fa1 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
@@ -62,12 +62,17 @@
   @VisibleForTesting
   public static final String IS_DYNAMIC_COLOR_ENABLED_METHOD = "isDynamicColorEnabled";
 
+  @VisibleForTesting
+  public static final String IS_NEUTRAL_BUTTON_STYLE_ENABLED_METHOD = "isNeutralButtonStyleEnabled";
+
   @VisibleForTesting static Bundle suwDayNightEnabledBundle = null;
 
   @VisibleForTesting public static Bundle applyExtendedPartnerConfigBundle = null;
 
   @VisibleForTesting public static Bundle applyDynamicColorBundle = null;
 
+  @VisibleForTesting public static Bundle applyNeutralButtonStyleBundle = null;
+
   private static PartnerConfigHelper instance = null;
 
   @VisibleForTesting Bundle resultBundle = null;
@@ -566,6 +571,7 @@
     suwDayNightEnabledBundle = null;
     applyExtendedPartnerConfigBundle = null;
     applyDynamicColorBundle = null;
+    applyNeutralButtonStyleBundle = null;
   }
 
   /**
@@ -645,6 +651,29 @@
         && applyDynamicColorBundle.getBoolean(IS_DYNAMIC_COLOR_ENABLED_METHOD, false));
   }
 
+  /** Returns true if the SetupWizard supports the neutral button style during setup flow. */
+  public static boolean isNeutralButtonStyleEnabled(@NonNull Context context) {
+    if (applyNeutralButtonStyleBundle == null) {
+      try {
+        applyNeutralButtonStyleBundle =
+            context
+                .getContentResolver()
+                .call(
+                    getContentUri(),
+                    IS_NEUTRAL_BUTTON_STYLE_ENABLED_METHOD,
+                    /* arg= */ null,
+                    /* extras= */ null);
+      } catch (IllegalArgumentException | SecurityException exception) {
+        Log.w(TAG, "Neutral button style supporting status unknown; return as false.");
+        applyNeutralButtonStyleBundle = null;
+        return false;
+      }
+    }
+
+    return (applyNeutralButtonStyleBundle != null
+        && applyNeutralButtonStyleBundle.getBoolean(IS_NEUTRAL_BUTTON_STYLE_ENABLED_METHOD, false));
+  }
+
   @VisibleForTesting
   static Uri getContentUri() {
     return new Uri.Builder()