[sonar] fix

This commit is contained in:
zhongchao
2023-10-18 19:42:58 +08:00
parent 523ae08c5a
commit c265850024
24 changed files with 91 additions and 139 deletions

View File

@@ -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);

View File

@@ -48,10 +48,10 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
private RecyclerView rvTopicList;
private TopicListAdapter topicListAdapter;
private String searchStr;
private List<TopicEntity> allTopicList = new ArrayList<>();
private final List<TopicEntity> allTopicList = new ArrayList<>();
private RecordTypeEntity recordType;
private List<String> addTopicList = new ArrayList<>();
private List<TopicEntity> searchTopicList = new ArrayList<>();
private final List<String> addTopicList = new ArrayList<>();
private final List<TopicEntity> searchTopicList = new ArrayList<>();
public CaseTopicListDialog(@NonNull Context context) {
super(context, R.style.bad_case_dialog);

View File

@@ -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);

View File

@@ -249,11 +249,7 @@ public class LogItemAdapter extends AbsRecyclerAdapter<AbsViewBinder<LogLine>, L
protected void publishResults(CharSequence constraint, FilterResults results) {
//noinspection unchecked
mList = (List<LogLine>) results.values;
if (results.count > 0) {
notifyDataSetChanged();
} else {
notifyDataSetChanged();
}
notifyDataSetChanged();
}
}
}

View File

@@ -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));

View File

@@ -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;

View File

@@ -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<MogoLatLng> 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;

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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)) {

View File

@@ -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<String> providers = mgr.getAllProviders();
if (providers == null) {
return false;
}
return providers.contains(LocationManager.GPS_PROVIDER);
return providers != null && providers.contains(LocationManager.GPS_PROVIDER);
}
}

View File

@@ -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<ActivityManager.RunningServiceInfo>
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<ActivityManager.RunningServiceInfo>
// for (info in runningServices) {
// if (info.service.className == ServiceName) {
// return true
// }
// }
return false
}

View File

@@ -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);
}
}

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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<BitmapDescriptor> ) {
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) {

View File

@@ -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){

View File

@@ -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)){

View File

@@ -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);

View File

@@ -34,7 +34,7 @@ public class CarConfigRespMessage extends MyAbstractMessageHandler {
adasListener.onCarConfigResp(raw.getHeader(), carConfigResp);
}
AdasChannel.calculateTimeConsumingBusiness("车机基础信息应答", nowTime);
CupidLogUtils.e("车机基础信息应答--->" + carConfigResp.toString());
CupidLogUtils.e("车机基础信息应答--->" + carConfigResp);
}
/**