Import updated Android SetupCompat Library 408226794

Copied from google3/third_party/java_src/android_libs/setupcompat

Bug: 205233262
Test: mm

Included changes:
  - 408226794 [Tablet] Add neutral button enable/disable flag
  - 407746786 [Tablet] Make the gravity of weight buttons control from ...

PiperOrigin-RevId: 408226794
Change-Id: Idb9bf711e64956595f044d53cc527c3b7e7abcf5
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()