diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/AppUtils.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/AppUtils.java index ef027bcaac..a28fa486dd 100644 --- a/foudations/mogo-utils/src/main/java/com/mogo/utils/AppUtils.java +++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/AppUtils.java @@ -6,7 +6,9 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.os.Bundle; import android.text.TextUtils; +import android.util.Log; import java.util.List; @@ -58,6 +60,25 @@ public class AppUtils { } } + private static final String MOGO_MAP_SDK_VERSION = "MAP_SDK_VERSION"; + + public static String getCustomMapSDKVersion(Context context){ + return getApplicationMetaValue(context,MOGO_MAP_SDK_VERSION); + } + + private static String getApplicationMetaValue(Context context,String metaName){ + try { + ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA); + Bundle bundle = applicationInfo.metaData; + if (bundle != null){ + return bundle.getString(metaName); + } + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + return ""; + } + public static boolean isAppForeground( Context context ) { if ( context != null ) { ActivityManager activityManager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE ); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java index 58d286ab95..9625a3d9ec 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java @@ -180,11 +180,9 @@ class BaseDrawer { AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); if (recognizedType == AdasRecognizedType.classIdCar) { return R.raw.othercar; - } else if (recognizedType == AdasRecognizedType.classIdTrafficBus - || recognizedType == AdasRecognizedType.classIdTrafficTruck) { + } else if (recognizedType == AdasRecognizedType.classIdTrafficBus) { return R.raw.bus; - } else if (recognizedType == AdasRecognizedType.classIdBicycle - || recognizedType == AdasRecognizedType.classIdMoto) { + } else if (recognizedType == AdasRecognizedType.classIdMoto) { return R.raw.motorbike; } else if (recognizedType == AdasRecognizedType.classIdStopLine) { return R.raw.stopline; @@ -192,6 +190,10 @@ class BaseDrawer { return R.raw.arraw; } else if (recognizedType == AdasRecognizedType.classIdUnKnow) { return R.raw.tache; + }else if(recognizedType == AdasRecognizedType.classIdBicycle){ + return R.raw.zixingche; + }else if(recognizedType == AdasRecognizedType.classIdTrafficTruck){ + return R.raw.kache; } return R.raw.people; } diff --git a/modules/mogo-module-common/src/main/res/raw/kache.n3d b/modules/mogo-module-common/src/main/res/raw/kache.n3d new file mode 100644 index 0000000000..4a5f519e2c Binary files /dev/null and b/modules/mogo-module-common/src/main/res/raw/kache.n3d differ diff --git a/modules/mogo-module-common/src/main/res/raw/zixingche.n3d b/modules/mogo-module-common/src/main/res/raw/zixingche.n3d new file mode 100644 index 0000000000..afee072bf7 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/raw/zixingche.n3d differ diff --git a/test/crashreport-bugly/src/main/java/com/mogo/test/crashreport/bugly/BuglyCrashReportProvider.java b/test/crashreport-bugly/src/main/java/com/mogo/test/crashreport/bugly/BuglyCrashReportProvider.java index d285c6fb2e..327cc49842 100644 --- a/test/crashreport-bugly/src/main/java/com/mogo/test/crashreport/bugly/BuglyCrashReportProvider.java +++ b/test/crashreport-bugly/src/main/java/com/mogo/test/crashreport/bugly/BuglyCrashReportProvider.java @@ -11,6 +11,7 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.test.crashreport.CrashReportConstants; import com.mogo.test.crashreport.ITestCrashReportProvider; +import com.mogo.utils.AppUtils; import com.mogo.utils.logger.Logger; import com.tencent.bugly.crashreport.CrashReport; @@ -31,7 +32,7 @@ class BuglyCrashReportProvider implements ITestCrashReportProvider { private static final String TAG = "BuglyCrashReportProvider"; @Override - public void init(final Context context ) { + public void init(Context context ) { Logger.d(TAG, "init"); String packageName = context.getPackageName(); String processName = getProcessName( android.os.Process.myPid() ); @@ -39,17 +40,9 @@ class BuglyCrashReportProvider implements ITestCrashReportProvider { strategy.setUploadProcess( processName == null || processName.equals( packageName ) ); CrashReport.initCrashReport( context, "f3f8b0b2f1", true, strategy ); CrashReport.putUserData( context, "serial", MoGoAiCloudClientConfig.getInstance().getSn() ); - try { - ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA); - Bundle bundle = applicationInfo.metaData; - if (bundle != null){ - String sdkVersion = bundle.getString("MAP_SDK_VERSION"); - Log.e("lianglihui", "init: "+sdkVersion); - CrashReport.putUserData( context, "MAP_SDK_VERSION",bundle.getString("MAP_SDK_VERSION") ); - } - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } + String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context); + Log.e("lianglihui", "init: "+mapSDKVersion); + CrashReport.putUserData( context, "MAP_SDK_VERSION",mapSDKVersion ); } /**