In reference to https://learn.microsoft.com/en-us/dual-screen/android/platform/jetpack-window-manager, I initialized the window manager like this:
wm = WindowManager(this, null)
and called
wm.registerDeviceStateChangeCallback
The accept method implemented in DeviceStateChangeCallback was invoked when I changed the screen size of emulator while was not on a real Huawei foldable device.
Can anyone tell me the reason, pls!