Jetpack WindowManager 1.4: Adaptive App Development Just Got Better ??
Rahul Pahuja
Staff Software Engineer @ CyberArk | Expertise in Android , iOS Development | MVC | MVVM | Java | Kotlin | Swift | Unit Testing | Automation Testing using Python and Appium | Bits Pilani Alum
Jetpack WindowManager continues to evolve, making it easier than ever to build adaptive Android apps for foldables, tablets, and large screens. With version 1.4 (now stable!), Google has introduced powerful new features that enhance multi-window experiences, activity embedding, and UI flexibility. If you're working on multi-activity apps or looking to optimize for foldables, this update is a game-changer!
?? Key Updates in WindowManager 1.4
?? Custom Window Size Classes
The WindowSizeClass API now supports custom breakpoints, making it easier to fine-tune layouts. ? Define your own minWidthDp and minHeightDp values ? New convenience methods for checking breakpoints ? Deprecated old width/height size classes in favor of isWidthAtLeastBreakpoint()
?? Activity Stack Pinning
Ever wanted to keep an activity stack always visible—like a floating chat window or a pinned video? Activity stack pinning lets you do just that! Apps can now keep activities anchored to a specific window, ensuring a seamless user experience.
private fun pinActivityStackExample(taskId: Int) {
val splitAttributes = SplitAttributes.Builder()
.setSplitType(SplitAttributes.SplitType.ratio(0.66f))
.setLayoutDirection(SplitAttributes.LayoutDirection.LEFT_TO_RIGHT)
.build()
val pinSplitRule = SplitPinRule.Builder()
.setDefaultSplitAttributes(splitAttributes)
.build()
SplitController.getInstance(applicationContext).pinTopActivityStack(taskId, pinSplitRule)
}
??? Pane Expansion & Interactive Dividers
Users can now resize split-screen activities dynamically, thanks to the interactive divider. This makes multi-pane layouts more flexible—especially useful for productivity apps.
splitAttributesBuilder.setDividerAttributes(
DividerAttributes.DraggableDividerAttributes.Builder()
.setColor(getColor(context, R.color.divider_color))
.setWidthDp(4)
.setDragRange(DividerAttributes.DragRange.DRAG_RANGE_SYSTEM_DEFAULT)
.build()
)
?? Dialog Full-Screen Dim
Dialogs can now dim either the entire screen or just the parent container, providing better UX control. Temu, one of the early adopters, reported a 5% reduction in invalid screen touches after implementing this feature!
EmbeddingConfiguration.DimAreaBehavior.ON_ACTIVITY_STACK
?? Foldable Posture Support
For foldables and dual-screen devices, the WindowInfoTracker#supportedPostures API allows apps to detect tabletop mode, ensuring an optimized experience.
val supportedPostures = WindowInfoTracker.getOrCreate(LocalContext.current).supportedPostures
?? Other Notable API Updates
? ActivityEmbeddingController#getActivityStack ? SplitAttributes.Builder#setAnimationParams ? ActivityEmbeddingController#finishActivityStack
?? Get Started with WindowManager 1.4
To upgrade, simply update your dependencies:
dependencies {
implementation("androidx.window:window:1.4.0")
testImplementation("androidx.window:window-testing:1.4.0")
}
Why This Matters WindowManager 1.4 is all about enhanced flexibility, better UX, and optimizing for foldables. If you’re building multi-window or adaptive UI experiences, now is the time to explore these powerful new capabilities!
?? What do you think about these updates? Have you started integrating them into your apps? Let’s discuss in the comments! ??
#Android #Jetpack #WindowManager #MobileDevelopment #Foldables