[dev_minibus-d_230425_3.2.0] 优化可能出现bug的代码

This commit is contained in:
lixiaopeng
2023-05-29 14:15:16 +08:00
parent 5a9da1f641
commit 8f7758aca2
7 changed files with 59 additions and 36 deletions

View File

@@ -62,9 +62,8 @@ public class TaxiPassengerModelLoopManager {
public void startRouteAndWipe() {
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startRouteAndWipe()");
if (mRouteWipeDisposable != null) return;
if (mRouteWipeDisposable == null){
mRouteWipeDisposable = new CompositeDisposable();
}
mRouteWipeDisposable = new CompositeDisposable();
Disposable disposable = startLoopRouteAndWipe()
.doOnSubscribe(new Consumer<Disposable>() {
@Override

View File

@@ -224,11 +224,15 @@ public class TaxiPassengerMapDirectionView
// 设置开始结束Marker位置
LatLng startLatLng = mCoordinatesLatLng.get(0);
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
if (mStartMarker != null) {
mStartMarker.setPosition(startLatLng);
mStartMarker.setVisible(true);
}
mStartMarker.setPosition(startLatLng);
mEndMarker.setPosition(endLatLng);
mStartMarker.setVisible(true);
mEndMarker.setVisible(true);
if (mEndMarker != null) {
mEndMarker.setPosition(endLatLng);
mEndMarker.setVisible(true);
}
}
}

View File

@@ -128,9 +128,9 @@ public class TaxiModelLoopManager {
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startCalculateRouteInfoLoop()");
if (mCalculateRouteDisposable != null) return;
if (mCalculateRouteDisposable == null){
mCalculateRouteDisposable = new CompositeDisposable();
}
mCalculateRouteDisposable = new CompositeDisposable();
Disposable disposable = loopDynamicCalculateRouteInfo()
.doOnSubscribe(new Consumer<Disposable>() {
@Override

View File

@@ -228,11 +228,14 @@ public class TaxiMapDirectionView
// 设置开始结束Marker位置
LatLng startLatLng = mCoordinatesLatLng.get(0);
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
mStartMarker.setPosition(startLatLng);
mEndMarker.setPosition(endLatLng);
mStartMarker.setVisible(true);
mEndMarker.setVisible(true);
if (mStartMarker != null) {
mStartMarker.setPosition(startLatLng);
mStartMarker.setVisible(true);
}
if (mEndMarker != null) {
mEndMarker.setPosition(endLatLng);
mEndMarker.setVisible(true);
}
}
}

View File

@@ -2176,8 +2176,12 @@ public final class ActivityUtils {
mGetHomeActivities = method;
}
}
mReplacePreferredActivity.setAccessible(true);
mGetHomeActivities.setAccessible(true);
if (mReplacePreferredActivity != null) {
mReplacePreferredActivity.setAccessible(true);
}
if (mGetHomeActivities != null) {
mGetHomeActivities.setAccessible(true);
}
IntentFilter HOME_FILTER = new IntentFilter(Intent.ACTION_MAIN);
HOME_FILTER.addCategory(Intent.CATEGORY_HOME);
@@ -2185,18 +2189,22 @@ public final class ActivityUtils {
final List<ComponentName> allComponents = new ArrayList<>();
final List<ResolveInfo> homeActivities = new ArrayList<>();
try {
mGetHomeActivities.invoke(packageManager, homeActivities);
if (mGetHomeActivities != null) {
mGetHomeActivities.invoke(packageManager, homeActivities);
}
for (ResolveInfo info : homeActivities) {
final ActivityInfo appInfo = info.activityInfo;
ComponentName activityName = new ComponentName(appInfo.packageName, appInfo.name);
allComponents.add(activityName);
}
mReplacePreferredActivity.invoke(
packageManager,
HOME_FILTER,
IntentFilter.MATCH_CATEGORY_EMPTY,
allComponents.toArray(new ComponentName[0]),
componentName);
if (mReplacePreferredActivity != null) {
mReplacePreferredActivity.invoke(
packageManager,
HOME_FILTER,
IntentFilter.MATCH_CATEGORY_EMPTY,
allComponents.toArray(new ComponentName[0]),
componentName);
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}

View File

@@ -391,12 +391,16 @@ public class AMapViewWrapper implements IMogoMapView,
)
@Override
public void setRoamTrajectory(String trajectory) {
mMapView.getMapAutoViewHelper().setRoamTrajectory(trajectory);
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().setRoamTrajectory(trajectory);
}
}
@Override
public void setRomaMode(int mode) {
mMapView.getMapAutoViewHelper().setRoamStyle(mode,1800, MapAutoApi.ROAM_SPEED_40);
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().setRoamStyle(mode,1800, MapAutoApi.ROAM_SPEED_40);
}
}
@Override
@@ -427,7 +431,9 @@ public class AMapViewWrapper implements IMogoMapView,
if (DebugConfig.isDebug()) {
CallerLogger.INSTANCE.d(M_MAP + TAG, Log.getStackTraceString(new Throwable()));
}
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
}
}
@Override
@@ -883,7 +889,9 @@ public class AMapViewWrapper implements IMogoMapView,
try {
mRtkEnable = !mRtkEnable;
TipToast.shortTip(mRtkEnable ? "已开启rtk道路匹配" : "已开启gps道路匹配");
mMapView.getLocationClient().rtkEnable(mRtkEnable);
if (mMapView != null && mMapView.getLocationClient() != null) {
mMapView.getLocationClient().rtkEnable(mRtkEnable);
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAP + TAG, "rtkEnable has exception : " + e);
}

View File

@@ -623,15 +623,16 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
List<IMogoTTSCallback> callBacks = mCmdMap.get(cmd);
if (callBacks != null) {
callBacks.remove(callBack);
}
if (callBacks.isEmpty()) {
mCmdMap.remove(cmd);
try {
mVoiceClient.unRegisterCustomWakeupCmd(cmd);
} catch (Exception e) {
e.printStackTrace();
if (callBacks.isEmpty()) {
mCmdMap.remove(cmd);
try {
mVoiceClient.unRegisterCustomWakeupCmd(cmd);
} catch (Exception e) {
e.printStackTrace();
}
mCacheUnWakeupCommands.remove(cmd);
}
mCacheUnWakeupCommands.remove(cmd);
}
}
}