Merge branch 'dev_MogoAP_eagle-220_211207_8.0.17_merge' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_MogoAP_eagle-220_211207_8.0.17_merge
This commit is contained in:
@@ -89,6 +89,7 @@ public class MogoApplication extends MainMoGoApplication {
|
||||
HmiBuildConfig.isShowPerspectiveSwitchView = false;
|
||||
HmiBuildConfig.isShowToolsView = false;
|
||||
HmiBuildConfig.isShowBadCaseView = false;
|
||||
HmiBuildConfig.isShowUpgradeTipsView = false;
|
||||
//业务端可以根据需要控制是否展示刹车和转向灯的ui
|
||||
// HmiBuildConfig.isShowBrakeLightView = false;
|
||||
// HmiBuildConfig.isShowTurnLightView = false;
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
本模块用来编写鹰眼核型功能
|
||||
|
||||
- function-impl 目录下编写的都是对mogo-core-function-api定的功能实现,
|
||||
- mogo-core-function-check 程序及车辆检测模块
|
||||
- mogo-core-function-devatools 开发工具模块
|
||||
- mogo-core-function-hmi UI呈现及交互模块
|
||||
- mogo-core-function-main 主入口
|
||||
- mogo-core-function-map 地图相关的模块
|
||||
- mogo-core-function-monitoring 远距离监控查看,路测摄像头、前车直播
|
||||
- mogo-core-function-notice 云端公告、调度相关模块
|
||||
- mogo-core-function-obu-mogo 自研OBU预警模块
|
||||
- mogo-core-function-smp 小地图模块
|
||||
- mogo-core-function-v2x 自车+云端预警模块
|
||||
- check 程序及车辆检测模块
|
||||
- devatools 开发工具模块
|
||||
- hmi UI呈现及交互模块
|
||||
- main 主入口(模块加载、后台服务启动、多进程启动等)
|
||||
- map 地图相关的模块
|
||||
- monitoring 行车超视距模块,路测摄像头、前车直播
|
||||
- notice 云端公告、调度相关模块
|
||||
- obu-mogo 自研OBU预警模块
|
||||
- smp 小地图模块
|
||||
- v2x 自车+云端预警模块
|
||||
|
||||
- mogo-core-data:定义基础业务所需要的数据结构
|
||||
|
||||
- mogo-core-function-res:这里只存放公共资源,图片,布局,动画等
|
||||
|
||||
- mogo-core-network:公共网络请求
|
||||
|
||||
- mogo-core-function-api:定义基础业务功能的接口
|
||||
|
||||
- mogo-core-function-call:定义基础业务暴露给外部调用的接口,对function-impl的二次封装,只将能对外调用的功能进行封装
|
||||
|
||||
- mogo-core-res:程序中涉及到的图片及布局资源,同一管理,并通过设置不同的目录指定是那个模块的资源
|
||||
- mogo-core-res:程序中涉及到的图片及布局资源,同一管理,并通过设置不同的目录指定是那个模块的资源,这里只存放公共资源,图片,布局,动画等
|
||||
|
||||
- mogo-core-utils:基于成熟的工具类开源框架下沉的,这里可以增添针对我们业务上的一些工具类
|
||||
|
||||
@@ -59,8 +59,8 @@ dependencies {
|
||||
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
compileOnly rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation project(':libraries:map-usbcamera')
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
@@ -76,7 +76,7 @@ dependencies {
|
||||
implementation project(':core:mogo-core-res')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-res')
|
||||
implementation project(':core:mogo-core-network')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
private var onBadCaseShow: (() -> View)? = null
|
||||
private var onBadCaseHide: (() -> Unit)? = null
|
||||
|
||||
private var upgradeTipsView: (() -> View)? = null
|
||||
|
||||
companion object {
|
||||
private const val MSG_WHAT_DISMISS_BAD_CASE_ENTRY = 0x1010
|
||||
private val CASE_EXPIRE_DURATION = TimeUnit.HOURS.toMillis(4)
|
||||
@@ -362,6 +364,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
onBadCaseHide = onHide
|
||||
}
|
||||
|
||||
/**
|
||||
*注册工控机升级提示圆点View的回调
|
||||
* @param 提示圆点View
|
||||
*/
|
||||
override fun registerUpgradeTipsCallback(tipsView: () -> View) {
|
||||
upgradeTipsView = tipsView
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机重启返回结果
|
||||
* @param code
|
||||
@@ -1093,11 +1103,21 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
upgradeStatus: Int
|
||||
) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
val tipsView = upgradeTipsView?.invoke()
|
||||
//如果工控机处于“下载中”、“可升级(下载完成)”、“升级中”、“升级失败”状态时,工具箱入口显示红色角标
|
||||
if (AdUpgradeStateHelper.showUpgradeTips(downloadStatus, upgradeStatus)) {
|
||||
viewUpgradeTips.visibility = View.VISIBLE
|
||||
if (HmiBuildConfig.isShowUpgradeTipsView){
|
||||
viewUpgradeTips?.visibility = View.VISIBLE
|
||||
}else{
|
||||
tipsView?.let {
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
viewUpgradeTips.visibility = View.GONE
|
||||
viewUpgradeTips?.visibility = View.GONE
|
||||
tipsView?.let {
|
||||
it.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
//将状态同步到工具箱
|
||||
toolsView?.showAdUpgradeStatus(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
|
||||
@@ -112,8 +112,8 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/viewUpgradeTips"
|
||||
android:layout_width="20px"
|
||||
android:layout_height="20px"
|
||||
android:layout_width="22px"
|
||||
android:layout_height="22px"
|
||||
app:layout_constraintCircle="@id/ivToolsIcon"
|
||||
app:layout_constraintCircleAngle="45"
|
||||
app:layout_constraintCircleRadius="60px"
|
||||
|
||||
@@ -36,6 +36,12 @@ object HmiBuildConfig {
|
||||
@JvmField
|
||||
var isShowBadCaseView = true
|
||||
|
||||
/**
|
||||
* 是否展示工控机升级提示UI
|
||||
*/
|
||||
@JvmField
|
||||
var isShowUpgradeTipsView = true
|
||||
|
||||
/**
|
||||
* 是否展示转向灯ui
|
||||
*/
|
||||
|
||||
@@ -193,6 +193,12 @@ interface IMoGoWaringProvider {
|
||||
*/
|
||||
fun registerBadCaseCallback(onShow:() -> View, onHide: (() -> Unit)?)
|
||||
|
||||
/**
|
||||
*注册工控机升级提示圆点View的回调
|
||||
* @param 提示圆点View
|
||||
*/
|
||||
fun registerUpgradeTipsCallback(tipsView:() -> View)
|
||||
|
||||
/**
|
||||
* 工控机重启返回结果
|
||||
* @param code
|
||||
|
||||
@@ -273,6 +273,14 @@ object CallerHmiManager : CallerBase() {
|
||||
waringProviderApi?.registerBadCaseCallback(onShow, onHide)
|
||||
}
|
||||
|
||||
/**
|
||||
*注册工控机升级提示圆点View的回调
|
||||
* @param 提示圆点View
|
||||
*/
|
||||
fun registerUpgradeTipsCallback(tipsView:() -> View){
|
||||
waringProviderApi?.registerUpgradeTipsCallback(tipsView)
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机重启返回结果
|
||||
* @param code
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.utilcode.util">
|
||||
|
||||
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
|
||||
<application>
|
||||
|
||||
<activity
|
||||
|
||||
@@ -3,38 +3,40 @@ package com.mogo.eagle.core.utilcode.util;
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.MediaDrm;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.elegant.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.elegant.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class DeviceIdUtils {
|
||||
|
||||
public static final String KEY_DEVICE_ID = "deviceId";
|
||||
|
||||
private DeviceIdUtils() {}
|
||||
private DeviceIdUtils() {
|
||||
}
|
||||
|
||||
private static void saveDeviceId( Context context, String deviceId){
|
||||
private static void saveDeviceId(Context context, String deviceId) {
|
||||
SharedPrefsMgr.getInstance(context).putString(KEY_DEVICE_ID, deviceId);
|
||||
}
|
||||
|
||||
public static String getDeviceId( Context context) {
|
||||
if(context == null){
|
||||
public static String getDeviceId(Context context) {
|
||||
if (context == null) {
|
||||
throw new NullPointerException("context must not be null.");
|
||||
}
|
||||
|
||||
final Context appContext = context.getApplicationContext();
|
||||
String deviceId = SharedPrefsMgr.getInstance( context ).getString( KEY_DEVICE_ID );
|
||||
String deviceId = SharedPrefsMgr.getInstance(context).getString(KEY_DEVICE_ID);
|
||||
|
||||
if ( TextUtils.isEmpty( deviceId )) {
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = getDeviceIdInternal(appContext);
|
||||
if (TextUtils.isEmpty(deviceId)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
@@ -54,35 +56,37 @@ public final class DeviceIdUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
saveDeviceId(appContext,deviceId);
|
||||
saveDeviceId(appContext, deviceId);
|
||||
}
|
||||
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
private static String getDeviceIdInternal( Context context) {
|
||||
private static String getDeviceIdInternal(Context context) {
|
||||
String id = "";
|
||||
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ) {
|
||||
if ( ContextCompat.checkSelfPermission( context, Manifest.permission.READ_PHONE_STATE ) != PackageManager.PERMISSION_GRANTED ) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
TelephonyManager telephonymanager = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE);
|
||||
TelephonyManager telephonymanager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (telephonymanager != null) {
|
||||
id = telephonymanager.getDeviceId();
|
||||
if ( TextUtils.isEmpty(id))
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
id = "";
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
private static String getAndroidId( Context context) {
|
||||
private static String getAndroidId(Context context) {
|
||||
String s = "";
|
||||
s = Settings.Secure.getString(context.getContentResolver(), "android_id");
|
||||
if ( TextUtils.isEmpty(s))
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
s = "";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -95,16 +99,63 @@ public final class DeviceIdUtils {
|
||||
if (!method.isAccessible()) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
serial = ( String ) method.invoke(new Build(), "ro.serialno");
|
||||
} catch ( ClassNotFoundException e) {
|
||||
serial = (String) method.invoke(new Build(), "ro.serialno");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch ( NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch ( InvocationTargetException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch ( IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return serial;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数字版权管理设备ID
|
||||
*
|
||||
* @return WidevineID,可能为空
|
||||
*/
|
||||
public static String getWidevineID(Context context) {
|
||||
try {
|
||||
//See https://stackoverflow.com/questions/16369818/how-to-get-crypto-scheme-uuid
|
||||
//You can find some UUIDs in the https://github.com/google/ExoPlayer source code
|
||||
final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);
|
||||
MediaDrm mediaDrm = new MediaDrm(WIDEVINE_UUID);
|
||||
byte[] widevineId = mediaDrm.getPropertyByteArray(MediaDrm.PROPERTY_DEVICE_UNIQUE_ID);
|
||||
if (widevineId == null) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte aByte : widevineId) {
|
||||
sb.append(String.format("%02x", aByte));
|
||||
}
|
||||
return sb.toString();
|
||||
} catch (Exception | Error e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数字版权管理设备ID,进行MD5加密,获取32位的唯一标记,给后台生成SN
|
||||
*
|
||||
* @return WidevineID,可能为空
|
||||
*/
|
||||
public static String getWidevineIDWithMd5(Context context) {
|
||||
try {
|
||||
String widevineId = getWidevineID(context);
|
||||
if (!TextUtils.isEmpty(widevineId)) {
|
||||
widevineId = EncryptUtils.encryptHmacMD5ToString(widevineId, "MoGoAuto");
|
||||
return widevineId;
|
||||
} else {
|
||||
return getDeviceId(context);
|
||||
}
|
||||
} catch (Exception | Error e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return getDeviceId(context);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,11 +8,13 @@ import com.apm.insight.CrashType;
|
||||
import com.apm.insight.MonitorCrash;
|
||||
import com.apm.insight.log.VLog;
|
||||
import com.bytedance.apm.insight.ApmInsight;
|
||||
import com.bytedance.apm.insight.ApmInsightAgent;
|
||||
import com.bytedance.apm.insight.ApmInsightInitConfig;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.CommonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceIdUtils;
|
||||
import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.mogo.test.crashreport.ITestCrashReportProvider;
|
||||
|
||||
@@ -23,7 +25,7 @@ import java.util.Map;
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/9
|
||||
*
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = CrashReportConstants.PATH)
|
||||
@@ -39,7 +41,8 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
initCrash(context);
|
||||
initApmInsight(context);
|
||||
}
|
||||
private void initCrash(final Context context) {
|
||||
|
||||
private void initCrash(final Context context) {
|
||||
|
||||
MonitorCrash crash = MonitorCrash.init(context, BYTEAMP_APPID, CommonUtils.getVersionCode(context), CommonUtils.getVersionName(context))
|
||||
.setCustomDataCallback(new AttachUserData() {
|
||||
@@ -55,9 +58,17 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
crash.config().setChannel("eagle");
|
||||
crash.config().setDeviceId(MoGoAiCloudClientConfig.getInstance().getSn());//可选,可以设置自定义did,不设置会使用内部默认的
|
||||
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
||||
crash.addTags(MAP_SDK_VERSION,mapSDKVersion);
|
||||
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
|
||||
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
|
||||
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
|
||||
|
||||
HashMap<String, String> dimension = new HashMap<>();
|
||||
//维度值
|
||||
dimension.put("Devices_ID", DeviceIdUtils.getWidevineID(context));
|
||||
HashMap<String, Double> metric = new HashMap<>();
|
||||
//指标值
|
||||
metric.put("Devices_ID_metric", (double) 100);
|
||||
ApmInsightAgent.monitorEvent("Devices_ID_EVENT", dimension, metric);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user