Unblock device state callback in Window Extension.
Update DeviceStateManagerFoldingFeatureProducer to allow device state callback off the main thread. Implement a lock to synchronize access to the device state, ensuring thread-safety and immediate visibility of updates from the binder thread to other threads. This allows device state manager initialization within Activity#onCreate(), removing the requirement to initialize WindowInfoTracker in an app initializer or Application#onCreate(). Additional changes improve readability and add unit tests to verify the new behavior. Notably, a new DeviceStateMapper class is introduced to encapsulate the device state to posture mapping logic, limiting access and ensuring immutability after initialization for thread safety. Bug: 337820752 Test: atest WMJetpackUnitTests:DeviceStateManagerFoldingFeatureProducerTest Flag: com.android.window.flags.wlinfo_oncreate Change-Id: I8a4af1c5ac98f5653e4293a049291ba5ff7cd464
Loading
Please register or sign in to comment