Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0'

Dev arch opt 3.0

See merge request zhjt/AndroidApp/MoGoEagleEye!692
This commit is contained in:
wangmingjun
2023-03-15 14:31:26 +00:00
13 changed files with 256 additions and 185 deletions

View File

@@ -12,10 +12,12 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.launcher.BuildConfig import com.mogo.launcher.BuildConfig
import com.mogo.launcher.R import com.mogo.launcher.R
import com.mogo.test.crashreport.CrashReportConstants import com.mogo.test.crashreport.CrashReportConstants
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
import com.zhidaoauto.map.sdk.open.HDTypes import com.zhidaoauto.map.sdk.open.HDTypes
import com.zhidaoauto.map.sdk.open.MapAutoApi import com.zhidaoauto.map.sdk.open.MapAutoApi
import com.zhidaoauto.map.sdk.open.MapParams import com.zhidaoauto.map.sdk.open.MapParams
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import tv.danmaku.ijk.media.player.IjkMediaPlayer
object ConfigStartUp { object ConfigStartUp {
@@ -27,6 +29,9 @@ object ConfigStartUp {
} }
private fun initBuildConfig() { private fun initBuildConfig() {
//ijk关闭log
IjkPlayerManager.setLogLevel(IjkMediaPlayer.IJK_LOG_SILENT);
// 初始化构建APP的时候的分支及提交HASH用于辅助定位问题 // 初始化构建APP的时候的分支及提交HASH用于辅助定位问题
AppConfigInfo.workingBranchName = BuildConfig.WORKING_BRANCH_NAME AppConfigInfo.workingBranchName = BuildConfig.WORKING_BRANCH_NAME
AppConfigInfo.workingBranchHash = BuildConfig.WORKING_BRANCH_HASH AppConfigInfo.workingBranchHash = BuildConfig.WORKING_BRANCH_HASH

View File

@@ -132,8 +132,8 @@ ext {
crashreport : "com.mogo.test:crashreport:${CRASHREPORT_VERSION}", crashreport : "com.mogo.test:crashreport:${CRASHREPORT_VERSION}",
crashreportapmbyte : "com.mogo.test:crashreport-apmbyte:${CRASHREPORT_APMBYTE_VERSION}", crashreportapmbyte : "com.mogo.test:crashreport-apmbyte:${CRASHREPORT_APMBYTE_VERSION}",
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}", crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
apm_insight : 'com.volcengine:apm_insight:1.4.9.cn-rc.5', apm_insight : 'com.volcengine:apm_insight:1.4.10.cn-rc.0',
apm_insight_crash : 'com.volcengine:apm_insight_crash:1.4.6-rc.14', apm_insight_crash : 'com.volcengine:apm_insight_crash:1.4.6-rc.17',
cicle_indicator : 'me.relex:circleindicator:2.1.6', cicle_indicator : 'me.relex:circleindicator:2.1.6',
//========================= TTS语音 Maven 版本管理 ========================= //========================= TTS语音 Maven 版本管理 =========================

View File

@@ -109,7 +109,6 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
override fun onCurrentVersion(version: MogoObuSystemBConfigData) { override fun onCurrentVersion(version: MogoObuSystemBConfigData) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onCurrentVersion version = ${version.version}") CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onCurrentVersion version = ${version.version}")
if (!version.version.isNullOrEmpty()) { if (!version.version.isNullOrEmpty()) {
CallerObuInfoListenerManager.invokeObuVersionName(version.version)
CallerDevaToolsManager.queryObuUpgrade(version.version) CallerDevaToolsManager.queryObuUpgrade(version.version)
} }
} }
@@ -200,7 +199,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* @param data 系统状态 * @param data 系统状态
*/ */
override fun onObuSystemStatus(data: MogoObuSystemStatusData?) { override fun onObuSystemStatus(data: MogoObuSystemStatusData?) {
CallerObuInfoListenerManager.invokeGetObuInfo(data.toString())
} }
/** /**

View File

@@ -152,8 +152,7 @@ internal class DebugSettingView @JvmOverloads constructor(
//OBU连接状态 //OBU连接状态
private var obuConnectStatus: Boolean = false private var obuConnectStatus: Boolean = false
private var mObuVersionName: String = "" private var mObuInfoStr: String = ""
private var mObuDeviceId: String = ""
//渠道包标签 //渠道包标签
private var onlineSelected: Boolean = true private var onlineSelected: Boolean = true
@@ -574,7 +573,7 @@ internal class DebugSettingView @JvmOverloads constructor(
setLogCheckedChangeListener() setLogCheckedChangeListener()
//OBU配置信息 //OBU配置信息
tvObuInfo.text = CallerObuConnectListenerManager.getObuStatusInfoJsonString() // tvObuInfo.text = CallerObuConnectListenerManager.getObuStatusInfoJsonString()
//工控机配置信息 //工控机配置信息
tvAutopilotInfo.text = tvAutopilotInfo.text =
@@ -1537,7 +1536,6 @@ internal class DebugSettingView @JvmOverloads constructor(
}" }"
) )
tvServerSocketStatus.text = Html.fromHtml( tvServerSocketStatus.text = Html.fromHtml(
"服务器Socket状态${ "服务器Socket状态${
if (MogoStatusManager.getInstance().isSocketOnLine) { if (MogoStatusManager.getInstance().isSocketOnLine) {
@@ -1645,10 +1643,8 @@ internal class DebugSettingView @JvmOverloads constructor(
tbIsDemoMode.text = "开启美化模式" tbIsDemoMode.text = "开启美化模式"
} }
//obu TODO 后面会添加很多os那边需要显示的内容 //obu信息排查obu相关问题使用
obuVersionNameTv.text = Html.fromHtml( tvObuInfoContent.text = mObuInfoStr
"OBU版本号$mObuVersionName"
)
obuConnectStatusTv.text = Html.fromHtml( obuConnectStatusTv.text = Html.fromHtml(
"OBU连接状态${ "OBU连接状态${
@@ -1667,7 +1663,7 @@ internal class DebugSettingView @JvmOverloads constructor(
*/ */
override fun onConnectStatus(obuStatusInfo: ObuStatusInfo) { override fun onConnectStatus(obuStatusInfo: ObuStatusInfo) {
lifecycleOwner.lifecycleScope.launch { lifecycleOwner.lifecycleScope.launch {
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo) // tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
@@ -2058,12 +2054,7 @@ internal class DebugSettingView @JvmOverloads constructor(
setLogCheckedChangeListener() setLogCheckedChangeListener()
} }
override fun onGetObuVersionName(obuVersionName: String) { override fun onGetObuInfo(obuInfoStr: String) {
mObuVersionName = obuVersionName mObuInfoStr = obuInfoStr
} }
override fun onObuDeviceId(obuDeviceId: String) {
mObuDeviceId = obuDeviceId
}
} }

View File

@@ -1086,16 +1086,16 @@
android:background="#F0F0F0" android:background="#F0F0F0"
app:layout_constraintTop_toBottomOf="@id/btnSetObuIP" /> app:layout_constraintTop_toBottomOf="@id/btnSetObuIP" />
<TextView <!-- <TextView-->
android:id="@+id/tvObuInfo" <!-- android:id="@+id/tvObuInfo"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:layout_margin="@dimen/dp_5" <!-- android:layout_margin="@dimen/dp_5"-->
android:minLines="4" <!-- android:minLines="3"-->
android:text="OBU配置信息" <!-- android:text="OBU配置信息"-->
android:textColor="#000" <!-- android:textColor="#000"-->
android:textSize="@dimen/dp_24" <!-- android:textSize="@dimen/dp_24"-->
app:layout_constraintTop_toBottomOf="@id/obuDivider" /> <!-- app:layout_constraintTop_toBottomOf="@id/obuDivider" />-->
<LinearLayout <LinearLayout
android:id="@+id/obuStatusCenterLayout" android:id="@+id/obuStatusCenterLayout"
@@ -1104,31 +1104,33 @@
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible" android:visibility="visible"
tools:visibility="visible" tools:visibility="visible"
app:layout_constraintTop_toBottomOf="@id/tvObuInfo" app:layout_constraintTop_toBottomOf="@id/obuDivider"
tools:ignore="MissingConstraints"> tools:ignore="MissingConstraints">
<TextView
<TextView android:id="@+id/obuConnectStatusTv"
android:id="@+id/obuVersionNameTv" style="@style/DebugSettingText"
style="@style/DebugSettingText" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="wrap_content" />
android:layout_height="wrap_content" /> <View
android:layout_width="match_parent"
<View android:layout_height="1dp"
android:layout_width="match_parent" android:background="#F0F0F0" />
android:layout_height="1dp" <TextView
android:background="#F0F0F0" /> android:id="@+id/obuVersionNameTv"
style="@style/DebugSettingText"
<TextView android:text="OBU信息"
android:id="@+id/obuConnectStatusTv" android:layout_width="match_parent"
style="@style/DebugSettingText" android:layout_height="wrap_content" />
android:layout_width="match_parent" <View
android:layout_height="wrap_content" /> android:layout_width="match_parent"
android:layout_height="1dp"
<View android:background="#F0F0F0" />
android:layout_width="match_parent" <TextView
android:layout_height="1dp" android:id="@+id/tvObuInfoContent"
android:background="#F0F0F0" /> style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3" />
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -125,7 +125,7 @@ public class TrackManager {
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos()); cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
mMarkersCaches.put(uuid, trackObj); mMarkersCaches.put(uuid, trackObj);
trafficDataUuid.add(uuid); trafficDataUuid.add(uuid);
Log.i("costTime","" + (System.currentTimeMillis() - cost)); //Log.i("costTime","" + (System.currentTimeMillis() - cost));
} }
return mFilterTrafficData; return mFilterTrafficData;
} }

View File

@@ -9,14 +9,8 @@ package com.mogo.eagle.core.function.api.datacenter.obu
interface IMoGoObuInfoListener { interface IMoGoObuInfoListener {
/** /**
* @param obuVersionName OBU硬件版本 * @param obuInfoStr OBU信息
*/ */
fun onGetObuVersionName(obuVersionName: String) fun onGetObuInfo(obuInfoStr: String)
/**
* obuDeviceId
*/
fun onObuDeviceId(obuDeviceId: String)
} }

View File

@@ -9,25 +9,12 @@ import com.mogo.eagle.core.function.call.base.CallerBase
*/ */
object CallerObuInfoListenerManager : CallerBase<IMoGoObuInfoListener>() { object CallerObuInfoListenerManager : CallerBase<IMoGoObuInfoListener>() {
fun invokeObuVersionName(obuVersionName: String) { fun invokeGetObuInfo(obuInfoStr: String) {
M_LISTENERS.forEach { M_LISTENERS.forEach {
val listener = it.value val listener = it.value
listener.onGetObuVersionName(obuVersionName) listener.onGetObuInfo(obuInfoStr)
} }
} }
fun invokeObuDeviceId(obuDeviceId: String) {
M_LISTENERS.forEach {
val listener = it.value
listener.onObuDeviceId(obuDeviceId)
}
}
// fun invokeQueryContainersResponse(dockerList: List<String>) {
// M_LISTENERS.forEach {
// val listener = it.value
// //TODO
// }
// }
} }

View File

@@ -66,23 +66,23 @@ SERVICE_BIZ_VERSION=1.2.4
LOGLIB_VERSION=1.5.11 LOGLIB_VERSION=1.5.11
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION # 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.5.7 MOGO_NETWORK_VERSION=1.4.5.10
# 鉴权 # 鉴权
MOGO_PASSPORT_VERSION=1.4.5.7 MOGO_PASSPORT_VERSION=1.4.5.10
# 常链接 # 常链接
MOGO_SOCKET_VERSION=1.4.5.7 MOGO_SOCKET_VERSION=1.4.5.10
# 数据采集 # 数据采集
MOGO_REALTIME_VERSION=1.4.5.7 MOGO_REALTIME_VERSION=1.4.5.10
# 探路,道路事件发布,获取 # 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.5.7 MOGO_TANLU_VERSION=1.4.5.10
# 直播推流 # 直播推流
MOGO_LIVE_VERSION=1.4.5.7 MOGO_LIVE_VERSION=1.4.5.10
# 直播拉流 # 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.5.7 MOGO_TRAFFICLIVE_VERSION=1.4.5.10
# 定位服务 # 定位服务
MOGO_LOCATION_VERSION=1.4.5.7 MOGO_LOCATION_VERSION=1.4.5.10
# 远程通讯模块 # 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.5.7 MOGO_TELEMATIC_VERSION=1.4.5.10
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 自研地图 # 自研地图
MAP_SDK_VERSION=2.10.0.9 MAP_SDK_VERSION=2.10.0.9

View File

@@ -4,7 +4,6 @@ import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_INIT_ON_MAP_LOADED; import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_INIT_ON_MAP_LOADED;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT; import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS; import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
import static com.mogo.eagle.core.utilcode.mogo.logger.Logger.d;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300; import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300;
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS; import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS;
@@ -41,8 +40,8 @@ import com.mogo.eagle.core.function.call.map.CallerMapDevaListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.hdcache.IHdCacheListener; import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.map.listener.MogoMapListenerHandler; import com.mogo.map.listener.MogoMapListenerHandler;
@@ -168,17 +167,19 @@ public class AMapViewWrapper implements IMogoMapView,
return; return;
} }
MapAutoViewHelper options = mMapView.getMapAutoViewHelper(); MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
if (options != null) { ThreadUtils.getIoPool().submit(() -> {
//设置手势是否可以缩放 isCanZoom true 可缩放 false 不可缩放 if (options != null) {
options.setZoomGesturesEnabled(true); //设置手势是否可以缩放 isCanZoom true 可缩放 false 不可缩放
options.setScaleVRMode(true); options.setZoomGesturesEnabled(true);
options.setScaleVRMode(true);
// options.setAllGesturesEnabled(false); //禁止全部手势 // options.setAllGesturesEnabled(false); //禁止全部手势
if (options.getMyLocationStyle() != null) { if (options.getMyLocationStyle() != null) {
options.getMyLocationStyle().setDisplayAnimEnable(true); options.getMyLocationStyle().setDisplayAnimEnable(true);
}
//修改自车模型,未来需区分车的类型
options.setMyLocationStyle(options.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true));
} }
//修改自车模型,未来需区分车的类型 });
options.setMyLocationStyle(options.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true));
}
} }
private void initListeners() { private void initListeners() {

View File

@@ -77,7 +77,7 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills() lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等 // 将高德中的一些用于业务的数据进行融合例如CityCode、address等
mapLocation?.let { aMapLocation.let {
// 转换 GCJ02-->WGS84 坐标 // 转换 GCJ02-->WGS84 坐标
val wgs84Location = val wgs84Location =
CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude) CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude)
@@ -112,17 +112,17 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
lastGaoDeLocation.errorInfo = it.errorInfo lastGaoDeLocation.errorInfo = it.errorInfo
} }
// 回掉给监听者 try {
CallerGaoDeMapLocationListenerManager.invokeMoGoLocationChanged(lastGaoDeLocation) mapLocation = aMapLocation
// 本地SP缓存城市Code
mapLocation = aMapLocation val cityCode = aMapLocation.cityCode
// 本地SP缓存城市Code if (cityCode != null && cityCode.isNotEmpty()) {
val cityCode = aMapLocation.cityCode mCityCode = aMapLocation.cityCode
if (cityCode != null && cityCode.isNotEmpty()) { SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
mCityCode = aMapLocation.cityCode .putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) }
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
// 缓存经纬度
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString( .putString(
SharedPrefsConstants.LOCATION_LATITUDE, SharedPrefsConstants.LOCATION_LATITUDE,
@@ -133,7 +133,11 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
SharedPrefsConstants.LOCATION_LONGITUDE, SharedPrefsConstants.LOCATION_LONGITUDE,
aMapLocation.longitude.toString() aMapLocation.longitude.toString()
) )
} catch (e: Exception) {
e.printStackTrace()
} }
// 回掉给监听者
CallerGaoDeMapLocationListenerManager.invokeMoGoLocationChanged(lastGaoDeLocation)
} }
} }

View File

@@ -39,6 +39,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
dependencies { dependencies {

View File

@@ -3,8 +3,6 @@ package com.mogo.test.crashreport.apm;
import android.content.Context; import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.apm.insight.AttachUserData;
import com.apm.insight.CrashType;
import com.apm.insight.MonitorCrash; import com.apm.insight.MonitorCrash;
import com.apm.insight.log.VLog; import com.apm.insight.log.VLog;
import com.bytedance.apm.insight.ApmInsight; import com.bytedance.apm.insight.ApmInsight;
@@ -12,8 +10,9 @@ import com.bytedance.apm.insight.ApmInsightAgent;
import com.bytedance.apm.insight.ApmInsightInitConfig; import com.bytedance.apm.insight.ApmInsightInitConfig;
import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.deva.bindingcar.CarInfo; import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.deva.bindingcar.CarInfo;
import com.mogo.eagle.core.function.api.devatools.apm.IApmEnvProvider; import com.mogo.eagle.core.function.api.devatools.apm.IApmEnvProvider;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
@@ -22,11 +21,11 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CommonUtils; import com.mogo.eagle.core.utilcode.util.CommonUtils;
import com.mogo.eagle.core.utilcode.util.DeviceUtils; import com.mogo.eagle.core.utilcode.util.DeviceUtils;
import com.mogo.eagle.core.utilcode.util.GsonUtils; import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.MetaDataUtils;
import com.mogo.test.crashreport.CrashReportConstants; import com.mogo.test.crashreport.CrashReportConstants;
import com.mogo.test.crashreport.ITestCrashReportProvider; import com.mogo.test.crashreport.ITestCrashReportProvider;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
/** /**
@@ -38,7 +37,9 @@ import java.util.Map;
@Route(path = CrashReportConstants.PATH) @Route(path = CrashReportConstants.PATH)
public class ApmCrashReportProvider implements ITestCrashReportProvider { public class ApmCrashReportProvider implements ITestCrashReportProvider {
private static final String BYTEAMP_APPID = "302368"; private static final String BYTEAMP_APPID = "302368";
private static final String BYTEAMP_AppToken = "de428a1a8b204c82ac60088aaf9205a3";
private static final String BYTEAMP_APPID_DEV = "379950"; private static final String BYTEAMP_APPID_DEV = "379950";
private static final String BYTEAMP_AppToken_DEV = "3a78191bc18842118c5b4515ec9bfefc";
private static final String TAG = "ApmCrashReportProvider"; private static final String TAG = "ApmCrashReportProvider";
private static final String MAP_SDK_VERSION = "MAP_SDK_VERSION"; private static final String MAP_SDK_VERSION = "MAP_SDK_VERSION";
@@ -49,11 +50,6 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
@Override @Override
public void init(Context context) { public void init(Context context) {
initCrash(context);
initApmInsight(context);
}
private void initCrash(final Context context) {
IApmEnvProvider provider = CallerDevaToolsManager.INSTANCE.apmEnvProvider(); IApmEnvProvider provider = CallerDevaToolsManager.INSTANCE.apmEnvProvider();
boolean isDebug = DebugConfig.isDebug(); boolean isDebug = DebugConfig.isDebug();
if (provider != null) { if (provider != null) {
@@ -62,85 +58,167 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
isDebug = enabled; isDebug = enabled;
} }
} }
MonitorCrash crash = MonitorCrash.init(context, isDebug ? BYTEAMP_APPID_DEV : BYTEAMP_APPID, CommonUtils.getVersionCode(context), CommonUtils.getVersionName(context)) initCrash(context, isDebug);
.setCustomDataCallback(new AttachUserData() { initApmInsight(context, isDebug);
@Override }
public Map<? extends String, ? extends String> getUserData(CrashType type) {
HashMap<String, String> map = new HashMap<>();
//车辆信息
String carInfoString = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO);
if (carInfoString != null && !carInfoString.isEmpty()) { private void initCrash(final Context context, boolean isDebug) {
mInfo = GsonUtils.fromJson(carInfoString, CarInfo.class); MonitorCrash.Config config =
} MonitorCrash.Config
.app(isDebug ? BYTEAMP_APPID_DEV : BYTEAMP_APPID)
.token(isDebug ? BYTEAMP_AppToken_DEV : BYTEAMP_AppToken)// 设置鉴权token可从平台应用信息处获取token错误无法上报数据
.versionCode(CommonUtils.getVersionCode(context))// 可选默认取PackageInfo中的versionCode
.versionName(CommonUtils.getVersionName(context))// 可选默认取PackageInfo中的versionName
.channel(MetaDataUtils.getMetaDataInApp("BUGLY_APP_CHANNEL"))// 可选设置App发布渠道在平台可以筛选
// .url("www.xxx.com")// 默认不需要,私有化部署才配置上报地址
//可选,可以设置自定义 did不设置会使用内部默认的
.dynamicParams(new MonitorCrash.Config.IDynamicParams() {
@Override
public String getDid() {//返回空会使用内部默认的did
String sn = SharedPrefsMgr.getInstance(context).getString("sn");
if (sn != null && !sn.isEmpty()) {
return sn;
} else {
return DeviceUtils.getDeviceSN().isEmpty() ? null : DeviceUtils.getDeviceSN();
}
}
//车辆所在位置 @Override
mCityCode = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_CITY_CODE); public String getUserId() {
mLat = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LATITUDE); return DeviceUtils.getDeviceSN();
mLogt = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LONGITUDE); }
//地图版本 })
String mapSDKVersion = DebugConfig.getMapVersion(); //应用崩溃后会执行这里,可选,添加业务自定义数据,在崩溃详情页->现场数据展示->自定义数据
map.put("MAP_SDK_VERSION", mapSDKVersion); .customData(crashType -> {
map.put("CITYCODE", mCityCode); //车辆所在位置
map.put("LATITUDE", mLat); mCityCode = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_CITY_CODE);
map.put("LONGITUTE", mLogt); mLat = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LATITUDE);
mLogt = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LONGITUDE);
//车辆信息
String carInfoString = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO);
if (carInfoString != null && !carInfoString.isEmpty()) {
mInfo = GsonUtils.fromJson(carInfoString, CarInfo.class);
}
if (mInfo != null) { //======================================== 自定义维度值 begin========================================
CallerLogger.INSTANCE.d(TAG, "nuber = " + mInfo.getNumber_plate() + "--brand = " + mInfo.getBrand() + "--modle = " + mInfo.getModel()); HashMap<String, String> dimension = new HashMap<>();
map.put("PLATE_NUMBER", mInfo.getNumber_plate()); // dimension.put("Devices_SN_DeviceId", sn + "__" + DeviceUtils.getDeviceSN());
map.put("BRAND", mInfo.getBrand()); // dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
map.put("MODEL", mInfo.getModel()); // dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context));
} //************************************* APP构建的信息 ***********************************************
return map; // Git版本信息
} dimension.put("GIT_BRANCH", AppConfigInfo.INSTANCE.getWorkingBranchName());
}); dimension.put("GIT_HASH", AppConfigInfo.INSTANCE.getWorkingBranchHash());
String mapSDKVersion = DebugConfig.getMapVersion(); // 地图版本
crash.config().setChannel("MAP_SDK_VERSION:" + mapSDKVersion); dimension.put("APP_MAP_SDK_VERSION", DebugConfig.getMapVersion());
//可选可以设置自定义did,不设置会使用内部默认的 // 渠道信息
String sn = SharedPrefsMgr.getInstance(context).getString("sn"); dimension.put("APP_CHANNEL", MetaDataUtils.getMetaDataInApp("BUGLY_APP_CHANNEL"));
if (sn != null && !sn.isEmpty()) { // 车辆类型
crash.config().setDeviceId(sn); dimension.put("APP_CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode));
} else { //************************************* APP构建的信息 ***********************************************
crash.config().setDeviceId(DeviceUtils.getDeviceSN());
}
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
crash.addTags("CITYCODE", mCityCode);
crash.addTags("LATITUDE", mLat);
crash.addTags("LONGITUTE", mLogt);
crash.addTags("CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode));
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址 //************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖 // 连接的OBU 状态
dimension.put("OBU_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectObu());
// 车牌号,从工控机获取的数据
dimension.put("IPC_PLATE_NUMBER", AppConfigInfo.INSTANCE.getPlateNumber());
// 连接的工控机 状态
dimension.put("IPC_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectAutopilot());
// 连接的工控机 MAC地址
dimension.put("IPC_MAC", AppConfigInfo.INSTANCE.getIPCMacAddress());
// 连接的工控机 Docker版本
dimension.put("IPC_MAP_VERSION", AppConfigInfo.INSTANCE.getDockerVersion());
// 连接的工控机 Protocol版本
dimension.put("IPC_MAP_PROTOCOL_VERSION", "" + AppConfigInfo.INSTANCE.getProtocolVersionNumber());
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
HashMap<String, String> dimension = new HashMap<>(); //************************************* 位置信息 ***********************************************
//维度值 // 城市信息
dimension.put("Devices_SN_DeviceId", sn + "__" + DeviceUtils.getDeviceSN()); dimension.put("LOCATION_CITY_CODE", mCityCode);
// dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context)); dimension.put("LOCATION_LATITUDE", mLat);
// dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context)); dimension.put("LOCATION_LONGITUTE", mLogt);
dimension.put(MAP_SDK_VERSION, mapSDKVersion); //************************************* 位置信息 ***********************************************
dimension.put("CITYCODE", mCityCode);
dimension.put("LATITUDE", mLat);
dimension.put("LONGITUTE", mLogt);
if (mInfo != null) {
dimension.put("PLATE_NUMBER", mInfo.getNumber_plate());
dimension.put("BRAND", mInfo.getBrand());
dimension.put("MODEL", mInfo.getModel());
}
HashMap<String, Double> metric = new HashMap<>(); //************************************* CMDB绑定的信息 ***********************************************
//指标值 if (mInfo != null) {
//metric.put("Devices_ID_metric", (double) 100); dimension.put("CMDB_PLATE_NUMBER", mInfo.getNumber_plate());
ApmInsightAgent.monitorEvent("Devices_ID_EVENT", dimension, metric); dimension.put("CMDB_BRAND", mInfo.getBrand());
dimension.put("CMDB_MODEL", mInfo.getModel());
}
//************************************* CMDB绑定的信息 ***********************************************
HashMap<String, Double> metric = new HashMap<>();
//指标值
//metric.put("Devices_ID_metric", (double) 100);
ApmInsightAgent.monitorEvent("Devices_ID_EVENT", dimension, metric);
//======================================== 自定义维度值 end========================================
//===================================== 自定义收集一些信息,在崩溃详情页->现场数据展示->自定义数据 begin========================================
HashMap<String, String> map = new HashMap<>();
//************************************* APP构建的信息 ***********************************************
// Git版本信息
map.put("GIT_BRANCH", AppConfigInfo.INSTANCE.getWorkingBranchName());
map.put("GIT_HASH", AppConfigInfo.INSTANCE.getWorkingBranchHash());
// 地图版本
map.put("APP_MAP_SDK_VERSION", DebugConfig.getMapVersion());
// 渠道信息
map.put("APP_CHANNEL", MetaDataUtils.getMetaDataInApp("BUGLY_APP_CHANNEL"));
// 车辆类型
map.put("APP_CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode));
//************************************* APP构建的信息 ***********************************************
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
// 连接的OBU 状态
map.put("OBU_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectObu());
// 车牌号,从工控机获取的数据
map.put("IPC_PLATE_NUMBER", AppConfigInfo.INSTANCE.getPlateNumber());
// 连接的工控机 状态
map.put("IPC_CONNECT_STATUS", "" + AppConfigInfo.INSTANCE.isConnectAutopilot());
// 连接的工控机 MAC地址
map.put("IPC_MAC", AppConfigInfo.INSTANCE.getIPCMacAddress());
// 连接的工控机 Docker版本
map.put("IPC_MAP_VERSION", AppConfigInfo.INSTANCE.getDockerVersion());
// 连接的工控机 Protocol版本
map.put("IPC_MAP_PROTOCOL_VERSION", "" + AppConfigInfo.INSTANCE.getProtocolVersionNumber());
//************************************* 与车辆连接的 IPC工控机、OBU 等信息 ***********************************************
//************************************* 位置信息 ***********************************************
// 城市信息
map.put("LOCATION_CITY_CODE", mCityCode);
map.put("LOCATION_LATITUDE", mLat);
map.put("LOCATION_LONGITUTE", mLogt);
//************************************* 位置信息 ***********************************************
//************************************* CMDB绑定的信息 ***********************************************
if (mInfo != null) {
CallerLogger.INSTANCE.d(TAG, "nuber = " + mInfo.getNumber_plate() + "--brand = " + mInfo.getBrand() + "--modle = " + mInfo.getModel());
map.put("CMDB_PLATE_NUMBER", mInfo.getNumber_plate());
map.put("CMDB_BRAND", mInfo.getBrand());
map.put("CMDB_MODEL", mInfo.getModel());
}
//************************************* CMDB绑定的信息 ***********************************************
return map;
//===================================== 自定义收集一些信息,在崩溃详情页->现场数据展示->自定义数据 end========================================
})
// 可选添加pv事件的自定义tag可以用来筛选崩溃率计算的分母数据
//.pageViewTags(<<Map<String, String>>>)
.build();
MonitorCrash monitorCrash = MonitorCrash.init(context, config);
} }
/** /**
* ApmInsight性能监控初始化 * ApmInsight性能监控初始化
*/ */
private void initApmInsight(Context context) { private void initApmInsight(Context context, boolean isDebug) {
ApmInsightInitConfig.Builder builder = ApmInsightInitConfig.builder(); ApmInsightInitConfig.Builder builder = ApmInsightInitConfig.builder();
//设置分配的appid //设置分配的appid
builder.aid(BYTEAMP_APPID); builder.aid(isDebug ? BYTEAMP_APPID_DEV : BYTEAMP_APPID);
//设置分配的AppToken
builder.token(isDebug ? BYTEAMP_AppToken_DEV : BYTEAMP_AppToken);
//是否开启卡顿功能 //是否开启卡顿功能
builder.blockDetect(true); builder.blockDetect(true);
//是否开启严重卡顿功能 //是否开启严重卡顿功能
@@ -153,6 +231,12 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
builder.memoryMonitor(true); builder.memoryMonitor(true);
//控制是否打开电量监控 //控制是否打开电量监控
builder.batteryMonitor(true); builder.batteryMonitor(true);
//控制是否打开CPU监控
builder.cpuMonitor(true);
//控制是否打开磁盘监控
builder.diskMonitor(true);
//控制是否打开流量监控
builder.trafficMonitor(true);
//是否打印日志线上release版本要配置为false //是否打印日志线上release版本要配置为false
builder.debugMode(true); builder.debugMode(true);
//支持用户自定义user_id把平台数据和自己用户关联起来可以不配置 //支持用户自定义user_id把平台数据和自己用户关联起来可以不配置
@@ -160,7 +244,7 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
//私有化部署:配置数据上报的域名 私有化部署才需要配置内部有默认域名测试支持设置http://www.xxx.com 默认是https协议 //私有化部署:配置数据上报的域名 私有化部署才需要配置内部有默认域名测试支持设置http://www.xxx.com 默认是https协议
// builder.defaultReportDomain("www.xxx.com"); // builder.defaultReportDomain("www.xxx.com");
//设置渠道。1.3.16版本增加接口 //设置渠道。1.3.16版本增加接口
builder.channel("local"); builder.channel(MetaDataUtils.getMetaDataInApp("BUGLY_APP_CHANNEL"));
//打开自定义日志回捞能力1.4.1版本新增接口 //打开自定义日志回捞能力1.4.1版本新增接口
builder.enableLogRecovery(true); builder.enableLogRecovery(true);
//设置数据和Rangers Applog数据打通设备标识did必填。1.3.16版本增加接口 //设置数据和Rangers Applog数据打通设备标识did必填。1.3.16版本增加接口