Merge remote-tracking branch 'origin/dev_robotaxi-d-app-module_2132_221223_2.13.2' into dev_robotaxi-d-app-module_240_230131_2.14.0

This commit is contained in:
renwj
2023-02-02 10:36:48 +08:00
5 changed files with 46 additions and 89 deletions

View File

@@ -39,8 +39,8 @@ if (!isAndroidTestBuild()) {
if (!isAndroidTestBuild()) {
apply plugin: 'bytex.threadOpt'
thread_opt {
enable !isReleaseBuild
enableInDebug !isReleaseBuild
enable true
enableInDebug true
logLevel "DEBUG"
}
}
@@ -52,13 +52,12 @@ if (!isAndroidTestBuild()) {
enableInDebug true
weaveGroup {
leak_canary_crash_fix {
enable !isReleaseBuild
}
anr_fix {
enable true
}
crash_fix {
enable true
}
}
}
}

View File

@@ -1,72 +1 @@
package com.mogo.launcher;
import com.mogo.eagle.core.function.main.MainMoGoApplication;
import android.content.Context;
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.launcher.crash.CrashSystem;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author congtaowang
* @since 2019-12-18
* <p>
* Launcher application
*/
public class MogoApplication extends MainMoGoApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// ThreadConfig.Builder builder = new ThreadConfig.Builder().listener(new ThreadConfig.TaskExecuteListener() {
// @Override
// public boolean isEnabled() {
// return true; // 如果返回true会有后续的回调如果返回false, 不会有后续的回调
// }
//
// @Override
// public void onExecutorBefore(@NonNull Runnable runnable, @NonNull ThreadConfig.TaskType type) {
// //每个任务执行前回调
//// if (type == ThreadConfig.TaskType.HandlerThread) {
////
////
//// }
// }
//
// @Override
// public void onExecutorAfter(@NonNull Runnable runnable, @NonNull ThreadConfig.TaskType type) {
// //每个任务执行后回调
// }
//
// /**
// * @param core 线程池的核心数
// * @param max 线程池的最大线程数
// * @param active 线程池正在活跃的任务数
// * @param completed 线程池已完成的任务数
// */
// @Override
// public void onExecutorStateChanged(@NonNull ThreadPoolExecutor pool, int core, int max, int active, long completed) {
// //线程池在执行过程,状态变化回调
// //Log.d("POOL", "core:" + core + ";max:" + max + ";active:" + active + ";completed:" + completed);
// }
// });
// builder.loggable(false);
// ThreadManager.INSTANCE.init(builder);
}
@Override
protected void initCrashConfig() {
CrashSystem crashSystem = CrashSystem.getInstance(this);
crashSystem.init();
//设置debug模式日志不上传
crashSystem.setDebug(BuildConfig.DEBUG);
}
@Override
protected void initLogConfig() {
super.initLogConfig();
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
}
}
package com.mogo.launcher;

View File

@@ -0,0 +1,32 @@
package com.mogo.launcher.lancet
import android.content.ComponentName
import android.content.Intent
import androidx.annotation.*
import com.knightboost.lancet.api.Origin
import com.knightboost.lancet.api.Scope.ALL
import com.knightboost.lancet.api.Scope.LEAF
import com.knightboost.lancet.api.annotations.*
@Keep
@Weaver
@Group("crash_fix")
class CrashFix {
/**
* 修正Android8.0及之后后台启动Service引起的崩溃
* java.lang.IllegalStateException: Not allowed to start service Intent {
* act=com.zhidao.cosupload.service.UPLOAD_ACTION cmp=com.mogo.launcher.f/com.zhidao.cosupload.service.UploadService }: app is in background uid UidRecord{6443b7b u0a404 LAST bg:+1m15s362ms idle change:idle procs:1 seq(0,0,0)}
*/
@Insert(mayCreateSuper = true)
@TargetClass("android.content.Context", scope = LEAF)
@TargetMethod(methodName = "startService")
fun fixStartServiceCrash(intent: Intent): ComponentName? {
return try {
Origin.call() as ComponentName?
} catch (t: Throwable) {
t.printStackTrace()
null
}
}
}

View File

@@ -96,43 +96,39 @@ object MarkerManager {
}
val currentLocation = carLoc.get()
val lastLocation = if (marker.coordinateType == 0) lastCarLocation.get() else lastGpsLocation.get()
if (marker.coordinateType == 0) {
lastCarLocation.set(currentLocation)
} else {
lastGpsLocation.set(currentLocation)
}
if (currentLocation != null && lastLocation != null) {
val delta = CoordinateUtils.calculateLineDistance(currentLocation.longitude, currentLocation.latitude, lastLocation.longitude, lastLocation.latitude)
Log.d(TAG, "--- checkTask --- 4 ---:delta:$delta")
Log.d(TAG, "--- checkTask --- 4 ---:delta:$delta, id:${marker.id}")
var elapsed = elapsedDistances[marker]
if (elapsed == null) {
elapsed = delta.toDouble()
} else {
elapsed += delta
}
Log.d(TAG, "--- checkTask --- 5 ---:delta:$delta, elapsed:${elapsed}")
Log.d(TAG, "--- checkTask --- 5 ---:delta:$delta, elapsed:${elapsed}, id: ${marker.id}")
if (elapsed >= 200) {
var removeMarkerError = false
marker.markers?.forEach {
try {
Log.e(TAG, "--- checkTask --- remove marker: $it, id: ${marker.id}")
it.setVisible(false)
it.destroy()
} catch (t: Throwable) {
t.printStackTrace()
removeMarkerError = true
Log.e(TAG, "--- checkTask --- remove marker error:${t.message}")
Log.e(TAG, "--- checkTask --- remove marker error:${t.message}, id: ${marker.id}")
}
}
var removeLineError = false
marker.lines?.forEach {
try {
it.isVisible = false
Log.e(TAG, "--- checkTask --- remove line : $it, id:${marker.id}")
it.destroy()
} catch (t: Throwable) {
t.printStackTrace()
removeLineError = true
Log.e(TAG, "--- checkTask --- remove line error:${t.message}")
Log.e(TAG, "--- checkTask --- remove line error:${t.message}, id: ${marker.id}")
}
}
if (!removeLineError && !removeMarkerError) {
@@ -186,6 +182,7 @@ object MarkerManager {
fun addMarker(marker: MarkerWrapper) {
Log.d(TAG, "=== addMarker ====: $marker")
synchronized(showedMarkers) {
showedMarkers.offer(marker)
}

View File

@@ -144,8 +144,8 @@ class AiRoadMarker {
if (line != null) {
wrapper.addLine(line)
}
MarkerManager.addMarker(wrapper)
}
MarkerManager.addMarker(wrapper)
}
private fun removeLine() {