Merge branch 'sonar' into dev_robotaxi-d_231031_6.2.0

This commit is contained in:
zhongchao
2023-11-01 15:33:36 +08:00
208 changed files with 2177 additions and 7793 deletions

3
.gitignore vendored
View File

@@ -7,4 +7,5 @@
/build
/captures
.externalNativeBuild
.cxx
.cxx
.gitlab-ci.yml

View File

@@ -25,3 +25,19 @@ inspect java and kotlin codes:
except:
- master
allow_failure: true
sonarqube-check:
image: gradle:jre11-slim
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script: gradle sonarqube
allow_failure: true
only:
- merge_requests
- $CI_COMMIT_BRANCH
- pushes

View File

@@ -7,7 +7,6 @@ import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@@ -81,7 +80,6 @@ import java.util.ArrayList;
import java.util.List;
import io.reactivex.exceptions.UndeliverableException;
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;
import mogo.telematics.pad.MessagePad;
@@ -98,6 +96,7 @@ public class OrderModel {
private int backgroundCurrentStationIndex = 0;//A->B 此处值是A站点索引
private static volatile OrderModel sInstance;
private static final byte[] obj = new byte[0];
private Context mContext;
private final List<BusStationBean> stationList = new ArrayList<>();
private BusRoutesResult busRoutesResult = null;
@@ -125,20 +124,20 @@ public class OrderModel {
private LoginService loginService;
private final Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
if (msg.what == MSG_QUERY_BUS_STATION) {
queryBusRoutes();
return true;
}
return false;
private final Handler handler = new Handler(msg -> {
if (msg.what == MSG_QUERY_BUS_STATION) {
queryBusRoutes();
return true;
}
return false;
});
private OrderModel() {
}
public static OrderModel getInstance() {
if (sInstance == null) {
synchronized (OrderModel.class) {
synchronized (obj) {
if (sInstance == null) {
sInstance = new OrderModel();
}
@@ -147,10 +146,6 @@ public class OrderModel {
return sInstance;
}
private OrderModel() {
}
public void init() {
mContext = AbsMogoApplication.getApp();
loginService = (LoginService) ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation();
@@ -171,7 +166,7 @@ public class OrderModel {
OCHSocketMessageManager.INSTANCE.registerSocketMessageListener(//监听核销乘客
OCHSocketMessageManager.msgWriteOffPassengerType,
mWriteOffPassengeOnMessageListener);
mWriteOffPassengerOnMessageListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
@@ -180,38 +175,35 @@ public class OrderModel {
//2022.1.28
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
// The exception could not be delivered to the consumer because it has already canceled/disposed
// the flow or the excTeption has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
public void accept(Throwable e) {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_BUS + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {//
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_BUS + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_BUS + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_BUS + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_BUS + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_BUS + TAG, "Undeliverable exception");
// the flow or the exception has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_BUS + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_BUS + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_BUS + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_BUS + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_BUS + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_BUS + TAG, "Undeliverable exception");
});
}
@@ -234,7 +226,7 @@ public class OrderModel {
}
};
private final IMogoOnMessageListener<WriteOffPassenger> mWriteOffPassengeOnMessageListener =
private final IMogoOnMessageListener<WriteOffPassenger> mWriteOffPassengerOnMessageListener =
new IMogoOnMessageListener<WriteOffPassenger>() {
@Override
public Class<WriteOffPassenger> target() {
@@ -272,11 +264,8 @@ public class OrderModel {
this.mControllerStatusCallback = callback;
}
private final ITrajectoryListener trajectoryListener = new ITrajectoryListener() {
@Override
public void trajectoryCallback(@NonNull List<MogoLocation> routeArrivied, @NonNull List<MogoLocation> routeArriving, @NonNull MogoLocation location) {
private final ITrajectoryListener trajectoryListener = (routeArrivied, routeArriving, location) -> {
}
};
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener() {
@@ -361,11 +350,6 @@ public class OrderModel {
TrajectoryAndDistanceManager.INSTANCE.removeListener(TAG);
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
private final IMogoStatusChangedListener mMogoStatusChangedListener = new IMogoStatusChangedListener() {
// VR mode变更回调
@Override
@@ -444,8 +428,6 @@ public class OrderModel {
CallerLogger.d(M_BUS + TAG, "judgeArrivedStation() = 刚过站且在15m内");
onArriveAt(null); //无自动驾驶到站信息传null
}
return;
}
}
@@ -621,10 +603,7 @@ public class OrderModel {
leaveTTSTips(nextStation,nextStationKr);
if (busRoutesResult != null) {
boolean isLastStop = false;
if (leaveIndex + 1 == stationList.size() - 1) {
isLastStop = true;
}
boolean isLastStop = leaveIndex + 1 == stationList.size() - 1;
//给bus外屏发送
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.LEAVE_STATION
, busRoutesResult.getName()
@@ -768,10 +747,7 @@ public class OrderModel {
private void arriveStationSuccess(int arrivedStationIndex, String departureStopName,
String arriveStation, String arriveStationKr) {
if (busRoutesResult != null) {
boolean isLastStop = false;
if (arrivedStationIndex == busRoutesResult.getSites().size() - 1) {
isLastStop = true;
}
boolean isLastStop = arrivedStationIndex == busRoutesResult.getSites().size() - 1;
//给bus外屏发送
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.ARRIVE_STATION
, busRoutesResult.getName()
@@ -845,12 +821,7 @@ public class OrderModel {
//车站10s后播报
private void leaveTTSTips(String nextStation,String nextStationKr) {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
VoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr);
}
},DELAY_10S);
UiThreadHandler.postDelayed(() -> VoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr),DELAY_10S);
}
/**
@@ -981,16 +952,12 @@ public class OrderModel {
}
}
Runnable tip3Runnable = new Runnable() {
@Override
public void run() {
if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
&& !stationList.get(0).isLeaving()){
tipStartTask("3");
}else {
removeTipRunnables();
}
Runnable tip3Runnable = () -> {
if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
&& !stationList.get(0).isLeaving()){
tipStartTask("3");
}else {
removeTipRunnables();
}
};
@@ -1005,16 +972,11 @@ public class OrderModel {
VoiceNotice.showNotice(tips);
}
Runnable tip1Runnable = new Runnable() {
@Override
public void run() {
if (backgroundCurrentStationIndex == 0 && stationList != null &&
stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
&& !stationList.get(0).isLeaving()){
tipStartTask("1");
}else {
removeTipRunnables();
}
Runnable tip1Runnable = () -> {
if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED && !stationList.get(0).isLeaving()){
tipStartTask("1");
}else {
removeTipRunnables();
}
};
@@ -1205,7 +1167,7 @@ public class OrderModel {
}
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
if (stationList == null || backgroundCurrentStationIndex >= stationList.size() - 1) {
if (backgroundCurrentStationIndex >= stationList.size() - 1) {
return;
}
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
@@ -1215,7 +1177,7 @@ public class OrderModel {
}
public void triggerUnableStartAPReasonEvent() {
if (stationList == null || backgroundCurrentStationIndex >= stationList.size() - 1) {
if (backgroundCurrentStationIndex >= stationList.size() - 1) {
return;
}
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
@@ -1253,8 +1215,8 @@ public class OrderModel {
}
private AutopilotControlParameters initAutopilotControlParameters(int leaveIndex) {
BusStationBean currentStation = null;
BusStationBean nextStation = null;
BusStationBean currentStation;
BusStationBean nextStation;
if (leaveIndex < 0) {
if (backgroundCurrentStationIndex + 1 > stationList.size() - 1 || !isGoingToNextStation) {

View File

@@ -46,7 +46,7 @@ public class BusRoutesResult {
return sites;
}
public void setSite(List<BusStationBean> site) {
public void setSites(List<BusStationBean> sites) {
this.sites = sites;
}

View File

@@ -1,7 +1,6 @@
package com.mogo.och.bus.model;
import android.content.Context;
import android.util.Log;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
@@ -24,9 +23,13 @@ public class BusLineModel {
private static volatile BusLineModel sInstance;
private Context mContext;
private IBusLinesCallback mBusLinesCallback;
private static final byte[] obj = new byte[0];
private BusLineModel() {
}
public static BusLineModel getInstance() {
if ( sInstance == null ) {
synchronized ( BusLineModel.class ) {
synchronized ( obj ) {
if ( sInstance == null ) {
sInstance = new BusLineModel();
}
@@ -34,9 +37,7 @@ public class BusLineModel {
}
return sInstance;
}
private BusLineModel() {
}
public void init() {
mContext = AbsMogoApplication.getApp();
}
@@ -79,7 +80,7 @@ public class BusLineModel {
/**
* 通过线路id 查询线路排班表
* @param lineId
* @param lineId 线路id
* @param position 位置
*/
public void queryBusLineTasksById(int lineId, int position,boolean autoRefresh){

View File

@@ -11,7 +11,6 @@ import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import java.util.ArrayList;
import java.util.List;
@@ -28,19 +27,19 @@ public class OpenItemAnimator extends DefaultItemAnimator {
private static TimeInterpolator sDefaultInterpolator;
private ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
private ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
private final ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
private final ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
private final ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
private final ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
private final ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
private static class MoveInfo {
public RecyclerView.ViewHolder holder;
@@ -102,20 +101,16 @@ public class OpenItemAnimator extends DefaultItemAnimator {
mPendingRemovals.clear();
// Next, move stuff
if (movesPending) {
final ArrayList<MoveInfo> moves = new ArrayList<>();
moves.addAll(mPendingMoves);
final ArrayList<MoveInfo> moves = new ArrayList<>(mPendingMoves);
mMovesList.add(moves);
mPendingMoves.clear();
Runnable mover = new Runnable() {
@Override
public void run() {
for (MoveInfo moveInfo : moves) {
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
moveInfo.toX, moveInfo.toY);
}
moves.clear();
mMovesList.remove(moves);
Runnable mover = () -> {
for (MoveInfo moveInfo : moves) {
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
moveInfo.toX, moveInfo.toY);
}
moves.clear();
mMovesList.remove(moves);
};
if (removalsPending) {
View view = moves.get(0).holder.itemView;
@@ -126,19 +121,15 @@ public class OpenItemAnimator extends DefaultItemAnimator {
}
// Next, change stuff, to run in parallel with move animations
if (changesPending) {
final ArrayList<ChangeInfo> changes = new ArrayList<>();
changes.addAll(mPendingChanges);
final ArrayList<ChangeInfo> changes = new ArrayList<>(mPendingChanges);
mChangesList.add(changes);
mPendingChanges.clear();
Runnable changer = new Runnable() {
@Override
public void run() {
for (ChangeInfo change : changes) {
animateChangeImpl(change);
}
changes.clear();
mChangesList.remove(changes);
Runnable changer = () -> {
for (ChangeInfo change : changes) {
animateChangeImpl(change);
}
changes.clear();
mChangesList.remove(changes);
};
if (removalsPending) {
RecyclerView.ViewHolder holder = changes.get(0).oldHolder;
@@ -149,19 +140,15 @@ public class OpenItemAnimator extends DefaultItemAnimator {
}
// Next, add stuff
if (additionsPending) {
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
additions.addAll(mPendingAdditions);
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>(mPendingAdditions);
mAdditionsList.add(additions);
mPendingAdditions.clear();
Runnable adder = new Runnable() {
@Override
public void run() {
for (RecyclerView.ViewHolder holder : additions) {
animateAddImpl(holder);
}
additions.clear();
mAdditionsList.remove(additions);
Runnable adder = () -> {
for (RecyclerView.ViewHolder holder : additions) {
animateAddImpl(holder);
}
additions.clear();
mAdditionsList.remove(additions);
};
if (removalsPending || movesPending || changesPending) {
long removeDuration = removalsPending ? getRemoveDuration() : 0;
@@ -341,8 +328,8 @@ public class OpenItemAnimator extends DefaultItemAnimator {
final ViewPropertyAnimator oldViewAnim = view.animate().setDuration(
getChangeDuration());
mChangeAnimations.add(changeInfo.oldHolder);
oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX);
oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY);
oldViewAnim.translationX((float) (changeInfo.toX - changeInfo.fromX));
oldViewAnim.translationY((float) (changeInfo.toY - changeInfo.fromY));
oldViewAnim.alpha(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
@@ -480,25 +467,25 @@ public class OpenItemAnimator extends DefaultItemAnimator {
}
// animations should be ended by the cancel above.
//noinspection PointlessBooleanExpression,ConstantConditions
//noinspection Pointless BooleanExpression,ConstantConditions
if (mRemoveAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mRemoveAnimations list");
}
//noinspection PointlessBooleanExpression,ConstantConditions
//noinspection Pointless BooleanExpression,ConstantConditions
if (mAddAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mAddAnimations list");
}
//noinspection PointlessBooleanExpression,ConstantConditions
//noinspection Pointless BooleanExpression,ConstantConditions
if (mChangeAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mChangeAnimations list");
}
//noinspection PointlessBooleanExpression,ConstantConditions
//noinspection Pointless BooleanExpression,ConstantConditions
if (mMoveAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mMoveAnimations list");

View File

@@ -24,13 +24,13 @@ import com.mogo.och.bus.R;
public class BusArcView extends View {
//中心的文字描述
private String mDes = "KM/H";
private final String mDes = "KM/H";
//根据数据显示的圆弧Paint
private Paint mArcPaint;
//圆弧颜色
private int mArcColor;
//圆弧的画笔的宽度
private float mStrokeWith = getResources().getDimension(R.dimen.bus_ext_arcView_stroke_with);
private final float mStrokeWith = getResources().getDimension(R.dimen.bus_ext_arcView_stroke_with);
//文字描述的paint
private Paint mTextPaint;
@@ -39,9 +39,9 @@ public class BusArcView extends View {
//当前数据
private int currentValue;
//最大数据
private int maxValue = 240;
private final int maxValue = 240;
//圆弧背景的开始和结束间的夹角大小
private float mAngle = 270;
private final float mAngle = 270;
//上次绘制圆弧夹角
private float lastAngle = 0;
@@ -75,13 +75,13 @@ public class BusArcView extends View {
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
//绘制中心的数值
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2 - 10, mTextPaint);
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
//绘制中心文字描述
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_des_text_size));
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
}
private void drawArc(Canvas canvas) {
@@ -135,13 +135,10 @@ public class BusArcView extends View {
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
progressAnimator.setDuration(time);
progressAnimator.setTarget(mIncludedAngle);
progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
}
progressAnimator.addUpdateListener(animation -> {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
});
//开始执行动画
progressAnimator.start();

View File

@@ -22,7 +22,6 @@ import android.view.animation.DecelerateInterpolator;
import androidx.annotation.Nullable;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
import com.mogo.och.bus.R;
import me.jessyan.autosize.AutoSizeConfig;
@@ -93,7 +92,7 @@ public class SlidePanelView extends View {
private ObjectAnimator matrixAnim;
private String blockText = STRING_SLIDE_TO_RIGHT;
private Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
private final Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
private static final int GRADIENT_OFFSET = 200;
@@ -250,7 +249,7 @@ public class SlidePanelView extends View {
private void startBlockBackAnim() {
ObjectAnimator blockBackanimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
blockBackanimator.setInterpolator(new DecelerateInterpolator());
blockBackanimator.setDuration(1000 * blockOffset / getWidth());
blockBackanimator.setDuration(1000L * blockOffset / getWidth());
blockBackanimator.start();
lastX = 0;
}
@@ -259,15 +258,15 @@ public class SlidePanelView extends View {
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 画背景
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2, (float) getHeight() / 2, bgPaint);
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2.0f, (float) getHeight() / 2.0f, bgPaint);
// 画文字
gradientMatrix.setTranslate(matrixTranslate, 0);
textGradient.setLocalMatrix(gradientMatrix);
canvas.save();
canvas.drawText(blockText, blockWidth + BLOCK_START_X + textMarginLeft, textOffset, textPaint);
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), textOffset, textPaint);
canvas.restore();
// 画滑块
canvas.drawBitmap(bmBlock, BLOCK_START_X + blockOffset, BLOCK_START_Y, blockPaint);
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
}
public interface OnSlidePanelMoveToEndListener {

View File

@@ -68,8 +68,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -47,7 +47,7 @@ public class MogoOCHBusPassenger implements IMogoOCH {
this.mContainerId = containerId;
showFragment();
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode) && activity != null) {
MultiDisplayUtils.INSTANCE.startActWithSecond(activity, VideoPlayerActivity.class);
}

View File

@@ -19,7 +19,10 @@ public class BusPassengerMapAssetStyleUtil {
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
int count = 0;
while ((count = is1.read(buffer1)) > 0) {
is1.read(buffer1);
}
} catch (IOException e) {
e.printStackTrace();
} finally {

View File

@@ -8,7 +8,7 @@ import org.junit.Test;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
//@Test
public void addition_isCorrect() {
}

View File

@@ -64,7 +64,8 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.magic.mogo.och.charter">
<manifest package="com.magic.mogo.och.charter">
</manifest>

View File

@@ -62,7 +62,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.charter.passenger">
<manifest package="com.mogo.och.charter.passenger">
</manifest>

View File

@@ -44,8 +44,8 @@ class MogoOCHBusPassenger : IMoGoFunctionProvider {
val supportFragmentManager: FragmentManager? = mActivity?.supportFragmentManager
if (mPassengerFragment == null) {
d(SceneConstant.M_TAXI_P + com.mogo.och.charter.passenger.MogoOCHBusPassenger.Companion.TAG, "准备add fragment======")
var fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(MainFragment.TAG)
d(SceneConstant.M_TAXI_P + TAG, "准备add fragment======")
val fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(MainFragment.TAG)
mPassengerFragment = if (fragmentByTag is MainFragment){
fragmentByTag
}else{
@@ -58,7 +58,7 @@ class MogoOCHBusPassenger : IMoGoFunctionProvider {
}
return
}
d(SceneConstant.M_TAXI_P + com.mogo.och.charter.passenger.MogoOCHBusPassenger.Companion.TAG, "准备show fragment")
d(SceneConstant.M_TAXI_P + TAG, "准备show fragment")
supportFragmentManager?.beginTransaction()?.show(mPassengerFragment!!)
?.commitAllowingStateLoss()
}
@@ -71,6 +71,6 @@ class MogoOCHBusPassenger : IMoGoFunctionProvider {
}
companion object {
private val TAG = com.mogo.och.charter.passenger.MogoOCHBusPassenger::class.java.simpleName
private val TAG = MogoOCHBusPassenger::class.java.simpleName
}
}

View File

@@ -19,7 +19,10 @@ public class BusPassengerMapAssetStyleUtil {
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
int count = 0;
while ((count = is1.read(buffer1)) > 0) {
is1.read(buffer1);
}
} catch (IOException e) {
e.printStackTrace();
} finally {

View File

@@ -13,13 +13,17 @@ public class CollectionUtils {
OkHttpClient okHttpClient = OkHttpFactory.Companion.getOkHttpClient();
List<Interceptor> interceptors = okHttpClient.interceptors();
Field pro = getDeclaredField(interceptors, "list");
pro.setAccessible(true);
List<Interceptor> modifyerList = null;
try {
modifyerList = (List<Interceptor>) pro.get(interceptors);
modifyerList.add(new SimpleInterceptor());
} catch (IllegalAccessException e) {
e.printStackTrace();
if(pro != null){
pro.setAccessible(true);
List<Interceptor> modifierList;
try {
modifierList = (List<Interceptor>) pro.get(interceptors);
if(modifierList != null){
modifierList.add(new SimpleInterceptor());
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
/**
@@ -32,7 +36,10 @@ public class CollectionUtils {
* @since2019年2月26日 下午4:06:16
*/
public static Field getDeclaredField(Object object, String fieldName){
Field field = null ;
if(fieldName == null){
return null;
}
Field field;
Class<?> clazz = object.getClass() ;
for(; clazz != Object.class ; clazz = clazz.getSuperclass()) {
try {

View File

@@ -14,7 +14,7 @@ public class NumberFormatUtil {
* @return
*/
public static String formatLong(double d) {
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
BigDecimal bg = BigDecimal.valueOf(d).setScale(1, RoundingMode.HALF_UP);
double num = bg.doubleValue();
if (Math.ceil(num) - num == 0) {
return String.valueOf((long) num);

View File

@@ -7,11 +7,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author: wangmingjun
* @date: 2022/7/19
*/
public class OCHThreadPoolManager<T> {
/**
@@ -42,10 +37,11 @@ public class OCHThreadPoolManager<T> {
}
private volatile static OCHThreadPoolManager INSTANCE;
private static final byte[] obj = new byte[0];
public static OCHThreadPoolManager getsInstance() {
if (INSTANCE == null) {
synchronized (OCHThreadPoolManager.class) {
synchronized (obj) {
if (INSTANCE == null) {
INSTANCE = new OCHThreadPoolManager();
}
@@ -57,12 +53,10 @@ public class OCHThreadPoolManager<T> {
/**
* 开启一个无返回结果的线程
*
* @param r
*/
public void execute(Runnable r) {
if (executor == null) {
/**
/*
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
@@ -73,7 +67,7 @@ public class OCHThreadPoolManager<T> {
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
// 把一个任务丢到了线程池中
@@ -87,13 +81,10 @@ public class OCHThreadPoolManager<T> {
/**
* 开启一个有返回结果的线程
*
* @param r
* @return
*/
public Future<T> submit(Callable<T> r) {
if (executor == null) {
/**
/*
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
@@ -104,7 +95,7 @@ public class OCHThreadPoolManager<T> {
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20),
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<>(20),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
// 把一个任务丢到了线程池中
@@ -113,12 +104,10 @@ public class OCHThreadPoolManager<T> {
/**
* 开启一个无返回结果的线程
*
* @param r
*/
public Future submit(Runnable r) {
if (executor == null) {
/**
/*
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
@@ -129,7 +118,7 @@ public class OCHThreadPoolManager<T> {
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
return executor.submit(r);
@@ -138,8 +127,6 @@ public class OCHThreadPoolManager<T> {
/**
* 把任务移除等待队列
*
* @param r
*/
public void cancel(Runnable r) {
if (r != null) {

View File

@@ -1,15 +1,10 @@
package com.mogo.och.common.module.utils;
import android.annotation.SuppressLint;
import android.media.*;
import android.content.*;
import android.os.*;
import android.app.*;
/**
* @author: wangmingjun
* @date: 2022/9/23
*
*/
public class SoundPoolHelper {
private SoundPool mSoundPool;
private AudioManager mAudioManager;
@@ -22,20 +17,16 @@ public class SoundPoolHelper {
private int resId;
private Context mContext;
private volatile static SoundPoolHelper INSTANCE;
private SoundPoolHelper(){}
public static SoundPoolHelper getSoundPoolHelper(){
if (INSTANCE == null){
synchronized (SoundPoolHelper.class){
if (INSTANCE == null){
INSTANCE = new SoundPoolHelper();
}
}
}
return INSTANCE;
return Holder.INSTANCE;
}
public SoundPoolHelper(){}
private static final class Holder{
@SuppressLint("StaticFieldLeak")
private static final SoundPoolHelper INSTANCE = new SoundPoolHelper();
}
//播放资源文件
public void playSoundWithRedId(Context context,int resId){
@@ -64,30 +55,19 @@ public class SoundPoolHelper {
if (mSoundPool == null){
// For Android SDK >= 21
if (Build.VERSION.SDK_INT >= 21 ) {
AudioAttributes audioAttrib = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_GAME)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build();
AudioAttributes audioAttrib = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_GAME)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build();
SoundPool.Builder builder= new SoundPool.Builder();
builder.setAudioAttributes(audioAttrib).setMaxStreams(MAX_STREAMS);
SoundPool.Builder builder= new SoundPool.Builder();
builder.setAudioAttributes(audioAttrib).setMaxStreams(MAX_STREAMS);
this.mSoundPool = builder.build();
} else {// for Android SDK < 21
// SoundPool(int maxStreams, int streamType, int srcQuality)
this.mSoundPool = new SoundPool(MAX_STREAMS, AudioManager.STREAM_MUSIC, 0);
}
this.mSoundPool = builder.build();
}
// When Sound Pool load complete.
this.mSoundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
@Override
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
playSound();
}
});
this.mSoundPool.setOnLoadCompleteListener((soundPool, sampleId, status) -> playSound());
//load res
this.mSoundId =this.mSoundPool.load(this.mContext,this.resId,1);
@@ -105,14 +85,12 @@ public class SoundPoolHelper {
}
}
//play the sound res
private void playSound(){
float leftVolumn = volume;
float rightVolumn = volume;
float leftVolume = volume;
float rightVolume = volume;
// Play sound of gunfire. Returns the ID of the new stream.
int streamId = this.mSoundPool.play(this.mSoundId,leftVolumn, rightVolumn, 1, 0, 1f);
int streamId = this.mSoundPool.play(this.mSoundId,leftVolume, rightVolume, 1, 0, 1f);
}
}

View File

@@ -26,7 +26,7 @@ public class MarqueeTextView extends androidx.appcompat.widget.AppCompatTextView
/**
* 是否使用自定义 gap
*/
private boolean mUseCustomGap;
private final boolean mUseCustomGap;
public MarqueeTextView(Context context) {
this(context, null);
@@ -60,7 +60,6 @@ public class MarqueeTextView extends androidx.appcompat.widget.AppCompatTextView
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
if (hasWindowFocus){}
super.onWindowFocusChanged(true);
}

View File

@@ -21,7 +21,7 @@ public class OCHGradientTextView extends AppCompatTextView {
private Paint mPaint;
private int mViewWidth = 0;//文字的宽度
private int mViewHeight = 0;//文字的高度
private Rect mTextBound = new Rect();
private final Rect mTextBound = new Rect();
private int[] mColorList;//存放颜色的数组
private boolean isVertrial;//默认是横向
@@ -60,7 +60,7 @@ public class OCHGradientTextView extends AppCompatTextView {
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
//画出文字
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
canvas.drawText(mTipText, getMeasuredWidth() / 2.0f - mTextBound.width() / 2.0f, getMeasuredHeight() / 2.0f + mTextBound.height() / 2.0f, mPaint);
}
/**

View File

@@ -22,18 +22,18 @@ import com.mogo.och.common.module.R;
public class OCHShapeBlurView extends OCHStockBlurView {
Paint mPaint;
RectF mRectF;
private float mRadius;
private int mTopColor; // default #aaffffff
private int mBottomColor; // default #aaffffff
private final float mRadius;
private final int mTopColor; // default #aaffffff
private final int mBottomColor; // default #aaffffff
public OCHShapeBlurView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OCHRShapeBlurView);
mRadius = a.getDimension(R.styleable.OCHRShapeBlurView_och_realtime_radius,
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OCHShapeBlurView);
mRadius = a.getDimension(R.styleable.OCHShapeBlurView_och_realtime_radius,
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, context.getResources().getDisplayMetrics()));
mTopColor = a.getColor(R.styleable.OCHRShapeBlurView_och_realtime_start_color, 0xAAFFFFFF);
mBottomColor = a.getColor(R.styleable.OCHRShapeBlurView_och_realtime_end_color, 0xAAFFFFFF);
mTopColor = a.getColor(R.styleable.OCHShapeBlurView_och_realtime_start_color, 0xAAFFFFFF);
mBottomColor = a.getColor(R.styleable.OCHShapeBlurView_och_realtime_end_color, 0xAAFFFFFF);
a.recycle();
mPaint = new Paint();
mRectF = new RectF();
@@ -60,7 +60,7 @@ public class OCHShapeBlurView extends OCHStockBlurView {
mPaint.reset();
mPaint.setAntiAlias(true);
/* 设置渐变色 这个正方形的颜色是改变的 */
Shader mShader = new LinearGradient(getWidth()/2, 0, getWidth()/2, getHeight(),
Shader mShader = new LinearGradient(getWidth()/2.0f, 0, getWidth()/2.0f, getHeight(),
new int[] {mTopColor,mBottomColor}, null, Shader.TileMode.CLAMP); // 一个材质,打造出一个线性梯度沿著一条线。
mPaint.setShader(mShader);//0xBFE0E8FF,0xBF6AA2D7
canvas.drawRoundRect(mRectF, mRadius,mRadius,mPaint);

View File

@@ -24,13 +24,13 @@ public class OCHStockBlurView extends View {
private float mDownsampleFactor; // default 4
private int mOverlayColor; // default #aaffffff
private float mBlurRadius; // default 10dp (0 < r <= 25)
private boolean onece;
private final boolean onece;
private boolean mDirty;
private Bitmap mBitmapToBlur, mBlurredBitmap;
private Canvas mBlurringCanvas;
private boolean mIsRendering;
private Paint mPaint;
private final Paint mPaint;
private final Rect mRectSrc = new Rect(), mRectDst = new Rect();
// mDecorView should be the root view of the activity (even if you are on a different window like a dialog)
private View mDecorView;
@@ -149,9 +149,11 @@ public class OCHStockBlurView extends View {
} finally {
if (!r) {
release();
return false;
}
}
if (!r) {
return false;
}
}
if (dirty) {
@@ -216,7 +218,9 @@ public class OCHStockBlurView extends View {
}
}
if(onece) {
mDecorView.getViewTreeObserver().removeOnPreDrawListener(this);
if(mDecorView!=null) {
mDecorView.getViewTreeObserver().removeOnPreDrawListener(this);
}
}
return true;
}

View File

@@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class FrameSurfaceView extends BaseSurfaceView {
public static final int INVALID_INDEX = Integer.MAX_VALUE;
private int bufferSize = 3;
private final int bufferSize = 3;
public static final String DECODE_THREAD_NAME = "DecodingThread";
public static final int INFINITE = -1;
//-1 means repeat infinitely
@@ -45,12 +45,12 @@ public class FrameSurfaceView extends BaseSurfaceView {
* decoded bitmaps stores in this queue
* consumer is drawing thread, producer is decoding thread.
*/
private LinkedBlockingQueue decodedBitmaps = new LinkedBlockingQueue(bufferSize);
private final LinkedBlockingQueue decodedBitmaps = new LinkedBlockingQueue(bufferSize);
/**
* bitmaps already drawn by canvas stores in this queue
* consumer is decoding thread, producer is drawing thread.
*/
private LinkedBlockingQueue drawnBitmaps = new LinkedBlockingQueue(bufferSize);
private final LinkedBlockingQueue drawnBitmaps = new LinkedBlockingQueue(bufferSize);
/**
* the thread for decoding bitmaps
*/
@@ -64,9 +64,9 @@ public class FrameSurfaceView extends BaseSurfaceView {
*/
private Handler handler;
private BitmapFactory.Options options;
private Paint paint = new Paint();
private final Paint paint = new Paint();
private Rect srcRect;
private Rect dstRect = new Rect();
private final Rect dstRect = new Rect();
private int defaultWidth;
private int defaultHeight;
@@ -138,7 +138,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
return;
}
this.bitmapIds = bitmapIds;
//by default, take the first bitmap's dimension into consideration
//by default, take the first bitMap's dimension into consideration
getBitmapDimension(bitmapIds.get(bitmapIdIndex));
preloadFrames();
decodeRunnable = new DecodeRunnable(bitmapIdIndex, bitmapIds, options);
@@ -203,8 +203,6 @@ public class FrameSurfaceView extends BaseSurfaceView {
/**
* draw a single frame which is a bitmap
*
* @param canvas
*/
private void drawOneFrame(Canvas canvas) {
LinkedBitmap linkedBitmap = getDecodedBitmap();
@@ -214,12 +212,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
putDrawnBitmap(linkedBitmap);
frameIndex.incrementAndGet();
if(isFinish()&&frameFinishCallback!=null){
runOnUIThread(new Runnable() {
@Override
public void run() {
frameFinishCallback.onFinishCallback();
}
});
runOnUIThread(() -> frameFinishCallback.onFinishCallback());
}
}
@@ -271,8 +264,8 @@ public class FrameSurfaceView extends BaseSurfaceView {
}
if (decodeRunnable != null) {
decodeRunnable.setIndex(0);
handler.post(decodeRunnable);
}
handler.post(decodeRunnable);
}
@@ -290,8 +283,8 @@ public class FrameSurfaceView extends BaseSurfaceView {
* decode bitmap by BitmapFactory.decodeStream(), it is about twice faster than BitmapFactory.decodeResource()
*
* @param resId the bitmap resource
* @param options
* @return
* @param options options
* @return Bitmap
*/
private Bitmap decodeBitmap(int resId, BitmapFactory.Options options) {
options.inScaled = false;
@@ -322,8 +315,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
* @param linkedBitmap
*/
private void decodeAndPutBitmap(int resId, BitmapFactory.Options options, LinkedBitmap linkedBitmap) {
Bitmap bitmap = decodeBitmap(resId, options);
linkedBitmap.bitmap = bitmap;
linkedBitmap.bitmap = decodeBitmap(resId, options);
try {
decodedBitmaps.put(linkedBitmap);
} catch (InterruptedException e) {
@@ -377,8 +369,8 @@ public class FrameSurfaceView extends BaseSurfaceView {
private class DecodeRunnable implements Runnable {
private int index;
private List<Integer> bitmapIds;
private BitmapFactory.Options options;
private final List<Integer> bitmapIds;
private final BitmapFactory.Options options;
public DecodeRunnable(int index, List<Integer> bitmapIds, BitmapFactory.Options options) {
this.index = index;

View File

@@ -4,8 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/road_video_bg"
tools:context="com.mogo.eagle.core.function.main.VideoAdAtc">
android:background="@drawable/road_video_bg">
<FrameLayout
android:id="@+id/videoPlayerContainer"

View File

@@ -47,7 +47,7 @@
<attr name="och_realtime_overlay_color" format="color" />
<attr name="och_realtime_onece" format="boolean" />
</declare-styleable>
<declare-styleable name="OCHRShapeBlurView">
<declare-styleable name="OCHShapeBlurView">
<attr name="och_realtime_start_color" format="color" />
<attr name="och_realtime_end_color" format="color" />
<attr name="och_realtime_radius" format="dimension" />

View File

@@ -1,24 +0,0 @@
package com.mogo.och.data
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mogo.och.data.test", appContext.packageName)
}
}

View File

@@ -1,17 +0,0 @@
package com.mogo.och.data
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.noop">
<manifest package="com.mogo.och.noop">
</manifest>

View File

@@ -28,10 +28,10 @@ public class OpenItemAnimator extends DefaultItemAnimator {
private static TimeInterpolator sDefaultInterpolator;
private ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
private ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
private final ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
private final ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
private final ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
@@ -102,20 +102,16 @@ public class OpenItemAnimator extends DefaultItemAnimator {
mPendingRemovals.clear();
// Next, move stuff
if (movesPending) {
final ArrayList<MoveInfo> moves = new ArrayList<>();
moves.addAll(mPendingMoves);
final ArrayList<MoveInfo> moves = new ArrayList<>(mPendingMoves);
mMovesList.add(moves);
mPendingMoves.clear();
Runnable mover = new Runnable() {
@Override
public void run() {
for (MoveInfo moveInfo : moves) {
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
moveInfo.toX, moveInfo.toY);
}
moves.clear();
mMovesList.remove(moves);
Runnable mover = () -> {
for (MoveInfo moveInfo : moves) {
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
moveInfo.toX, moveInfo.toY);
}
moves.clear();
mMovesList.remove(moves);
};
if (removalsPending) {
View view = moves.get(0).holder.itemView;
@@ -126,19 +122,15 @@ public class OpenItemAnimator extends DefaultItemAnimator {
}
// Next, change stuff, to run in parallel with move animations
if (changesPending) {
final ArrayList<ChangeInfo> changes = new ArrayList<>();
changes.addAll(mPendingChanges);
final ArrayList<ChangeInfo> changes = new ArrayList<>(mPendingChanges);
mChangesList.add(changes);
mPendingChanges.clear();
Runnable changer = new Runnable() {
@Override
public void run() {
for (ChangeInfo change : changes) {
animateChangeImpl(change);
}
changes.clear();
mChangesList.remove(changes);
Runnable changer = () -> {
for (ChangeInfo change : changes) {
animateChangeImpl(change);
}
changes.clear();
mChangesList.remove(changes);
};
if (removalsPending) {
RecyclerView.ViewHolder holder = changes.get(0).oldHolder;
@@ -149,19 +141,15 @@ public class OpenItemAnimator extends DefaultItemAnimator {
}
// Next, add stuff
if (additionsPending) {
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
additions.addAll(mPendingAdditions);
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>(mPendingAdditions);
mAdditionsList.add(additions);
mPendingAdditions.clear();
Runnable adder = new Runnable() {
@Override
public void run() {
for (RecyclerView.ViewHolder holder : additions) {
animateAddImpl(holder);
}
additions.clear();
mAdditionsList.remove(additions);
Runnable adder = () -> {
for (RecyclerView.ViewHolder holder : additions) {
animateAddImpl(holder);
}
additions.clear();
mAdditionsList.remove(additions);
};
if (removalsPending || movesPending || changesPending) {
long removeDuration = removalsPending ? getRemoveDuration() : 0;
@@ -341,8 +329,8 @@ public class OpenItemAnimator extends DefaultItemAnimator {
final ViewPropertyAnimator oldViewAnim = view.animate().setDuration(
getChangeDuration());
mChangeAnimations.add(changeInfo.oldHolder);
oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX);
oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY);
oldViewAnim.translationX((float)(changeInfo.toX - changeInfo.fromX));
oldViewAnim.translationY((float)(changeInfo.toY - changeInfo.fromY));
oldViewAnim.alpha(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {

View File

@@ -75,13 +75,13 @@ public class BusArcView extends View {
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
//绘制中心的数值
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2 - 10, mTextPaint);
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
//绘制中心文字描述
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_des_text_size));
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
}
private void drawArc(Canvas canvas) {
@@ -135,13 +135,10 @@ public class BusArcView extends View {
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
progressAnimator.setDuration(time);
progressAnimator.setTarget(mIncludedAngle);
progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
}
progressAnimator.addUpdateListener(animation -> {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
});
//开始执行动画
progressAnimator.start();

View File

@@ -22,7 +22,6 @@ import android.view.animation.DecelerateInterpolator;
import androidx.annotation.Nullable;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
import com.mogo.och.bus.R;
import me.jessyan.autosize.AutoSizeConfig;
@@ -92,7 +91,7 @@ public class SlidePanelView extends View {
private ObjectAnimator matrixAnim;
private String blockText = STRING_SLIDE_TO_RIGHT;
private Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
private final Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
private static final int GRADIENT_OFFSET = 200;
@@ -263,10 +262,10 @@ public class SlidePanelView extends View {
gradientMatrix.setTranslate(matrixTranslate, 0);
textGradient.setLocalMatrix(gradientMatrix);
canvas.save();
canvas.drawText(blockText, blockWidth + BLOCK_START_X + textMarginLeft, textOffset, textPaint);
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), (float) textOffset, textPaint);
canvas.restore();
// 画滑块
canvas.drawBitmap(bmBlock, BLOCK_START_X + blockOffset, BLOCK_START_Y, blockPaint);
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
}
public interface OnSlidePanelMoveToEndListener {

View File

@@ -74,7 +74,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}

View File

@@ -493,7 +493,6 @@ public class BusPassengerModel {
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;
int state = autopilotStatusInfo.getState();
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
//2022.7.20 自动驾驶更换成带档位的

View File

@@ -58,7 +58,7 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
mapBizView = findViewById(R.id.mapBizView);
romaPView = findViewById(R.id.romaPView);
if(DeviceUtils.isLenovoModel() || DeviceUtils.isEB5Model()){
romaPView.setVisibility(View.GONE);
romaPView.setVisibility(View.VISIBLE);
}else{
romaPView.setVisibility(View.GONE);
}

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mogo.och.bus.passenger">
<application>
<activity android:name="com.mogo.eagle.core.function.main.MainLauncherActivity"
android:screenOrientation="portrait"
tools:replace="android:screenOrientation"/>
</application>
</manifest>

View File

@@ -19,7 +19,10 @@ public class BusPassengerMapAssetStyleUtil {
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
int count = 0;
while ((count = is1.read(buffer1)) > 0) {
is1.read(buffer1);
}
} catch (IOException e) {
e.printStackTrace();
} finally {

View File

@@ -62,6 +62,8 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -128,55 +128,52 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
//设置左下角四个按钮监听事件
setBottomBtnListener();
// 模拟 下发启动自驾命令
findViewById(R.id.btnStartAutopilot).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() + ", 请稍候重试");
return;
}
new AutopilotModeConfigManager(new AutopilotModeConfigManager.OnReadAutopilotModeConfigListener() {
@Override
public void onReadFailed(String err) {
ThreadUtils.runOnUiThread(() -> {
ToastUtils.showLong("读取失败=" + err);
});
}
@Override
public void onParseFailed(String err) {
ToastUtils.showLong("解析失败=" + err);
}
@Override
public void onParse(MessagePad.SetAutopilotModeReq bean) {
ToastUtils.showLong("下发命令\n" + TextFormat.printer().escapingNonAscii(false).printToString(bean));
AutopilotControlParameters parameters = new AutopilotControlParameters();
MessagePad.RouteInfo routeInfo = bean.getRouteInfo();
if (routeInfo.getRouteID() > 0) {
parameters.routeID = routeInfo.getRouteID();
}
parameters.routeName = routeInfo.getRouteName();
parameters.startName = routeInfo.getStartName();//拼音
parameters.endName = routeInfo.getEndName();//拼音
parameters.startLatLon = new AutopilotControlParameters
.AutoPilotLonLat(routeInfo.getStartLocation().getLatitude(), routeInfo.getStartLocation().getLongitude());
parameters.endLatLon = new AutopilotControlParameters
.AutoPilotLonLat(routeInfo.getEndLocation().getLatitude(), routeInfo.getEndLocation().getLongitude());
parameters.vehicleType = 10;
MessagePad.Line line = routeInfo.getLine();
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
line.getLineId(), line.getLineName(),
line.getTrajUrl(), line.getTrajMd5(),
line.getStopUrl(), line.getStopMd5(),
line.getTimestamp(), line.getVehicleModel(),
line.getTrajUrlDpqp(), line.getTrajMd5Dpqp(),
line.getStopUrlDpqp(), line.getStopMd5Dpqp(),
line.getTimestampDpqp());
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters);
}
}).read();
findViewById(R.id.btnStartAutopilot).setOnClickListener(v -> {
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() + ", 请稍候重试");
return;
}
new AutopilotModeConfigManager(new AutopilotModeConfigManager.OnReadAutopilotModeConfigListener() {
@Override
public void onReadFailed(String err) {
ThreadUtils.runOnUiThread(() -> {
ToastUtils.showLong("读取失败=" + err);
});
}
@Override
public void onParseFailed(String err) {
ToastUtils.showLong("解析失败=" + err);
}
@Override
public void onParse(MessagePad.SetAutopilotModeReq bean) {
ToastUtils.showLong("下发命令\n" + TextFormat.printer().escapingNonAscii(false).printToString(bean));
AutopilotControlParameters parameters = new AutopilotControlParameters();
MessagePad.RouteInfo routeInfo = bean.getRouteInfo();
if (routeInfo.getRouteID() > 0) {
parameters.routeID = routeInfo.getRouteID();
}
parameters.routeName = routeInfo.getRouteName();
parameters.startName = routeInfo.getStartName();//拼音
parameters.endName = routeInfo.getEndName();//拼音
parameters.startLatLon = new AutopilotControlParameters
.AutoPilotLonLat(routeInfo.getStartLocation().getLatitude(), routeInfo.getStartLocation().getLongitude());
parameters.endLatLon = new AutopilotControlParameters
.AutoPilotLonLat(routeInfo.getEndLocation().getLatitude(), routeInfo.getEndLocation().getLongitude());
parameters.vehicleType = 10;
MessagePad.Line line = routeInfo.getLine();
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
line.getLineId(), line.getLineName(),
line.getTrajUrl(), line.getTrajMd5(),
line.getStopUrl(), line.getStopMd5(),
line.getTimestamp(), line.getVehicleModel(),
line.getTrajUrlDpqp(), line.getTrajMd5Dpqp(),
line.getStopUrlDpqp(), line.getStopMd5Dpqp(),
line.getTimestampDpqp());
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters);
}
}).read();
});
// 模拟 查询当前任务
findViewById(R.id.btnQueryCurrentTask).setOnClickListener(view ->
@@ -437,7 +434,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
}
});
mSettingBtn.setOnClickListener(v -> {
// TODO: 2021/12/9
CallerHmiManager.INSTANCE.showToolsView();
});
if (mCardBtn != null) {
@@ -458,8 +454,8 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
if (isShow) {
mFlWeltMapOverView.setVisibility(View.VISIBLE);
if (mWeltMapOverViewFragment == null) {
mWeltMapOverViewFragment = mWeltMapOverViewFragment.newInstance(
(IWeltMapSwitchToSmallCallback) this,
mWeltMapOverViewFragment = WeltMapOverViewFragment.newInstance(
this,
mCurrentTaskEndStation,
mWeltDataBeanList,
mSubTaskCoordinates,
@@ -565,7 +561,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
}
public static String format(double value) {
BigDecimal bd = new BigDecimal(value);
BigDecimal bd = BigDecimal.valueOf(value);
bd = bd.setScale(2, RoundingMode.HALF_UP);
return bd.toString();
}

View File

@@ -59,7 +59,6 @@ import java.util.List;
import chassis.ChassisStatesOuterClass;
import io.reactivex.exceptions.UndeliverableException;
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
@@ -110,7 +109,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
private boolean isHasTaskInfo = false;//判断是否有任务数据
//用于对应messageType和reqNo绑定在一起保证请求的reqNo和响应的reqNo一致
private HashMap<Integer, String> msgTypeAndReqNo = new HashMap<>();
private final HashMap<Integer, String> msgTypeAndReqNo = new HashMap<>();
public static SweeperTaskModel getInstance() {
if (sInstance == null) {
@@ -149,38 +148,35 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
//2022.1.28
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
// The exception could not be delivered to the consumer because it has already canceled/disposed
// the flow or the excTeption has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
public void accept(Throwable e) {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_SWEEPER + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {//
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_SWEEPER + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_SWEEPER + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_SWEEPER + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_SWEEPER + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_SWEEPER + TAG, "Undeliverable exception");
// the flow or the exception has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_SWEEPER + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {//
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_SWEEPER + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_SWEEPER + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_SWEEPER + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_SWEEPER + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_SWEEPER + TAG, "Undeliverable exception");
});
}
@@ -279,11 +275,6 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null);
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
private final IMogoStatusChangedListener mMogoStatusChangedListener = new IMogoStatusChangedListener() {
// VR mode变更回调
@Override
@@ -424,9 +415,6 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
@Override
public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
if (cleanSystemState == null) {
return;
}
long current = System.currentTimeMillis();
if (current - mVehicleStateCurrentTimeMillis <= VEHICLE_STATE_INTERVAL_MILLIS) {
return;
@@ -506,7 +494,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
}
private static String format(double value) {
BigDecimal bd = new BigDecimal(value);
BigDecimal bd = BigDecimal.valueOf(value);
bd = bd.setScale(2, RoundingMode.HALF_UP);
return bd.toString();
}
@@ -688,18 +676,18 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
if (mControllerStatusCallback != null) {
mControllerStatusCallback.onAutopilotState(state);
}
switch (state) {
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING://自动驾驶中
break;
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING://平行驾驶
break;
default:
break;
}
// switch (state) {
// case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
// break;
// case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
// break;
// case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING://自动驾驶中
// break;
// case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING://平行驾驶
// break;
// default:
// break;
// }
}
@Override

View File

@@ -62,6 +62,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -36,14 +36,14 @@ public class SweeperProvider implements IMogoOCH {
FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
if (sweeperFragment == null) {
CallerLogger.d(TAG, "准备add fragment======");
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(sweeperFragment.TAG);
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(SweeperFragment.TAG);
if (fragmentByTag instanceof SweeperFragment) {
sweeperFragment = (SweeperFragment) fragmentByTag;
} else {
sweeperFragment = new SweeperFragment();
}
if(!sweeperFragment.isAdded()) {
supportFragmentManager.beginTransaction().add(containerId, sweeperFragment, sweeperFragment.TAG).commitAllowingStateLoss();
supportFragmentManager.beginTransaction().add(containerId, sweeperFragment, SweeperFragment.TAG).commitAllowingStateLoss();
}
return;
}

View File

@@ -408,8 +408,8 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
if (isShow) {
mFlWeltMapOverView.setVisibility(View.VISIBLE);
if (mWeltMapOverViewFragment == null) {
mWeltMapOverViewFragment = mWeltMapOverViewFragment.newInstance(
(IWeltMapSwitchToSmallCallback) this,
mWeltMapOverViewFragment = WeltMapOverViewFragment.newInstance(
this,
mCurrentTaskEndStation,
mWeltDataBeanList,
mSubTaskCoordinates,

View File

@@ -360,11 +360,11 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
*/
lifecycleScope.launch(Dispatchers.IO) {
mSubMutableList?.let {
var sum: Double = 0.0
var sum = 0.0
for (index in it.indices) {
sum += it[index].mileage
}
var completed: Double = 0.0
var completed = 0.0
for (index in it.indices) {
if (index < mCurrentSubPosition) {
// 已完成的子任务记入完成度,进行中的不计入

View File

@@ -140,38 +140,35 @@ public class SweeperTaskModel {
//2022.1.28
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
// The exception could not be delivered to the consumer because it has already canceled/disposed
// the flow or the excTeption has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
public void accept(Throwable e) {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_SWEEPER + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {//
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_SWEEPER + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_SWEEPER + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_SWEEPER + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_SWEEPER + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_SWEEPER + TAG, "Undeliverable exception");
// the flow or the exception has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_SWEEPER + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_SWEEPER + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_SWEEPER + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_SWEEPER + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_SWEEPER + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_SWEEPER + TAG, "Undeliverable exception");
});
}
@@ -191,7 +188,7 @@ public class SweeperTaskModel {
@Override
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
if (null != routeList && routeList.getWayPointsList()!=null&&routeList.getWayPointsList().size() > 0) {
if (null != routeList && routeList.getWayPointsList().size() > 0) {
if (mCurrentSubTaskDetail.getLineId() != mLineId) {//判断是否同一条路线
mLineId = mCurrentSubTaskDetail.getLineId();
points.addAll(coordinateConverterWgsToGcjList(mContext, routeList.getWayPointsList()));
@@ -316,7 +313,6 @@ public class SweeperTaskModel {
}
if (SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.getCode() == mSubTaskType) {//人工驾驶子任务需要手动跳过,不能自动结束
addCoordinates(gnssInfo);
return;
}
//子任务完成的围栏判断 子任务正在执行中,还未到达子任务终点
//20230504 为了避免自车定位提前结束任务导致的溜车问题,这里删除自车自动触发到站
@@ -365,7 +361,6 @@ public class SweeperTaskModel {
isAutopilotSubTaskArriveEndSite = true;
//到达子任务终点 结束子任务
subTaskEnd(mIsFirstSubtask, mIsLastSubtask, mSubTaskId); //无自动驾驶到终点信息传null
return;
}
}
@@ -393,10 +388,6 @@ public class SweeperTaskModel {
firstStartAutopilot++;
triggerStartServiceEvent(isRestart, false);
AutopilotControlParameters parameters = initAutopilotControlParameters();
if (null == parameters) {
CallerLogger.e(M_SWEEPER + TAG, "行程日志-AutopilotControlParameters is empty.");
return;
}
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters);
CallerLogger.d(M_SWEEPER + TAG, "行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
@@ -496,10 +487,6 @@ public class SweeperTaskModel {
private void updateAutopilotControlParameters() {
AutopilotControlParameters parameters = initAutopilotControlParameters();
if (null == parameters) {
CallerLogger.e(M_SWEEPER + TAG, "AutopilotControlParameters is empty.");
return;
}
CallerLogger.d(M_SWEEPER + TAG, "AutopilotControlParameters" + GsonUtil.jsonFromObject(parameters));
CallerLogger.d(M_SWEEPER + TAG, "AutopilotControlParameters is update.");
CallerAutoPilotStatusListenerManager.INSTANCE.updateAutopilotControlParameters(parameters);

View File

@@ -30,7 +30,7 @@ public class BusArcView extends View {
//圆弧颜色
private int mArcColor;
//圆弧的画笔的宽度
private float mStrokeWith = getResources().getDimension(R.dimen.sweeper_ext_arcView_stroke_with);
private final float mStrokeWith = getResources().getDimension(R.dimen.sweeper_ext_arcView_stroke_with);
//文字描述的paint
private Paint mTextPaint;
@@ -39,9 +39,9 @@ public class BusArcView extends View {
//当前数据
private int currentValue;
//最大数据
private int maxValue = 240;
private final int maxValue = 240;
//圆弧背景的开始和结束间的夹角大小
private float mAngle = 270;
private final float mAngle = 270;
//上次绘制圆弧夹角
private float lastAngle = 0;
@@ -75,13 +75,13 @@ public class BusArcView extends View {
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
//绘制中心的数值
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2 - 10, mTextPaint);
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
//绘制中心文字描述
mTextPaint.setTextSize(getResources().getDimension(R.dimen.sweeper_ext_arcView_des_text_size));
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
}
private void drawArc(Canvas canvas) {
@@ -135,13 +135,10 @@ public class BusArcView extends View {
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
progressAnimator.setDuration(time);
progressAnimator.setTarget(mIncludedAngle);
progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
}
progressAnimator.addUpdateListener(animation -> {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
});
//开始执行动画
progressAnimator.start();

View File

@@ -1,5 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.taxi">
/
<manifest package="com.mogo.och.taxi">
</manifest>

View File

@@ -5,6 +5,8 @@ import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_SOURCE_ADA
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_TYPE_SOCKET_AUTOPILOT;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
import static java.util.Collections.emptyList;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
@@ -123,8 +125,8 @@ public class TaxiModel {
private volatile String mPrevOrderNo = ""; //前一次的新到单id当次和前一次orderId相同时本次不再弹出
private volatile OrderQueryRespBean.Result mNewBookingOrder; //新到待抢预约单
private volatile OrderQueryRespBean.Result mCurrentOCHOrder; //当前订单
private volatile List<OrderQueryRespBean.Result> mInServiceList = Collections.emptyList(); //进行中订单
private volatile List<OrderQueryRespBean.Result> mWaitServiceList = Collections.emptyList(); //待服务订单
private List<OrderQueryRespBean.Result> mInServiceList = Collections.synchronizedList(emptyList()); //进行中订单
private volatile List<OrderQueryRespBean.Result> mWaitServiceList = emptyList(); //待服务订单
private ITaxiADASStatusCallback mADASStatusCallback; //Model->Presenter自动驾驶状态相关
private ITaxiCarOperationalCallback mCarOperationalCallback; //Model->Presenter登录状态和司机今日接单状态
@@ -135,7 +137,7 @@ public class TaxiModel {
private volatile boolean isRestartAutopilot = false;
private final List<MogoLocation> mRoutePoints = new ArrayList<>();
private int mPreRouteIndex = 0;
private final int mPreRouteIndex = 0;
private double mLongitude, mLatitude;
private MogoLocation mLocation = null;
@@ -180,37 +182,34 @@ public class TaxiModel {
//2022.1.28
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
// The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the excTeption has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
public void accept(Throwable e) {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_TAXI + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {//
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_TAXI + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_TAXI + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_TAXI + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_TAXI + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_TAXI + TAG, "Undeliverable exception");
RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
CallerLogger.d(M_TAXI + TAG, "UndeliverableException");
}
if ((e instanceof IOException)) {//
// fine, irrelevant network problem or API that throws on cancellation
CallerLogger.d(M_TAXI + TAG, "IOException");
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
CallerLogger.d(M_TAXI + TAG, "InterruptedException");
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
CallerLogger.d(M_TAXI + TAG, "NullPointerException or IllegalArgumentException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
CallerLogger.d(M_TAXI + TAG, "IllegalStateException");
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
CallerLogger.d(M_TAXI + TAG, "Undeliverable exception");
});
}
@@ -1595,8 +1594,8 @@ public class TaxiModel {
/**
* 上报订单剩余里程和时间 单位KM, M 单位:秒
*
* @param lastSumLength
* @param duration
* @param lastSumLength 上报订单剩余里程
* @param duration 上报订单剩余时间
*/
public void reportOrderRemain(long lastSumLength, long duration) {// 米/秒
if (mCurrentOCHOrder == null) return;
@@ -1737,18 +1736,15 @@ public class TaxiModel {
mOrderStatusCallback.onNaviToEnd(false, isShow);
}
} else {//若直接要显示导航地图则直接导航, 若不是则2s后若无轨迹数据使用高德导航
if (isShow && mRoutePoints.size() == 0 && mOrderStatusCallback != null) {
if (isShow && mOrderStatusCallback != null) {
mOrderStatusCallback.onNaviToEnd(true, true);
} else {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (mRoutePoints.size() == 0 && mOrderStatusCallback != null) {
mOrderStatusCallback.onNaviToEnd(true, false);
}
UiThreadHandler.postDelayed(() -> {
if (mRoutePoints.size() == 0 && mOrderStatusCallback != null) {
mOrderStatusCallback.onNaviToEnd(true, false);
}
}, 2000l);
}, 2000L);
}
}

View File

@@ -5,7 +5,6 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.drawable.BitmapDrawable
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoBackCameraVideoListener
@@ -128,7 +127,7 @@ class RightRearCamView : ConstraintLayout , IMoGoBackCameraVideoListener,
private fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int {
val width = options.outWidth
val height = options.outHeight
Log.i(TAG, "calculateInSampleSize: out width and height is $width height $height")
d(SceneConstant.M_TAXI_P + TAG, "calculateInSampleSize: out width and height is $width height $height")
var inSampleWidth = 1
if (height > reqHeight || width > reqWidth) {
val halfHeight = height / 2

View File

@@ -1,974 +0,0 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mogo.och.taxi.passenger.utils.blur;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* A cache that uses a bounded amount of space on a filesystem. Each cache
* entry has a string key and a fixed number of values. Each key must match
* the regex <strong>[a-z0-9_-]{1,64}</strong>. Values are byte sequences,
* accessible as streams or files. Each value must be between {@code 0} and
* {@code Integer.MAX_VALUE} bytes in length.
*
* <p>The cache stores its data in a directory on the filesystem. This
* directory must be exclusive to the cache; the cache may delete or overwrite
* files from its directory. It is an error for multiple processes to use the
* same cache directory at the same time.
*
* <p>This cache limits the number of bytes that it will store on the
* filesystem. When the number of stored bytes exceeds the limit, the cache will
* remove entries in the background until the limit is satisfied. The limit is
* not strict: the cache may temporarily exceed it while waiting for files to be
* deleted. The limit does not include filesystem overhead or the cache
* journal so space-sensitive applications should set a conservative limit.
*
* <p>Clients call {@link #edit} to create or update the values of an entry. An
* entry may have only one editor at one time; if a value is not available to be
* edited then {@link #edit} will return null.
* <ul>
* <li>When an entry is being <strong>created</strong> it is necessary to
* supply a full set of values; the empty value should be used as a
* placeholder if necessary.
* <li>When an entry is being <strong>edited</strong>, it is not necessary
* to supply data for every value; values default to their previous
* value.
* </ul>
* Every {@link #edit} call must be matched by a call to {@link Editor#commit}
* or {@link Editor#abort}. Committing is atomic: a read observes the full set
* of values as they were before or after the commit, but never a mix of values.
*
* <p>Clients call {@link #get} to read a snapshot of an entry. The read will
* observe the value at the time that {@link #get} was called. Updates and
* removals after the call do not impact ongoing reads.
*
* <p>This class is tolerant of some I/O errors. If files are missing from the
* filesystem, the corresponding entries will be dropped from the cache. If
* an error occurs while writing a cache value, the edit will fail silently.
* Callers should handle other problems by catching {@code IOException} and
* responding appropriately.
*/
final class DiskLruCache implements Closeable {
static final String JOURNAL_FILE = "journal";
static final String JOURNAL_FILE_TEMP = "journal.tmp";
static final String JOURNAL_FILE_BACKUP = "journal.bkp";
static final String MAGIC = "libcore.io.DiskLruCache";
static final String VERSION_1 = "1";
static final long ANY_SEQUENCE_NUMBER = -1;
static final Pattern LEGAL_KEY_PATTERN = Pattern.compile("[a-z0-9_-]{1,64}");
private static final String CLEAN = "CLEAN";
private static final String DIRTY = "DIRTY";
private static final String REMOVE = "REMOVE";
private static final String READ = "READ";
/*
* This cache uses a journal file named "journal". A typical journal file
* looks like this:
* libcore.io.DiskLruCache
* 1
* 100
* 2
*
* CLEAN 3400330d1dfc7f3f7f4b8d4d803dfcf6 832 21054
* DIRTY 335c4c6028171cfddfbaae1a9c313c52
* CLEAN 335c4c6028171cfddfbaae1a9c313c52 3934 2342
* REMOVE 335c4c6028171cfddfbaae1a9c313c52
* DIRTY 1ab96a171faeeee38496d8b330771a7a
* CLEAN 1ab96a171faeeee38496d8b330771a7a 1600 234
* READ 335c4c6028171cfddfbaae1a9c313c52
* READ 3400330d1dfc7f3f7f4b8d4d803dfcf6
*
* The first five lines of the journal form its header. They are the
* constant string "libcore.io.DiskLruCache", the disk cache's version,
* the application's version, the value count, and a blank line.
*
* Each of the subsequent lines in the file is a record of the state of a
* cache entry. Each line contains space-separated values: a state, a key,
* and optional state-specific values.
* o DIRTY lines track that an entry is actively being created or updated.
* Every successful DIRTY action should be followed by a CLEAN or REMOVE
* action. DIRTY lines without a matching CLEAN or REMOVE indicate that
* temporary files may need to be deleted.
* o CLEAN lines track a cache entry that has been successfully published
* and may be read. A publish line is followed by the lengths of each of
* its values.
* o READ lines track accesses for LRU.
* o REMOVE lines track entries that have been deleted.
*
* The journal file is appended to as cache operations occur. The journal may
* occasionally be compacted by dropping redundant lines. A temporary file named
* "journal.tmp" will be used during compaction; that file should be deleted if
* it exists when the cache is opened.
*/
private final File directory;
private final File journalFile;
private final File journalFileTmp;
private final File journalFileBackup;
private final int appVersion;
private long maxSize;
private int maxFileCount;
private final int valueCount;
private long size = 0;
private int fileCount = 0;
private Writer journalWriter;
private final LinkedHashMap<String, Entry> lruEntries =
new LinkedHashMap<String, Entry>(0, 0.75f, true);
private int redundantOpCount;
/**
* To differentiate between old and current snapshots, each entry is given
* a sequence number each time an edit is committed. A snapshot is stale if
* its sequence number is not equal to its entry's sequence number.
*/
private long nextSequenceNumber = 0;
/** This cache uses a single background thread to evict entries. */
final ThreadPoolExecutor executorService =
new ThreadPoolExecutor(0, 1, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private final Callable<Void> cleanupCallable = new Callable<Void>() {
public Void call() throws Exception {
synchronized (DiskLruCache.this) {
if (journalWriter == null) {
return null; // Closed.
}
trimToSize();
trimToFileCount();
if (journalRebuildRequired()) {
rebuildJournal();
redundantOpCount = 0;
}
}
return null;
}
};
private DiskLruCache(File directory, int appVersion, int valueCount, long maxSize, int maxFileCount) {
this.directory = directory;
this.appVersion = appVersion;
this.journalFile = new File(directory, JOURNAL_FILE);
this.journalFileTmp = new File(directory, JOURNAL_FILE_TEMP);
this.journalFileBackup = new File(directory, JOURNAL_FILE_BACKUP);
this.valueCount = valueCount;
this.maxSize = maxSize;
this.maxFileCount = maxFileCount;
}
/**
* Opens the cache in {@code directory}, creating a cache if none exists
* there.
*
* @param directory a writable directory
* @param valueCount the number of values per cache entry. Must be positive.
* @param maxSize the maximum number of bytes this cache should use to store
* @param maxFileCount the maximum file count this cache should store
* @throws IOException if reading or writing the cache directory fails
*/
public static DiskLruCache open(File directory, int appVersion, int valueCount, long maxSize, int maxFileCount)
throws IOException {
if (maxSize <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
if (maxFileCount <= 0) {
throw new IllegalArgumentException("maxFileCount <= 0");
}
if (valueCount <= 0) {
throw new IllegalArgumentException("valueCount <= 0");
}
// If a bkp file exists, use it instead.
File backupFile = new File(directory, JOURNAL_FILE_BACKUP);
if (backupFile.exists()) {
File journalFile = new File(directory, JOURNAL_FILE);
// If journal file also exists just delete backup file.
if (journalFile.exists()) {
backupFile.delete();
} else {
renameTo(backupFile, journalFile, false);
}
}
// Prefer to pick up where we left off.
DiskLruCache cache = new DiskLruCache(directory, appVersion, valueCount, maxSize, maxFileCount);
if (cache.journalFile.exists()) {
try {
cache.readJournal();
cache.processJournal();
cache.journalWriter = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(cache.journalFile, true), Util.US_ASCII));
return cache;
} catch (IOException journalIsCorrupt) {
System.out
.println("DiskLruCache "
+ directory
+ " is corrupt: "
+ journalIsCorrupt.getMessage()
+ ", removing");
cache.delete();
}
}
// Create a new empty cache.
directory.mkdirs();
cache = new DiskLruCache(directory, appVersion, valueCount, maxSize, maxFileCount);
cache.rebuildJournal();
return cache;
}
private void readJournal() throws IOException {
StrictLineReader reader = new StrictLineReader(new FileInputStream(journalFile), Util.US_ASCII);
try {
String magic = reader.readLine();
String version = reader.readLine();
String appVersionString = reader.readLine();
String valueCountString = reader.readLine();
String blank = reader.readLine();
if (!MAGIC.equals(magic)
|| !VERSION_1.equals(version)
|| !Integer.toString(appVersion).equals(appVersionString)
|| !Integer.toString(valueCount).equals(valueCountString)
|| !"".equals(blank)) {
throw new IOException("unexpected journal header: [" + magic + ", " + version + ", "
+ valueCountString + ", " + blank + "]");
}
int lineCount = 0;
while (true) {
try {
readJournalLine(reader.readLine());
lineCount++;
} catch (EOFException endOfJournal) {
break;
}
}
redundantOpCount = lineCount - lruEntries.size();
} finally {
Util.closeQuietly(reader);
}
}
private void readJournalLine(String line) throws IOException {
int firstSpace = line.indexOf(' ');
if (firstSpace == -1) {
throw new IOException("unexpected journal line: " + line);
}
int keyBegin = firstSpace + 1;
int secondSpace = line.indexOf(' ', keyBegin);
final String key;
if (secondSpace == -1) {
key = line.substring(keyBegin);
if (firstSpace == REMOVE.length() && line.startsWith(REMOVE)) {
lruEntries.remove(key);
return;
}
} else {
key = line.substring(keyBegin, secondSpace);
}
Entry entry = lruEntries.get(key);
if (entry == null) {
entry = new Entry(key);
lruEntries.put(key, entry);
}
if (secondSpace != -1 && firstSpace == CLEAN.length() && line.startsWith(CLEAN)) {
String[] parts = line.substring(secondSpace + 1).split(" ");
entry.readable = true;
entry.currentEditor = null;
entry.setLengths(parts);
} else if (secondSpace == -1 && firstSpace == DIRTY.length() && line.startsWith(DIRTY)) {
entry.currentEditor = new Editor(entry);
} else if (secondSpace == -1 && firstSpace == READ.length() && line.startsWith(READ)) {
// This work was already done by calling lruEntries.get().
} else {
throw new IOException("unexpected journal line: " + line);
}
}
/**
* Computes the initial size and collects garbage as a part of opening the
* cache. Dirty entries are assumed to be inconsistent and will be deleted.
*/
private void processJournal() throws IOException {
deleteIfExists(journalFileTmp);
for (Iterator<Entry> i = lruEntries.values().iterator(); i.hasNext(); ) {
Entry entry = i.next();
if (entry.currentEditor == null) {
for (int t = 0; t < valueCount; t++) {
size += entry.lengths[t];
fileCount++;
}
} else {
entry.currentEditor = null;
for (int t = 0; t < valueCount; t++) {
deleteIfExists(entry.getCleanFile(t));
deleteIfExists(entry.getDirtyFile(t));
}
i.remove();
}
}
}
/**
* Creates a new journal that omits redundant information. This replaces the
* current journal if it exists.
*/
private synchronized void rebuildJournal() throws IOException {
if (journalWriter != null) {
journalWriter.close();
}
Writer writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(journalFileTmp), Util.US_ASCII));
try {
writer.write(MAGIC);
writer.write("\n");
writer.write(VERSION_1);
writer.write("\n");
writer.write(Integer.toString(appVersion));
writer.write("\n");
writer.write(Integer.toString(valueCount));
writer.write("\n");
writer.write("\n");
for (Entry entry : lruEntries.values()) {
if (entry.currentEditor != null) {
writer.write(DIRTY + ' ' + entry.key + '\n');
} else {
writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n');
}
}
} finally {
writer.close();
}
if (journalFile.exists()) {
renameTo(journalFile, journalFileBackup, true);
}
renameTo(journalFileTmp, journalFile, false);
journalFileBackup.delete();
journalWriter = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(journalFile, true), Util.US_ASCII));
}
private static void deleteIfExists(File file) throws IOException {
if (file.exists() && !file.delete()) {
throw new IOException();
}
}
private static void renameTo(File from, File to, boolean deleteDestination) throws IOException {
if (deleteDestination) {
deleteIfExists(to);
}
if (!from.renameTo(to)) {
throw new IOException();
}
}
/**
* Returns a snapshot of the entry named {@code key}, or null if it doesn't
* exist is not currently readable. If a value is returned, it is moved to
* the head of the LRU queue.
*/
public synchronized Snapshot get(String key) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (entry == null) {
return null;
}
if (!entry.readable) {
return null;
}
// Open all streams eagerly to guarantee that we see a single published
// snapshot. If we opened streams lazily then the streams could come
// from different edits.
File[] files = new File[valueCount];
InputStream[] ins = new InputStream[valueCount];
try {
File file;
for (int i = 0; i < valueCount; i++) {
file = entry.getCleanFile(i);
files[i] = file;
ins[i] = new FileInputStream(file);
}
} catch (FileNotFoundException e) {
// A file must have been deleted manually!
for (int i = 0; i < valueCount; i++) {
if (ins[i] != null) {
Util.closeQuietly(ins[i]);
} else {
break;
}
}
return null;
}
redundantOpCount++;
journalWriter.append(READ + ' ' + key + '\n');
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return new Snapshot(key, entry.sequenceNumber, files, ins, entry.lengths);
}
/**
* Returns an editor for the entry named {@code key}, or null if another
* edit is in progress.
*/
public Editor edit(String key) throws IOException {
return edit(key, ANY_SEQUENCE_NUMBER);
}
private synchronized Editor edit(String key, long expectedSequenceNumber) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (expectedSequenceNumber != ANY_SEQUENCE_NUMBER && (entry == null
|| entry.sequenceNumber != expectedSequenceNumber)) {
return null; // Snapshot is stale.
}
if (entry == null) {
entry = new Entry(key);
lruEntries.put(key, entry);
} else if (entry.currentEditor != null) {
return null; // Another edit is in progress.
}
Editor editor = new Editor(entry);
entry.currentEditor = editor;
// Flush the journal before creating files to prevent file leaks.
journalWriter.write(DIRTY + ' ' + key + '\n');
journalWriter.flush();
return editor;
}
/** Returns the directory where this cache stores its data. */
public File getDirectory() {
return directory;
}
/**
* Returns the maximum number of bytes that this cache should use to store
* its data.
*/
public synchronized long getMaxSize() {
return maxSize;
}
/** Returns the maximum number of files that this cache should store */
public synchronized int getMaxFileCount() {
return maxFileCount;
}
/**
* Changes the maximum number of bytes the cache can store and queues a job
* to trim the existing store, if necessary.
*/
public synchronized void setMaxSize(long maxSize) {
this.maxSize = maxSize;
executorService.submit(cleanupCallable);
}
/**
* Returns the number of bytes currently being used to store the values in
* this cache. This may be greater than the max size if a background
* deletion is pending.
*/
public synchronized long size() {
return size;
}
/**
* Returns the number of files currently being used to store the values in
* this cache. This may be greater than the max file count if a background
* deletion is pending.
*/
public synchronized long fileCount() {
return fileCount;
}
private synchronized void completeEdit(Editor editor, boolean success) throws IOException {
Entry entry = editor.entry;
if (entry.currentEditor != editor) {
throw new IllegalStateException();
}
// If this edit is creating the entry for the first time, every index must have a value.
if (success && !entry.readable) {
for (int i = 0; i < valueCount; i++) {
if (!editor.written[i]) {
editor.abort();
throw new IllegalStateException("Newly created entry didn't create value for index " + i);
}
if (!entry.getDirtyFile(i).exists()) {
editor.abort();
return;
}
}
}
for (int i = 0; i < valueCount; i++) {
File dirty = entry.getDirtyFile(i);
if (success) {
if (dirty.exists()) {
File clean = entry.getCleanFile(i);
dirty.renameTo(clean);
long oldLength = entry.lengths[i];
long newLength = clean.length();
entry.lengths[i] = newLength;
size = size - oldLength + newLength;
fileCount++;
}
} else {
deleteIfExists(dirty);
}
}
redundantOpCount++;
entry.currentEditor = null;
if (entry.readable | success) {
entry.readable = true;
journalWriter.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n');
if (success) {
entry.sequenceNumber = nextSequenceNumber++;
}
} else {
lruEntries.remove(entry.key);
journalWriter.write(REMOVE + ' ' + entry.key + '\n');
}
journalWriter.flush();
if (size > maxSize || fileCount > maxFileCount || journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
}
/**
* We only rebuild the journal when it will halve the size of the journal
* and eliminate at least 2000 ops.
*/
private boolean journalRebuildRequired() {
final int redundantOpCompactThreshold = 2000;
return redundantOpCount >= redundantOpCompactThreshold //
&& redundantOpCount >= lruEntries.size();
}
/**
* Drops the entry for {@code key} if it exists and can be removed. Entries
* actively being edited cannot be removed.
*
* @return true if an entry was removed.
*/
public synchronized boolean remove(String key) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (entry == null || entry.currentEditor != null) {
return false;
}
for (int i = 0; i < valueCount; i++) {
File file = entry.getCleanFile(i);
if (file.exists() && !file.delete()) {
throw new IOException("failed to delete " + file);
}
size -= entry.lengths[i];
fileCount--;
entry.lengths[i] = 0;
}
redundantOpCount++;
journalWriter.append(REMOVE + ' ' + key + '\n');
lruEntries.remove(key);
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return true;
}
/** Returns true if this cache has been closed. */
public synchronized boolean isClosed() {
return journalWriter == null;
}
private void checkNotClosed() {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
}
/** Force buffered operations to the filesystem. */
public synchronized void flush() throws IOException {
checkNotClosed();
trimToSize();
trimToFileCount();
journalWriter.flush();
}
/** Closes this cache. Stored values will remain on the filesystem. */
public synchronized void close() throws IOException {
if (journalWriter == null) {
return; // Already closed.
}
for (Entry entry : new ArrayList<Entry>(lruEntries.values())) {
if (entry.currentEditor != null) {
entry.currentEditor.abort();
}
}
trimToSize();
trimToFileCount();
journalWriter.close();
journalWriter = null;
}
private void trimToSize() throws IOException {
while (size > maxSize) {
Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}
}
private void trimToFileCount() throws IOException {
while (fileCount > maxFileCount) {
Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}
}
/**
* Closes the cache and deletes all of its stored values. This will delete
* all files in the cache directory including files that weren't created by
* the cache.
*/
public void delete() throws IOException {
close();
Util.deleteContents(directory);
}
private void validateKey(String key) {
Matcher matcher = LEGAL_KEY_PATTERN.matcher(key);
if (!matcher.matches()) {
throw new IllegalArgumentException("keys must match regex [a-z0-9_-]{1,64}: " + key);
}
}
private static String inputStreamToString(InputStream in) throws IOException {
return Util.readFully(new InputStreamReader(in, Util.UTF_8));
}
/** A snapshot of the values for an entry. */
public final class Snapshot implements Closeable {
private final String key;
private final long sequenceNumber;
private File[] files;
private final InputStream[] ins;
private final long[] lengths;
private Snapshot(String key, long sequenceNumber, File[] files, InputStream[] ins, long[] lengths) {
this.key = key;
this.sequenceNumber = sequenceNumber;
this.files = files;
this.ins = ins;
this.lengths = lengths;
}
/**
* Returns an editor for this snapshot's entry, or null if either the
* entry has changed since this snapshot was created or if another edit
* is in progress.
*/
public Editor edit() throws IOException {
return DiskLruCache.this.edit(key, sequenceNumber);
}
/** Returns file with the value for {@code index}. */
public File getFile(int index) {
return files[index];
}
/** Returns the unbuffered stream with the value for {@code index}. */
public InputStream getInputStream(int index) {
return ins[index];
}
/** Returns the string value for {@code index}. */
public String getString(int index) throws IOException {
return inputStreamToString(getInputStream(index));
}
/** Returns the byte length of the value for {@code index}. */
public long getLength(int index) {
return lengths[index];
}
public void close() {
for (InputStream in : ins) {
Util.closeQuietly(in);
}
}
}
private static final OutputStream NULL_OUTPUT_STREAM = new OutputStream() {
@Override
public void write(int b) throws IOException {
// Eat all writes silently. Nom nom.
}
};
/** Edits the values for an entry. */
public final class Editor {
private final Entry entry;
private final boolean[] written;
private boolean hasErrors;
private boolean committed;
private Editor(Entry entry) {
this.entry = entry;
this.written = (entry.readable) ? null : new boolean[valueCount];
}
/**
* Returns an unbuffered input stream to read the last committed value,
* or null if no value has been committed.
*/
public InputStream newInputStream(int index) throws IOException {
synchronized (DiskLruCache.this) {
if (entry.currentEditor != this) {
throw new IllegalStateException();
}
if (!entry.readable) {
return null;
}
try {
return new FileInputStream(entry.getCleanFile(index));
} catch (FileNotFoundException e) {
return null;
}
}
}
/**
* Returns the last committed value as a string, or null if no value
* has been committed.
*/
public String getString(int index) throws IOException {
InputStream in = newInputStream(index);
return in != null ? inputStreamToString(in) : null;
}
/**
* Returns a new unbuffered output stream to write the value at
* {@code index}. If the underlying output stream encounters errors
* when writing to the filesystem, this edit will be aborted when
* {@link #commit} is called. The returned output stream does not throw
* IOExceptions.
*/
public OutputStream newOutputStream(int index) throws IOException {
synchronized (DiskLruCache.this) {
if (entry.currentEditor != this) {
throw new IllegalStateException();
}
if (!entry.readable) {
written[index] = true;
}
File dirtyFile = entry.getDirtyFile(index);
FileOutputStream outputStream;
try {
outputStream = new FileOutputStream(dirtyFile);
} catch (FileNotFoundException e) {
// Attempt to recreate the cache directory.
directory.mkdirs();
try {
outputStream = new FileOutputStream(dirtyFile);
} catch (FileNotFoundException e2) {
// We are unable to recover. Silently eat the writes.
return NULL_OUTPUT_STREAM;
}
}
return new FaultHidingOutputStream(outputStream);
}
}
/** Sets the value at {@code index} to {@code value}. */
public void set(int index, String value) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(newOutputStream(index), Util.UTF_8);
writer.write(value);
} finally {
Util.closeQuietly(writer);
}
}
/**
* Commits this edit so it is visible to readers. This releases the
* edit lock so another edit may be started on the same key.
*/
public void commit() throws IOException {
if (hasErrors) {
completeEdit(this, false);
remove(entry.key); // The previous entry is stale.
} else {
completeEdit(this, true);
}
committed = true;
}
/**
* Aborts this edit. This releases the edit lock so another edit may be
* started on the same key.
*/
public void abort() throws IOException {
completeEdit(this, false);
}
public void abortUnlessCommitted() {
if (!committed) {
try {
abort();
} catch (IOException ignored) {
}
}
}
private class FaultHidingOutputStream extends FilterOutputStream {
private FaultHidingOutputStream(OutputStream out) {
super(out);
}
@Override public void write(int oneByte) {
try {
out.write(oneByte);
} catch (IOException e) {
hasErrors = true;
}
}
@Override public void write(byte[] buffer, int offset, int length) {
try {
out.write(buffer, offset, length);
} catch (IOException e) {
hasErrors = true;
}
}
@Override public void close() {
try {
out.close();
} catch (IOException e) {
hasErrors = true;
}
}
@Override public void flush() {
try {
out.flush();
} catch (IOException e) {
hasErrors = true;
}
}
}
}
private final class Entry {
private final String key;
/** Lengths of this entry's files. */
private final long[] lengths;
/** True if this entry has ever been published. */
private boolean readable;
/** The ongoing edit or null if this entry is not being edited. */
private Editor currentEditor;
/** The sequence number of the most recently committed edit to this entry. */
private long sequenceNumber;
private Entry(String key) {
this.key = key;
this.lengths = new long[valueCount];
}
public String getLengths() throws IOException {
StringBuilder result = new StringBuilder();
for (long size : lengths) {
result.append(' ').append(size);
}
return result.toString();
}
/** Set lengths using decimal numbers like "10123". */
private void setLengths(String[] strings) throws IOException {
if (strings.length != valueCount) {
throw invalidLengths(strings);
}
try {
for (int i = 0; i < strings.length; i++) {
lengths[i] = Long.parseLong(strings[i]);
}
} catch (NumberFormatException e) {
throw invalidLengths(strings);
}
}
private IOException invalidLengths(String[] strings) throws IOException {
throw new IOException("unexpected journal line: " + java.util.Arrays.toString(strings));
}
public File getCleanFile(int i) {
return new File(directory, key + i);
}
public File getDirtyFile(int i) {
return new File(directory, key + i + ".tmp");
}
}
}

View File

@@ -1,101 +0,0 @@
package com.mogo.och.taxi.passenger.utils.blur;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.TextUtils;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
/*******************************************************************************
* Description: 用于缓存经过高斯模糊的图片
*
* Author: Freeman
*
* Date: 2018/9/4
*
* Copyright: all rights reserved by Freeman.
*******************************************************************************/
public class DiskLruCacheManager {
private DiskLruCache diskLruCache;
private static DiskLruCacheManager instance;
private final int MAX_CACHE_SIZE = 64 * 1024 * 1024;
private DiskLruCacheManager(Context context) {
try {
diskLruCache = DiskLruCache.open(context.getCacheDir(), 1, 1,
MAX_CACHE_SIZE, Integer.MAX_VALUE);
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
public static DiskLruCacheManager getInstance(Context context) {
if (instance == null) {
synchronized (DiskLruCacheManager.class) {
if (instance == null) {
instance = new DiskLruCacheManager(context.getApplicationContext());
}
}
}
return instance;
}
public void put(String url, Bitmap bitmap) {
if (TextUtils.isEmpty(url) || bitmap == null || bitmap.isRecycled()) {
return;
}
try {
DiskLruCache.Editor editor = diskLruCache.edit(getKey(url));
OutputStream outputStream = editor.newOutputStream(0);
if (bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream)) {
editor.commit();
}
diskLruCache.flush();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
public Bitmap get(String url) {
try {
DiskLruCache.Snapshot snapshot = diskLruCache.get(getKey(url));
if (snapshot != null) {
InputStream inputStream = snapshot.getInputStream(0);
return BitmapFactory.decodeStream(inputStream);
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return null;
}
public static String getKey(String url) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
byte[] md5 = digest.digest(url.getBytes());
BigInteger bigInteger = new BigInteger(1, md5);
return bigInteger.toString(16);
} catch (Exception e) {
e.printStackTrace(System.err);
}
return null;
}
public void close() {
try {
diskLruCache.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}

View File

@@ -1,241 +0,0 @@
package com.mogo.och.taxi.passenger.utils.blur;
import android.graphics.Bitmap;
/**
* Created by jay on 11/7/15.
*/
public class FastBlurUtil {
public static Bitmap doBlur(Bitmap sentBitmap, int scaleRadius, int radius) {
// Stack Blur v1.0 from
// http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
//
// Java Author: Mario Klingemann <mario at quasimondo.com>
// http://incubator.quasimondo.com
// created Feburary 29, 2004
// Android port : Yahel Bouaziz <yahel at kayenko.com>
// http://www.kayenko.com
// ported april 5th, 2012
// This is a compromise between Gaussian Blur and Box blur
// It creates much better looking blurs than Box Blur, but is
// 7x faster than my Gaussian Blur implementation.
//
// I called it Stack Blur because this describes best how this
// filter works internally: it creates a kind of moving stack
// of colors whilst scanning through the image. Thereby it
// just has to add one new block of color to the right side
// of the stack and remove the leftmost color. The remaining
// colors on the topmost layer of the stack are either added on
// or reduced by one, depending on if they are on the right or
// on the left side of the stack.
//
// If you are using this algorithm in your code please add
// the following line:
//
// Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com>
if (scaleRadius > 0) {
sentBitmap = Bitmap.createScaledBitmap(sentBitmap, sentBitmap.getWidth() / scaleRadius,
sentBitmap.getHeight() / scaleRadius, false);
}
Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
if (radius < 1) {
return (null);
}
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int[] pix = new int[w * h];
bitmap.getPixels(pix, 0, w, 0, 0, w, h);
int wm = w - 1;
int hm = h - 1;
int wh = w * h;
int div = radius + radius + 1;
int r[] = new int[wh];
int g[] = new int[wh];
int b[] = new int[wh];
int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
int vmin[] = new int[Math.max(w, h)];
int divsum = (div + 1) >> 1;
divsum *= divsum;
int dv[] = new int[256 * divsum];
for (i = 0; i < 256 * divsum; i++) {
dv[i] = (i / divsum);
}
yw = yi = 0;
int[][] stack = new int[div][3];
int stackpointer;
int stackstart;
int[] sir;
int rbs;
int r1 = radius + 1;
int routsum, goutsum, boutsum;
int rinsum, ginsum, binsum;
for (y = 0; y < h; y++) {
rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
for (i = -radius; i <= radius; i++) {
p = pix[yi + Math.min(wm, Math.max(i, 0))];
sir = stack[i + radius];
sir[0] = (p & 0xff0000) >> 16;
sir[1] = (p & 0x00ff00) >> 8;
sir[2] = (p & 0x0000ff);
rbs = r1 - Math.abs(i);
rsum += sir[0] * rbs;
gsum += sir[1] * rbs;
bsum += sir[2] * rbs;
if (i > 0) {
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
} else {
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
}
}
stackpointer = radius;
for (x = 0; x < w; x++) {
r[yi] = dv[rsum];
g[yi] = dv[gsum];
b[yi] = dv[bsum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
stackstart = stackpointer - radius + div;
sir = stack[stackstart % div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
if (y == 0) {
vmin[x] = Math.min(x + radius + 1, wm);
}
p = pix[yw + vmin[x]];
sir[0] = (p & 0xff0000) >> 16;
sir[1] = (p & 0x00ff00) >> 8;
sir[2] = (p & 0x0000ff);
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
stackpointer = (stackpointer + 1) % div;
sir = stack[(stackpointer) % div];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
yi++;
}
yw += w;
}
for (x = 0; x < w; x++) {
rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
yp = -radius * w;
for (i = -radius; i <= radius; i++) {
yi = Math.max(0, yp) + x;
sir = stack[i + radius];
sir[0] = r[yi];
sir[1] = g[yi];
sir[2] = b[yi];
rbs = r1 - Math.abs(i);
rsum += r[yi] * rbs;
gsum += g[yi] * rbs;
bsum += b[yi] * rbs;
if (i > 0) {
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
} else {
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
}
if (i < hm) {
yp += w;
}
}
yi = x;
stackpointer = radius;
for (y = 0; y < h; y++) {
// Preserve alpha channel: ( 0xff000000 & pix[yi] )
pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
stackstart = stackpointer - radius + div;
sir = stack[stackstart % div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
if (x == 0) {
vmin[y] = Math.min(y + r1, hm) * w;
}
p = x + vmin[y];
sir[0] = r[p];
sir[1] = g[p];
sir[2] = b[p];
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
stackpointer = (stackpointer + 1) % div;
sir = stack[stackpointer];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
yi += w;
}
}
bitmap.setPixels(pix, 0, w, 0, 0, w, h);
return (bitmap);
}
}

View File

@@ -1,48 +0,0 @@
package com.mogo.och.taxi.passenger.utils.blur;
import android.content.Context;
import android.graphics.Bitmap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
public class GlideBlurTransform extends BitmapTransformation {
private String key;
private int blurRadius;
public GlideBlurTransform(String key, int blurRadius) {
this.key = key;
this.blurRadius = blurRadius;
}
@Override
protected Bitmap transform( @NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight ) {
Bitmap bitmap = FastBlurUtil.doBlur( toTransform, 1, blurRadius );
return bitmap;
}
@Override
public boolean equals(@Nullable Object obj) {
if (obj instanceof GlideBlurTransform) {
return ((GlideBlurTransform) obj).key.equals(key);
}
return false;
}
@Override
public int hashCode() {
return key.hashCode();
}
@Override
public void updateDiskCacheKey( MessageDigest messageDigest ) {
messageDigest.update(key.getBytes(StandardCharsets.UTF_8));
}
}

View File

@@ -1,191 +0,0 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mogo.och.taxi.passenger.utils.blur;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
/**
* Buffers input from an {@link InputStream} for reading lines.
*
* <p>This class is used for buffered reading of lines. For purposes of this class, a line ends
* with "\n" or "\r\n". End of input is reported by throwing {@code EOFException}. Unterminated
* line at end of input is invalid and will be ignored, the caller may use {@code
* hasUnterminatedLine()} to detect it after catching the {@code EOFException}.
*
* <p>This class is intended for reading input that strictly consists of lines, such as line-based
* cache entries or cache journal. Unlike the {@link java.io.BufferedReader} which in conjunction
* with {@link java.io.InputStreamReader} provides similar functionality, this class uses different
* end-of-input reporting and a more restrictive definition of a line.
*
* <p>This class supports only charsets that encode '\r' and '\n' as a single byte with value 13
* and 10, respectively, and the representation of no other character contains these values.
* We currently check in constructor that the charset is one of US-ASCII, UTF-8 and ISO-8859-1.
* The default charset is US_ASCII.
*/
class StrictLineReader implements Closeable {
private static final byte CR = (byte) '\r';
private static final byte LF = (byte) '\n';
private final InputStream in;
private final Charset charset;
/*
* Buffered data is stored in {@code buf}. As long as no exception occurs, 0 <= pos <= end
* and the data in the range [pos, end) is buffered for reading. At end of input, if there is
* an unterminated line, we set end == -1, otherwise end == pos. If the underlying
* {@code InputStream} throws an {@code IOException}, end may remain as either pos or -1.
*/
private byte[] buf;
private int pos;
private int end;
/**
* Constructs a new {@code LineReader} with the specified charset and the default capacity.
*
* @param in the {@code InputStream} to read data from.
* @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
* supported.
* @throws NullPointerException if {@code in} or {@code charset} is null.
* @throws IllegalArgumentException if the specified charset is not supported.
*/
public StrictLineReader(InputStream in, Charset charset) {
this(in, 8192, charset);
}
/**
* Constructs a new {@code LineReader} with the specified capacity and charset.
*
* @param in the {@code InputStream} to read data from.
* @param capacity the capacity of the buffer.
* @param charset the charset used to decode data. Only US-ASCII, UTF-8 and ISO-8859-1 are
* supported.
* @throws NullPointerException if {@code in} or {@code charset} is null.
* @throws IllegalArgumentException if {@code capacity} is negative or zero
* or the specified charset is not supported.
*/
public StrictLineReader(InputStream in, int capacity, Charset charset) {
if (in == null || charset == null) {
throw new NullPointerException();
}
if (capacity < 0) {
throw new IllegalArgumentException("capacity <= 0");
}
if (!(charset.equals(Util.US_ASCII))) {
throw new IllegalArgumentException("Unsupported encoding");
}
this.in = in;
this.charset = charset;
buf = new byte[capacity];
}
/**
* Closes the reader by closing the underlying {@code InputStream} and
* marking this reader as closed.
*
* @throws IOException for errors when closing the underlying {@code InputStream}.
*/
public void close() throws IOException {
synchronized (in) {
if (buf != null) {
buf = null;
in.close();
}
}
}
/**
* Reads the next line. A line ends with {@code "\n"} or {@code "\r\n"},
* this end of line marker is not included in the result.
*
* @return the next line from the input.
* @throws IOException for underlying {@code InputStream} errors.
* @throws EOFException for the end of source stream.
*/
public String readLine() throws IOException {
synchronized (in) {
if (buf == null) {
throw new IOException("LineReader is closed");
}
// Read more data if we are at the end of the buffered data.
// Though it's an error to read after an exception, we will let {@code fillBuf()}
// throw again if that happens; thus we need to handle end == -1 as well as end == pos.
if (pos >= end) {
fillBuf();
}
// Try to find LF in the buffered data and return the line if successful.
for (int i = pos; i != end; ++i) {
if (buf[i] == LF) {
int lineEnd = (i != pos && buf[i - 1] == CR) ? i - 1 : i;
String res = new String(buf, pos, lineEnd - pos, charset.name());
pos = i + 1;
return res;
}
}
// Let's anticipate up to 80 characters on top of those already read.
ByteArrayOutputStream out = new ByteArrayOutputStream(end - pos + 80) {
@Override
public String toString() {
int length = (count > 0 && buf[count - 1] == CR) ? count - 1 : count;
try {
return new String(buf, 0, length, charset.name());
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e); // Since we control the charset this will never happen.
}
}
};
while (true) {
out.write(buf, pos, end - pos);
// Mark unterminated line in case fillBuf throws EOFException or IOException.
end = -1;
fillBuf();
// Try to find LF in the buffered data and return the line if successful.
for (int i = pos; i != end; ++i) {
if (buf[i] == LF) {
if (i != pos) {
out.write(buf, pos, i - pos);
}
pos = i + 1;
return out.toString();
}
}
}
}
}
/**
* Reads new input data into the buffer. Call only with pos == end or end == -1,
* depending on the desired outcome if the function throws.
*/
private void fillBuf() throws IOException {
int result = in.read(buf, 0, buf.length);
if (result == -1) {
throw new EOFException();
}
pos = 0;
end = result;
}
}

View File

@@ -1,77 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mogo.och.taxi.passenger.utils.blur;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/** Junk drawer of utility methods. */
final class Util {
static final Charset US_ASCII = StandardCharsets.US_ASCII;
static final Charset UTF_8 = StandardCharsets.UTF_8;
private Util() {
}
static String readFully(Reader reader) throws IOException {
try {
StringWriter writer = new StringWriter();
char[] buffer = new char[1024];
int count;
while ((count = reader.read(buffer)) != -1) {
writer.write(buffer, 0, count);
}
return writer.toString();
} finally {
reader.close();
}
}
/**
* Deletes the contents of {@code dir}. Throws an IOException if any file
* could not be deleted, or if {@code dir} is not a readable directory.
*/
static void deleteContents(File dir) throws IOException {
File[] files = dir.listFiles();
if (files == null) {
throw new IOException("not a readable directory: " + dir);
}
for (File file : files) {
if (file.isDirectory()) {
deleteContents(file);
}
if (!file.delete()) {
throw new IOException("failed to delete file: " + file);
}
}
}
static void closeQuietly(/*Auto*/Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (RuntimeException rethrown) {
throw rethrown;
} catch (Exception ignored) {
}
}
}
}

View File

@@ -5,7 +5,6 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.drawable.BitmapDrawable
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoBackCameraVideoListener
@@ -128,7 +127,7 @@ class RightRearCamView : ConstraintLayout , IMoGoBackCameraVideoListener,
private fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int {
val width = options.outWidth
val height = options.outHeight
Log.i(TAG, "calculateInSampleSize: out width and height is $width height $height")
d(SceneConstant.M_TAXI_P + TAG, "calculateInSampleSize: out width and height is $width height $height")
var inSampleWidth = 1
if (height > reqHeight || width > reqWidth) {
val halfHeight = height / 2

View File

@@ -15,12 +15,10 @@
},
"taxi" :{
"driver": ["ochDFHQ"],
"driverPassenger": ["ochDFHQ"],
"passenger": ["ochDFHQ"]
},
"bus" :{
"driver": ["ochJL"],
"driverPassenger": ["ochJL"],
"passenger": ["ochJL"]
},
"charter" :{
@@ -54,7 +52,6 @@
"saas": {
"taxiunmanned" :{
"driver": ["ochDFHQ"],
"driverpassenger": ["ochDFHQ"],
"passenger": ["ochDFHQ"]
},
"shuttle" :{
@@ -63,7 +60,6 @@
},
"bus" :{
"driver": ["ochJL"],
"driverPassenger": ["ochJL"],
"passenger": ["ochJL"]
},
"charter" :{

View File

@@ -8,9 +8,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Bus",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -8,9 +8,9 @@ project.android.productFlavors {
manifestPlaceholders = [
CHANNEL_VALUE_HEAD: "Charter",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识
buildConfigField 'String', 'APP_IDENTITY_MODE_HEAD', "\"Charter\""

View File

@@ -7,9 +7,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Noop",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -9,7 +9,7 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Shuttle",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
]
// ①标识

View File

@@ -7,9 +7,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Sweeper",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -7,9 +7,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Sweeper",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -6,7 +6,7 @@ project.android.productFlavors {
manifestPlaceholders = [
CHANNEL_VALUE_HEAD: "Taxi",
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识
buildConfigField 'String', 'APP_IDENTITY_MODE_HEAD', "\"Taxi\""

View File

@@ -6,7 +6,7 @@ project.android.productFlavors {
manifestPlaceholders = [
CHANNEL_VALUE_HEAD: "Taxi",
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识
buildConfigField 'String', 'APP_IDENTITY_MODE_HEAD', "\"Taxi\""

View File

@@ -684,7 +684,6 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onConnectionIPCStatus(int ipcConnectionStatus, String reason) {
// Log.i(TAG, "连接状态=" + (reason == null ? "主动断开连接" : reason));
String time = sdf.format(new Date());
connectStatusList.add(0, new IPCConnectState(reason == null ? "主动断开连接" : reason, getStatusColor(ipcConnectionStatus)));
if (connectStatusList.size() > 100) {

View File

@@ -15,13 +15,9 @@ buildscript {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven {
url "https://artifact.bytedance.com/repository/Volcengine/"
}
maven {
url "https://artifact.bytedance.com/repository/byteX/"
}
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://artifact.bytedance.com/repository/Volcengine/" }
maven { url "https://artifact.bytedance.com/repository/byteX/" }
gradlePluginPortal()
// mavenCentral()
google()
@@ -41,6 +37,7 @@ buildscript {
classpath "io.github.knight-zxw:lancet-plugin:${lancetx_plugin_version}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0"
classpath 'com.mogo.cloud:matrix:1.0.0'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513'
// classpath 'com.bytedance.btrace:rhea-gradle-plugin:2.0.0'
}
// 遇无法更新依赖情况针对Snapshot无法刷新然后sync project即可刷新完成注释该代码
@@ -62,6 +59,7 @@ allprojects {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://plugins.gradle.org/m2/' }
// mavenCentral()
maven {
@@ -73,7 +71,7 @@ allprojects {
google()
}
if (isCodeInspectEnable ) {
if (isCodeInspectEnable) {
def basePath = new File(codequality, 'code_inspect_increment.gradle').path
apply from: "$basePath"
def pmdPath = new File(codequality, 'pmd.gradle').path
@@ -85,6 +83,9 @@ allprojects {
}
}
apply plugin: 'jacoco'
apply from: rootProject.file('codequality/sonar.gradle')
task clean(type: Delete) {
delete rootProject.buildDir
}

19
codequality/sonar.gradle Normal file
View File

@@ -0,0 +1,19 @@
apply plugin: 'org.sonarqube'
sonarqube {
properties {
property "sonar.log.level", "TRACE"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "MoGoEagleEyeTest"
property "sonar.sources", "src/main/java"
property "sonar.binaries", "build/intermediates/classes"
property "sonar.qualitygate.wait", true
property "sonar.android.lint.report", false
property "sonar.scm.exclusions.disabled", false
property "sonar.scm.exclusions.file", "**/.gitignore"
property "sonar.exclusions", "**/AndroidManifest.xml, **/src/test/**, com/mogo/eagle/core/utilcode, **/*.jar, **/*.aar, **/*.war, **/*.ear, **/*.rar, **/*.tgz, **/*.zip, **/src/test/java/**/*.java, **/src/test/java/**/*.kt, **/test/**/*, **/*Test.java, **/*Tests.java, **/*Test.kt, **/*.xml,*.xml, **/target/**, **/src/main/java/proto/**, **/build/**, build, build/**, **/db/dao/*.java, **/build/intermediates/**/*"
// property "sonar.java.coveragePlugin", "jacoco"
// property("sonar.coverage.jacoco.xmlReportPaths", "../../build/reports/jacocoTestReport.xml,../build/reports/jacocoTestReport.xml")
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.function.biz.dispatch
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
@@ -9,6 +10,7 @@ import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
import com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
@@ -31,11 +33,12 @@ import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Compani
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_STOP_MANUAL_CANCEL
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_STOP_TIMER_CANCEL
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.dispatchServiceModel
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.zhjt.mogo.adas.data.bean.MogoReport
import com.zhjt.service.chain.ChainLog
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
//todo emArrow 添加biz链路日志
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
class DispatchAutoPilotManager private constructor() :
IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>,
@@ -61,7 +64,7 @@ class DispatchAutoPilotManager private constructor() :
private var isDispatch = false
private var isArriveEnd = false
private val handler: Handler = object : Handler() {
private val handler: Handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
@@ -109,6 +112,12 @@ class DispatchAutoPilotManager private constructor() :
return DispatchAdasAutoPilotLocReceiverBean::class.java
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
nodeAliasCode = ChainConstant.CHAIN_CODE_DISPATCH_RECEIVE,
paramIndexes = [0]
)
override fun onMsgReceived(adasAutoPilotLocReceiverBean: DispatchAdasAutoPilotLocReceiverBean?) {
CallerLogger.i("$M_BIZ$TAG","onMsgReceived 收到云调度长链接, adasAutoPilotLocReceiver:${adasAutoPilotLocReceiverBean?:""}")
if (adasAutoPilotLocReceiverBean != null && adasAutoPilotLocReceiverBean.startLat != 0.0 && adasAutoPilotLocReceiverBean.startLon != 0.0) {
@@ -130,6 +139,12 @@ class DispatchAutoPilotManager private constructor() :
}
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
nodeAliasCode = ChainConstant.CHAIN_CODE_DISPATCH_START,
paramIndexes = [-1]
)
private fun startAutoPilot() {
val currentAutopilot = AutopilotControlParameters()
// currentAutopilot.isSpeakVoice = false
@@ -146,34 +161,42 @@ class DispatchAutoPilotManager private constructor() :
}
}
if(it.trajUrl == null){
V2XBizTrace.onAck(M_BIZ + TAG, "trajUrl-null")
ToastUtils.showShort("trajUrl数据为空")
return
}
if(it.trajMd5 == null){
V2XBizTrace.onAck(M_BIZ + TAG, "trajMd5-null")
ToastUtils.showShort("trajMd5数据为空")
return
}
if(it.stopUrl == null){
V2XBizTrace.onAck(M_BIZ + TAG, "stopUrl-null")
ToastUtils.showShort("stopUrl数据为空")
return
}
if(it.stopMd5 == null){
V2XBizTrace.onAck(M_BIZ + TAG, "stopMd5-null")
ToastUtils.showShort("stopMd5数据为空")
return
}
if(it.vehicleModel == null){
V2XBizTrace.onAck(M_BIZ + TAG, "vehicleModel-null")
ToastUtils.showShort("vehicleModel数据为空")
return
}
if(it.lineName == null){
V2XBizTrace.onAck(M_BIZ + TAG, "lineName-null")
ToastUtils.showShort("lineName数据为空")
return
}
if(it.startLocAddress == null){
V2XBizTrace.onAck(M_BIZ + TAG, "startLocAddress-null")
ToastUtils.showShort("startLocAddress数据为空")
return
}
if(it.endLocAddress == null){
V2XBizTrace.onAck(M_BIZ + TAG, "endLocAddress-null")
ToastUtils.showShort("endLocAddress数据为空")
return
}
@@ -191,7 +214,7 @@ class DispatchAutoPilotManager private constructor() :
currentAutopilot.endLatLon =
AutopilotControlParameters.AutoPilotLonLat(it.endLat, it.endLon)
currentAutopilot.vehicleType = 10
CallerLogger.d(M_BIZ + TAG, "开启自动驾驶====$currentAutopilot")
V2XBizTrace.onAck(M_BIZ + TAG, "开启自动驾驶====$currentAutopilot")
CallerAutoPilotControlManager.startAutoPilot(currentAutopilot)
}
}
@@ -213,6 +236,7 @@ class DispatchAutoPilotManager private constructor() :
* 停止调度确认
*/
fun stopAffirm(){
V2XBizTrace.onAck(M_BIZ + TAG,"stopAffirm")
CallerHmiManager.dismissDispatchDialog()
receiverBean?.taskId?.let{
dispatchServiceModel.dispatchResultUpload(DISPATCH_STOP_AFFIRM, it,
@@ -230,6 +254,7 @@ class DispatchAutoPilotManager private constructor() :
}
fun cancel(manualTrigger: Boolean) {
V2XBizTrace.onAck(M_BIZ + TAG,"cancel")
CallerHmiManager.dismissDispatchDialog()
receiverBean?.taskId?.let {
dispatchServiceModel.dispatchResultUpload(
@@ -241,6 +266,7 @@ class DispatchAutoPilotManager private constructor() :
* 停止调度取消
*/
fun stopCancel(manualTrigger: Boolean){
V2XBizTrace.onAck(M_BIZ + TAG,"stopCancel:$manualTrigger")
CallerHmiManager.dismissDispatchDialog()
receiverBean?.taskId?.let{
dispatchServiceModel.dispatchResultUpload(
@@ -263,9 +289,6 @@ class DispatchAutoPilotManager private constructor() :
if (isArriveEnd) {
return
}
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
// 上述等待鄂州项目复盘后,产品输出完成方案后再进操作!!!
if (isDispatch) {
startAutoPilot()
}
@@ -324,6 +347,8 @@ class DispatchAutoPilotManager private constructor() :
//语音提示到站
AIAssist.getInstance(mContext).speakTTSVoice("云调度完成,车辆已到达${it.endLocAddress}")
}
}else{
V2XBizTrace.onAck(M_BIZ + TAG, mapOf("ArriveAtStation" to arrivalNotification, "distanceFromSelf" to distanceFromSelf))
}
}

View File

@@ -30,7 +30,6 @@ import okhttp3.RequestBody;
* @since: 10/28/21
*/
public class NoticeNetWorkManager {
private static volatile NoticeNetWorkManager requestNoticeManager;
private final INoticeApiService mNoticeApiService;
private NoticeNetWorkManager() {
@@ -39,14 +38,11 @@ public class NoticeNetWorkManager {
}
public static NoticeNetWorkManager getInstance() {
if (requestNoticeManager == null) {
synchronized (NoticeNetWorkManager.class) {
if (requestNoticeManager == null) {
requestNoticeManager = new NoticeNetWorkManager();
}
}
}
return requestNoticeManager;
return Holder.requestNoticeManager;
}
private static final class Holder{
private static final NoticeNetWorkManager requestNoticeManager = new NoticeNetWorkManager();
}
/**
@@ -88,7 +84,7 @@ public class NoticeNetWorkManager {
* 反馈交警是否接受事故任务
*
* @param infoId 事故id
* @param sn
* @param sn sn
* @param status 是否接受 0否 1是
*/
public void sendAccidentAcceptStatus(String infoId, String sn, int status) {

View File

@@ -11,6 +11,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
/**
@@ -53,7 +54,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
}
}
obuDataMap[type] = System.currentTimeMillis()
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onMoGoObuSaveMessage type = $type ---content = $content ---tts = $tts ")
V2XBizTrace.onAck("${SceneConstant.M_OBU}${TAG}", mapOf("type" to type,"content" to content,"tts" to tts))
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.function.biz.v2x.redlightwarning
import android.util.Log
import com.mogo.eagle.core.data.biz.trafficlight.*
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_GREEN
@@ -235,9 +234,6 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
speed
)
if (content.isEmpty() || tts.isEmpty()) {
Log.d("MsgBox-RedLightWarManaG", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,

View File

@@ -7,6 +7,7 @@ import androidx.annotation.*
import androidx.localbroadcastmanager.content.*
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_V2X_MSG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_V2X
import com.mogo.eagle.core.data.enums.*
@@ -182,7 +183,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
@RequiresApi(Build.VERSION_CODES.N)
@ChainLog(
linkChainLog = CHAIN_TYPE_V2X,
linkCode = CHAIN_SOURCE_CLOUD,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_V2X_MSG,
paramIndexes = [0]
)
@@ -301,6 +302,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
val msgBoxBean =
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${count}个事件", "",CommunicationType.V2N.name))
msgBoxBean.sourceType = DataSourceType.SUMMARY
V2XBizTrace.onAck("$M_V2X$TAG", mapOf("v2xEventsSummary" to msgBoxBean))
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent("summary","查询到当前全程共${count}个事件",

View File

@@ -12,7 +12,9 @@ import com.mogo.eagle.core.data.v2x.V2XEvent
import com.mogo.eagle.core.data.v2x.V2XMarkerResponse
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.mogo.eagle.function.biz.v2x.v2n.network.V2XRefreshModel
import com.mogo.eagle.function.biz.v2x.v2n.network.callback.IV2XCallback
import com.mogo.eagle.function.biz.v2x.v2n.network.callback.IV2XRefreshCallback
@@ -160,6 +162,7 @@ class V2XPoiLoader private constructor() {
val msgBoxBean =
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${size}个事件", "",CommunicationType.V2N.name))
msgBoxBean.sourceType = DataSourceType.SUMMARY
V2XBizTrace.onAck("${SceneConstant.M_V2X}$TAG", mapOf("v2xEventsSummary" to msgBoxBean))
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent("summary","查询到当前全程共${size}个事件",

View File

@@ -17,7 +17,6 @@ import com.mogo.eagle.core.function.call.hmi.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
import com.mogo.eagle.core.utilcode.mogo.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.*
@@ -33,7 +32,6 @@ import mogo.v2x.MogoV2X.RSI_PB
*/
internal object V2NIdentifyDrawer {
private const val TAG = "V2NIdentifyDataSubscriber"
private const val MSG_WHAT_DRAW_SHIGONE = 0x1010 // 道路施工
@@ -44,6 +42,7 @@ internal object V2NIdentifyDrawer {
if (msg.what == MSG_WHAT_DRAW_SHIGONE || msg.what == MSG_WHAT_DRAW_SHIGU) {
val events = msg.obj as? List<*>
if (events == null || events.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("shiGong-shiGu" to ""))
return@Callback true
}
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
@@ -51,6 +50,7 @@ internal object V2NIdentifyDrawer {
DrivingDirectionUtils.getDegreeOfCar2Poi(car.longitude, car.latitude, itx.longitude, itx.latitude, car.heading.toInt()) < 90
}
if (filtered.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("shiGong-shiGu-filter" to ""))
return@Callback true
}
filtered.forEach { itx ->
@@ -78,7 +78,7 @@ internal object V2NIdentifyDrawer {
val distance = CoordinateUtils.calculateLineDistance(itx.longitude, itx.latitude, car.longitude, car.latitude)
val alertContent = getAlertContent(poiType, distance.toDouble())
val ttsContent = getTtsContent(poiType, distance.toDouble())
V2XBizTrace.onAck("V2NIdentifyDrawer","绘制poi事件:$poiType")
V2XBizTrace.onAck(TAG,"绘制poi事件:$poiType")
saveMsgBox(MsgBoxBean(V2X, V2XMsg(poiType, alertContent, ttsContent,CommunicationType.V2N.name)))
CallerHmiManager.warningV2X(poiType, alertContent, ttsContent, object : IMoGoWarningStatusListener {
override fun onShow() {
@@ -100,6 +100,7 @@ internal object V2NIdentifyDrawer {
} else if (msg.what == MSG_WHAT_DRAW_YONGDU) {
val events = msg.obj as? List<*>
if (events == null || events.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("yongDu" to ""))
return@Callback true
}
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
@@ -109,6 +110,7 @@ internal object V2NIdentifyDrawer {
DrivingDirectionUtils.getDegreeOfCar2Poi(car.longitude, car.latitude, eventLon, eventLat, car.heading.toInt()) < 90
}
if (filtered.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("yongDu-filter" to ""))
return@Callback true
}
filtered.forEach { itx ->
@@ -137,6 +139,7 @@ internal object V2NIdentifyDrawer {
val distance = CoordinateUtils.calculateLineDistance(lon, lat, car.longitude, car.latitude)
val alertContent = getAlertContent(poiType, distance.toDouble())
val ttsContent = getTtsContent(poiType, distance.toDouble())
V2XBizTrace.onAck(TAG,"绘制poi事件:$poiType")
saveMsgBox(MsgBoxBean(V2X, V2XMsg(poiType, alertContent, ttsContent,CommunicationType.V2N.name)))
CallerHmiManager.warningV2X(poiType, alertContent, ttsContent, object : IMoGoWarningStatusListener {
override fun onShow() {
@@ -221,7 +224,6 @@ internal object V2NIdentifyDrawer {
override fun onAutopilotV2nCongestionEvent(header: Header, rsi: RSI_PB) {
super.onAutopilotV2nCongestionEvent(header, rsi)
Logger.d(TAG, "--- onAutopilotV2nCongestionEvent -- : rsi: ${ GsonUtils.toJson(rsi) }")
try {
V2XBizTrace.onAck("onAutopilotV2nCongestionEvent", rsi)
} catch (t: Throwable) {

View File

@@ -101,7 +101,7 @@ class AiRoadMarker {
300f, call = { result ->
//施工中心点后方的自车行驶方向上300米距离
result?.let {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", it)
V2XBizTrace.onAck("$TAG -marker-3-l1:", it)
l1 = result
}
countDown.incrementAndGet()
@@ -113,7 +113,7 @@ class AiRoadMarker {
location.heading.toFloat(),
-300f, call = { result ->
result?.let {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l2:", it)
V2XBizTrace.onAck("$TAG -marker-3-l2:", it)
l2 = result
}
countDown.incrementAndGet()
@@ -136,14 +136,14 @@ class AiRoadMarker {
return@post
}
if (l1 == null || l2 == null) {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- line null return ----", "")
V2XBizTrace.onAck("$TAG -marker-3-line null return ----", "")
return@post
}
if (l1.points.isEmpty() || l2.points.isEmpty()) {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- line points null return ----", "")
V2XBizTrace.onAck("$TAG -marker-3-line points null return ----", "")
return@post
}
V2XBizTrace.onAck("$TAG --- marker --- 4 --- l2:", l2)
V2XBizTrace.onAck("$TAG -marker-4-l2:", l2)
val points = LinkedList<MogoLatLng>()
if (l2.points.isNotEmpty()) {
points.addAll(l2.points.reversed().map {
@@ -152,7 +152,7 @@ class AiRoadMarker {
}
val centerX = marker.poi_lon
val centerY = marker.poi_lat
V2XBizTrace.onAck("$TAG --- marker --- 5 --- marker:", marker)
V2XBizTrace.onAck("$TAG -marker-5-marker:", marker)
val farthestPoint = marker.polygon?.let {
var find: Pair<Double, Double> = Pair(centerX, centerY)
var min = Long.MAX_VALUE
@@ -172,7 +172,7 @@ class AiRoadMarker {
MogoLatLng(find.second, find.first)
} ?: MogoLatLng(centerY, centerX)
marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat)
V2XBizTrace.onAck("$TAG --- marker --- 6 --- marker:", marker)
V2XBizTrace.onAck("$TAG -marker-6-marker:", marker)
if (l1.points.isNotEmpty()) {
for (l in l1.points) {
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(
@@ -204,7 +204,7 @@ class AiRoadMarker {
builder.points(points)
builder.colors(colors)
builder.setVisible(true)
V2XBizTrace.onAck("$TAG --- marker --- 7 --- points:", "${points.size}")
V2XBizTrace.onAck("$TAG -marker-7-points:", "${points.size}")
val line = overlayManager?.showOrUpdateLine(builder.build())
if (line != null) {
this.line.set(line)
@@ -220,9 +220,9 @@ class AiRoadMarker {
private fun removeLine() {
val old = line.get()
V2XBizTrace.onAck("$TAG --- removeRedLine --- 1", "")
V2XBizTrace.onAck("$TAG -removeRedLine-1", "")
if (old != null) {
V2XBizTrace.onAck("$TAG --- removeRedLine --- 2", "")
V2XBizTrace.onAck("$TAG -removeRedLine-2", "")
line.set(null)
old.delegate?.remove()
}
@@ -230,7 +230,7 @@ class AiRoadMarker {
private fun unMarker(marker: Marker) {
v2nDrawHandler.post {
V2XBizTrace.onAck("$TAG --- unMarker ---", "")
V2XBizTrace.onAck("$TAG -unMarker-", "")
this.marker.set(null)
removeLine()
roadMarker.removeMarkers()
@@ -240,7 +240,7 @@ class AiRoadMarker {
}
fun receive() {
V2XBizTrace.onAck("$TAG --- receive --- 1 ---", "")
V2XBizTrace.onAck("$TAG -receive-1-", "")
val poi = this.marker.get()
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (poi != null) {
@@ -251,7 +251,7 @@ class AiRoadMarker {
poi.poi_lat
)
V2XBizTrace.onAck(
"$TAG --- receive --- 2 ---",
"$TAG -receive-2-",
"car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance"
)
if (distance < 500) {

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

@@ -4,7 +4,6 @@ import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.Log
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
@@ -269,9 +268,6 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
alertContent: CharSequence,
ttsContent: String,
) {
if (alertContent.toString().isEmpty() || ttsContent.isEmpty()) {
Log.d("MsgBox-VipCarManager", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(MsgBoxType.V2X, V2XMsg(v2xType, alertContent.toString(), ttsContent,CommunicationType.V2N.name))
)

View File

@@ -21,7 +21,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_SEND
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_MULTI_CONNECT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_AUTOPILOT
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotControlProvider
@@ -347,7 +347,7 @@ class MoGoAutopilotControlProvider :
startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.PAD)
}
//todo chainlog
//todo emArrow chainlog
override fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) {
if (controlParameters==null){
startAutoPilotWithNoParameter(Constants.AUTOPILOT_SOURCE.MO_FANG)
@@ -983,7 +983,7 @@ class MoGoAutopilotControlProvider :
}
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_MULTI_CONNECT,
paramIndexes = [0]

View File

@@ -23,7 +23,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_AD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_STATUS_QUERY_RESP
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_GNSS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_AUTOPILOT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_VEHICLE
@@ -50,7 +50,6 @@ import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.v2x.*
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.support.obu.ObuScene
@@ -364,7 +363,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
//工控机基础配置信息
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_CAR_CONFIG,
paramIndexes = [0, 1]

View File

@@ -9,7 +9,7 @@ import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
@@ -65,7 +65,7 @@ class TeleMsgHandler : IMsgHandler {
AdasManager.getInstance().decoderRaw(it.body)
} catch (e: Exception) {
e.printStackTrace()
invokeNettyConnResult("乘客屏解析数据过程中出现异常:${e.message}")
invokeReqStatusLog(mapOf("dataParseError" to "${e.message}"))
}
}
MogoProtocolMsg.SYNC_MODE_STATUS -> {
@@ -188,8 +188,8 @@ class TeleMsgHandler : IMsgHandler {
MogoProtocolMsg.REQ_MAC_ADDRESS,
configArray.size, configArray
), channel
) {
invokeNettyConnResult("司机屏发送配置信息到乘客屏是否成功:${it.isSuccess}")
) { future ->
invokeReqStatusLog(mapOf("dSendParam2P" to future.isSuccess))
}
} else {
queryCarConfig()
@@ -205,8 +205,8 @@ class TeleMsgHandler : IMsgHandler {
val snArray = sn.toByteArray()
NSDNettyManager.getInstance().sendMsgToSpecifiedClient(
MogoProtocolMsg(10, snArray.size, snArray), channel
) {
invokeNettyConnResult("司机屏发送SN(${sn})到乘客屏是否成功:${it.isSuccess}")
) { future ->
invokeReqStatusLog(mapOf("dSendSN(${sn})2P" to future.isSuccess))
}
} else {
invokeNettyConnResult("司机屏SN未获取到不发送给乘客屏")
@@ -245,12 +245,12 @@ class TeleMsgHandler : IMsgHandler {
}
// AdasManager.getInstance().startDispatchHandler()
ToastUtils.showShort("连接司机屏成功!")
invokeNettyConnResult("乘客屏连接司机屏成功")
invokeReqStatusLog(mapOf("dpConnectStatus" to true))
val byteArray = byteArrayOf(0)
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
MogoProtocolMsg(MogoProtocolMsg.REQ_MAC_ADDRESS, byteArray.size, byteArray)
) {
invokeNettyConnResult("乘客屏请求配置信息的数据发送是否成功:${it}")
invokeReqStatusLog(mapOf("pReqParamSendResult" to it))
}
// 请求司机屏SN
reqServerSN()
@@ -261,14 +261,14 @@ class TeleMsgHandler : IMsgHandler {
AppConfigInfo.plateNumber = ""
AppConfigInfo.iPCMacAddress = ""
ToastUtils.showLong("断开和司机屏的连接!")
invokeNettyConnResult("断开和司机屏的连接!")
invokeReqStatusLog(mapOf("dpConnectStatus" to false))
AdasManager.getInstance().stopDispatchHandler()
}
}
ConnectState.STATUS_CONNECT_ERROR -> {
AppConfigInfo.plateNumber = ""
ToastUtils.showLong("和司机端连接异常!")
invokeNettyConnResult("乘客屏和司机屏连接异常,错误为:$content")
invokeReqStatusLog(mapOf("dpConnectErrorMsg" to "$content"))
AdasManager.getInstance().stopDispatchHandler()
}
else -> {
@@ -280,7 +280,7 @@ class TeleMsgHandler : IMsgHandler {
override fun handleServerConnStatus(statusCode: Int, content: String?, channel: Channel) {}
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_MULTI_CONNECT,
paramIndexes = [0]
@@ -289,6 +289,16 @@ class TeleMsgHandler : IMsgHandler {
CallerLogger.d("${SceneConstant.M_D_C}$TAG", status)
}
@ChainLog(
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_MULTI_CONNECT,
paramIndexes = [0]
)
private fun invokeReqStatusLog(param:Map<String,Any>){
CallerLogger.d("${SceneConstant.M_D_C}$TAG", param.toString())
}
/**
* 记录最新的司机屏发送数据的时间戳
* 或乘客屏解析数据的时间戳
@@ -317,7 +327,7 @@ class TeleMsgHandler : IMsgHandler {
NSDNettyManager.getInstance().sendMogoProtocolMsgToServer(
MogoProtocolMsg(10, byteArray.size, byteArray)
) {
invokeNettyConnResult("乘客屏请求司机屏SN的数据发送是否成功${it}")
invokeReqStatusLog(mapOf("pReqSNSendResult" to it))
}
delay(700)
}

View File

@@ -31,7 +31,7 @@ class SpeedLimitDispatcher : ILimitingVelocityListener {
/**
* 地图限速数据
*/
// @BizConfig(FuncBizConfig.V2I, "", FuncBizConfig.BIZ_SLW) //todo arrow 重新考虑放的位置
// @BizConfig(FuncBizConfig.V2I, "", FuncBizConfig.BIZ_SLW) //todo emArrow 重新考虑放的位置
override fun onUnion(limitingVelocity: Int, sourceType: DataSourceType) {
super.onUnion(limitingVelocity, sourceType)
when (sourceType) { // obu 优先级高于 map体现链路能力

View File

@@ -8,4 +8,5 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
</manifest>

View File

@@ -173,7 +173,7 @@ class DevaToolsProvider : IDevaToolsProvider {
if (plugin is TracePlugin) {
if (tag == SharePluginInfo.TAG_PLUGIN_EVIL_METHOD) {
isEvil = true
printEvilMsg(issue.toString())
printEvilMsg(mapOf("evilMethod" to issue.toString()))
}
}
}
@@ -216,7 +216,7 @@ class DevaToolsProvider : IDevaToolsProvider {
nodeAliasCode = ChainConstant.CHAIN_CODE_RECORD_ANR,
paramIndexes = [0]
)
private fun printEvilMsg(evilMethod: String) {
private fun printEvilMsg(evilMethod: Map<String,String>) {
w("TraceCanary", evilMethod)
}

View File

@@ -6,7 +6,7 @@ import android.widget.Toast
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_INIT_ENV_RESTART
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_INIT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
import com.mogo.eagle.core.function.api.devatools.apm.*
import com.mogo.eagle.core.utilcode.util.*
import com.zhjt.mogo_core_function_devatools.apm.config.*
@@ -84,7 +84,7 @@ class ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
val appRelaunched = ApmEnvConfig.isAppRelaunched()
if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
ApmEnvConfig.setAppRelaunched(true)
restartApp("buildType:$buildType,netType:$netType,dockerVersion:$dockerVersion")
restartApp(mapOf<String,Any>("buildType" to buildType, "netType" to netType,"dockerVersion" to dockerVersion))
return@launch
}
if (isFirstDockerVersionSet) {
@@ -110,12 +110,12 @@ class ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
}
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_INIT,
nodeAliasCode = CHAIN_CODE_INIT_ENV_RESTART,
paramIndexes = [0]
)
private fun restartApp(envStr:String) {
private fun restartApp(envStr:Map<String,Any>) {
launch(Dispatchers.Main) {
Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
delay(50)

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

@@ -13,7 +13,7 @@ import com.zhjt.mogo_core_function_devatools.R
* @description Case清单列表适配器
* @since: 2022/10/19
*/
class CaseListAdapter: RecyclerView.Adapter<CaseListAdapter.CaseListHolder>() {
open class CaseListAdapter: RecyclerView.Adapter<CaseListAdapter.CaseListHolder>() {
private var data:List<RecordCaseEntity>? = null
private var caseClickListener: CaseClickListener?=null

View File

@@ -13,7 +13,7 @@ import com.zhjt.mogo_core_function_devatools.R
* @description Topic列表适配器
* @since: 2022/10/19
*/
class TopicListAdapter: RecyclerView.Adapter<TopicListAdapter.TopicListHolder>() {
open class TopicListAdapter: RecyclerView.Adapter<TopicListAdapter.TopicListHolder>() {
private var data:MutableList<TopicEntity>? = null
private var topicClickListener: TopicClickListener? = null

View File

@@ -6,14 +6,12 @@ import android.text.TextUtils;
//播放试听
public class Audition implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener{
private static volatile Audition INSTANCE;
public MediaPlayer mediaPlayer;
private String oldPath;
private OnAuditionListener listener;
public interface OnAuditionListener {
void onAuditionCompletion();
}
public void registerOnAuditionListener(OnAuditionListener listener) {
@@ -28,16 +26,12 @@ public class Audition implements MediaPlayer.OnPreparedListener, MediaPlayer.OnC
}
public static Audition getInstance() {
if (INSTANCE == null) {
synchronized (Audition.class) {
if (INSTANCE == null) {
INSTANCE = new Audition();
}
}
}
return INSTANCE;
return Holder.INSTANCE;
}
private static final class Holder{
private static final Audition INSTANCE = new Audition();
}
public boolean isPlaying() {
return mediaPlayer != null && mediaPlayer.isPlaying();

View File

@@ -5,7 +5,6 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEV
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Environment;
import android.util.Log;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.FileUtils;
@@ -42,7 +41,7 @@ public class RecordHelper {
private File resultFile = null;
private File tmpFile = null;
private List<File> files = new ArrayList<>();
private final List<File> files = new ArrayList<>();
private Mp3EncodeThread mp3EncodeThread;
public RecordHelper(RecordConfig config) {
@@ -69,7 +68,9 @@ public class RecordHelper {
return;
}
String path = getFilePath(fileName);
resultFile = new File(path);
if(path!=null){
resultFile = new File(path);
}
String tempFilePath = getTempFilePath();
tmpFile = new File(tempFilePath);
audioRecordThread = new AudioRecordThread();
@@ -134,7 +135,7 @@ public class RecordHelper {
}
}
private FftFactory fftFactory = new FftFactory(FftFactory.Level.Original);
private final FftFactory fftFactory = new FftFactory(FftFactory.Level.Original);
private void notifyData(final byte[] data) {
if (listener != null) {
@@ -192,14 +193,10 @@ public class RecordHelper {
@Override
public void run() {
super.run();
switch (currentConfig.getFormat()) {
case MP3:
startMp3Recorder();
break;
default:
startPcmRecorder();
break;
if (currentConfig.getFormat() == RecordConfig.RecordFormat.MP3) {
startMp3Recorder();
} else {
startPcmRecorder();
}
}
@@ -275,12 +272,9 @@ public class RecordHelper {
private void stopMp3Encoded() {
if (mp3EncodeThread != null) {
mp3EncodeThread.stopSafe(new Mp3EncodeThread.EncordFinishListener() {
@Override
public void onFinish() {
notifyFinish();
mp3EncodeThread = null;
}
mp3EncodeThread.stopSafe(() -> {
notifyFinish();
mp3EncodeThread = null;
});
} else {
CallerLogger.e("$M_DEVA$TAG", "mp3EncodeThread is null, 代码业务流程有误,请检查!! ");
@@ -382,8 +376,7 @@ public class RecordHelper {
}
String format = currentConfig.getFormat().getExtension();
String filePath = String.format(Locale.getDefault(), "%s%s%s", ROOT_PATH, fileName, format);
return filePath;
return String.format(Locale.getDefault(), "%s%s%s", ROOT_PATH, fileName, format);
}
private String getTempFilePath() {

View File

@@ -7,9 +7,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.record.listener.RecordListe
public class RecordManager {
private static final String TAG = RecordManager.class.getSimpleName();
@SuppressLint("StaticFieldLeak")
private volatile static RecordManager instance;
private final RecordHelper recordHelper;
/**
* 录音配置
@@ -21,14 +19,11 @@ public class RecordManager {
}
public static RecordManager getInstance() {
if (instance == null) {
synchronized (RecordManager.class) {
if (instance == null) {
instance = new RecordManager();
}
}
}
return instance;
return Holder.instance;
}
private static final class Holder{
private static final RecordManager instance = new RecordManager();
}
// /**

View File

@@ -3,7 +3,6 @@ package com.zhjt.mogo_core_function_devatools.binding
import android.annotation.*
import android.content.Context
import android.text.TextUtils
import com.elegant.utils.UiThreadHandler
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.eagle.core.data.app.AppConfigInfo.role
@@ -25,7 +24,6 @@ import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeAppNetWorkManager
import mogo.telematics.pad.MessagePad
/**
* //todo emArrow 链路biz
* 车辆绑定
*/
@SuppressLint("StaticFieldLeak")

View File

@@ -8,6 +8,7 @@ import com.mogo.eagle.core.data.deva.bindingcar.BindingCarInfo
import com.mogo.eagle.core.data.deva.bindingcar.BindingCarRequest
import com.mogo.eagle.core.data.deva.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingCarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingCarDialog
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
@@ -20,6 +21,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.service.chain.ChainLog
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
@@ -65,6 +67,7 @@ class BindingCarNetWorkManager private constructor() {
MediaType.get("application/json;charset=UTF-8"),
GsonUtil.jsonFromObject(request)
)
bindLog(mapOf("bingReq" to request))
mBindingCarApiService.getBindingCarInfo(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -72,7 +75,7 @@ class BindingCarNetWorkManager private constructor() {
override fun onSubscribe(d: Disposable) {}
override fun onNext(info: BindingCarInfo) {
if (info != null && info.getData() != null) {
d(SceneConstant.M_DEVA + TAG, "getBindingCarInfo data =" + info.getData().toString() + "---getDefaultId() : ${getDefaultId()}")
bindLog(mapOf("bindResult" to true,"carType" to getDefaultId(),"msg" to info))
SharedPrefsMgr.getInstance(context).putString(
SharedPrefsConstants.CAR_INFO,
GsonUtils.toJson(info.getData())
@@ -91,6 +94,7 @@ class BindingCarNetWorkManager private constructor() {
override fun onError(e: Throwable) {
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, "")
bindLog(mapOf("bindResult" to false,"msg" to e.toString()))
e(SceneConstant.M_DEVA + TAG, "getBindingCarInfo onError e = " + e.toString() + "---e.getMessage = " + e.message + "---getDefaultId() : ${getDefaultId()}")
}
@@ -115,6 +119,7 @@ class BindingCarNetWorkManager private constructor() {
widevineIDWithMd5,
screenType
)
bindLog(mapOf("bindingReq" to request))
val requestBody = RequestBody.create(
MediaType.get("application/json;charset=UTF-8"),
GsonUtil.jsonFromObject(request)
@@ -127,13 +132,13 @@ class BindingCarNetWorkManager private constructor() {
override fun onNext(info: ModifyBindingcarInfo) {
if (info != null) {
callBack.invoke(info)
d(SceneConstant.M_DEVA + TAG, "modifyBindingCar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString())
bindLog(mapOf("bindingStatus" to true,"bindMsg" to info))
updateCarVrIconRes(info.data.brandId)
}
}
override fun onError(e: Throwable) {
e(SceneConstant.M_DEVA + TAG, "modifyBindingCar onError e = " + e.toString() + "---e.getMessage = " + e.message)
bindLog(mapOf("bindingStatus" to false,"bindMsg" to e.toString()))
}
override fun onComplete() {}
@@ -177,6 +182,16 @@ class BindingCarNetWorkManager private constructor() {
}
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_INIT,
nodeAliasCode = ChainConstant.CHAIN_CODE_BINDING_CAR,
paramIndexes = [0]
)
private fun bindLog(msg:Map<String,Any>){
d(SceneConstant.M_DEVA + TAG, "bindLog : $msg")
}
private fun getDefaultId(): String {
return when (HdMapBuildConfig.currentCarVrIconRes) {
R.raw.chuzuche -> "1"

View File

@@ -14,7 +14,7 @@ internal class MainBlockLinkedLog {
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_HMI,
linkChainLog = ChainConstant.CHAIN_TYPE_ANR_LEAK,
linkCode = ChainConstant.CHAIN_SOURCE_HMI,
nodeAliasCode = ChainConstant.CHAIN_CODE_MAIN_BLOCK,
paramIndexes = [0]

View File

@@ -6,7 +6,7 @@ import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_FUNC_CONFIG_CHANGED
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
@@ -71,7 +71,7 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig>, IMoGoAutopilotCarCo
}
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_CLOUD,
nodeAliasCode = CHAIN_CODE_FUNC_CONFIG_CHANGED,
paramIndexes = [0]

View File

@@ -14,7 +14,7 @@ internal class MoFangLinkedLog {
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_HMI,
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_HMI,
nodeAliasCode = ChainConstant.CHAIN_CODE_MO_FANG_CONNECT,
paramIndexes = [0]

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

Some files were not shown because too many files have changed in this diff Show More