---
title: "Fold, Split, Resize: How RevenueCat Paywalls Adapt to Window Size on Android"
description: "In this article, you'll start from that fold, reproduced on the Android Emulator, and trace inward through the RevenueCat Android SDK's paywall renderer."
language: "en"
publishedAt: "2026-11-25T01:41:44.250Z"
updatedAt: "2026-11-25T01:41:44.250Z"
authors:
  - name: "Jaewoong Eum"
    url: "https://www.revenuecat.com/blog/author/jaewoong-eum"
category: "Engineering"
categoryUrl: "https://www.revenuecat.com/blog/engineering"
canonical: "https://www.revenuecat.com/blog/engineering/paywall-foldable"
---

# Fold, Split, Resize: How RevenueCat Paywalls Adapt to Window Size on Android

In this article, you'll start from that fold, reproduced on the Android Emulator, and trace inward through the RevenueCat Android SDK's paywall renderer.

## Table of contents

- [The fundamental problem: One paywall definition, every window](#the-fundamental-problem-one-paywall-definition-every-window)
- [Size classes: The app window's width, read from composition](#size-classes-the-app-windows-width-read-from-composition)
  - [Size class overrides accumulate](#size-class-overrides-accumulate)
- [Window rules: Measured on the paywall's own bounds](#window-rules-measured-on-the-paywalls-own-bounds)
  - [A paywall in a dialog](#a-paywall-in-a-dialog)
- [Through a fold: What survives recreation](#through-a-fold-what-survives-recreation)
- [Reconciliation: When a rule hides the selected package](#reconciliation-when-a-rule-hides-the-selected-package)
- [A selection that didn't survive: Color schemes without equals](#a-selection-that-didnt-survive-color-schemes-without-equals)
- [Short windows and large screens: Footers and size limits](#short-windows-and-large-screens-footers-and-size-limits)
- [What the renderer leaves out: Posture and the hinge](#what-the-renderer-leaves-out-posture-and-the-hinge)
- [Testing on the emulator: Setup and checks](#testing-on-the-emulator-setup-and-checks)
- [Conclusion](#conclusion)

A user opens your paywall on the cover screen of a Pixel Fold, taps the annual plan, and unfolds the phone to read the details on the larger screen. In that one gesture the window goes from 411 dp to 841 dp wide, Android recreates the activity, and the paywall has to come back with a different layout and the same plan selected. Starting April 2027, Google Play requires new apps and updates to meet Tier 3 of its adaptive app quality guidelines for foldables, which includes keeping state through folding, unfolding, and resizing. So what does a server driven paywall do when its window changes underneath it?

In this article, you'll start from that fold, reproduced on the Android Emulator, and trace inward through the [RevenueCat Android SDK](https://github.com/RevenueCat/purchases-android)'s paywall renderer: the two ways a paywall asks how big it is, why size class overrides accumulate, how a paywall in a dialog measures itself, how the selection moves when a rule hides a package, a selection reset we found while recording the demos for this article, and what the renderer leaves out.

## **The fundamental problem: One paywall definition, every window**

A RevenueCat paywall is designed once in the dashboard and arrives in the app as a tree of components: stacks, texts, images, packages, buttons. Any component can carry overrides, partial property sets that apply while a condition holds. The same paywall has to work on a 411 dp cover screen, an 841 dp inner screen, half of a split screen, and a dialog on a tablet, and it has to keep working when the window changes while it's on screen.

[Google Play's announcement from November 18, 2026](https://developer.android.com/blog/posts/google-play-adaptive-quality-standards) puts dates on this:

- **November 2026**: Play Console accepts foldable screenshots for store listings.
- **April 2027**: new apps and updates need Tier 3, "Adaptive ready", the baseline of three tiers, with Tier 2 and Tier 1 above it. Apps must fill the available display area without letterboxing, preserve state (scroll position, text input, media playback) during rotation, folding, unfolding, and resizing, and support multi window. Submissions also need 3 foldable screenshots in addition to the 2 phone screenshots.
- **August 2027**: new apps and updates must target API level 37. For apps targeting Android 17, [orientation, resizability, and aspect ratio restrictions no longer apply](https://developer.android.com/about/versions/17/changes/ff-restrictions-ignored) on displays whose smallest width is greater than 600 dp, and the temporary opt out from Android 16 is gone.
For a subscription app, the paywall is where this matters most directly: the price and the purchase button have to stay visible, and the button must still buy the plan the user picked after the window changes. To watch what happens, we built a demo paywall from the SDK's own component models, the same types the dashboard's JSON decodes into. Its plans sit in a vertical stack, and one override turns the stack horizontal when the paywall is at least 700 dp wide:

```
val wide = ComponentOverride.Condition.WindowWidthRule(
    operator = ComparisonOperator.GREATER_THAN_OR_EQUAL,
    value = 700.0,
)

val plans = StackComponent(
    components = listOf(monthlyCard, annualCard, weeklyCard),
    dimension = Vertical(HorizontalAlignment.LEADING, FlexDistribution.START),
    size = Size(width = Fill(), height = Fit()),
    overrides = listOf(
        ComponentOverride(
            conditions = listOf(wide),
            properties = PartialStackComponent(
                dimension = Horizontal(VerticalAlignment.TOP, FlexDistribution.START),
            ),
        ),
    ),
)
```

A text under the title also carries three overrides, one per size class, so a screenshot shows which ones applied. The demo activity embeds the SDK's paywall with its real PaywallViewModelImpl and a mocked purchases dependency, and draws an overlay with the window size, the size class, the paywall's measured size, how many times the activity was created, and the selected package. It runs on a Pixel Fold emulator, where adb emu fold and adb emu unfold switch between the two screens. On the left, the unfolded 841 dp window puts the plans in a row. On the right, the folded 411 dp window stacks them:

![](https://cdn.sanity.io/images/c3qnx9b0/production/e33bf623a4596d8504c0b5e35eb7083274c9a631-2446x1038.png)

Both layouts come from one definition.

## **Size classes: The app window's width, read from composition**

The first way a paywall asks about size is the window size class: Compact, Medium, or Expanded. Most component states read it through a helper. Looking at the implementation:

```
@Composable
@ReadOnlyComposable
internal fun currentWindowWidthSizeClass(): WindowWidthSizeClass {
    // Read for its side effect, exactly as `currentWindowSize()` does: the window metrics below are not
    // snapshot state, so this read is what invalidates callers on a configuration change.
    LocalConfiguration.current
    val bounds = WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(LocalContext.current).bounds
    val dpSize = with(LocalDensity.current) { IntSize(bounds.width(), bounds.height()).toSize().toDpSize() }
    return WindowSizeClass.compute(dpSize.width.value, dpSize.height.value).windowWidthSizeClass
}
```

Notice the structure:

1. **The window, not the display**: `computeCurrentWindowMetrics` returns the bounds of the app's window, so half of a split screen reports half the width.
1. **Standard breakpoints**: below 600 dp is Compact, below 840 dp is Medium, anything wider is Expanded (`window-core` 1.5.0). The folded Pixel Fold at 411 dp is Compact, and the unfolded one at 841 dp is Expanded, by 1 dp.
1. **The **`**LocalConfiguration**`** read**: window metrics aren't snapshot state, so nothing would tell composition that they changed. Reading `LocalConfiguration.current` subscribes the caller to configuration changes, and a fold is one.
### **Size class overrides accumulate**

How a size class matches an override is less obvious. The conditions aren't exclusive:

```
private val ScreenCondition.applicableConditions: Set<ComponentOverride.Condition>
    get() = when (this) {
        ScreenCondition.COMPACT -> setOf(ComponentOverride.Condition.Compact)
        ScreenCondition.MEDIUM -> setOf(ComponentOverride.Condition.Compact, ComponentOverride.Condition.Medium)
        ScreenCondition.EXPANDED -> setOf(
            ComponentOverride.Condition.Compact,
            ComponentOverride.Condition.Medium,
            ComponentOverride.Condition.Expanded,
        )
    }
```

A Medium window matches Compact and Medium overrides, and an Expanded window matches all three. Each condition means "at least this wide", like a min-width media query in CSS. Every override that matches is then merged in the order the paywall declares them:

```
var partial: T? = null
for (override in this) {
    if (override.shouldApply(windowSize, offerEligibility, state, conditionContext)) {
        partial = partial.combineOrReplace(override.properties)
    }
}
return partial
```

combineOrReplace lays the next override's properties over the accumulated ones, so when two matching overrides set the same property, the one declared later wins. Declared as Compact, Medium, Expanded, the Expanded text wins on an Expanded window. Declared in the reverse order, the Compact text wins on every window, because Compact always matches and comes last. The demo renders both orders on the same unfolded screen:

![](https://cdn.sanity.io/images/c3qnx9b0/production/71b21e2332e7ca6376e3eb8a638c83dfec2ba2f0-2223x1038.png)

The plan cards are horizontal in both, because they follow the 700 dp width rule, not a size class. That's the second way to ask about size.

## **Window rules: Measured on the paywall's own bounds**

PR [4193](https://github.com/RevenueCat/purchases-android/pull/4193) (10.21.0) added three numeric conditions to the paywall schema: window width, window height, and window aspect ratio, each compared with an operator such as `>=`. Despite the name, they don't measure the app window. They measure the space given to the paywall, through `MeasurePaywallBounds`, a composable at the root of the paywall. Trimmed to its core:

```
BoxWithConstraints(modifier) {
    val bounds = if (constraints.hasBoundedWidth && constraints.hasBoundedHeight) {
        DpSize(maxWidth, maxHeight)
    } else {
        val windowDpSize = currentWindowDpSize()
        DpSize(
            width = if (constraints.hasBoundedWidth) maxWidth else windowDpSize.width,
            height = if (constraints.hasBoundedHeight) maxHeight else windowDpSize.height,
        )
    }
```

BoxWithConstraints exposes the constraints the parent passed down, which is the size the paywall is offered. When an axis is unbounded, such as the height of a sheet that wraps its content, that axis falls back to the window. The function continues by publishing the result:

```
    val screenCondition = ScreenCondition.from(currentWindowAdaptiveInfo().windowSizeClass.windowWidthSizeClass)
    for (state in states) {
        state.paywallBoundsDp = bounds
        state.windowScreenCondition = screenCondition
    }
    LaunchedEffect(bounds, screenCondition, states) {
        for (state in states) {
            state.reconcileSelectionForWindowSize(bounds)
        }
    }
    content()
}
```

Four details are worth pointing out:

- **Written before the content composes**: `paywallBoundsDp` is snapshot state, and it's set before `content()` runs, so the first frame already lays out against the right size. While the size is unknown, as it is when the initial selection is resolved, a window rule evaluates to `false`.
- **Live updates**: when the bounds change, every component state that read `paywallBoundsDp` re-evaluates its overrides, with no recreation required.
- **Both answers recorded**: the root also stores the window's size class, because the selection check below needs both, and in a dialog or a pane they can differ. `states` is a list because a multi step paywall prepares the states of its next screens ahead of time.
- **A selection check after the frame**: the `LaunchedEffect` reruns when the bounds, the size class, or the set of states change. The initial selection is resolved before any bounds are known, and effects run after the frame, so the layout is right on the first frame and the selection is corrected right after it.
#4193 also notes that older SDKs decode these conditions as `Unsupported` and fall back to the paywall's default layout.

### **A paywall in a dialog**

The difference between the two questions shows up as soon as the paywall doesn't fill the window. `PaywallDialog` uses a scaffold that picks the dialog's width from the window:

```
@Composable
@ReadOnlyComposable
internal fun shouldUsePlatformDefaultWidth(): Boolean {
    return !hasCompactDimension()
}
```

When either window dimension is Compact, the dialog spans the full width. On the unfolded Pixel Fold, neither dimension is Compact, so the dialog takes the platform's default dialog width. The demo puts the paywall in that same scaffold on the same window:

![](https://cdn.sanity.io/images/c3qnx9b0/production/686fd27dbc4039b924e90ef65f568bba3fe7ab83-2223x1038.png)

The window is still 841 dp, so the size class is still Expanded and the Expanded text still applies. The dialog gives the paywall 579 dp, so the 700 dp width rule doesn't match and the plans stay vertical. Both answers are correct for the question asked. A size class describes the app. A window rule describes the paywall. In a dialog, a sheet, or a pane, only a window rule sees the space the paywall has.

## **Through a fold: What survives recreation**

Now fold the device. The SDK's own `PaywallActivity` doesn't declare `configChanges` in its manifest entry:

```
<activity
    android:name=".activity.PaywallActivity"
    android:exported="false" />
```

So a fold destroys the activity and creates a new one, along with a new composition. Anything held only in the composition is lost. The paywall's loaded state lives in a ViewModel instead, created through getPaywallViewModel:

```
val viewModel = viewModel<PaywallViewModelImpl>(
    key = options.hashCode().toString(),
    factory = PaywallViewModelFactory(
        applicationContext.toResourceProvider(),
        options,
        MaterialTheme.colorScheme,
        isSystemInDarkTheme(),
        shouldDisplayBlock = shouldDisplayBlock,
        preview = isInPreviewMode(),
    ),
)
viewModel.updateOptions(options)
```

The `ViewModelStore` survives configuration changes, and the key is derived from the paywall options, so the recreated activity gets the same instance back. That instance holds the loaded paywall state, including the selected package. The new composition then measures again, and `MeasurePaywallBounds` writes the new bounds into the same state before anything draws. In the demo's overlay, this shows up as "activity created #2" with the selection unchanged. Scroll position takes a different route, through `rememberScrollState` and saved instance state, and these demos don't cover it.

If your app handles the window change itself with `configChanges`, nothing is recreated. The configuration change invalidates the `LocalConfiguration` readers, `BoxWithConstraints` measures with new constraints, and the paywall re-evaluates its overrides in place. Either way, layout follows the window, and the selection stays in the `ViewModel`, with one exception covered below.

## **Reconciliation: When a rule hides the selected package**

Window rules can do more than rearrange components. They can hide them, and a hidden component can be the selected package. The demo's second paywall marks Monthly as the default selection and hides the Monthly card when the paywall is at least 700 dp wide. Here is what happens across fold, unfold, and fold:

![](https://cdn.sanity.io/images/c3qnx9b0/production/edea7640afd581bc20a296ef67d10e4f73a7ae0c-2446x1038.png)

1. Folded, the paywall is 411 dp wide, Monthly is visible, and it's selected by default.
1. Unfolded, the paywall is 841 dp wide and the Monthly card is hidden. The purchase button now says $67.99/year, so the selection moved to Annual.
1. Folded again, Monthly is visible again, but Annual stays selected.
The `LaunchedEffect` in `MeasurePaywallBounds` drives step 2. It calls `reconcileSelectionForWindowSize`, which asks a resolver for the package that should be selected at these bounds and applies the answer only when it differs. The policy lives in `PackageSelectionResolver.reconcile`:

```
fun reconcile(current: String?, remembered: String?): String? = when {
    // An explicit choice may hide its own card. Keep it while the card could still render
    // unselected; viewport/container rules that hide both states still trigger reconciliation.
    current != null && reconciliationCandidates.couldBeSelected(current, context) -> current
    else -> defaultSelection(remembered)
        ?: sheetOnlyDefaultSelection()
        ?: current
        ?: allHiddenFallback()
}
```

A package card can have different visibility when it's selected and when it isn't. The key observation: the resolver keeps the current selection while its card can render in at least one of those two states. Otherwise `defaultSelection` tries the authored default, then the remembered selection, then the first package that can be selected, and a later fallback keeps the current selection if no other package can be selected. On the unfolded window, the authored default is Monthly, the hidden package, so the resolver lands on Annual.

That same rule explains step 3. When the paywall folds back, Annual can still be rendered, so it stays. The resolver doesn't snap back to Monthly just because Monthly became visible again. A selection that moves only when it has to keeps the price on the purchase button from changing on its own. The reconciliation arrived in [#4198](https://github.com/RevenueCat/purchases-android/pull/4198), and [#4519](https://github.com/RevenueCat/purchases-android/pull/4519) made package selection use the same visibility evaluation as the rendered cards. Both shipped in 11.0.1. Window rules themselves shipped in 10.21.0, so from 10.21.0 through 11.0.0, including all of 10.30.x, a package hidden by a window rule could stay selected and purchasable.

## **A selection that didn't survive: Color schemes without **`**equals**`

While recording the demos for this article, one configuration lost the selection on every fold. The demo's host theme was the Compose theme that Android Studio generates for a new project (checked in Android Studio 2026.1):

```
@Composable
fun MyAppTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    // Dynamic color is available on Android 12+
    dynamicColor: Boolean = true,
    content: @Composable () -> Unit
) {
    val colorScheme = when {
      dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
        val context = LocalContext.current
        if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
      }
      darkTheme -> DarkColorScheme
      else -> LightColorScheme
    }
    MaterialTheme(colorScheme = colorScheme, typography = Typography, content = content)
}
```

With the embedded Paywall inside this theme, selecting Annual and folding the device brought the paywall back with Monthly selected, and the purchase button switched to the monthly price. With a theme built from top level color schemes, the same steps kept Annual:

![](https://cdn.sanity.io/images/c3qnx9b0/production/e8a2f6757408d5d07f0239130017671853a3ce8e-1730x1038.png)

The cause is in how the paywall notices theme changes. InternalPaywall passes the current color scheme to the ViewModel after every successful composition:

```
val colorScheme = MaterialTheme.colorScheme
val isDark = isSystemInDarkTheme()
SideEffect {
    viewModel.refreshStateIfLocaleChanged()
    viewModel.refreshStateIfColorsChanged(colorScheme = colorScheme, isDark = isDark)
}
```

The ViewModel rebuilds its state when the scheme differs from the one it saw last. Trimmed to the comparison:

```
override fun refreshStateIfColorsChanged(colorScheme: ColorScheme, isDark: Boolean) {
    // ...
    if (_colorScheme.value != colorScheme) {
        _colorScheme.value = colorScheme
        if (workflowNavigator != null) {
            rebuildWorkflowStepStates()
        } else {
            updateState()
        }
    }
}
```

Two facts combine here:

1. `**ColorScheme**`** has no **`**equals**`: in material3 1.4.0 it's a plain class, so `!=` compares references. Two schemes with identical colors are still different.
1. **The template builds a new scheme on every call**: `dynamicLightColorScheme(context)` calls `lightColorScheme(...)` and returns a new instance, and the template calls it during composition.
A fold runs the theme function again, in a new composition after recreation, or in a recomposition when the app handles `configChanges`. Each time, the `ViewModel` sees a "new" color scheme and rebuilds its state, through `rebuildWorkflowStepStates()` on the workflow branch that Paywalls V2 normally take, or through `updateState()` otherwise. On either branch, the rebuilt state starts from the default selection. The `ViewModel` survived the fold. Its selection didn't.

To check that this comparison is the cause and not just a plausible story, we ran the same steps (select Annual, fold) across host themes and activity setups, then changed only the comparison. The demo logs which branch the `ViewModel` is on, and every case below ran on both branches with the same result:

- **Template theme with dynamic color**: reset to Monthly, both with recreation and with `configChanges` handled. With recreation, it reset in all seven runs.
- **Dynamic scheme wrapped in **`**remember**`: reset with recreation, because `remember` doesn't outlive the composition. Kept with `configChanges`, because the composition survives.
- **Top level color schemes**: kept in both setups, because the same instance comes back.
- `**MaterialTheme { }**`** with no scheme**, which is what `PaywallActivity` does: kept in both setups. The default comes from `staticCompositionLocalOf { lightColorScheme() }`, and the runtime creates that default once and reuses it.
- **Comparison changed to compare the color values**: every case that reset above kept Annual.
`PaywallActivity` wraps the paywall in `MaterialTheme { }`, so `PaywallActivityLauncher` should be unaffected, as the default theme case above shows. An embedded `Paywall` under a theme that builds its color scheme during composition, which is the default new project setup on Android 12 and later, loses the selection on a fold, and by the same mechanism on any other change that runs the theme again. `PaywallDialog` reads the same theme through the same code, so it should behave the same way, though we only ran its scaffold with a static theme. [[FIX STATUS: fill in with the PR link and the SDK version that ships the fix before publishing]] Until then, presenting the paywall with `PaywallActivityLauncher` should avoid it.

## **Short windows and large screens: Footers and size limits**

A fold changes the width, but some window changes take height away. A landscape phone or a top and bottom split screen can leave a few hundred dp, and a paywall's sticky footer, which holds the purchase button, can be taller than that. Since 11.4.2 (and 10.30.5 on the 10.x line), a Fit height footer without its own vertical scroll measures its content first and scrolls only when the content doesn't fit:

```
private fun Modifier.measureFooterContent(viewportHeight: Int, onOverflowChanged: (Boolean) -> Unit): Modifier =
    layout { measurable, constraints ->
        val content = measurable.measure(constraints.copy(minHeight = 0, maxHeight = Constraints.Infinity))
        onOverflowChanged(content.height > viewportHeight)
        layout(content.width, constraints.constrainHeight(content.height)) { content.placeRelative(0, 0) }
    }
```

The content is measured with no height limit, the footer reports whether that height exceeds the space it was given, and the caller adds `verticalScroll` only in that case, as long as the height is bounded and scrolling isn't disabled. Scrolling only on overflow matters because `verticalScroll` clips its content and exposes a scroll action to accessibility services. A footer that fits keeps its shadows and badges outside its bounds, and a footer that doesn't fit can still scroll its purchase button into view.

The opposite problem is width. A layout designed for a phone stretches on an unfolded screen, and Tier 2 of the same guidelines calls out stretched UI elements. [Minimum and maximum sizes](https://www.revenuecat.com/docs/tools/paywalls/creating-paywalls/component-properties#minimum-and-maximum-sizes) (10.25.0 on Android, [#4379](https://github.com/RevenueCat/purchases-android/pull/4379)) let a Fill size stop growing at a maximum. They apply only to Fill sizes, and the parent's alignment decides where the leftover space goes, so content can stay at a readable width inside a full width background.

## **What the renderer leaves out: Posture and the hinge**

The paywall knows its size, and nothing else about the fold. `currentWindowAdaptiveInfo()` appears in the renderer, but only `windowSizeClass` is read from it. No component reads `windowPosture` or a `FoldingFeature`. A half opened device in tabletop posture is a window like any other, and the paywall lays out across the hinge as if the screen were flat.

The April 2027 baseline doesn't ask for more. Tier 3 is about filling the window and keeping state. Postures belong to Tier 1, "Adaptive differentiated", which evaluates tabletop and book postures along with features like camera continuity and interactive picture in picture.

## **Testing on the emulator: Setup and checks**

Play accepts screenshots from the foldable emulators for the new listing requirement, and the same emulators cover the behavior in this article. A few things we learned setting them up:

- **Use the Pixel Fold profile**: with an API 34 Google APIs image, it reports CLOSED, HALF_OPENED, and OPENED device states, and `adb emu fold` and `adb emu unfold` switch between a 411 dp and an 841 dp wide window. In our headless setup on Apple silicon, the Pixel 9 Pro Fold profile with API 34 and 35 images exposed the two screens as separate displays, and folding didn't move the app.
- **Select something first**: a paywall that comes back with the default plan selected looks correct. Select a package that isn't the default before every fold, resize, or split, and check the purchase button afterward.
- **Test the way you present the paywall**: `PaywallActivityLauncher`, an embedded `Paywall`, and `PaywallDialog` take different paths, and only the embedded ones inherit your theme.
- **Watch for recreation**: logging `onCreate` and the `savedInstanceState` tells you whether a change recreated the activity or recomposed it, and the two can behave differently, as the color scheme results above show.
## **Conclusion**

When you check a paywall for foldables and large screens, ask two questions instead of one: what does the layout look like at this size, and what does the paywall still remember after the size changed. Size classes answer for the app window and window rules answer for the paywall's own bounds, so pick the one that matches where the paywall is shown. Then fold the device with a plan selected that isn't the default, because a reset to the default selection is the easiest failure to miss.

The layout part of adapting is arithmetic. The harder part is identity: the paywall's state survives recreation because it lives in a `ViewModel`, and the one reset we found came from two identical color schemes that weren't equal. That part only shows up when you test it.
