I'm getting UnsupportedOperationException crash on live app. All the crashes are associated with Samsung Fold Android 14 devices. But still no clue how to reproduce or fix this. Any help would be appreciated.
Fatal Exception: java.lang.UnsupportedOperationException: Tried to obtain display from a Context not associated with one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display.
at android.app.ContextImpl.getDisplay(ContextImpl.java:3166)
at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1209)
at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1209)
at android.content.ContextWrapper.getDisplay(ContextWrapper.java:1209)
at androidx.window.extensions.layout.WindowLayoutComponentImpl.shouldReportDisplayFeatures(WindowLayoutComponentImpl.java:355)
at androidx.window.extensions.layout.WindowLayoutComponentImpl.getDisplayFeatures(WindowLayoutComponentImpl.java:313)
at androidx.window.extensions.layout.WindowLayoutComponentImpl.getWindowLayoutInfo(WindowLayoutComponentImpl.java:265)
at androidx.window.extensions.layout.WindowLayoutComponentImpl.onDisplayFeaturesChanged(WindowLayoutComponentImpl.java:250)
at androidx.window.extensions.layout.WindowLayoutComponentImpl.$r8$lambda$CcdqSJgN0v7j8yjFplaR5_gC_ag()
at androidx.window.extensions.layout.WindowLayoutComponentImpl$ExternalSyntheticLambda0.accept(:4)
at androidx.window.util.BaseDataProducer.notifyDataChanged(BaseDataProducer.java:101)
at androidx.window.common.DeviceStateManagerFoldingFeatureProducer.notifyFoldingFeatureChange(DeviceStateManagerFoldingFeatureProducer.java:212)
at androidx.window.common.DeviceStateManagerFoldingFeatureProducer.-$Nest$mnotifyFoldingFeatureChange()
at androidx.window.common.DeviceStateManagerFoldingFeatureProducer\$1.$r8$lambda$Cq8m54r9pahGe0xgKiimh_L76YM()
at androidx.window.common.DeviceStateManagerFoldingFeatureProducer\$1$ExternalSyntheticLambda0.accept(:4)
at androidx.window.common.RawFoldingFeatureProducer.getData(RawFoldingFeatureProducer.java:71)
at androidx.window.common.DeviceStateManagerFoldingFeatureProducer\$1.onStateChanged(DeviceStateManagerFoldingFeatureProducer.java:87)
at android.hardware.devicestate.DeviceStateManagerGlobal$DeviceStateCallbackWrapper.lambda$notifyStateChanged\$2(DeviceStateManagerGlobal.java:428)
at android.hardware.devicestate.DeviceStateManagerGlobal$DeviceStateCallbackWrapper.$r8$lambda$FiFeo7UDl_Jzgv3ijVmtwGDn8K0()
at android.hardware.devicestate.DeviceStateManagerGlobal$DeviceStateCallbackWrapper$ExternalSyntheticLambda0.run(:4)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)