如何检测弹出窗口中的图片已关闭(向下拖动以关闭)?

How to detect picture in popup dismissed (drag down to dismiss)?

我们正在使用具有画中画 (pip) 功能的通话页面。

问题:
如果用户关闭 pip 弹出窗口 window(通过向下拖动关闭),我们无法检测到。

如何检测画中画window向下拖动关闭?

更新:
设置画中画

// RemoteRenderLayout -> call preview layout. You can set anyone view
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

    Rational aspectRatio = new Rational(
        remoteRenderLayout.getWidth(), remoteRenderLayout.getHeight());
    PictureInPictureParams params = new PictureInPictureParams.Builder()
        .setAspectRatio(aspectRatio)
        .build();
    enterPictureInPictureMode(params);
}
else{

    enterPictureInPictureMode();
}

当activity进入或退出画中画模式时系统调用Activity.onPictureInPictureModeChanged()Fragment.onPictureInPictureModeChanged().

您可以在其中实现您的代码:

 override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean,
                                           newConfig: Configuration) {
    if (isInPictureInPictureMode) {
        // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode.
    } else {
        // Restore the full-screen UI.
    }
}