Originally published on Medium:
https://medium.com/@supsabhi/beyond-one-size-fits-all-a-beginners-guide-to-jetpack-windowmanager-1-5-0-fc42532542dc?sharedUserId=supsabhi
In the early days of Android, it was only designed for a phone and maybe if an app was required to run on a tablet, then you would tweak a few things for a tablet. Fast forward to 2026, Android screens are no longer simple rectangles; the landscape has changed. Today we have foldables that turn into mini-tablets, dual-screen devices, resizable app windows, and desktop-style windowing on tablets. For apps to look great everywhere, they must adapt. That’s where Jetpack WindowManager comes in.
Jetpack WindowManager is the Jetpack library that helps your app understand “what kind of window am I running in?” It’s a Jetpack library that:
Detects folds, hinges, and postures on foldables
Computes window size & metrics
Helps your UI adapt to multi-window and multi-screen environments
While the system knows the screen size, WindowManager tells you about the Window size — which is what actually matters when your app is in split-screen or running on a foldable.
For Compose apps this means you can:
Show a single-pane layout on phones, two-pane on tablets, and more complex layouts on big monitors.
React when the user resizes a window in desktop mode or rotates the device.
Handle foldables (e.g., put content on each side of the hinge).
In simple terms: WindowManager gives your app “eyes” to understand the screen layout and how it changes.
What’s New in Version 1.5.0?
The latest 1.5.0 stable release (October 2025) is a big deal because it officially recognizes that “Large” isn’t big enough anymore and it makes the library stable. At a high level, 1.5.0 focuses on better breakpoints, better activity embedding, and more flexible metrics APIs.
Key Changes
- Large & Extra-Large Window Size Classes Before, size classes were roughly Compact / Medium / Expanded. But on desktops and ultra-large screens, even Expanded feels too small — you can fit much more UI. So 1.5.0 adds:
- Large: widths ~1200dp to 1600dp
- Extra-large: widths ≥1600dp This means you can now design layouts that take full advantage of truly big screens.
Application Context Support Previously, you needed an Activity to calculate window metrics. Now, you can do it from the Application context, making it much more flexible for background logic.
Auto-Save for Activity Embedding If you use “Activity Embedding” (showing two activities side-by-side), the library now automatically remembers your split state even if the app process is killed and restarted.
Better WindowMetrics Support You can calculate window metrics even from the application context, which makes it easier to measure screen/window sizes outside of activities.
Easier WindowLayoutInfo Access A direct getter makes accessing layout info smoother and more idiomatic.
WindowManager + Jetpack Compose: Real Example
Let’s see the basic setup for the demo app which will demonstrate the usage of WindowManager.
Add the dependencies In your build.gradle.kts (module):
dependencies {
implementation("androidx.window:window:1.5.0") // Core WindowManager
implementation("androidx.compose.material3:material3:1.3.0") // Example compose version
implementation("androidx.compose.ui:ui:1.7.0")
}
(Use the latest Compose versions that match your project; the important part is androidx.window🪟1.5.0.)
The rest of the code I have uploaded on GitHub. Please find it on: https://github.com/supsabhi/Windows-Manager-Demo.git
Jetpack WindowManager vs WindowSizeClass
WindowSizeClass (and its newer adaptive cousins) and WindowManager are related but they sit at different abstraction levels. WindowManager is the low-level source of window information; WindowSizeClass is a friendly, opinionated wrapper that gives you named buckets like compact / medium / expanded.
WindowManager:
- Library: androidx.window:window.
- Provides raw window metrics, folding features, posture, and activity embedding APIs.
- You can define any breakpoints and behavior you want, including the new large / extra-large ranges.
WindowSizeClass / Adaptive APIs:
- Built on top of WindowManager’s metrics and breakpoints logic.
- Maps width/height into semantic classes (compact, medium, expanded, large, extra-large) aligned with Material Design guidance.
- Provides helpers like calculateWindowAdaptiveInfo and components like NavigationSuite that auto-adapt.
Final Takeaway
Jetpack WindowManager lets your app:
- Understand how the screen is shaped
- Adapt UI across phones, foldables, tablets, and now large/extra-large screens
- Work even better with Compose thanks to the latest 1.5.0 updates
By using the 1.5.0 updates, you’re future-proofing your app for the next generation of massive “Pro” tablets and desktop-modded Android devices.
Top comments (0)