画中画不会更新UI并在还原时冻结应用程序

时间:2019-01-11 14:27:33

标签: android performance multi-window android-picture-in-picture

我正在尝试在基于导航的应用程序中实现PIP模式。 应用程序使用诺基亚HERE Maps SDK作为地图引擎。 该应用程序在没有PIP的情况下可以正常运行,可以进入后台,在没有PIP的情况下可以继续运行。

但是在使用PIP模式时,PIP窗口不会更新,在该窗口上看不到用户位置/速度更新。有时我会听到TTS机动指令。

此外,当我尝试最大化PIP窗口时,它会导致屏幕冻结,并且大约10秒钟后我无法恢复。一段时间后,应用程序恢复到正常状态并按照预期方式显示运动。

我不知道为什么应用程序会如此运行。

我已使用此代码实现PIP模式。

try {
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;

    Rational aspectRatio = new Rational(width,height);
    PictureInPictureParams.Builder mPictureInPictureParamsBuilder = new PictureInPictureParams.Builder();
    mPictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
    enterPictureInPictureMode(mPictureInPictureParamsBuilder.build());
    } catch (IllegalStateException e) {
        e.printStackTrace();
}

请任何人告诉我我的错误。

0 个答案:

没有答案
相关问题