diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 46fb18b8dc..f7700b1668 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -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; diff --git a/core/README.md b/core/README.md index ba2ca3c14f..767091bc8a 100644 --- a/core/README.md +++ b/core/README.md @@ -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:基于成熟的工具类开源框架下沉的,这里可以增添针对我们业务上的一些工具类 diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index a6f481b4a8..eacd9256cd 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -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') } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index c0eb75381f..bcd0564a1d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -102,6 +102,8 @@ class MoGoHmiFragment : MvpFragment 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 onBadCaseHide = onHide } + /** + *注册工控机升级提示圆点View的回调 + * @param 提示圆点View + */ + override fun registerUpgradeTipsCallback(tipsView: () -> View) { + upgradeTipsView = tipsView + } + /** * 工控机重启返回结果 * @param code @@ -1093,11 +1103,21 @@ class MoGoHmiFragment : MvpFragment 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) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index ddc8434d76..fbbc1af7f3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -112,8 +112,8 @@ View, onHide: (() -> Unit)?) + /** + *注册工控机升级提示圆点View的回调 + * @param 提示圆点View + */ + fun registerUpgradeTipsCallback(tipsView:() -> View) + /** * 工控机重启返回结果 * @param code diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index f7a25198d8..a7f5173590 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -273,6 +273,14 @@ object CallerHmiManager : CallerBase() { waringProviderApi?.registerBadCaseCallback(onShow, onHide) } + /** + *注册工控机升级提示圆点View的回调 + * @param 提示圆点View + */ + fun registerUpgradeTipsCallback(tipsView:() -> View){ + waringProviderApi?.registerUpgradeTipsCallback(tipsView) + } + /** * 工控机重启返回结果 * @param code diff --git a/core/mogo-core-utils/src/main/AndroidManifest.xml b/core/mogo-core-utils/src/main/AndroidManifest.xml index c953b8a6ce..11c86de1fd 100644 --- a/core/mogo-core-utils/src/main/AndroidManifest.xml +++ b/core/mogo-core-utils/src/main/AndroidManifest.xml @@ -1,6 +1,8 @@ + + = 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); + } + } \ No newline at end of file diff --git a/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java b/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java index 7fd5286c10..86e15da72e 100644 --- a/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java +++ b/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java @@ -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 - * + *

* 描述 */ @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 dimension = new HashMap<>(); + //维度值 + dimension.put("Devices_ID", DeviceIdUtils.getWidevineID(context)); + HashMap metric = new HashMap<>(); + //指标值 + metric.put("Devices_ID_metric", (double) 100); + ApmInsightAgent.monitorEvent("Devices_ID_EVENT", dimension, metric); } /**