[automerger skipped] setupdesign minsdk bump from 19 to 21 am: c1117bf174 -s ours

am skip reason: Merged-In I46302d5af424e666e2f666478afe9adf2b480b65 with SHA-1 8a0bee1ab1 is already in history

Original change: https://android-review.googlesource.com/c/platform/external/setupdesign/+/3146161

Change-Id: I1c42cd71ad9a92d5cfc5e1d462705e82b640754d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index 053b19e..aa336ad 100644
--- a/Android.bp
+++ b/Android.bp
@@ -67,6 +67,6 @@
     resource_dirs: [
         "strings/res",
     ],
-    min_sdk_version: "21",
+    min_sdk_version: "19",
     sdk_version: "current",
 }
diff --git a/lottie_loading_layout/res/values-v34/layouts.xml b/lottie_loading_layout/res/values-v34/layouts.xml
index 5ae5f54..7d5a5d3 100644
--- a/lottie_loading_layout/res/values-v34/layouts.xml
+++ b/lottie_loading_layout/res/values-v34/layouts.xml
@@ -15,7 +15,8 @@
     limitations under the License.
 -->
 
-<resources xmlns:tools="http://schemas.android.com/tools">
-  <item name="sud_glif_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item>
-  <item name="sud_glif_fullscreen_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item>
+<resources xmlns:tools="http://schemas.android.com/tools"
+    tools:keep="@layout/*_two_pane">
+    <item name="sud_glif_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item>
+    <item name="sud_glif_fullscreen_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_compat</item>
 </resources>
diff --git a/lottie_loading_layout/res/values-w840dp-v34/layouts.xml b/lottie_loading_layout/res/values-w840dp-v34/layouts.xml
index ff80def..fae9297 100644
--- a/lottie_loading_layout/res/values-w840dp-v34/layouts.xml
+++ b/lottie_loading_layout/res/values-w840dp-v34/layouts.xml
@@ -15,7 +15,8 @@
     limitations under the License.
 -->
 
-<resources xmlns:tools="http://schemas.android.com/tools">
-  <item name="sud_glif_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_card_two_pane</item>
-  <item name="sud_glif_fullscreen_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_fullscreen_loading_template_card_two_pane</item>
+<resources xmlns:tools="http://schemas.android.com/tools"
+    tools:keep="@layout/*_two_pane">
+    <item name="sud_glif_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_loading_template_card_two_pane</item>
+    <item name="sud_glif_fullscreen_loading_template_two_pane" type="layout" tools:ignore="UnusedResources">@layout/sud_glif_fullscreen_loading_template_card_two_pane</item>
 </resources>
diff --git a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
index 004a20b..46ece9a 100644
--- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
+++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
@@ -33,12 +33,14 @@
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 import android.util.AttributeSet;
+import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.MeasureSpec;
 import android.view.ViewGroup;
 import android.view.ViewStub;
+import android.view.ViewTreeObserver;
 import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import androidx.annotation.IntDef;
@@ -93,6 +95,9 @@
   protected static final String GLIF_LAYOUT_TYPE = "GlifLayoutType";
   protected static final String LOADING_LAYOUT = "LoadingLayout";
   @VisibleForTesting public boolean runRunnable;
+  private boolean isHeaderFullTextEnabled = false;
+  // This value is decided by local test expereince.
+  @VisibleForTesting static final float MIN_ALLOWED_ILLUSTRATION_HEIGHT_RATIO = 0.25f;
 
   @VisibleForTesting
   public List<LottieAnimationFinishListener> animationFinishListeners = new ArrayList<>();
@@ -196,6 +201,16 @@
     }
   }
 
+  public void setHeaderFullTextEnabled(boolean enabled) {
+    isHeaderFullTextEnabled = enabled;
+    // Update header height again.
+    updateHeaderHeight();
+  }
+
+  public boolean isHeaderFullTextEnabled() {
+    return isHeaderFullTextEnabled;
+  }
+
   @Override
   protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
     super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -314,13 +329,98 @@
         && PartnerConfigHelper.get(getContext())
             .isPartnerConfigAvailable(PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT)
         && currentConfig.orientation != Configuration.ORIENTATION_LANDSCAPE) {
-      float configHeaderHeight =
-          PartnerConfigHelper.get(getContext())
-              .getDimension(getContext(), PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT);
-      headerView.getLayoutParams().height = (int) configHeaderHeight;
+      if (isHeaderFullTextEnabled) {
+        // Set header height to wrap content for rendering full text view as much as possible.
+        headerView.getLayoutParams().height = LinearLayout.LayoutParams.WRAP_CONTENT;
+        // Optimize loading style if there's no extra space for showing illustration view.
+        optimizeLoadingStyle(headerView);
+      } else {
+        float configHeaderHeight =
+            PartnerConfigHelper.get(getContext())
+                .getDimension(getContext(), PartnerConfig.CONFIG_LOADING_LAYOUT_HEADER_HEIGHT);
+        headerView.getLayoutParams().height = (int) configHeaderHeight;
+      }
     }
   }
 
+  /**
+   * If there's no space in the loading screen page, layout will hide the original illustration view
+   * and show a linear progress bar for saving space.
+   */
+  private void optimizeLoadingStyle(View headerView) {
+    if (headerView == null) {
+      return;
+    }
+    // Listen for layout changes to header view
+    headerView
+        .getViewTreeObserver()
+        .addOnGlobalLayoutListener(
+            new ViewTreeObserver.OnGlobalLayoutListener() {
+              @Override
+              public void onGlobalLayout() {
+                // Remove the listener to avoid multiple calls
+                getViewTreeObserver().removeOnGlobalLayoutListener(this);
+
+                // Check if linear progress should be shown
+                if (shouldShowTopLinearProgress(headerView)) {
+                  showTopLinearProgress();
+                  hideLoadingIllustration();
+                }
+              }
+            });
+  }
+
+  private boolean shouldShowTopLinearProgress(View headerView) {
+    Context context = getContext();
+    // Get device height in dp
+    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
+    float deviceHeightDp = displayPixelsToDp(displayMetrics.heightPixels, context);
+
+    // Get height of the view in dp
+    float headerViewHeightDp = displayPixelsToDp(headerView.getHeight(), context);
+
+    // Calculate remaining height after subtracting view's height in dp
+    float remainingHeightDp = deviceHeightDp - headerViewHeightDp;
+    if (deviceHeightDp <= 0) {
+      return false;
+    }
+
+    Log.i(
+        TAG,
+        "deviceHeightDp : "
+            + deviceHeightDp
+            + " viewHeightDp : "
+            + headerViewHeightDp
+            + " remainingHeightDp : "
+            + remainingHeightDp
+            + " remainingHeightRatio : "
+            + remainingHeightDp / deviceHeightDp);
+
+    // Check if remaining height ratio is less than the minimum allowed ratio
+    return (remainingHeightDp / deviceHeightDp) < MIN_ALLOWED_ILLUSTRATION_HEIGHT_RATIO;
+  }
+
+  private void showTopLinearProgress() {
+    View view = findViewById(com.google.android.setupdesign.R.id.sud_glif_top_progress_bar);
+    if (view == null) {
+      return;
+    }
+    view.setVisibility(View.VISIBLE);
+  }
+
+  private void hideLoadingIllustration() {
+    View lottieAnimationView = findViewById(R.id.sud_lottie_view);
+    if (lottieAnimationView == null) {
+      return;
+    }
+    lottieAnimationView.setVisibility(View.GONE);
+  }
+
+  private float displayPixelsToDp(int pixels, Context context) {
+    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
+    return pixels / displayMetrics.density;
+  }
+
   private void updateContentPadding(LinearLayout linearLayout) {
     int paddingTop = linearLayout.getPaddingTop();
     int paddingLeft = linearLayout.getPaddingLeft();
diff --git a/main/res/color-v34/sud_dynamic_switch_track_off_light.xml b/main/res/color-v34/sud_dynamic_switch_track_off_light.xml
new file mode 100644
index 0000000..ffa9141
--- /dev/null
+++ b/main/res/color-v34/sud_dynamic_switch_track_off_light.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+  <item android:color="@android:color/system_neutral1_100" />
+</selector>
\ No newline at end of file
diff --git a/main/res/drawable-v34/sud_switch_track_off_background.xml b/main/res/drawable-v34/sud_switch_track_off_background.xml
new file mode 100644
index 0000000..7488f48
--- /dev/null
+++ b/main/res/drawable-v34/sud_switch_track_off_background.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2024 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle"
+    android:width="@dimen/sud_switch_track_width"
+    android:height="@dimen/sud_switch_track_height">
+    <solid android:color="@color/sud_switch_track_off" />
+    <corners android:radius="@dimen/sud_switch_track_radius" />
+    <stroke android:width="2dp" android:color="?attr/sudSwitchBarTrackOffOutlineColor" />
+</shape>
\ No newline at end of file
diff --git a/main/res/layout-v34/sud_glif_preference_recycler_view_two_pane.xml b/main/res/layout-v34/sud_glif_preference_recycler_view_two_pane.xml
new file mode 100644
index 0000000..d81324e
--- /dev/null
+++ b/main/res/layout-v34/sud_glif_preference_recycler_view_two_pane.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (C) 2024 The Android Open Source Project
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- Please keep filterTouchesWhenObscured=true; it's to prevent tapjacking.
+     See https://developer.android.com/privacy-and-security/risks/tapjacking -->
+<com.google.android.setupdesign.view.HeaderRecyclerView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/sud_recycler_view"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:clipChildren="false"
+    android:filterTouchesWhenObscured="true"
+    android:scrollIndicators="?attr/sudScrollIndicators"
+    android:scrollbars="vertical"
+    app:sudHeader="@layout/sud_glif_header" />
\ No newline at end of file
diff --git a/main/res/layout-w840dp-v34/sud_glif_preference_recycler_view_two_pane.xml b/main/res/layout-w840dp-v34/sud_glif_preference_recycler_view_two_pane.xml
new file mode 100644
index 0000000..7804b2b
--- /dev/null
+++ b/main/res/layout-w840dp-v34/sud_glif_preference_recycler_view_two_pane.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (C) 2024 The Android Open Source Project
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- Please keep filterTouchesWhenObscured=true; it's to prevent tapjacking.
+     See https://developer.android.com/privacy-and-security/risks/tapjacking -->
+<com.google.android.setupdesign.view.HeaderRecyclerView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/sud_recycler_view"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:clipChildren="false"
+    android:filterTouchesWhenObscured="true"
+    android:scrollIndicators="?attr/sudScrollIndicators"
+    android:scrollbars="vertical" />
\ No newline at end of file
diff --git a/main/res/layout/sud_glif_header.xml b/main/res/layout/sud_glif_header.xml
index accb3c0..df30ff7 100644
--- a/main/res/layout/sud_glif_header.xml
+++ b/main/res/layout/sud_glif_header.xml
@@ -22,6 +22,16 @@
     android:layout_height="wrap_content"
     android:orientation="vertical">
 
+    <ProgressBar
+        android:id="@+id/sud_glif_top_progress_bar"
+        style="?android:attr/progressBarStyleHorizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="?attr/sudMarginStart"
+        android:layout_marginRight="?attr/sudMarginStart"
+        android:visibility="gone"
+        android:indeterminate="true" />
+
     <FrameLayout
         android:id="@+id/sud_layout_icon_container"
         style="@style/SudGlifIconContainer"
diff --git a/main/res/values-v31/styles.xml b/main/res/values-v31/styles.xml
index 7216905..6230a07 100644
--- a/main/res/values-v31/styles.xml
+++ b/main/res/values-v31/styles.xml
@@ -30,6 +30,7 @@
     <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_dark</item>
     <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_dark</item>
     <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_dark</item>
+    <item name="sudSwitchBarTrackOffOutlineColor">@color/sud_dynamic_switch_thumb_off_outline_dark</item>
     <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_dark</item>
   </style>
 
@@ -46,6 +47,7 @@
     <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_light</item>
     <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_light</item>
     <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_light</item>
+    <item name="sudSwitchBarTrackOffOutlineColor">@color/sud_dynamic_switch_thumb_off_outline_light</item>
     <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_light</item>
   </style>
 
@@ -120,6 +122,7 @@
     <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_dark</item>
     <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_dark</item>
     <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_dark</item>
+    <item name="sudSwitchBarTrackOffOutlineColor">@color/sud_dynamic_switch_thumb_off_outline_dark</item>
     <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_dark</item>
   </style>
 
@@ -134,6 +137,7 @@
     <item name="sudSwitchBarTrackOnColor">@color/sud_dynamic_switch_track_on_light</item>
     <item name="sudSwitchBarThumbOffColor">@color/sud_dynamic_switch_thumb_off_light</item>
     <item name="sudSwitchBarTrackOffColor">@color/sud_dynamic_switch_track_off_light</item>
+    <item name="sudSwitchBarTrackOffOutlineColor">@color/sud_dynamic_switch_thumb_off_outline_light</item>
     <item name="sudEditBoxColor">@color/sud_dynamic_color_accent_glif_v3_light</item>
   </style>
 
diff --git a/main/res/values-v34/colors.xml b/main/res/values-v34/colors.xml
index 9460e6e..5e06218 100644
--- a/main/res/values-v34/colors.xml
+++ b/main/res/values-v34/colors.xml
@@ -18,4 +18,19 @@
 <resources>
   <!-- Accent color -->
   <color name="sud_dynamic_color_accent_glif_v3_dark">@color/sud_system_accent1_300</color>
+
+
+  <color name="sud_system_neutral2_600">@android:color/system_neutral2_600</color>
+
+
+  <color name="sud_dynamic_switch_thumb_off_light">@color/sud_system_neutral2_500</color>
+
+  <color name="sud_dynamic_switch_thumb_off_outline_light">@color/sud_system_neutral2_500</color>
+
+  <color name="sud_dynamic_switch_track_off_dark">@color/sud_system_neutral2_600</color>
+
+  <color name="sud_dynamic_switch_thumb_off_dark">@color/sud_system_neutral2_400</color>
+
+  <color name="sud_dynamic_switch_thumb_off_outline_dark">@color/sud_system_neutral2_400</color>
+
 </resources>
\ No newline at end of file
diff --git a/main/res/values-v34/layouts.xml b/main/res/values-v34/layouts.xml
index fd9fa12..f655865 100644
--- a/main/res/values-v34/layouts.xml
+++ b/main/res/values-v34/layouts.xml
@@ -15,9 +15,10 @@
     limitations under the License.
 -->
 
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools"
+    tools:keep="@layout/*_two_pane">
 
-  <!-- Layout for supporting force two pane even if it is portrait mode. -->
-  <item name="sud_glif_preference_template_two_pane" type="layout">@layout/sud_glif_preference_template_compact</item>
+    <!-- Layout for supporting force two pane even if it is portrait mode. -->
+    <item name="sud_glif_preference_template_two_pane" type="layout">@layout/sud_glif_preference_template_compact</item>
 
 </resources>
diff --git a/main/res/values-w840dp-v34/layouts.xml b/main/res/values-w840dp-v34/layouts.xml
index f19e88b..2fe2e83 100644
--- a/main/res/values-w840dp-v34/layouts.xml
+++ b/main/res/values-w840dp-v34/layouts.xml
@@ -15,12 +15,13 @@
     limitations under the License.
 -->
 
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools"
+    tools:keep="@layout/*_two_pane">
 
-  <!-- Layout for supporting force two pane even if it is portrait mode. -->
-  <item name="sud_glif_template_two_pane" type="layout">@layout/sud_glif_template_card_two_pane</item>
-  <item name="sud_glif_list_template_two_pane" type="layout">@layout/sud_glif_list_template_card_two_pane</item>
-  <item name="sud_glif_recycler_template_two_pane" type="layout">@layout/sud_glif_recycler_template_card_two_pane</item>
-  <item name="sud_glif_preference_template_two_pane" type="layout">@layout/sud_glif_preference_template_card_two_pane</item>
+    <!-- Layout for supporting force two pane even if it is portrait mode. -->
+    <item name="sud_glif_template_two_pane" type="layout">@layout/sud_glif_template_card_two_pane</item>
+    <item name="sud_glif_list_template_two_pane" type="layout">@layout/sud_glif_list_template_card_two_pane</item>
+    <item name="sud_glif_recycler_template_two_pane" type="layout">@layout/sud_glif_recycler_template_card_two_pane</item>
+    <item name="sud_glif_preference_template_two_pane" type="layout">@layout/sud_glif_preference_template_card_two_pane</item>
 
 </resources>
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml
index d31ce14..16b656d 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -307,4 +307,5 @@
     <attr name="sudSwitchBarThumbOffColor" format="color|reference" />
     <attr name="sudSwitchBarTrackOnColor" format="color|reference" />
     <attr name="sudSwitchBarTrackOffColor" format="color|reference" />
+    <attr name="sudSwitchBarTrackOffOutlineColor" format="color|reference" />
 </resources>
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index 5cbcf07..d52e2b6 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -178,10 +178,13 @@
 
 
     <color name="sud_switch_track_off_light">#FF55575E</color>
+    <color name="sud_switch_track_outline_off_light">#FFA5ACB2</color>
     <color name="sud_switch_thumb_off_light">#FFA5ACB2</color>
     <color name="sud_switch_track_off_dark">#FF454749</color>
+    <color name="sud_switch_track_outline_off_dark">#FF8F9193</color>
     <color name="sud_switch_thumb_off_dark">#FF8F9193</color>
 
+
     <color name="sud_switch_track_on_light">#3B78E7</color>
 
     <color name="sud_switch_thumb_on_light">#C6DAFC</color>
diff --git a/main/res/values/layouts.xml b/main/res/values/layouts.xml
index 7d3bd57..472edb1 100644
--- a/main/res/values/layouts.xml
+++ b/main/res/values/layouts.xml
@@ -15,7 +15,8 @@
     limitations under the License.
 -->
 
-<resources xmlns:tools="http://schemas.android.com/tools">
+<resources xmlns:tools="http://schemas.android.com/tools"
+    tools:keep="@layout/*_two_pane">
 
     <item name="sud_template" type="layout">@layout/sud_template_header</item>
 
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index 6fe9550..1cddbd0 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -217,6 +217,7 @@
         <item name="sudSwitchBarTrackOnColor">@color/sud_switch_track_on_dark</item>
         <item name="sudSwitchBarThumbOffColor">@color/sud_switch_thumb_off_dark</item>
         <item name="sudSwitchBarTrackOffColor">@color/sud_switch_track_off_dark</item>
+        <item name="sudSwitchBarTrackOffOutlineColor">@color/sud_switch_track_outline_off_dark</item>
         <item name="sudEditBoxStyle">@style/SudEditBoxTheme</item>
         <item name="sudEditBoxColor">@color/sud_color_accent_glif_dark</item>
         <item name="sudItemContainerStyle">@style/SudItemContainer</item>
@@ -316,6 +317,7 @@
         <item name="sudSwitchBarTrackOnColor">@color/sud_switch_track_on_light</item>
         <item name="sudSwitchBarThumbOffColor">@color/sud_switch_thumb_off_light</item>
         <item name="sudSwitchBarTrackOffColor">@color/sud_switch_track_off_light</item>
+        <item name="sudSwitchBarTrackOffOutlineColor">@color/sud_switch_track_outline_off_light</item>
         <item name="sudEditBoxStyle">@style/SudEditBoxTheme</item>
         <item name="sudEditBoxColor">@color/sud_color_accent_glif_light</item>
         <item name="sudItemContainerStyle">@style/SudItemContainer</item>
diff --git a/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java b/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java
index d208a67..b967719 100644
--- a/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java
@@ -115,8 +115,12 @@
     // Inflate the recycler view here, so attributes on the decoration views can be applied
     // immediately.
     final LayoutInflater inflater = LayoutInflater.from(getContext());
-    RecyclerView recyclerView =
-        (RecyclerView) inflater.inflate(R.layout.sud_glif_preference_recycler_view, this, false);
+    int recyclerViewLayoutId = R.layout.sud_glif_preference_recycler_view;
+    if (ForceTwoPaneHelper.isForceTwoPaneEnable(getContext())) {
+      recyclerViewLayoutId =
+          ForceTwoPaneHelper.getForceTwoPaneStyleLayout(getContext(), recyclerViewLayoutId);
+    }
+    RecyclerView recyclerView = (RecyclerView) inflater.inflate(recyclerViewLayoutId, this, false);
     recyclerMixin = new RecyclerMixin(this, recyclerView);
   }
 }