Improve device state callback for thread context.
Optimize the initial device state callback execution in
DeviceStateManagerFoldingFeatureProducer (FFP) based on the calling
thread . If FFP is created on the main thread, execute the initial
`onDeviceStateChanged` callback directly. If FFP is created on a thread
other than the main thread, post the callback to the main thread.
This improves callback efficiency and maintains consistency across
thread contexts.
Bug: 337820752
Test: atest FrameworksCoreDeviceStateManagerTests:DeviceStateManagerGlobalTest
Test: atest WMJetpackUnitTests:DeviceStateManagerFoldingFeatureProducerTest
Flag: com.android.window.flags.wlinfo_oncreate
Change-Id: I3ee26a3427cf59c8da3366b48199e7703ec7c5e8
3 files changed