Galaxy fold/flip crash UnsupportedOperationException

I’m android developer, we detect galaxy fold/flip will crash in large numbers.

I posted in android issue tracker.

https://issuetracker.google.com/issues/344735119

similar

https://issuetracker.google.com/issues/344912774

We’re now pretty sure it’s a system problem, because sometimes the crash code happens directly in the activity’s super.onCreate, not the app specific code, not a specific screen, but every screen has a crash record.

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(Unknown Source:0)
	at androidx.window.extensions.layout.WindowLayoutComponentImpl$$ExternalSyntheticLambda0.accept(Unknown Source: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(Unknown Source:0)
	at androidx.window.common.DeviceStateManagerFoldingFeatureProducer$1.$r8$lambda$Cq8m54r9pahGe0xgKiimh_L76YM(Unknown Source:0)
	at androidx.window.common.DeviceStateManagerFoldingFeatureProducer$1$$ExternalSyntheticLambda0.accept(Unknown Source: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(Unknown Source:0)
	at android.hardware.devicestate.DeviceStateManagerGlobal$DeviceStateCallbackWrapper$$ExternalSyntheticLambda0.run(Unknown Source: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(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)