Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
October 16, 2024 | 1.3.0 | - | - | 1.4.0-alpha05 |
Declaring dependencies
To add a dependency on WindowManager, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Add the dependencies for the artifacts you need in the build.gradle
file for
your app or module:
Groovy
dependencies { implementation "androidx.window:window:1.3.0" // For Java-friendly APIs to register and unregister callbacks implementation "androidx.window:window-java:1.3.0" // For RxJava2 integration implementation "androidx.window:window-rxjava2:1.3.0" // For RxJava3 integration implementation "androidx.window:window-rxjava3:1.3.0" // For testing implementation "androidx.window:window-testing:1.3.0" }
Kotlin
dependencies { implementation("androidx.window:window:1.3.0") // For Java-friendly APIs to register and unregister callbacks implementation("androidx.window:window-java:1.3.0") // For RxJava2 integration implementation("androidx.window:window-rxjava2:1.3.0") // For RxJava3 integration implementation("androidx.window:window-rxjava3:1.3.0") // For testing implementation("androidx.window:window-testing:1.3.0") }
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
Version 1.4
Version 1.4.0-alpha05
October 16, 2024
androidx.window:window-*:1.4.0-alpha05
is released. Version 1.4.0-alpha05 contains these commits.
New Features
- Add convenience functions to get the
widthDp
andheightDp
fromWindowMetrics
.
API Changes
- Add
widthDp
andheightDp
toWindowMetrics
. (Ide026) - Remove experimental
WindowInsets
API. (I68a71) - Update bounds check method names to
isAtLeast
(Ib0ab7)
Version 1.4.0-alpha04
October 2, 2024
androidx.window:window-*:1.4.0-alpha04
is released. Version 1.4.0-alpha04 contains these commits.
API Changes
- Added a method to compute the
WindowSizeClass
fromWindowMetrics
. (874dba) - Change the
WindowSizeClass
methods tocontainsWidthDp
,containsHeightDp
, andcontainsWindowSizeDp
for clarity. (fa760d) - Convert
WindowAreaController
to abstract base class. (I90893)
Bug Fixes
- Add support for relative bounds when creating a test
FoldingFeature
. (2e6b3e) - General bug fixes when selecting a
WindowSizeClass
.
Version 1.4.0-alpha03
September 18, 2024
androidx.window:window-*:1.4.0-alpha03
is released. Version 1.4.0-alpha03 contains these commits.
New Features
- Add a utility method to get a
WindowSizeClass
fromWindowMetrics
. (I83f1f) - Rename
isAtLeast
tocontainsBreakpoint
. (I85b47) - Add overload to
computeWindowSizeClass
using floats. (I3dcb2, b/364677934, b/364677802, b/364680886)
Bug Fixes
- Add missing breakpoints to the default
WindowSizeClass
breakpoint set. - Fixed a bug where compact dimensions were not being selected correctly in some cases.
Version 1.4.0-alpha02
September 4, 2024
androidx.window:window-*:1.4.0-alpha02
is released. Version 1.4.0-alpha02 contains these commits.
New Features
Add support for custom WindowSizeClass
.
- Open the constructor for
WindowSizeClass
so devs can use their own. - Add
isAtLeast
utility methods so that developers can process a range ofWindowSizeClass
values. - Add an extension function on
Set<WindowSizeClass>
to compute the best match from the Set. - Add constants for the Android recommended breakpoints.
- Add the breakpoint set corresponding to the Android recommended breakpoints.
API Changes
- Update bounds method names for
WindowSizeClass
. (If89a6) - Update the
WindowSizeClass
API to support adding new breakpoint values in the future. Instead of having absolute bounds we use the lower bounds and recommend devs use lower bound checks when processing aWindowSizeClass
. The existingWindowWidthSizeClass
andWindowHeightSizeClass
will be deprecated as they will not be developed further. (I014ce)
Version 1.4.0-alpha01
August 7, 2024
androidx.window:window-*:1.4.0-alpha01
is released. Version 1.4.0-alpha01 contains these commits.
New Features
- ActivityStack Pinning allows apps to pin the content in one container and have its navigation isolated from the other container.
- Interactive Divider allows apps to display a fixed or draggable divider between the two activities in a split presentation.
- Fullscreen Dialog Dimming allows apps to specify the dialog dim area, to either dim the entire task window or only dim the container that shows the dialog.
- Embedded Activity Window Info Callback allows apps to continuously receive updates of the embedded activity window.
- Embedding Animation Background allows apps to specify the animation background, improving the transition animation quality when
ActivityEmbedding
is used. - Improved ActivityStack Management allows apps to have more control over the
ActivityStacks
whenActivityEmbedding
is used, including: - Launching an activity into a specified
ActivityStack
- Finishing an
ActivityStack
API Changes
A new API
WindowInfoTracker#supportedPostures
:- An API to determine if the device supports TableTop mode for foldables. Adds WindowAreaSessionPresenter#getWindow
Add APIs to support
ActivityStack
pinning:SplitPinRule
classSplitController#pinTopActivityStack
SplitController#unpinTopActivityStack
Add APIs to enable and configure the interactive divider
DividerAttributes
classSplitAttributes.Builder#setDividerAttributes
Add APIs to set
EmbeddingConfiguration
andDimAreaBehavior
for dialogsEmbeddingConfiguration
classDimAreaBehavior
classActivityEmbeddingController#setEmbeddingConfiguration
Add APIs to receive embedded activity window info updates
EmbeddedActivityWindowInfo
classActivityEmbeddingController#embeddedActivityWindowInfo
Add APIs to set embedding animation background
EmbeddingAnimationBackground
SplitAttributes.Builder#setAnimationBackground
Add APIs to finish
ActivityStacks
ActivityEmbeddingController#finishActivityStacks
Add APIs to set launching
ActivityStack
ActivityEmbeddingOptions#setLaunchingActivityStack
The following APIs are stable and no longer experimental:
ActivityEmbeddingController#invalidateVisibleActivityStacks
(moved from SplitController#invalidateTopVisibleSplitAttributes)ActivityEmbeddingController#getActivityStack
SplitController#updateSplitAttributes
Add APIs for 1.4. (I56774)
Bug Fixes
- Fixes bug on certain devices where UNAVAILABLE would be returned instead of ACTIVE when a session is active.
- Removes support for
transferActivityToWindowArea
on devices with avendorApiLevel
of 2 due to unstable API support. - Introduce API to enable drag-to-fullscreen for Activity Embedding draggable divider. (I645c9)
- Allow apps to disable
ActivityEmbedding
animations via animation params forSplitAttributes
. (Idc01a) - Removed manual outlining of access to new platform APIs since this happens automatically via API modeling when using R8 with AGP 7.3 or later (e.g. R8 version 3.3) and for all builds when using AGP 8.1 or later (e.g. D8 version 8.1). Clients who are not using AGP are advised to update to D8 version 8.1 or later. See this article for more details. (Ia60e0, b/345472586)
- Allow extensions to take animation params for
SplitAttributes
so that the device can use it for animation transitions. (Iede00) - Hide overlay APIs (Ic4251)
- Introduce APIs to configure the fixed or draggable divider for the split (Ia7a78)
- Added density to
WindowMetrics
(Id6723) - Add API to get the
SupportedPostures
. (If557a) - Remove
setLaunchingActivityStack
from experimental API (I191cf) - Introduce
ActivityEmbeddingController#embeddedActivityWindowInfo
(I24312) - Deprecate
#getToken
and add#getActivityStackToken
(Ie0471) - Introduce callback adapter for
embeddedActivityWindowInfo
flow API (Ida77f) - Add callback adapter for overlayInfo flow API (I7264f)
- Introduce
WindowSdkExtensionsRule
to overrideextensionsVersion
for testing. (Ifb928) - - Migrate
#setLaunchingActivityStack
to Bundle to compat withActivityOptionsCompat
usages.- Users should pass
activityOptions.toBundle
instead ofActvityOptions
itself. - Remove
#setLaunchingActivityStack(Activity)
. Users should migrate to useActivityEmbeddingController#getActivityStac(Activity)
to get anActivityStack
, and pass theActivityStack
to#setLaunchingActivityStack
. (Ie0ccc)
- Users should pass
- - Introduce
ActivityStack.Token
andSpltInfo.Token
as an identifier to communicate between WM Jetpack and extensions.- Deprecate/Replace APIs to take/return Token instead of IBinder. (I12b24)
- - Introduce
ActivityEmbeddingController#invalidateVisibleActivityStacks
- Remove
SplitController#invalidateTopVisibleSplitAttributes
because the feature is consolidate to#invalidateVisibleActivityStacks
(I02ef5)
- Remove
- - Adding API to set embedding configuration. (I59a4a)
- - Adding pin/unpin top
ActivityStack
androidx.Window
APIs- Updating demo app to allow pin/unpin top
ActivityStack
(I24dd3)
- Updating demo app to allow pin/unpin top
- Re-add
#finishActivityStacks
andActivityEmbeddingOptions
(Ic1ab3) - Remove unstable APIs. (Ibc534, b/302380585)
Version 1.3
Version 1.3.0
May 29, 2024
androidx.window:window-*:1.3.0
is released. Version 1.3.0 contains these commits.
Important changes since 1.2.0
- Kotlin Multiplatform support for Window Size Classes.
Version 1.3.0-rc01
May 14, 2024
WindowManager
Jetpack 1.3 brings Kotlin Multiplatform support for WindowSizeClass
features as well as multiple bug fixes.
androidx.window:window-*:1.3.0-rc01
is released. Version 1.3.0-rc01 contains these commits.
Version 1.3.0-beta02
May 1, 2024
androidx.window:window-*:1.3.0-beta02
is released. Version 1.3.0-beta02 contains these commits.
API Changes
- Remove support for creating and using custom
WindowSizeClass
's. (Id1143)
Bug Fixes
- Fixes
KotlinReflectionInternalError
caused by proguard stripping out some files on certain device implementations. (I01b02)
Version 1.3.0-beta01
April 3, 2024
androidx.window:window-*:1.3.0-beta01
is released. Version 1.3.0-beta01 contains these commits.
Version 1.3.0-alpha03
March 6, 2024
androidx.window:window-*:1.3.0-alpha03
is released. Version 1.3.0-alpha03 contains these commits.
API Changes
- Split
WindowSizeClassUtil
into more focused methods. (Ie9292) - Restore
WindowSizeClass#compute
(I21355, b/324293374)
Bug Fixes
- Fixes crash where the context provided wasn't being unwrapped correctly. (94d10ce , b/318787482)
Version 1.3.0-alpha02
February 7, 2024
androidx.window:window-*:1.3.0-alpha02
is released. Version 1.3.0-alpha02 contains these commits.
New Features
- Updates made to the API surface of the Window Size Class API's to improve flexibility for developers who want to use their own size classes.
API Changes
- Add height constraints to the width selector. (I23393)
- Add utility functions for picking a
WindowSizeClass
from a set. Add experimental scoring functions so developers can write their own selectors. Add a selector extension function to pick the widestWindowSizeClass
within a given bound. (I0c944) - Open the
WindowSizeClass
constructor so custom breakpoints can be added. (Ic1ff3) - Add convenience function to create size class from width, height, and density. (If67f4)
Bug Fixes
- Fix exception when float value is truncated to 0. (272ffac)
Version 1.3.0-alpha01
November 15, 2023
androidx.window:window-*:1.3.0-alpha01
is released. Version 1.3.0-alpha01 contains these commits.
New Features
- Expose experimental window APIs for accessing the rear screen.
- Test APIs for creating a
FoldingFeature
is now stable. - Test APIs for setting up fake
ActivityEmbedding
values are now stable. WindowLayoutInfoPublisherRule
now reports the override when obtaining a value from aUiContext
.WindowInfoTracker
reports folding feature data toUiContext
parameters.- Expose the Extensions Version on the device.
WindowProperties
constants for user per-app overrides:PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_OVERRIDE
— Informs the system the app has opted out of the user-facing aspect ratio compatibility override.PROPERTY_COMPAT_ALLOW_USER_ASPECT_RATIO_FULLSCREEN_OVERRIDE
— Informs the system the app has opted out of the full-screen option of the user aspect ratio compatibility override settings
Version 1.2
Version 1.2.0
November 15, 2023
androidx.window:window-*:1.2.0
is released. Version 1.2.0 contains these commits.
Important changes since 1.1.0
- Expose experimental window APIs for accessing the rear screen.
- Test APIs for creating a
FoldingFeature
is now stable. - Test APIs for setting up fake
ActivityEmbedding
values are now stable. WindowLayoutInfoPublisherRule
now reports the override when obtaining a value from aUiContext
.WindowInfoTracker
reports folding feature data toUiContext
parameters.- Expose the Extensions Version on the device.
Version 1.2.0-rc01
November 1, 2023
androidx.window:window-*:1.2.0-rc01
is released. Version 1.2.0-rc01 contains these commits.
New Features
- Expose experimental window APIs for accessing the rear screen.
- Test APIs for creating a
FoldingFeature
is now stable. - Test APIs for setting up fake
ActivityEmbedding
values are now stable. WindowLayoutInfoPublisherRule
now reports the override when obtaining a value from aUiContext
.WindowInfoTracker
reports folding feature data toUiContext
parameters.- Expose the Extensions Version on the device.
Version 1.2.0-beta04
October 18, 2023
androidx.window:window-*:1.2.0-beta04
is released. Version 1.2.0-beta04 contains these commits.
API Changes
- Remove unstable APIs. (Ibc534, b/302380585)
Version 1.2.0-beta03
September 20, 2023
androidx.window:window-*:1.2.0-beta03
is released. Version 1.2.0-beta03 contains these commits.
New Features
- Add
RequiresApi
checks for APIs that need a specific version of extensions to function correctly. - Add an API to expose the extensions version on the device.
API Changes
- Annotate required window SDK extension version on public APIs.
- Remove
isXXXSupported
in the Activity Embedding component. (Ie3dae)
- Remove
- Introduce
WindowSdkExtensions
to report the extension version on the device.- Introduce
RequiresWindowSdkExtension
to annotate the minimum required extension version. (I05fd4)
- Introduce
- Makes
WindowAreaInfo#getCapability
non-nullable. (I17048)
Version 1.2.0-beta01
July 26, 2023
androidx.window:window-*:1.2.0-beta01
is released. Version 1.2.0-beta01 contains these commits.
New Features
- Expose experimental window APIs for accessing the rear screen.
- Test APIs for creating a
FoldingFeature
is now stable. - Test APIs for setting up fake
ActivityEmbedding
values are now stable. WindowLayoutInfoPublisherRule
now reports the override when obtaining a value from aUiContext
.WindowInfoTracker
reports folding feature data toUiContext
parameters.
API Changes
- Marks
WindowArea
API's as experimental to allow API changes to continue for a stable release in 1.3 (I857f5) - Updated API files to annotate compatibility suppression (I8e87a, b/287516207)
Version 1.2.0-alpha03
June 21, 2023
androidx.window:window-*:1.2.0-alpha03
is released. Version 1.2.0-alpha03 contains these commits.
New Features
- Removing deprecated APIs from the API surface.
- Add APIs to support concurrent displays.
- Add a property to opt out of forced resize override.
- Add property to opt out of min aspect ratio override.
- Stabilize
ActivityEmbeddingRule
to support unit testing around Activity Embedding.
API Changes
Bug Fixes
- Adding opt-out compat property for force resize override (Ie7ab1)
- Removes
SESSION_STATE_CONTENT_INVISIBLE
from extensions interface. (I6ed19) - Stabilize
ActivityEmbeddingRule
to support unit testing around Activity embedding. (I8d6b6) - Adding opt-out compat property for min aspect ratio override. (I66390)
- Removes deprecated WindowArea API's (Ieb67c)
- Rename orientation request loop property to
PROPERTY_COMPAT_ALLOW_IGNORING_ORIENTATION_REQUEST_WHEN_LOOP_DETECTED
. (Ie2fbd) - Updates window area session constant names (I83675)
- Adding opt-out compat property that ignores orientation request loop when detected (I0a7a2)
- Add
WindowAreaComponent#STATUS_ACTIVE
to signify that the feature is already active. (I62bc3) - Add
RearDisplayPresentationMode
APIs (I0401c) - Remove background color API for stable. (I34c3e)
- Hide Window Area APIs. (I39de0)
- Add methods to override the
SplitInfo
inSplitController
. Add test methods to create double forSplitInfo
andActivityStack
. (Icd69f) - Make tag optional for
ActivityRule.Builder
. (Ib0b44) - Remove
RatioSplitType
,ExpandContainersSplit
andHingeSplitType
. They areSplitType
now.- Replace
#splitEqually()
,#expandContainers()
and#splitByHinge
to constantSplitType SPLIT_TYPE_EQUAL
,SPLIT_TYPE_EXPAND
andSPLIT_TYPE_HINGE
- Remove the functionality to set fallback type of hinge split type. If the hinge split type cannot be applied due to the current device or window state, it fallbacks to split the parent task container equally. Use
SplitController#setSplitAttributesCalculator
to customize the fallback split type. (Ifcc59)
- Replace
- Deprecate
add
/removeSplitCallback
- Move
add
/removeSplitCallback
toSplitControllerCallbackAdapter
- Add
Flow
support to getSplitInfo
list (I7f1b6)
- Move
- Add a test rule for
ActivityEmbeddingController
(I42e9b) - Renaming
ActivityOptionsCompat
toActivityEmbeddingOptions
(I89301) - Add
splitSupportStatus
to indicate if Activity embedding is available. (I10024) - Introduce
SplitAttributes.BackgroundColor
to better represent theDEFAULT
value. Clarify that non-opaque animation background color is not supported, so any non-opaque colors will be treated as the default, which means to use the current theme window background color. (Ic6b95) - Replace
alwaysAllow()
andalwaysDisallow()
withALWAYS_ALLOW
andALWAYS_DISALLOW
. (I3057b) - Add APIs for
SplitRule
,SplitAttributes
,SplitAttributesCalculator
. (I92d23) - Add
TestActivityStack
to createActivityStack
for testing- Add
TestSplitInfo
to createSplitInfo
for testing. (I8e779)
- Add
- Add a way to create fake
SplitAttributesCalculatorParams
so that developers can verify their customizedSplitAttributesCalculator
(Id4a6e) - Add
WindowMetricsCalculator#computeCurrentWindowMetrics(@UiContext context: Context)
andWindowMetricsCalculator#computeMaximumWindowMetrics(@UiContext context: Context)
(I66c7f)
Version 1.2.0-alpha02
June 7, 2023
androidx.window:window-*:1.2.0-alpha02
is released. Version 1.2.0-alpha02 contains these commits.
New Features
- Update test API to have a constant for unspecified folding features.
- Overriding with
WindowLayoutInfoPublishRule
will override all values ofwindowLayoutInfo
, including the Context based API.
API Changes
- Add constant for unspecified center folding feature. (I7530c)
Bug Fixes
- Update
WindowLayoutInfoPublishRule
to support overrides onContext
basedWindowLayoutInfo
. (I2037a)
Version 1.2.0-alpha01
May 24, 2023
androidx.window:window-*:1.2.0-alpha01
is released. Version 1.2.0-alpha01 contains these commits.
New Features
Stabilize testing APIs around Activity Embedding and WindowLayoutInfoTracker
. ActivityEmbeddingRule
has been promoted to stable.
WindowMetricsCalculatorRule
has been promoted to stable.
Utility functions to create a FoldingFeature
for test have been promoted to stable.
API Changes
- Stabilize
ActivityEmbeddingRule
to support unit testing around Activity embedding. (I8d6b6) WindowMetrisCalculatorTestRule
is stable allowing stub metrics for JVM tests. We recommend using an emulator for accurate results.- Stabilize test APIs for
WindowLayoutInfo
to support JVM testing. (Ie036e) - Add
IntRange
for test folding feature values. (I69f7d)
Version 1.1
Version 1.1.0
June 7, 2023
androidx.window:window-*:1.1.0
is released. Version 1.1.0 contains these commits.
Important changes since 1.0.0
Activity Embedding
- Added
PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED
as a boolean property of the<application>
tag in the app manifest. - Deprecated
isSplitSupported
and replaced withsplitSupportStatus
to provide more detailed information about why the split feature is not available. - Added the
SplitController.SplitSupportStatus
nested class to provide state constants for thesplitSupportStatus
property. - Refactored
SplitController
to several modules:ActivityEmbeddingController
module forActivity
orActivityStack
related APIs.- Moved
isActivityEmbedded
fromSplitController
toActivityEmbeddingController
. RuleController
module forEmbeddingRule
related operations:- Removed
SplitController
APIs: clearRegisteredRules()
getSplitRules()
initialize()
registerRule()
unregisterRule()
- Added
RuleController
APIs: addRule()
— Adds a rule or updates the rule that has the same tag.removeRule()
— Removes a rule from the collection of registered rules.setRules()
— Establishes a collection of rules.clearRules()
— Removes all registered rules.parseRules()
— Parses rules from XML rule definitions.
- All modules require a context to be initialized by
#getInstance()
method, including:ActivityEmbeddingController#getInstance(Context)
SplitController#getInstance(Context)
RuleController#getInstance(Context)
- Added the
EmbeddingAspectRatio
class to define enum-like behavior constants related to display aspect ratio. - Added the
SplitAttributes
class to define the split layout. - Added
SplitAttributes
calculator functions toSplitController
to customize split layouts:setSplitAttributesCalculator(Function)
clearSplitAttributesCalculator()
isSplitAttributesCalculatorSupported()
to check if theSplitAttributesCalculator
APIs are supported on the device
- Added
EmbeddingRule#tag
field. - API updates in
SplitRule
:- Added
defaultSplitAttributes
— Defines the default split layout of a split; replacessplitRatio
andlayoutDirection
. - Added translation of the XML properties
splitRatio
andsplitLayoutDirection
todefaultSplitAttributes
. - Changed minimum dimension definitions to use density-independent pixels (dp) instead of pixels.
- Added
minHeightDp
with default value 600dp. - Changed
minWidth
tominWidthDp
with default value 600dp. - Changed
minSmallestWidth
tominSmallestWidthDp
with default value 600dp. - Added
maxAspectRatioInHorizontal
with default valueALWAYS_ALLOW
. - Added
maxAspectRatioInPortrait
with default value 1.4. - Defined
FinishBehavior
nested class to replace finish behavior constants. - Applied the property changes to the Builder nested class of
SplitPairRule
andSplitPlaceholderRule
.
- Added
- Replaced
SplitInfo#getSplitRatio()
withSplitInfo#getSplitAttributes()
to provide additional split-related information.
WindowLayout
- Added experimental non-activity UI context support to
WindowInfoTracker
. - Added experimental non-activity UI context to
WindowMetricsCalculator
.
Migration Steps
- To enable activity embedding to display activities in splits, apps must add the
PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED
property to the manifest<application>
tag:xml <property android:name="android.window.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED" android:value="true" />
This allows the system to optimize the split behaviors for an application ahead of time. SplitInfo
ratio- Check if the current split is stacked:
kotlin SplitInfo.splitAttributes.splitType is SplitAttributes.SplitType.ExpandContainersSplitType
- Check the current ratio:
kotlin if (SplitInfo.splitAttributes.splitType is SplitAttributes.SplitType.RatioSplitType) { val ratio = splitInfo.splitAttributes.splitType.ratio } else { // Ratio is meaningless for other types. }
- Check if the current split is stacked:
- SplitController migrations:
SplitController.getInstance()
changes toSplitController.getInstance(Context)
.SplitController.initialize(Context, @ResId int)
changes toRuleController.getInstance(Context).setRules(RuleController.parse(Context, @ResId int))
.SplitController.getInstance().isActivityEmbedded(Activity)
changes toActivityEmbeddingController.getInstance(Context).isActivityEmbedded(Activity)
.SplitController.getInstance().registerRule(rule)
changes toRuleController.getInstance(Context).addRule(rule)
.SplitController.getInstance().unregisterRule(rule)
changes toRuleController.getInstance(Context).removeRule(rule)
.SplitController.getInstance().clearRegisteredRules()
changes toRuleController.getInstance(Context).clearRules()
.SplitController.getInstance().getSplitRules()
changes toRuleController.getInstance(Context).getRules()
.
SplitRule
property migrations:minWidth
andminSmallestWidth
now use dp units instead of pixels. Apps can use the following call:kotlin TypedValue.applyDimension( COMPLEX_UNIT_DIP, minWidthInPixels, resources.displayMetrics )
or simply divideminWith
in pixels bydisplayMetrics#density
.
- Finish behavior constants must be migrated to
FinishBehavior
enum-like class constants:FINISH_NEVER
changes toFinishBehavior.NEVER
.FINISH_ALWAYS
changes toFinishBehavior.ALWAYS
.FINISH_ADJACENT
changes toFinishBehavior.ADJACENT
.
- Layout direction must be migrated to
SplitAttributes.LayoutDirection
:ltr
changes toSplitAttributes.LayoutDirection.LEFT_TO_RIGHT
.rtl
changes toSplitAttributes.LayoutDirection.RIGHT_TO_LEFT
.locale
changes toSplitAttributes.LayoutDirection.LOCALE
.splitRatio
must be migrated toSplitAttributes.SplitType.ratio(splitRatio)
.
SplitPairRule.Builder
migrations:SplitPairRule.Builder(filters, minWidth, minSmallestWidth)
changes tokotlin SplitPairRule.Builder(filters) .setMinWidthDp(minWidthInDp) // Optional if minWidthInDp is 600. .setMinSmallestWidthDp(minSmallestWidthDp) // Optional if minSmallestWidthInDp is 600.
setLayoutDirection(layoutDirection)
andsetSplitRatio(ratio)
changes tokotlin setDefaultSplitAttributes( SplitAttributes.Builder() .setLayoutDirection(layoutDirection) .setSplitType(SplitAttributes.SplitType.ratio(ratio)) .build() )
setFinishPrimaryWithSecondary
andsetFinishSecondaryWithPrimary
take theFinishBehavior
enum-like constants. See “SplitRule migrations” for details.- Use
setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
to show splits on portrait devices.
SplitPlaceholder.Builder
migrations:- Has only
filters
andplaceholderIntent
parameters. Other properties move to setters. See “SplitPairRule.Builder migrations” for details. setFinishPrimaryWithPlaceholder
takes theFinishBehavior
enum-like constants. See “SplitRule migrations” for details.setLayoutDirection(layoutDirection)
andsetSplitRatio(ratio)
change to:kotlin setDefaultSplitAttributes( SplitAttributes.Builder() .setLayoutDirection(layoutDirection) .setSplitType(SplitAttributes.SplitType.ratio(ratio)) .build() )
- Use
setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
to show splits on portrait devices.
- Has only
Version 1.1.0-rc01
May 10, 2023
androidx.window:window-*:1.1.0-rc01
is released. Version 1.1.0-rc01 contains these commits.
New Features
- Release
ActivityEmbedding
as a stable API. - Various bug fixes.
Version 1.1.0-beta02
April 5, 2023
androidx.window:window-*:1.1.0-beta02
is released. Version 1.1.0-beta02 contains these commits.
New Features
- Internal fixes and clean up.
Version 1.1.0-beta01
March 22, 2023
androidx.window:window-*:1.1.0-beta01
is released. Version 1.1.0-beta01 contains these commits.
Activity Embedding
- Added
PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED
as a boolean property of the<application>
tag in the app manifest. - Deprecated
isSplitSupported
and replaced withsplitSupportStatus
to provide more detailed information about why the split feature is not available. - Added the
SplitController.SplitSupportStatus
nested class to provide state constants for thesplitSupportStatus
property. - Refactored
SplitController
to several modules:ActivityEmbeddingController
module forActivity
orActivityStack
related APIs.- Moved
isActivityEmbedded
fromSplitController
toActivityEmbeddingController
. RuleController
module forEmbeddingRule
related operations:- Removed
SplitController
APIs:clearRegisteredRules()
getSplitRules()
initialize()
registerRule()
unregisterRule()
- Added
RuleController
APIs:addRule()
— Adds a rule or updates the rule that has the same tag.removeRule()
— Removes a rule from the collection of registered rules.setRules()
— Establishes a collection of rules.clearRules()
— Removes all registered rules.- `parseRules() — Parses rules from XML rule definitions.
- All modules require a context to be initialized by
#getInstance()
method, including:ActivityEmbeddingController#getInstance(Context)
SplitController#getInstance(Context)
RuleController#getInstance(Context)
- Added the
EmbeddingAspectRatio
class to define enum-like behavior constants related to display aspect ratio. - Added the
SplitAttributes
class to define the split layout. - Added
SplitAttributes
calculator functions toSplitController
to customize split layouts:setSplitAttributesCalculator(Function)
clearSplitAttributesCalculator()
isSplitAttributesCalculatorSupported()
to check if the SplitAttributesCalculator APIs are supported on the device
- Added
EmbeddingRule#tag
field. - API updates in
SplitRule
:- Added
defaultSplitAttributes
— Defines the default split layout of a split; replacessplitRatio
andlayoutDirection
. - Added translation of the XML properties
splitRatio
andsplitLayoutDirection
todefaultSplitAttributes
. - Changed minimum dimension definitions to use density-independent pixels (dp) instead of pixels.
- Added
minHeightDp
with default value 600dp. - Changed
minWidth
tominWidthDp
with default value 600dp. - Changed
minSmallestWidth
tominSmallestWidthDp
with default value 600dp. - Added
maxAspectRatioInHorizontal
with default valueALWAYS_ALLOW
. - Added
maxAspectRatioInPortrait
with default value1.4
. - Defined
FinishBehavior
nested class to replace finish behavior constants. - Applied the property changes to the
Builder
nested class ofSplitPairRule
andSplitPlaceholderRule
.
- Added
- Replaced
SplitInfo#getSplitRatio()
withSplitInfo#getSplitAttributes()
to provide additional split-related information.
WindowLayout
- Added non-activity UI context support to
WindowInfoTracker
. - Added non-activity UI context to
WindowMetricsCalculator
.
Migration Steps
- To enable activity embedding to display activities in splits, apps must add the
PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED
property to the manifest<application>
tag:xml <property android:name="android.window.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED" android:value="true" />
This allows the system to optimize the split behaviors for an application ahead of time. SplitInfo
ratio- Check if the current split is stacked:
kotlin SplitInfo.splitAttributes.splitType is SplitAttributes.SplitType.ExpandContainersSplitType
- Check the current ratio:
kotlin if (SplitInfo.splitAttributes.splitType is SplitAttributes.SplitType.RatioSplitType) { val ratio = splitInfo.splitAttributes.splitType.ratio } else { // Ratio is meaningless for other types. }
- Check if the current split is stacked:
SplitController
migrations:SplitController.getInstance()
changes toSplitController.getInstance(Context)
.SplitController.initialize(Context, @ResId int)
changes toRuleController.getInstance(Context).setRules(RuleController.parse(Context, @ResId int))
.SplitController.getInstance().isActivityEmbedded(Activity)
changes toActivityEmbeddingController.getInstance(Context).isActivityEmbedded(Activity)
.SplitController.getInstance().registerRule(rule)
changes toRuleController.getInstance(Context).addRule(rule)
.SplitController.getInstance().unregisterRule(rule)
changes toRuleController.getInstance(Context).removeRule(rule)
.SplitController.getInstance().clearRegisteredRules()
changes toRuleController.getInstance(Context).clearRules()
.SplitController.getInstance().getSplitRules()
changes toRuleController.getInstance(Context).getRules()
.
SplitRule
property migrations:minWidth
andminSmallestWidth
now use dp units instead of pixels. Apps can use the following call:kotlin TypedValue.applyDimension( COMPLEX_UNIT_DIP, minWidthInPixels, resources.displayMetrics )
or simply divideminWith
in pixels bydisplayMetrics#density
.
- Finish behavior constants must be migrated to
FinishBehavior
enum-like class constants:FINISH_NEVER
changes toFinishBehavior.NEVER
.FINISH_ALWAYS
changes toFinishBehavior.ALWAYS
.FINISH_ADJACENT
changes toFinishBehavior.ADJACENT
.
- Layout direction must be migrated to
SplitAttributes.LayoutDirection
:ltr
changes toSplitAttributes.LayoutDirection.LEFT_TO_RIGHT
.rtl
changes toSplitAttributes.LayoutDirection.RIGHT_TO_LEFT
.locale
changes toSplitAttributes.LayoutDirection.LOCALE
.splitRatio
must be migrated toSplitAttributes.SplitType.ratio(splitRatio)
.
SplitPairRule.Builder
migrations:SplitPairRule.Builder(filters, minWidth, minSmallestWidth)
changes tokotlin SplitPairRule.Builder(filters) .setMinWidthDp(minWidthInDp) // Optional if minWidthInDp is 600. .setMinSmallestWidthDp(minSmallestWidthDp) // Optional if minSmallestWidthInDp is 600.
setLayoutDirection(layoutDirection)
andsetSplitRatio(ratio)
change tokotlin setDefaultSplitAttributes( SplitAttributes.Builder() .setLayoutDirection(layoutDirection) .setSplitType(SplitAttributes.SplitType.ratio(ratio)) .build() )
setFinishPrimaryWithSecondary
andsetFinishSecondaryWithPrimary
take theFinishBehavior
enum-like constants. See “SplitRule migrations” for details.- Use
setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
to show splits on portrait devices.
SplitPlaceholder.Builder
migrations:- Has only
filters
andplaceholderIntent
parameters. Other properties move to setters. See “SplitPairRule.Builder migrations” for details. setFinishPrimaryWithPlaceholder
takes theFinishBehavior
enum-like constants. See “SplitRule migrations” for details.setLayoutDirection(layoutDirection)
andsetSplitRatio(ratio)
change to:kotlin setDefaultSplitAttributes( SplitAttributes.Builder() .setLayoutDirection(layoutDirection) .setSplitType(SplitAttributes.SplitType.ratio(ratio)) .build() )
- Use
setMaxAspectRatioInPortrait(EmbeddingAspectRatio.ALWAYS_ALLOW)
to show splits on portrait devices.
- Has only
Version 1.1.0-alpha06
February 22, 2023
androidx.window:window-*:1.1.0-alpha06
is released. Version 1.1.0-alpha06 contains these commits.
New Features
- Expose experimental version of getting the
WindowLayoutInfo
from a UI context.
API Changes
- Add
splitSupportStatus
to indicate if Activity embedding is available. (I10024) - Make UI Context
WindowLayoutInfo
API as experimental. (I58ee0) - Introduces the
WindowAreaController
and API's to enableRearDisplay
Mode to move the current window to the display that is aligned with the rear camera. (Iffcbf) - Update default background color. (I1ac1b)
- Add
SplitAttributes
params. (I18bdd) - Add APIs for
SplitRule
,SplitAttributes
,SplitAttributesCalculator
. (I92d23) - Improve the APIs around
maxAspectRatio
:- Replace
alwaysAllow()
andalwaysDisallow()
withALWAYS_ALLOW
andALWAYS_DISALLOW
. - Update API documentation of @see with standalone documentation. (I3057b)
- Replace
- The following constructors are removed from public APIs because they are not supposed to be called by apps.
SplitInfo
constructorActivityStack
constructor (Ide534)
SplitRule
now takesmaxAspectRatioInPortrait/Landscape
. It only allows activities split when the aspect ratio of the parent bounds is smaller or equal to the requestedmaxAspectRatio
. (Ia5990)- Change
RuleController#parseRules
to be static (I785df) - Improve the APIs around ActivityEmbedding
- Align the API naming - Use add/remove for multiple instances:
registerRule
changes toaddRule
unregisterRule
changes toremoveRule
- Replace
getSplitRules
withgetRules
sinceActivityRule
is not a split rule - Add
RuleController#setRules
to set a bunch of rules - Extract rule related APIs from
SplitController
to singletonRuleController
. They are: addRule
removeRule
getRules
setRules
clearRules
parseRules
- Extract
#isActivityEmbedded
fromSplitController
to singletonActivityEmbeddingController
. They are: isActivityEmbedded
- Remove
SplitController#initialize
. To set rules from XML file, please useRuleController#parseRules
and#setRules
. Before this change:SplitController.initialize(context, R.xml.static_rules)
After this change:val ruleController = RuleController.getInstance(context) val rules = ruleController.parseRules(R.xml.static_rules) ruleController.setRules(rules)
- We don't distinguish static rules with runtime rules anymore. That said, calling
#clearRules
results to clear all rules no matter they are registered with static XML rule definitions or at runtime. To hav the legacy behavior ofSplitController#clearRegisteredRules
, please callRuleController#parseRules
with the XML resources id and callRuleController#setRules
to set back the rules again. Before this change:SplitController.getInstance(context).clearRegisteredRules()
After this change:val ruleController = RuleController.getInstance(context) val rules = ruleController.parseRules(R.xml.static_rules) ruleController.setRules(rules)
(Ib3967)
- Improve the SplitRule APIs:
- Take min dimensions in DP instead of pixels for
SplitRule
. - Refactor for
SplitRule
Builder to take min dimensions as optional. (I95f17)
- Take min dimensions in DP instead of pixels for
- Pass a Context to initialize
SplitController
(I42549) - Renamed
SplitRule#layoutDir
to#layoutDirection
andSplitRule Builder#setLayoutDir
toBuilder#setLayoutDirection
. (I3f6d1)
Version 1.1.0-alpha04
November 9, 2022
androidx.window:window-*:1.1.0-alpha04
is released. Version 1.1.0-alpha04 contains these commits.
New Features
- Expose a method to determine if an
ActivityStack
is empty forActivityEmbedding
. - Removed experimental API tags from
ActivityEmbedding
APIs. - Hide
ActivityRule
constructor as theBuilder
is the preferred way to construct. - Add an experimental method to get the
WindowInsets
onWindowMetrics
. - Update
SplitPlaceholderFinishBehavior
to prevent finishing the placeholder. Finishing the placeholder caused some confusing behavior.
API Changes
- Make val
isEmpty
public to replace funisEmpty
. - Rename
ActivityStack
parameter activities toactivitiesInProcess
. (Ia5055) - Remove
ActivityFilter#matchesClassName
andActivityFilter#matchesClassNameOrWildCard
because they are confusing. - Add
ActivityFilter#componentName
abdActivityFilter#intentAction
to allow the caller to distinguish different filters (I41f22) - Remove the
@Deprecated
APIs from the experimental API (I216b3) - Remove
@ExperimentalWindowApi
for Activity Embedding APIs (I69ebe) - Hide
ActivityRule
constructor, use Builder instead. (If4eb6) - Add APIs to check if an Activity is part of the
ActivityFilter
. (Ia43cf) - Update API files to reflect changes in
WindowMetrics
andWindowMetricsCalculatorCompat
classes (I667fe) - Update
ActivityEmbedding
Property Javadoc and class name (Ia1386) - Adding
ActivityEmbedding
property tag names to be used in AndroidManifest.xml (Id1ad4) - Added new API
SplitPlaceholderFinishBehavior
andSplitPlaceholderRule.finishPrimaryWithPlaceholder
, this replaces existingSplitPlaceholderRule.finishPrimaryWithSecondary
which defines when placeholder activites are finished, how associated activites in Activity Embedding should behave. (I64647)
Bug Fixes
- Introduces the
WindowAreaController
and API's to enableRearDisplay
Mode to move the current window to the display that is aligned with the rear camera. (I388ab)
Version 1.1.0-alpha03
July 27, 2022
androidx.window:window-*:1.1.0-alpha03
is released. Version 1.1.0-alpha03 contains these commits.
New Features
- Update the default values for embedding rules.
API Changes
- Update default values for embedding rule properties. (Ic4d35)
Version 1.1.0-alpha02
May 11, 2022
androidx.window:window-*:1.1.0-alpha02
is released. Version 1.1.0-alpha02 contains these commits.
New Features
- Release the adapter libraries to support Java and RxJava.
Version 1.1.0-alpha01
May 11, 2022
androidx.window:window-*:1.1.0-alpha01
is released. Version 1.1.0-alpha01 contains these commits.
New Features
- Release adapters to support java and RxJava
Version 1.1.0-alpha01
April 20, 2022
androidx.window:window:1.1.0-alpha01
is released. Version 1.1.0-alpha01 contains these commits.
New Features
- Fixes a bug where backgrounding an app stops emitting fold features.
- Expand on the experimental ActivityEmbedding API.
API Changes
- A public API to check if an activity is being embedded. (I39eb7)
Bug Fixes
- Add APIs that customize finishing behavior for containers in activity splits (I1a1e4)
- Added a new configuration option for activity split rules. (Iec6af)
Version 1.0
Version 1.0.0
January 26, 2022
androidx.window:window-*:1.0.0
is released. Version 1.0.0 contains these commits.
Major features of 1.0.0
- Support for folding phones through
WindowInfoTracker
andFoldingFeature
.WindowMetricsCalculator
to help calculate the current WindowMetrics.
Version 1.0.0-rc01
December 15, 2021
androidx.window:window-*:1.0.0-rc01
is released. Version 1.0.0-rc01 contains these commits.
New Features
- Add support for folding phones through
WindowInfoTracker
. - Add methods to calculate the current and maximum
WindowMetrics
. - Add supporting test APIs.
Version 1.0.0-beta04
November 17, 2021
androidx.window:window-*:1.0.0-beta04
is released. Version 1.0.0-beta04 contains these commits.
New Features
- Rename WindowInfoRepository to WindowInfoTracker.
- Make Activity an explicit method dependency for WindowInfoTracker.
- Add a simple TestRule for WindowMetricsCalculator to support developers using Robolectric.
API Changes
- Extract extensions (I25a5f)
- add isEmpty in ActivityStack (I5a4e6)
- Rename WindowInfoRepository to WindowInfoTracker.
- Update java/rxjava/testing dependencies to match. (I0da63)
- Add a test rule for a simple WindowMetricsCalculator. (Ibacdb)
Version 1.0.0-beta03
October 27, 2021
androidx.window:window-*:1.0.0-beta03
is released. Version 1.0.0-beta03 contains these commits.
New Features
- Add experimental Activity Embedding APIs. This initial layout version allows showing two Activities side by side.
API Changes
- Removed the currentWindowMetrics API since we can not provide it accurately. Please use WindowMetricsCalculator instead (Icda5f)
- Updated the extensions api. (Ica92b)
- Added an interface for a new feature that allows embedding activities and showing them side-by-side within the parent task window. (I5711d)
- Hid the constructors for WindowMetrics and WindowLayoutInfo, please use the test APIs instead. (I5a1b5)
- Add an API to create fake WindowLayoutInfo objects. (I4a2fd)
Bug Fixes
- Fixed memory leak. (I3fc79, b/202989046)
Version 1.0.0-beta02
September 1, 2021
androidx.window:window-*:1.0.0-beta02
is released. Version 1.0.0-beta02 contains these commits.
New Features
- Add an experimental annotation to annotate experimental APIs. (I9f1b6)
- Add a test method to create a test FoldingFeature that accepts a Rect. This will make it easie to test when using Robolectric as opposed to an actual Activity. (Id1cca)
Version 1.0.0-beta01
August 18, 2021
androidx.window:window-*:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
New Features
- Removed old constants and made
FoldingFeature
into an interface.
API Changes
- Remove old constants and make FoldFeature an interface. (I9a2d5)
Bug Fixes
- Libraries that depend on the
Test Core
library have been upgraded to version1.4.0
and will now work with Android platform version S. (I88b72, b/189353863)
Version 1.0.0-alpha10
August 4, 2021
androidx.window:window-*:1.0.0-alpha10
is released. Version 1.0.0-alpha10 contains these commits.
New Features
- Rename WindowInfoRepo to WindowInfoRepository and adjust corresponding classes / files.
- Convert current window metrics to a Flow in WindowInfoRepository since the value changes over time.
- Rename WindowInfoRepoJavaAdapter to WindowInfoRepoCallbackAdapter
- Add helper method to create test FoldingFeature objects
- Update packages to group classes based on the feature they are supporting.
API Changes
- Rename ActivityExt to ActivityExtensions Change from Repo to Repository. (I61a16)
- Update packages for classes. (I23ae2)
- Remove WindowMetrics from WindowInfoRepo (I24663)
- Remove WindowManager and use WindowInfoRepo
- Make WindowBackend internal. (I06d9a)
- Convert window metrics to Flow.
- Rename java adapter to WindowInfoRepoCallbackAdapter
- Remove callbackFlow so no more experimental APIs are in use. (Ia4d15)
- Add helper method to create test display features.
- Change from occlusionMode to occlusionType (If4cff)
Bug Fixes
- Fix proguard error where core library was being removed.
- Fix error where WindowLayoutInfo was not being delivered to additional subscribers.
- Fix error where config changes would not trigger folding feature updates.
Version 1.0.0-alpha09
June 30, 2021
androidx.window:window-*:1.0.0-alpha09
is released. Version 1.0.0-alpha09 contains these commits.
New Features
- Change from integer constants to unbounded enums.
- Add a test util to create test folding features.
API Changes
- Add helper method to create test display features. (I3cf54)
- Change from
occlusionMode
toocclusionType
.
- Change from
Bug Fixes
- Emit initial value when adding multiple consumers of the data streams.
Version 1.0.0-alpha08
June 16, 2021
androidx.window:window-*:1.0.0-alpha08
is released. Version 1.0.0-alpha08 contains these commits.
New Features
- Released a testing artifact to make it easier to test when using WindowInfoRepository. Use WindowInfoRepository to get information about DisplayFeatures and the WindowMetrics. (I57f66, Ida620)
Version 1.0.0-alpha07
June 2, 2021
androidx.window:window-*:1.0.0-alpha07
is released. Version 1.0.0-alpha07 contains these commits.
New Features
- Migrate core window library to Kotlin. Will use coroutines and suspend functions to expose asynchronous data going forward.
- Add WindowInfoRepo as the main interaction point for getting the WindowMetrics and the stream of WindowLayoutInfo.
- New
window-java
artifact to expose Java-friendly APIs to register and unregister callbacks. - New
window-rxjava2
andwindow-rxjava3
artifacts to expose RxJava adapted APIs.
API Changes
- Add
WindowServices
to provide dependencies uniformly.- Add coroutine based api to consume window layout info. (Iab70f)
- Migrate core window manager library to Kotlin. (Icca34)
Bug Fixes
- Add new data class to represent feature bounds. (I6dcd1)
Version 1.0.0-alpha06
May 5, 2021
androidx.window:window:1.0.0-alpha06
is released. Version 1.0.0-alpha06 contains these commits.
New Features
- We have started our migration to Kotlin and will finish in the next release.
- DeviceState has been removed from the public API, please use FoldingFeature instead.
- We have removed
STATE_FLIPPED
from the FoldingFeature states since it is not supported by any use-case at the moment. - We have also removed other deprecated APIs.
API Changes
- Adding Kotlin as a dependency.
- Migrate core library to Kotlin. (Idd995)
- Removed
DisplayFeature
builder. (I61fa4) - Removed
DeviceState
from public api, useFoldingFeature
instead. (Id6079) - Remove device state callback from extensions. (I5ea83)
- Remove
STATE_FLIPPED
from FoldingFeature. (I9c4e1) - Remove deprecated registration methods. (Ib381b)
Version 1.0.0-alpha05
March 24, 2021
androidx.window:window:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits.
New Features
We have added convenience methods to FoldingFeature so that apps can tell if the feature is separating, occluding, and determine the orientation of the hinge. We are also hiding the hinge type so that
We are removing the synchronous read methods from WindowManager. Synchronous read methods are error prone since there is an implicit race condition. Register listeners and callbacks to receive updates on the WindowLayoutInfo.
API Changes
- Add convenience methods for working with FoldingFeatures (Ie733f)
- Removes synchronous read methods from WindowManager (I96fd4)
Version 1.0.0-alpha04
March 10, 2021
androidx.window:window:1.0.0-alpha04
is released. Version 1.0.0-alpha04 contains these commits.
New Features
- Fixes a bug where no WindowLayoutInfo is emitted if there isn’t an OEM implementation. Now we emit an empty WIndowLayoutInfo.
- Fix a bug where state would not update properly if the hinge state changed while the app was backgrounded. Now the state should be consistent.
- Update our proguard files to ignore warnings from runtime dependencies.
Bug Fixes
- Emit an empty value when the OEM library is missing. (Ide935)
Version 1.0.0-alpha03
February 18, 2021
androidx.window:window:1.0.0-alpha03
is released. Version 1.0.0-alpha03 contains these commits.
New Features
- Emit an empty value for WindowLayoutInfo when the OEM implementation is empty. This should make it easier to use the library on more devices. Since the APIs are asynchronous it is still recommended that apps write some defensive code and emit a default value after a timeout. We do not have any guarantees on OEM implementations and the initial value may be delayed.
Bug Fixes
- Emit an empty value when the OEM library is missing. (Ide935)
Version 1.0.0-alpha02
January 27, 2021
androidx.window:window:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
New Features
We have deprecated some APIs to help streamline the api and reduce mistakes. Some notable examples are removing the synchronous read operations from WindowManager and deprecating DeviceState. Synchronous read operations can lead to race conditions and have incorrect UI.
We have converted DisplayFeature to an interface that other features will implement going forward. Our first feature is FoldingFeature which is now the representation of a screen fold or a hinge. This also contains the state of the hinge replacing DeviceState.
WindowMetrics was introduced in Android 11 to provide developers with a simple way to query for metrics about a window, for example its position and size on screen and any system insets. We’ve backported the API in this release so that developers can leverage WindowMetrics and continue to support older Android versions. WindowMetrics can be obtained through the
WindowManager#getCurrentWindowMetrics()
and WindowManager#getMaximumWindowMetrics() APIs.
API Changes
- Deprecate APIs that will be removed in the next alpha (Ib7cc4)
- Updates
ExtensionInterface
to accept explicit Activity references. (I07ded) - Introduces the WindowMetrics API. (I3ccee)
- Remove synchronous read methods from WindowManager (I69983)
- Make ExtensionWindowBackend package protected. (Ied208)
Bug Fixes
- Update
ExtensionInterface
APIs to accept visual contexts. (I8e827)
External Contribution
- Merge DeviceState and WindowLayoutInfo so it is easier to access data. (Id34f4)
Version 1.0.0-alpha01
February 27, 2020
androidx.window:window:1.0.0-alpha01
and androidx.window:window-extensions:1.0.0-alpha01
are released. Version 1.0.0-alpha01 contains these commits.
This is the first release of the Window Manager library.
New features
DisplayFeature
: This new API identifies disruptions in the continuous flat screen surfaces such as hinges or foldsDeviceState
: This new API provides the current posture of the phone from a list of defined postures (For example,CLOSED
,OPENED
,HALF_OPENED
, etc.)