From 393d4d26478b1f2d220b6a8a147fda95995025a4 Mon Sep 17 00:00:00 2001 From: xuxinchao <13522809046@163.com> Date: Mon, 28 Feb 2022 19:21:44 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=B7=A5=E6=8E=A7=E6=9C=BA=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、添加网约车小红点View回调、显示逻辑 2、修改鹰眼小红点大小 --- .../com/mogo/launcher/MogoApplication.java | 1 + .../core/function/hmi/ui/MoGoHmiFragment.kt | 24 +++++++++++++++++-- .../src/main/res/layout/fragment_hmi.xml | 4 ++-- .../eagle/core/data/config/HmiBuildConfig.kt | 6 +++++ .../api/hmi/warning/IMoGoWaringProvider.kt | 6 +++++ .../function/call/hmi/CallerHmiManager.kt | 8 +++++++ 6 files changed, 45 insertions(+), 4 deletions(-) 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/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 From 31a0fdd86d46600a2881c0e385475e736e1e6e31 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 28 Feb 2022 19:32:51 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[Change]=20=E5=A2=9E=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E5=AD=97=E7=89=88=E6=9D=83=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=AE=BE=E5=A4=87ID=E6=96=B9=E6=B3=95=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=9B=A0=E4=B8=BA=E7=B3=BB=E7=BB=9F=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E7=AD=89=E5=8E=9F=E5=9B=A0=E9=80=A0=E6=88=90=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9A=84SN=E8=A2=AB=E6=94=B9=E5=8F=98=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../src/main/AndroidManifest.xml | 2 + .../core/utilcode/util/DeviceIdUtils.java | 93 ++++++++++++++----- 2 files changed, 74 insertions(+), 21 deletions(-) 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 From 5133e9813082b670b880911dfd4dead17fe5f692 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 28 Feb 2022 20:41:36 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[Change]=20=E5=A2=9E=E5=8A=A0APM=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5pad=E5=94=AF=E4=B8=80=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../crashreport/apm/ApmCrashReportProvider.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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..2460e95e1d 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("event1", dimension, metric); } /** From 222491d70cb1c775e5d1243a964f9bd05343a4d3 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 28 Feb 2022 20:43:40 +0800 Subject: [PATCH 4/5] =?UTF-8?q?[Change]=20=E5=A2=9E=E5=8A=A0APM=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5pad=E5=94=AF=E4=B8=80=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../com/mogo/test/crashreport/apm/ApmCrashReportProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2460e95e1d..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 @@ -68,7 +68,7 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider { HashMap metric = new HashMap<>(); //指标值 metric.put("Devices_ID_metric", (double) 100); - ApmInsightAgent.monitorEvent("event1", dimension, metric); + ApmInsightAgent.monitorEvent("Devices_ID_EVENT", dimension, metric); } /** From 95c0c0c8830cef0bcb39991ff4cb82686984a54c Mon Sep 17 00:00:00 2001 From: donghongyu Date: Tue, 1 Mar 2022 11:47:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?[Change]=20=E5=A2=9E=E5=8A=A0README?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=20=E8=B0=83=E6=95=B4=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- core/README.md | 26 +++++++++---------- .../mogo-core-function-hmi/build.gradle | 4 +-- 2 files changed, 15 insertions(+), 15 deletions(-) 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') }