Android画中画行为异常

问题描述

我们正在尝试在Android上实现PIP模式,并看到一些不一致的行为。

我们在清单中添加了以下配置

  android:name=".ui.home.HomeActivity"
  android:supportsPictureInPicture="true"
           android:configChanges="keyboardHidden|orientation|screenSize|fontScale|screenLayout|smallestScreenSize|density|uiMode|screenSize"
            android:launchMode="singleTask"
            android:screenorientation="locked"
            android:theme="@style/HomeTheme"
            android:windowSoftInputMode="adjustResize"
            android:resizeableActivity="true">

当我们添加以下代码时,

boolean supportsPIP =
                    pkg.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE);

它返回true

但是下面的代码有时返回true,有时返回false。

 mActivity.enterPictureInPictureMode(mPictureInPictureParamsBuilder.build());

行为非常不一致,有时我们看到PIP,有时看不到。

根据文档,“在各种情况下,系统可能不允许输入画中画,包括当活动不可见,屏幕被锁定或用户固定了活动时” em>

但是这两种情况均未发生。

我们已经在Android v10和配备4GB内存的Huwaei手机上进行了尝试

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)