From c2658500245599d4e28577e39384398ee569fb7e Mon Sep 17 00:00:00 2001 From: zhongchao Date: Wed, 18 Oct 2023 19:42:58 +0800 Subject: [PATCH] [sonar] fix --- .../warning/V2XFrontWarningScenario.java | 7 ++-- .../badcase/biz/CaseTopicListDialog.java | 6 +-- .../monitor/remote/RemoteUserServiceImp.java | 6 ++- .../hmi/ui/logcatch/LogItemAdapter.java | 6 +-- .../function/hmi/ui/logcatch/LogLine.java | 3 +- .../business/identify/TrackManager.java | 10 +++-- .../{smp => utils}/RoutePathConvertUtils.java | 5 +-- .../eagle/core/data/enums/EventTypeEnumNew.kt | 37 ++----------------- .../core/utilcode/geometry/Platform.java | 2 +- .../eagle/core/utilcode/geometry/Real.java | 8 ++-- .../transform/GlideCircleBitmapTransform.java | 8 ++-- .../core/utilcode/util/ActivityUtils.java | 2 +- .../eagle/core/utilcode/util/ShellUtils.java | 13 ++----- .../sdk/inner/marker/MarkerNativeInterface.kt | 2 +- .../map/sdk/inner/utils/AMapUtils.java | 9 +---- .../map/sdk/open/data/MapDataApi.kt | 30 +++++++-------- .../map/sdk/open/dialog/BlurView.java | 12 ++---- .../zhidaoauto/map/sdk/open/marker/Marker.kt | 4 +- .../map/sdk/open/marker/MarkerController.kt | 2 +- .../map/sdk/open/marker/MarkerOptions.kt | 16 ++++---- .../open/marker/MultiPointOverlayOptions.kt | 2 +- .../map/sdk/open/tools/MD5Utils.java | 13 ++++--- .../adas/high/common/IPCFixationIPHelper.java | 25 ++++++------- .../adas/high/msg/CarConfigRespMessage.java | 2 +- 24 files changed, 91 insertions(+), 139 deletions(-) rename core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/{smp => utils}/RoutePathConvertUtils.java (90%) diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/warning/V2XFrontWarningScenario.java index df2adcc441..6de3fb5893 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/warning/V2XFrontWarningScenario.java @@ -29,6 +29,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Locale; import java.util.concurrent.TimeUnit; @@ -68,7 +69,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoChas if (mMarkerEntity != null) { CallerLogger.d(M_V2X + TAG, "----- show --- 2 --:\n" + mMarkerEntity); String v2xType = getV2XTypeForFrontWarning(mMarkerEntity); - V2XMessageEntity entity = getV2XMessageEntity(); +// V2XMessageEntity entity = getV2XMessageEntity(); if (!v2xType.equals("0")) { if (getAlertContentForFrontWarning(mMarkerEntity).toString() == null || getAlertContentForFrontWarning(mMarkerEntity).toString().isEmpty() @@ -112,8 +113,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoChas private CharSequence getAlertContentForFrontWarning(V2XWarningTarget entity) { double dis = entity.getDistance(); //距离四舍五入保留整数 - BigDecimal bg = new BigDecimal(dis); - double disBig = bg.setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue(); + BigDecimal bg = BigDecimal.valueOf(dis); + double disBig = bg.setScale(0, RoundingMode.HALF_UP).doubleValue(); String distance = String.format(Locale.getDefault(), "%.0f", disBig) + "米"; String content = entity.getWarningContent(); SpannableStringBuilder ssb = new SpannableStringBuilder(content + distance); diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/CaseTopicListDialog.java b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/CaseTopicListDialog.java index ea8ae41b25..b924f6213a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/CaseTopicListDialog.java +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/CaseTopicListDialog.java @@ -48,10 +48,10 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL private RecyclerView rvTopicList; private TopicListAdapter topicListAdapter; private String searchStr; - private List allTopicList = new ArrayList<>(); + private final List allTopicList = new ArrayList<>(); private RecordTypeEntity recordType; - private List addTopicList = new ArrayList<>(); - private List searchTopicList = new ArrayList<>(); + private final List addTopicList = new ArrayList<>(); + private final List searchTopicList = new ArrayList<>(); public CaseTopicListDialog(@NonNull Context context) { super(context, R.style.bad_case_dialog); diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/monitor/remote/RemoteUserServiceImp.java b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/monitor/remote/RemoteUserServiceImp.java index d9f1d3487a..8ca36552ad 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/monitor/remote/RemoteUserServiceImp.java +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/monitor/remote/RemoteUserServiceImp.java @@ -60,8 +60,10 @@ public class RemoteUserServiceImp extends Binder implements IUserInterface { String _arg0; _arg0 = data.readString(); String _result = this.exec(_arg0); - reply.writeNoException(); - reply.writeString(_result); + if (reply != null) { + reply.writeNoException(); + reply.writeString(_result); + } return true; default: return super.onTransact(code, data, reply, flags); diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogItemAdapter.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogItemAdapter.java index 36f3e02cd4..fdc64291f1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogItemAdapter.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogItemAdapter.java @@ -249,11 +249,7 @@ public class LogItemAdapter extends AbsRecyclerAdapter, L protected void publishResults(CharSequence constraint, FilterResults results) { //noinspection unchecked mList = (List) results.values; - if (results.count > 0) { - notifyDataSetChanged(); - } else { - notifyDataSetChanged(); - } + notifyDataSetChanged(); } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogLine.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogLine.java index 8c858e6526..f834f1c568 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogLine.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/logcatch/LogLine.java @@ -25,6 +25,7 @@ public class LogLine { "\\): "); private static final String filterPattern = "ResourceType|memtrack|android.os.Debug|BufferItemConsumer|DPM.*|MDM.*|ChimeraUtils|BatteryExternalStats.*|chatty.*|DisplayPowerController|WidgetHelper|WearableService|DigitalWidget.*|^ANDR-PERF-.*"; + private static final String failPattern = "^maxLineHeight.*|Failed to read.*"; private int logLevel; private String tag; private String logOutput; @@ -57,7 +58,7 @@ public class LogLine { char logLevelChar = matcher.group(1).charAt(0); String logText = originalLine.substring(matcher.end()); - if (logText.matches("^maxLineHeight.*|Failed to read.*")) { + if (logText.matches(failPattern)) { logLine.setLogLevel(convertCharToLogLevel('V')); } else { logLine.setLogLevel(convertCharToLogLevel(logLevelChar)); diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java index 3c61109b02..f90860481e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java @@ -120,10 +120,12 @@ public class TrackManager { trackObj = new TrackObj(data,s2CellId,s2LatLng); } } - mFilterTrafficData.put(uuid, trackObj.getCache()); - cellIdCaches.forcePut(uuid, trackObj.getCellIdPos()); - mMarkersCaches.put(uuid, trackObj); - trafficDataUuid.add(uuid); + if(trackObj != null){ + mFilterTrafficData.put(uuid, trackObj.getCache()); + cellIdCaches.forcePut(uuid, trackObj.getCellIdPos()); + mMarkersCaches.put(uuid, trackObj); + trafficDataUuid.add(uuid); + } //Log.i("costTime","" + (System.currentTimeMillis() - cost)); } return mFilterTrafficData; diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/RoutePathConvertUtils.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/utils/RoutePathConvertUtils.java similarity index 90% rename from core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/RoutePathConvertUtils.java rename to core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/utils/RoutePathConvertUtils.java index b841bcbb56..2a663fbf1e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/RoutePathConvertUtils.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/utils/RoutePathConvertUtils.java @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.function.smp; +package com.mogo.eagle.core.function.utils; import com.mogo.eagle.core.data.map.MogoLatLng; @@ -6,7 +6,6 @@ import java.util.List; public class RoutePathConvertUtils { - public List routeList; public int ROUTE_LEFT = 1; @@ -21,7 +20,7 @@ public class RoutePathConvertUtils { double v1x = latLng1.lat - latLng0.lat; double v1y = latLng1.lon - latLng0.lon; double v2x = latLng2.lat - latLng1.lat; - double v2y = latLng2.lon - latLng2.lon; + double v2y = latLng2.lon - latLng1.lon; double r = v1x* v2y - v1y*v2x; if (r > 0.0){ route_direction = ROUTE_LEFT; diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt index 4c993d936a..1b75421eb7 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt @@ -898,14 +898,6 @@ enum class EventTypeEnumNew( TYPE_ERROR_WEAKNESS.poiType ->{ TYPE_ERROR_WEAKNESS.poiTypeStr } - //学校 - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType ->{ - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeStr - } - //禁止停车 - TYPE_USECASE_ID_ROAD_NO_PARKING.poiType ->{ - TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeStr - } //超速行驶 TYPE_USECASE_ID_SLW.poiType ->{ TYPE_USECASE_ID_SLW.poiTypeStr @@ -918,10 +910,6 @@ enum class EventTypeEnumNew( TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType ->{ TYPE_USECASE_ID_BREAKDOWN_WARNING.poiTypeStr } - //道路积水 - FOURS_PONDING.poiType ->{ - FOURS_PONDING.poiTypeStr - } //异常停车 TYPE_USECASE_ID_ROAD_PARKING.poiType ->{ TYPE_USECASE_ID_ROAD_PARKING.poiTypeStr @@ -1093,10 +1081,6 @@ enum class EventTypeEnumNew( FOURS_BLOCK_UP.poiType -> { R.drawable.icon_warning_v2x_congestion } - //积水 - FOURS_PONDING.poiType -> { - R.drawable.v2x_icon_jishui_vr - } //结冰 FOURS_ICE.poiType -> { R.drawable.v2x_icon_jiebing_vr @@ -1210,9 +1194,6 @@ enum class EventTypeEnumNew( TYPE_ERROR_WEAKNESS.poiType -> { R.drawable.icon_warning_v2x_abnormal_vehicle } - - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.poiTypeSrcVr TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.poiTypeSrcVr TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.poiTypeSrcVr @@ -1232,13 +1213,13 @@ enum class EventTypeEnumNew( TYPE_VEHICLE_QUEUE.poiType -> TYPE_VEHICLE_QUEUE.poiTypeSrcVr TYPE_NO_PASSING.poiType -> TYPE_NO_PASSING.poiTypeSrcVr TYPE_NO_TURNING_AROUND.poiType -> TYPE_NO_TURNING_AROUND.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.poiTypeSrcVr TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiTypeSrcVr TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.poiTypeSrcVr TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.poiTypeSrcVr TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.poiTypeSrcVr TYPE_ATTENTION_CONFLUENCE.poiType -> TYPE_ATTENTION_CONFLUENCE.poiTypeSrcVr TYPE_PEDESTRIAN_CROSSING.poiType -> TYPE_PEDESTRIAN_CROSSING.poiTypeSrcVr @@ -1284,18 +1265,12 @@ enum class EventTypeEnumNew( TYPE_ERROR.poiType -> TYPE_ERROR.content TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content GHOST_PROBE.poiType -> GHOST_PROBE.content - TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.content TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.content - TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.content TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.content TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.content TYPE_ERROR_WEAKNESS.poiType -> TYPE_ERROR_WEAKNESS.content - - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content - TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content - TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.content TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.content TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.content TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.content @@ -1318,10 +1293,10 @@ enum class EventTypeEnumNew( TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.content TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.content + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.content TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.content TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.content - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.content TYPE_ATTENTION_CONFLUENCE.poiType -> TYPE_ATTENTION_CONFLUENCE.content TYPE_PEDESTRIAN_CROSSING.poiType -> TYPE_PEDESTRIAN_CROSSING.content @@ -1353,18 +1328,12 @@ enum class EventTypeEnumNew( TYPE_ERROR.poiType -> TYPE_ERROR.tts TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts GHOST_PROBE.poiType -> GHOST_PROBE.tts - TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.tts TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.tts - TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.tts TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.tts TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.tts TYPE_ERROR_WEAKNESS.poiType -> TYPE_ERROR_WEAKNESS.tts - - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts - TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts - TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.tts TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.tts TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.tts TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.tts @@ -1387,10 +1356,10 @@ enum class EventTypeEnumNew( TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.tts TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.tts + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.tts TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.tts TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.tts - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.tts TYPE_ATTENTION_CONFLUENCE.poiType -> TYPE_ATTENTION_CONFLUENCE.tts TYPE_PEDESTRIAN_CROSSING.poiType -> TYPE_PEDESTRIAN_CROSSING.tts diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Platform.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Platform.java index e0914b521b..bab8cb6c53 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Platform.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Platform.java @@ -154,6 +154,6 @@ final class Platform { * {@code x}, emulating the behavior of {@link BigDecimal#BigDecimal(double)}. */ static BigDecimal newBigDecimal(double x) { - return new BigDecimal(x); + return BigDecimal.valueOf(x); } } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Real.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Real.java index fe1fec67e9..db5e9ebc77 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Real.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/geometry/Real.java @@ -284,18 +284,16 @@ strictfp class Real extends Number { /** Returns a BigDecimal representation of this extended precision real value. */ public BigDecimal bigValue() { - BigDecimal sum = new BigDecimal(values[0]); + BigDecimal sum = BigDecimal.valueOf(values[0]); for (int i = 1; i < values.length; i++) { - sum = sum.add(new BigDecimal(values[i])); + sum = sum.add(BigDecimal.valueOf(values[i])); } return sum.stripTrailingZeros(); } private static double[] copyOf(double[] array, int newLength) { double[] result = new double[newLength]; - for (int i = 0; i < newLength; i++) { - result[i] = array[i]; - } + System.arraycopy(array, 0, result, 0, newLength); return result; } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java index b56d33102a..fa97d2b814 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java @@ -17,10 +17,10 @@ import java.security.MessageDigest; public class GlideCircleBitmapTransform extends BitmapTransformation { - private int mBorderWidth; - private int mBorderColor; - private String mKey; - private Context mContext; + private final int mBorderWidth; + private final int mBorderColor; + private final String mKey; + private final Context mContext; public GlideCircleBitmapTransform( Context context, String key, int borderWidth, int borderColor ) { this.mContext = context; diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ActivityUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ActivityUtils.java index 79f51e2dc9..a50b114c09 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ActivityUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ActivityUtils.java @@ -133,7 +133,7 @@ public final class ActivityUtils { @Nullable private static Activity getActivityFromDecorContext(@Nullable Context context) { if (context == null) return null; - if (context.getClass().getName().equals("com.android.internal.policy.DecorContext")) { + if ("com.android.internal.policy.DecorContext".equals(context.getClass().getName())) { try { Field mActivityContextField = context.getClass().getDeclaredField("mActivityContext"); mActivityContextField.setAccessible(true); diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ShellUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ShellUtils.java index e32b943363..6cb6015e9d 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ShellUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ShellUtils.java @@ -6,6 +6,7 @@ import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -308,10 +309,10 @@ public final class ShellUtils { successMsg = new StringBuilder(); errorMsg = new StringBuilder(); successResult = new BufferedReader( - new InputStreamReader(process.getInputStream(), "UTF-8") + new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8) ); errorResult = new BufferedReader( - new InputStreamReader(process.getErrorStream(), "UTF-8") + new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8) ); String line; if ((line = successResult.readLine()) != null) { @@ -334,17 +335,9 @@ public final class ShellUtils { if (os != null) { os.close(); } - } catch (IOException e) { - e.printStackTrace(); - } - try { if (successResult != null) { successResult.close(); } - } catch (IOException e) { - e.printStackTrace(); - } - try { if (errorResult != null) { errorResult.close(); } diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt index 547a375661..bb3c70f27c 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt @@ -170,7 +170,7 @@ class MarkerNativeInterface(private val mMapController: IMapController): IMarker if(markerBytes.isEmpty()){ return } - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerIconName = MD5Utils.getMD5String(markerBytes) //缓存图片 if (!containMarkerIcon(markerIconName)) { diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java index 7020c5d097..aee75434eb 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java @@ -53,7 +53,7 @@ public class AMapUtils { var29[0] = var24 * var22; var29[1] = var24 * var18; var29[2] = var20; - return (float)(Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D); + return (float) (Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D); } catch (Throwable var26) { var26.printStackTrace(); return 0.0F; @@ -83,8 +83,6 @@ public class AMapUtils { /** * 是否有GPS - * @param context - * @return */ public static boolean hasGPSDevice(Context context) { final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); @@ -92,10 +90,7 @@ public class AMapUtils { return false; } final List providers = mgr.getAllProviders(); - if (providers == null) { - return false; - } - return providers.contains(LocationManager.GPS_PROVIDER); + return providers != null && providers.contains(LocationManager.GPS_PROVIDER); } } \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt index 2f9562607d..745272b89b 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt @@ -64,21 +64,21 @@ object MapDataApi { * @return */ fun isServiceRunning(context: Context, ServiceName: String): Boolean { - if (true) { - return false - } - if (TextUtils.isEmpty(ServiceName)) { - return false - } - val myManager = context - .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager - val runningServices = myManager - .getRunningServices(50) as ArrayList - for (info in runningServices) { - if (info.service.className == ServiceName) { - return true - } - } +// if (true) { +// return false +// } +// if (TextUtils.isEmpty(ServiceName)) { +// return false +// } +// val myManager = context +// .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager +// val runningServices = myManager +// .getRunningServices(50) as ArrayList +// for (info in runningServices) { +// if (info.service.className == ServiceName) { +// return true +// } +// } return false } diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java index 8eff359642..e5f7d06e6f 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java @@ -336,10 +336,6 @@ public class BlurView extends View { /** * Custom draw the blurred bitmap and color to define your own shape - * - * @param canvas - * @param blurredBitmap - * @param overlayColor */ protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap, int overlayColor) { if (blurredBitmap != null) { @@ -371,16 +367,16 @@ public class BlurView extends View { private static class StopException extends RuntimeException { } - private static StopException STOP_EXCEPTION = new StopException(); + private static final StopException STOP_EXCEPTION = new StopException(); - static { +// static { // try { // BlurView.class.getClassLoader().loadClass("androidx.renderscript.RenderScript"); // } catch (ClassNotFoundException e) { // throw new RuntimeException("\n错误!\nRenderScript支持库未启用,要启用模糊效果,请在您的app的Gradle配置文件中添加以下语句:" + // "\nandroid { \n...\n defaultConfig { \n ...\n renderscriptTargetApi 19 \n renderscriptSupportModeEnabled true \n }\n}"); // } - } +// } // android:debuggable="true" in AndroidManifest.xml (auto set by build tool) static Boolean DEBUG = null; @@ -389,6 +385,6 @@ public class BlurView extends View { if (DEBUG == null && ctx != null) { DEBUG = (ctx.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } - return DEBUG.equals(Boolean.TRUE); + return DEBUG != null && DEBUG.equals(Boolean.TRUE); } } \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt index 711fe9eee3..ff584aed22 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt @@ -800,7 +800,7 @@ public class Marker(private var markerOptions: MarkerOptions,private var mMapCon mMapController?.getContext()?.let {context-> val markerView = BitmapDescriptorFactory.from3DResource(context, icon) markerView?.let { - MD5Utils.getInstanse() + MD5Utils.getInstance() val anchor3dName = MD5Utils.getMD5String(markerView) if (mMarkerCall?.containMarkerIcon(anchor3dName) == false) { if (CompileConfig.DEBUG) { @@ -830,7 +830,7 @@ public class Marker(private var markerOptions: MarkerOptions,private var mMapCon if (icons != null) { for (icon in icons) { val markerView = icon.getBytes() - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerIconName = MD5Utils.getMD5String(markerView) if (mMarkerCall?.containMarkerIcon(markerIconName) == false) { if (CompileConfig.DEBUG) { diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt index 969e547371..3b4dc16aec 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt @@ -255,7 +255,7 @@ class MarkerController(mapController: IMapController) : IMarkerController { } val markerView = OperationUtils.fromRawResource(modelRes,mMapController.getContext()) if(markerView != null){ - MD5Utils.getInstanse() + MD5Utils.getInstance() val modelKey = MD5Utils.getMD5String(markerView) mMarkerCall.addMarkerIconCache(modelRes,modelKey) diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt index 6ae7e3beee..9bb2870e28 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt @@ -200,7 +200,7 @@ class MarkerOptions { if(markerInfoView.isEmpty()){ return this } - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerInfoMd5 = MD5Utils.getMD5String(markerInfoView) if(!markerInfoUseCache){ if(!TextUtils.isEmpty(markerInfoName) && !TextUtils.equals(markerInfoMd5,markerInfoName)){ @@ -226,7 +226,7 @@ class MarkerOptions { fun markerIcon(bitmap: Bitmap,mapController: IMapController?): MarkerOptions { val markerBitmap = BitmapDescriptorFactory.fromBitmap(bitmap) val markerView = markerBitmap.getBytes() - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerIconName = MD5Utils.getMD5String(markerView) this.markerIconName = markerIconName this.vrIcon = false @@ -279,7 +279,7 @@ class MarkerOptions { fun markerIcon(markerBitmap: BitmapDescriptor,mapController: IMapController?): MarkerOptions { val markerView = markerBitmap.getBytes() - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerIconName = MD5Utils.getMD5String(markerView) this.markerIconName = markerIconName this.vrIcon = false @@ -306,7 +306,7 @@ class MarkerOptions { mapController?.getContext()?.let { val markerView = BitmapDescriptorFactory.from3DResource(it, icon) markerView?.let { - MD5Utils.getInstanse() + MD5Utils.getInstance() val anchor3dName = MD5Utils.getMD5String(markerView) this.icons.add(anchor3dName) if (mapController.getMarkerCall()?.containMarkerIcon(anchor3dName) == false) { @@ -332,7 +332,7 @@ class MarkerOptions { }else { for (icon in icons as ArrayList ) { val markerView = icon.getBytes() - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerIconName = MD5Utils.getMD5String(markerView) this.icons.add(markerIconName) if (mapController?.getMarkerCall()?.containMarkerIcon(markerIconName) == false) { @@ -372,7 +372,7 @@ class MarkerOptions { mapController?.getContext()?.let { val markerBitmap = BitmapDescriptorFactory.fromResource(it, resId) val markerView = markerBitmap.getBytes() - MD5Utils.getInstanse() + MD5Utils.getInstance() val markerIconName = MD5Utils.getMD5String(markerView) this.markerIconName = markerIconName this.vrIcon = false @@ -402,7 +402,7 @@ class MarkerOptions { } if(markerView != null) { - MD5Utils.getInstanse() + MD5Utils.getInstance() val anchor3dName = MD5Utils.getMD5String(markerView) if (mapController?.getMarkerCall()?.containMarkerIcon(anchor3dName) == false) { @@ -451,7 +451,7 @@ class MarkerOptions { } val markerView = OperationUtils.fromRawResource(resId,mapController?.getContext()) if(markerView != null) { - MD5Utils.getInstanse() + MD5Utils.getInstance() val anchor3dName = MD5Utils.getMD5String(markerView) if (mapController?.getMarkerCall()?.containMarkerIcon(anchor3dName) == false) { diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt index e66baaef27..fb906bd31f 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt @@ -23,7 +23,7 @@ class MultiPointOverlayOptions { mapController?.getContext()?.let { val descriptor = fromResource(it, icon) val markerBytes = descriptor.getBytes() - MD5Utils.getInstanse() + MD5Utils.getInstance() this.markerIconName = MD5Utils.getMD5String(markerBytes) if (mapController.getMarkerCall()?.containMarkerIcon(markerIconName) == false) { if(DEBUG){ diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java index a9bb773378..a54e3bce29 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java @@ -8,7 +8,7 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Utils { - protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + protected static char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; protected static MessageDigest messagedigest = null; /** @@ -16,7 +16,7 @@ public class MD5Utils { * *  *                   */ - public static MessageDigest getInstanse() { + public static MessageDigest getInstance() { if (messagedigest == null) { try { @@ -31,11 +31,11 @@ public class MD5Utils { messagedigest.update(bytes); return bufferToHex(messagedigest.digest()); } - public static String bufferToHex(byte bytes[]) { + public static String bufferToHex(byte[] bytes) { return bufferToHex(bytes, 0, bytes.length); } - private static String bufferToHex(byte bytes[], int m, int n) { + private static String bufferToHex(byte[] bytes, int m, int n) { StringBuffer stringbuffer = new StringBuffer(2 * n); int k = m + n; for (int l = m; l < k; l++) { @@ -51,9 +51,12 @@ public class MD5Utils { public static boolean isSameImage(byte[] bytes, Context context){ SharedPrefsMgr mgr = SharedPrefsMgr.getInstance(context); String imageStr = mgr.getString(MARKERIMAGE); - MessageDigest md = MD5Utils.getInstanse(); + MessageDigest md = MD5Utils.getInstance(); StringBuffer buffer = new StringBuffer(); buffer.append(imageStr); + if(md == null){ + return false; + } md.update(bytes); String Md5Str = MD5Utils.bufferToHex(md.digest()); if (imageStr.contains(Md5Str)){ diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/IPCFixationIPHelper.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/IPCFixationIPHelper.java index dd289c9562..e50f1ee814 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/IPCFixationIPHelper.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/IPCFixationIPHelper.java @@ -91,21 +91,18 @@ public class IPCFixationIPHelper { unavailableCount.set(0); isCallListener.set(false); for (final String temp : ips) { - Runnable runnable = new Runnable() { - @Override - public void run() { - CupidLogUtils.i(TAG, "ip=" + temp); - boolean isAvailable = ping(temp); - if (isAvailable) { - if (!isCallListener.get() && !Thread.currentThread().isInterrupted()) { - isCallListener.set(true); - listener.onAvailableIP(temp); - CupidLogUtils.i(TAG, "可用IP=" + temp); - interrupted(); - } - } else { - allNotAvailable(ips); + Runnable runnable = () -> { + CupidLogUtils.i(TAG, "ip=" + temp); + boolean isAvailable = ping(temp); + if (isAvailable) { + if (!isCallListener.get() && !Thread.currentThread().isInterrupted()) { + isCallListener.set(true); + listener.onAvailableIP(temp); + CupidLogUtils.i(TAG, "可用IP=" + temp); + interrupted(); } + } else { + allNotAvailable(ips); } }; Future future = ThreadPoolManager.getsInstance().submit(runnable); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java index 98220d91be..f4a0eafc1c 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java @@ -34,7 +34,7 @@ public class CarConfigRespMessage extends MyAbstractMessageHandler { adasListener.onCarConfigResp(raw.getHeader(), carConfigResp); } AdasChannel.calculateTimeConsumingBusiness("车机基础信息应答", nowTime); - CupidLogUtils.e("车机基础信息应答--->" + carConfigResp.toString()); + CupidLogUtils.e("车机基础信息应答--->" + carConfigResp); } /**