Merge branch 'release_robotaxi-d-app-module_2130_221116_2.13.0.1' into 'master'

Release robotaxi d app module 2130 221116 2.13.0.1

See merge request zhjt/AndroidApp/MoGoEagleEye!504
This commit is contained in:
pangfan
2023-01-13 06:54:15 +00:00
4 changed files with 64 additions and 35 deletions

View File

@@ -63,9 +63,13 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.rousetime.android_startup.StartupManager;
import com.rousetime.android_startup.model.LoggerLevel;
import com.rousetime.android_startup.model.StartupConfig;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -271,6 +275,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
// 启动Native内存泄漏监测
startLeakMonitor();
}
checkMonitorDb();
}
/**
@@ -309,6 +314,25 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
LeakMonitor.INSTANCE.start();
}
private void checkMonitorDb() {
new Thread(() -> {
long limitId = 50001;
File file = this.getDatabasePath(MonitorDb.INTERNAL_DB_NAME);
try {
if (file != null && file.exists()) {
List<CpuInfo> cpuList = MonitorDb.getDb(this).monitorDao().getAllCPUById(limitId);
List<MemInfo> memList = MonitorDb.getDb(this).monitorDao().getAllMemById(limitId);
// 大于5w条清除
if (cpuList.size() > 0 || memList.size() > 0) {
this.deleteDatabase(MonitorDb.INTERNAL_DB_NAME);
}
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, e.getMessage());
}
}).start();
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_NATIVE_LEAK,
linkCode = CHAIN_LINK_LEAK,

View File

@@ -39,9 +39,6 @@ import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.SPUtils;
import com.mogo.map.MapApiPath;
import com.zhidao.support.obu.ami.AmiClientManager;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb;
import java.io.File;
import java.lang.reflect.Field;
@@ -65,21 +62,22 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}
start = System.currentTimeMillis();
connectAmiIp();
initOverviewDb();
// Crash 日志收集
initCrashConfig();
initLogConfig();
initTipToast();
initModules();
if (DebugConfig.isDebug()) {
initKoom();
}
//查询是否有版本的更新
queryAppUpgrade();
clearMessageBoxTable();
checkMonitorDb();
if (ProcessUtils.isMainProcess(this)) {
initOverviewDb();
if (DebugConfig.isDebug()) {
initKoom();
}
clearMessageBoxTable();
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
}
upgradeProgressListener();
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
}
@Override
@@ -104,35 +102,27 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date currDate = new Date(System.currentTimeMillis());
String currTimeStr = format.format(currDate);
if (lastLaunchTimeStr != null && !lastLaunchTimeStr.isEmpty()) {
boolean isSameDay = currTimeStr.equals(lastLaunchTimeStr);
// 超过一天需要清除消息盒子中的数据并把时间戳存入SP
if (!isSameDay) {
try {
if (lastLaunchTimeStr != null && !lastLaunchTimeStr.isEmpty()) {
boolean isSameDay = currTimeStr.equals(lastLaunchTimeStr);
// 超过一天需要清除消息盒子中的数据并把时间戳存入SP
if (!isSameDay) {
File file = this.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME);
if (file != null && file.exists()) {
this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME);
}
SPUtils.getInstance().put("last_launch", currTimeStr);
}
} else {
// 首次使用App或中途仅删除sp文件
File file = this.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME);
if (file != null && file.exists()) {
this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME);
}
SPUtils.getInstance().put("last_launch", currTimeStr);
}
} else {
// 首次使用App或中途仅删除sp文件
File file = this.getDatabasePath(MsgBoxDb.INTERNAL_DB_NAME);
if (file != null && file.exists()) {
this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME);
}
SPUtils.getInstance().put("last_launch", currTimeStr);
}
}).start();
}
private void checkMonitorDb() {
new Thread(() -> {
long limitId = 50001;
List<CpuInfo> cpuList = MonitorDb.getDb(this).monitorDao().getAllCPUById(limitId);
List<MemInfo> memList = MonitorDb.getDb(this).monitorDao().getAllMemById(limitId);
// 大于5w条清除
if (cpuList.size() > 0 || memList.size() > 0) {
this.deleteDatabase(MonitorDb.INTERNAL_DB_NAME);
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, e.getMessage());
}
}).start();
}

View File

@@ -9,9 +9,11 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb
import com.mogo.eagle.core.function.msgbox.db.MsgBoxInfo
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.Utils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -139,7 +141,11 @@ object DataManager {
fun queryAllMessages(context: Context) {
scope.launch {
initCache()
getCacheMessages(context)
try {
getCacheMessages(context)
} catch (e: Exception) {
CallerLogger.e("DataManager", e.message)
}
}
}
@@ -156,6 +162,7 @@ object DataManager {
}
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = withContext(Dispatchers.IO) {
delay(2000)
return@withContext MsgBoxDb.getDb(context)
.monitorDao()
.getAllCachedMessages()

View File

@@ -2,4 +2,12 @@ package com.mogo.eagle.core.data.msgbox
import java.io.Serializable
data class V2XMsg(var type: String = "", var content: String? = "", var tts: String? = ""): Serializable
data class V2XMsg(var type: String = "", var content: String? = "", var tts: String? = ""): Serializable {
// 临时解决该问题V2XMsg->json作为主键如果主键一样数据条目不会新增
private var timeStamp: Long = 0
init {
timeStamp = System.currentTimeMillis()
}
}