[dev_arch_opt_3.0]

[Change]
[
1、修复EB5副屏幕启动失效问题
]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-02-17 14:21:18 +08:00
parent ba5720afe1
commit 89ed9838a3
2 changed files with 18 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.support.obu.model.MogoObuHvBasicsData
@@ -124,6 +125,7 @@ object MoGoLocationDispatcher :
DataSourceType.TELEMATIC
)
}
MultiDisplayUtils.getOtherDisplay()
}
/**

View File

@@ -39,10 +39,11 @@ object MultiDisplayUtils {
// 获取除了内置屏幕(主屏幕)的其它屏幕
val displays = mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
// 初始化新的集合进行接收排序后的屏幕信息
val displaysList = arrayOfNulls<Display>(displays.size)
var displaysList = arrayOfNulls<Display>(displays.size)
// 判断副屏个数
if (displays.isNotEmpty()) {
displaysList = arrayOfNulls(displays.size)
// 循环出来副屏幕进行重新排序
for (i in displays.indices) {
// 这里如果需要固定某个屏幕, 使用 if( display.toString().indexOf("port=1")!=-1) ) 而不是使用 display[i]
@@ -62,6 +63,18 @@ object MultiDisplayUtils {
}
}
}
// 处理EB5副屏幕
else {
if (mDisplayManager.displays.isNotEmpty()) {
displaysList = arrayOfNulls(1)
// EB5目前副屏幕ID为固定4096
for (i in mDisplayManager.displays.indices) {
if (mDisplayManager.displays[i].displayId == 4096) {
displaysList[0] = mDisplayManager.displays[i]
}
}
}
}
return displaysList
}
@@ -83,11 +96,9 @@ object MultiDisplayUtils {
* @param activity 要在第二个屏幕启动的页面
*/
fun startActWithSecond(context: Context, activity: Class<*>) {
val launchDisplayId: Int
if (isSupportMultiDisplay(context)) {
if (getOtherDisplay().size > 1 && getOtherDisplay()[0] != null) {
launchDisplayId = getOtherDisplay()[0]!!.displayId
if (getOtherDisplay().isNotEmpty() && getOtherDisplay()[0] != null) {
val launchDisplayId = getOtherDisplay()[0]!!.displayId
// 要加上Intent.FLAG_ACTIVITY_NEW_TASK
val options = ActivityOptions.makeBasic()
options.launchDisplayId = launchDisplayId