问题背景
在做pad项目时,发现很多不支持分屏的应用都被分屏了。导致各种显示异常的bug。
问题分析
1、反编译apk发现,apk本身是不支持分屏的。被系统强制分屏了
2、和客户研发沟通,发现是Android 12L的新特性。
frameworks\base\core\res\res\values\config.xml中配置了分屏的模式
<!-- Whether the device supports non-resizable activity in multi windowing modes.
-1: The device doesn't support non-resizable in multi windowing modes.
0: The device supports non-resizable in multi windowing modes only if this is a large
screen (smallest width >= {@link config_largeScreenSmallestScreenWidthDp}).
1: The device always supports non-resizable in multi windowing modes.
-->
<integer name="config_supportsNonResizableMultiWindow">0</integer>
默认配置0,当设备尺寸大于config_largeScreenSmallestScreenWidthDp时,就默认应用支持分屏。
改为-1就好了。会根据apk是否支持分屏判断