From e2fc87494b0a3e7afffcf2be580a8e243d117a32 Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 29 Nov 2024 19:37:00 +0800 Subject: [PATCH] =?UTF-8?q?[6.8.0][NativeCrash]=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=9B=A0SP=E4=BD=BF=E7=94=A8=E9=97=AE=E9=A2=98=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../env/EnvChangeManager.kt | 112 +++++++++--------- .../main/res/layout/view_debug_setting.xml | 3 +- 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/env/EnvChangeManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/env/EnvChangeManager.kt index 06c4e48840..e4f6061084 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/env/EnvChangeManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/env/EnvChangeManager.kt @@ -13,88 +13,88 @@ import com.mogo.eagle.core.utilcode.util.Utils object EnvChangeManager { - private val sp = Utils.getApp().getSharedPreferences("env_change", MODE_PRIVATE) +// private val sp = Utils.getApp().getSharedPreferences("env_change", MODE_PRIVATE) private fun updateCityCode(cityCode: String?) { - sp.edit().putString("city_code", cityCode).apply() +// sp.edit().putString("city_code", cityCode).apply() } private fun updateNetMode(netMode: Int) { - sp.edit().putInt("net_mode", netMode).apply() +// sp.edit().putInt("net_mode", netMode).apply() } private fun getConfig() : Pair? { - val cityCode = sp.getString("city_code", null) - val severType = sp.getInt("net_mode", -1) - if (cityCode == null || severType == -1) { - return null - } - return Pair(cityCode, severType) +// val cityCode = sp.getString("city_code", null) +// val severType = sp.getInt("net_mode", -1) +// if (cityCode == null || severType == -1) { +// return null +// } +// return Pair(cityCode, severType) + return null } fun getCityName(): String { - val cache = getConfig() - return if (cache == null) { - when(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()?.cityCode ?: SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.LOCATION_CITY_CODE) ?: "010") { - "010" -> "北京" - "0734" -> "衡阳" - else -> "未知" - } - } else { - when(cache.first) { - "010" -> "北京" - "0734" -> "衡阳" - else -> "未知" - } - } +// val cache = getConfig() +// return if (cache == null) { +// when(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()?.cityCode ?: SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.LOCATION_CITY_CODE) ?: "010") { +// "010" -> "北京" +// "0734" -> "衡阳" +// else -> "未知" +// } +// } else { +// when(cache.first) { +// "010" -> "北京" +// "0734" -> "衡阳" +// else -> "未知" +// } +// } + return "未知" } fun getConfigNetMode(): Int { - val cache = getConfig() - return cache?.second ?: -1 +// val cache = getConfig() +// return cache?.second ?: -1 + return -1 } fun getNetMode(): String { - val cache = getConfig() - return if (cache == null) { - when(DebugConfig.getNetMode()) { - DebugConfig.NET_MODE_RELEASE -> "生产" - DebugConfig.NET_MODE_QA -> "测试" - DebugConfig.NET_MODE_DEMO -> "演示" - else -> "未知" - } - } else { - when(cache.second) { - DebugConfig.NET_MODE_RELEASE -> "生产" - DebugConfig.NET_MODE_QA -> "测试" - DebugConfig.NET_MODE_DEMO -> "演示" - else -> "未知" - } - } +// val cache = getConfig() +// return if (cache == null) { +// when(DebugConfig.getNetMode()) { +// DebugConfig.NET_MODE_RELEASE -> "生产" +// DebugConfig.NET_MODE_QA -> "测试" +// DebugConfig.NET_MODE_DEMO -> "演示" +// else -> "未知" +// } +// } else { +// when(cache.second) { +// DebugConfig.NET_MODE_RELEASE -> "生产" +// DebugConfig.NET_MODE_QA -> "测试" +// DebugConfig.NET_MODE_DEMO -> "演示" +// else -> "未知" +// } +// } + return "未知" } fun changeTo(cityCode: String, netMode: Int) { - updateCityCode(cityCode) - updateNetMode(netMode) - restartApp() +// updateCityCode(cityCode) +// updateNetMode(netMode) +// restartApp() } fun reset() { - updateCityCode(null) - updateNetMode(-1) - restartApp() +// updateCityCode(null) +// updateNetMode(-1) +// restartApp() } private fun restartApp() { - Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName)?.also { - ActivityUtils.startActivity(it) - } - Process.killProcess(Process.myPid()) +// Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName)?.also { +// ActivityUtils.startActivity(it) +// } +// Process.killProcess(Process.myPid()) } - fun getEnvConfig(): EnvConfig? = getConfig()?.let { - EnvConfig(it.first, it.second, - if (it.first == "010") 116.397446 else 112.582654, - if (it.first == "010") 39.909004 else 26.816478) - } + fun getEnvConfig(): EnvConfig? = null } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 004dec529e..a39a16afc2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -1272,6 +1272,7 @@ android:background="@drawable/debug_setting_edit_bg" android:gravity="center_vertical" android:orientation="horizontal" + android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -1307,7 +1308,7 @@ android:text="设置刹车加速度阈值" android:textSize="@dimen/dp_24" app:layout_constraintLeft_toLeftOf="parent" - app:layout_constraintTop_toBottomOf="@id/llChangeEnv" /> + app:layout_constraintTop_toTopOf="parent" />