WindowManager
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
May 24, 2023 | 1.0.0 | 1.1.0-rc01 | - | 1.2.0-alpha01 |
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.0.0" // For Java-friendly APIs to register and unregister callbacks implementation "androidx.window:window-java:1.0.0" // For RxJava2 integration implementation "androidx.window:window-rxjava2:1.0.0" // For RxJava3 integration implementation "androidx.window:window-rxjava3:1.0.0" // For testing implementation "androidx.window:window-testing:1.0.0" }
Kotlin
dependencies { implementation("androidx.window:window:1.0.0") // For Java-friendly APIs to register and unregister callbacks implementation("androidx.window:window-java:1.0.0") // For RxJava2 integration implementation("androidx.window:window-rxjava2:1.0.0") // For RxJava3 integration implementation("androidx.window:window-rxjava3:1.0.0") // For testing implementation("androidx.window:window-testing:1.0.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.2
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-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.)