[Xiaomi Mi Pad 4 ROMs, Kernels, Recoveries, & Other] S-trace:
It's a ROM bug, my tablet chashes too on freeform window resize. Will take a deeper look on it later.

04-12 20:52:58.026 3358 3538 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: android.display
04-12 20:52:58.026 3358 3538 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.os.IBinder.unlinkToDeath(android.os.IBinder$DeathRecipient, int)' on a null object reference
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at com.android.server.wm.TaskPositioner.unregister(TaskPositioner.java:354)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at com.android.server.wm.TaskPositioningController.cleanUpTaskPositioner(TaskPositioningController.java:215)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at com.android.server.wm.TaskPositioningController.startPositioningLocked(TaskPositioningController.java:181)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at com.android.server.wm.TaskPositioningController.lambda$handleTapOutsideTask$0$TaskPositioningController(TaskPositioningController.java:129)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at com.android.server.wm.-$$Lambda$TaskPositioningController$u0oAwi82C-bAGo2JAsAc_9ZLi70.run(Unknown Source:8)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:883)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:100)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:67)
04-12 20:52:58.026 3358 3538 E AndroidRuntime: at com.android.server.ServiceThread.run(ServiceThread.java:44)

Yes, my tablet have this issue too (when I try to start screen recording with audio from the microphone.

04-12 21:11:45.432 23381 23381 D ScreencastService: Start output
04-12 21:11:45.434 23381 23468 D MPEG4Writer: Video skip non-key frame
04-12 21:11:45.434 23381 23468 I MPEG4Writer: setStartTimestampUs: 170682579883
04-12 21:11:45.434 23381 23468 I MPEG4Writer: Earliest track starting time: 170682579883
04-12 21:11:45.436 23381 23466 I MPEG4Writer: setStartTimestampUs: 170682617829
04-12 21:11:45.465 23381 23466 W MPEG4Writer: 0-duration samples found: 1
04-12 21:11:45.467 23381 23467 I MPEG4Writer: setStartTimestampUs: 170682617829
04-12 21:11:45.488 23381 23466 W MPEG4Writer: 0-duration samples found: 1
04-12 21:11:45.558 23381 23467 E MPEG4Writer: do not support out of order frames (timestamp: 77335 < last: 77380 for Audio track
04-12 21:11:45.558 23381 23467 E MPEG4Writer: 0 frames to dump timeStamps in Audio track
04-12 21:11:45.558 23381 23467 I MPEG4Writer: Received total/0-length (5/0) buffers and encoded 4 frames. - Audio
04-12 21:11:45.559 23381 23467 I MPEG4Writer: Audio track drift time: 0 us
04-12 21:11:45.564 23381 23466 W MPEG4Writer: 0-duration samples found: 1
04-12 21:11:45.572 23381 23381 E MediaAdapter: pushBuffer called before start
04-12 21:11:45.575 23381 23381 D AndroidRuntime: Shutting down VM
04-12 21:11:45.575 23381 23381 E AndroidRuntime: FATAL EXCEPTION: main
04-12 21:11:45.575 23381 23381 E AndroidRuntime: Process: org.lineageos.recorder, PID: 23381
04-12 21:11:45.575 23381 23381 E AndroidRuntime: java.lang.IllegalStateException: writeSampleData returned an error
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.media.MediaMuxer.nativeWriteSampleData(Native Method)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.media.MediaMuxer.writeSampleData(MediaMuxer.java:694)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at org.lineageos.recorder.screen.ScreencastService$4.onOutputBufferAvailable(ScreencastService.java:410)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.media.MediaCodec$EventHandler.handleCallback(MediaCodec.java:1752)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.media.MediaCodec$EventHandler.handleMessage(MediaCodec.java:1697)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7356)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
04-12 21:11:45.575 23381 23381 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)