diff --git a/.idea/misc.xml b/.idea/misc.xml
index 2db9aab721..47f1a4e1d4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index 21c813e433..2f8c0e5c6e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -265,6 +265,7 @@ dependencies {
implementation rootProject.ext.dependencies.moduletanlu, {
exclude group: 'com.mogo.module', module: 'module-share'
}
+ implementation rootProject.ext.dependencies.mogologlib
if (Boolean.valueOf(RELEASE)) {
launcherImplementation rootProject.ext.dependencies.modulemainlauncher
diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java
index a067f4bf8e..d37549c3ee 100644
--- a/app/src/main/java/com/mogo/launcher/MogoApplication.java
+++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java
@@ -73,6 +73,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
+ MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_LOG_LIB, "LogLib"));
if ( !DebugConfig.isLauncher() ) {
PersistentManager.getInstance().initManager( this );
diff --git a/config.gradle b/config.gradle
index 8526d3249f..ea7d423463 100644
--- a/config.gradle
+++ b/config.gradle
@@ -173,6 +173,8 @@ targetSdkVersion : 22,
// 基础服务实现
mogobaseservicesdk : "com.mogo.base:services-sdk:${MOGO_BASE_SERVICES_SDK_VERSION}",
mogobaseserviceapk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_APK_VERSION}",
+ // loglib
+ mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
// google
googlezxing : "com.google.zxing:core:3.3.3",
diff --git a/gradle.properties b/gradle.properties
index a9638dd04e..96dd28b93c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -76,7 +76,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
# 在线车辆F
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
# 推送
-MOGO_MODULE_PUSH_VERSION=1.1.6
+MOGO_MODULE_PUSH_VERSION=1.1.6.1
MOGO_MODULE_PUSH_BASE_VERSION=1.1.5.5
MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.6
# 广告资源位
@@ -101,6 +101,9 @@ MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
+# loglib
+LOGLIB_VERSION = 1.0.0-SNAPSHOT
+
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
applicationId=com.mogo.launcer
applicationName=IntelligentPilot
diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java
index a551c302bc..89dfeac7f4 100644
--- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java
+++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/location/ALocationClient.java
@@ -26,6 +26,7 @@ import java.util.Set;
public class ALocationClient implements IMogoLocationClient {
private static final String TAG = "LocationClient";
+ private final Context mContext;
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
private MogoLocation mLastLocation;
@@ -34,12 +35,7 @@ public class ALocationClient implements IMogoLocationClient {
private boolean mIsDestroyed = false;
public ALocationClient( Context context ) {
- mClient = new AMapLocationClient( context );
- mClient.setLocationListener( mListener );
- mLastLocation = ObjectUtils.fromAMap( mClient.getLastKnownLocation() );
- if ( mLastLocation == null ) {
- mLastLocation = new MogoLocation();
- }
+ mContext = context;
}
private AMapLocationClient mClient;
@@ -51,11 +47,12 @@ public class ALocationClient implements IMogoLocationClient {
@Override
public void start( long interval ) {
- if ( mIsDestroyed ) {
- destroyWarming();
- return;
+ if ( mClient == null ) {
+ mClient = new AMapLocationClient( mContext );
+ mClient.setLocationListener( mListener );
+ mLastLocation = ObjectUtils.fromAMap( mClient.getLastKnownLocation() );
}
- if ( mClient != null ) {
+ if ( !mClient.isStarted() ) {
AMapLocationClientOption option = new AMapLocationClientOption();
option.setLocationMode( AMapLocationClientOption.AMapLocationMode.Hight_Accuracy );
option.setNeedAddress( true );
@@ -109,6 +106,9 @@ public class ALocationClient implements IMogoLocationClient {
destroyWarming();
return null;
}
+ if ( mLastLocation == null ) {
+ mLastLocation = new MogoLocation();
+ }
return mLastLocation;
}
@@ -140,7 +140,7 @@ public class ALocationClient implements IMogoLocationClient {
aMapLocation.getLongitude() == 0.0D ) {
return;
}
- Trace.beginSection("timer.onLocationChanged");
+ Trace.beginSection( "timer.onLocationChanged" );
mLastLocation = ObjectUtils.fromAMap( aMapLocation );
synchronized ( sListeners ) {
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
diff --git a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java
index 4ded331a36..1194734bb3 100644
--- a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java
+++ b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java
@@ -34,8 +34,8 @@ public class BackToMainHomeManager {
}
public static void backToLauncher() {
- if (mStatusManager == null) {
- Logger.e(TAG,"未初始化完成");
+ if ( mStatusManager == null ) {
+ Logger.e( TAG, "未初始化完成" );
return;
}
if ( mStatusManager.isMainPageOnResume() ) {
@@ -45,6 +45,10 @@ public class BackToMainHomeManager {
return;
}
+ if ( mStatusManager.isAppListUIShow() ) {
+ mApis.getIntentManagerApi().invoke( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, new Intent() );
+ }
+
Logger.d( TAG, "返回桌面" );
Intent intent = new Intent();
@@ -75,7 +79,7 @@ public class BackToMainHomeManager {
params.x = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_left );
params.y = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_top );
params.gravity = Gravity.LEFT | Gravity.CENTER;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
diff --git a/modules/mogo-module-extensions/src/main/res/values/strings.xml b/modules/mogo-module-extensions/src/main/res/values/strings.xml
index bcfcbae52f..def8fbcd0e 100644
--- a/modules/mogo-module-extensions/src/main/res/values/strings.xml
+++ b/modules/mogo-module-extensions/src/main/res/values/strings.xml
@@ -13,7 +13,7 @@
- 周五
- 周六
- 99+
+ ···
搜索目的地
分享
diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/NoopPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/NoopPresenter.java
new file mode 100644
index 0000000000..4270a87d06
--- /dev/null
+++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/NoopPresenter.java
@@ -0,0 +1,52 @@
+package com.mogo.module.media.presenter;
+
+import android.content.Context;
+
+import com.mogo.module.media.model.MediaInfoData;
+import com.mogo.module.media.view.IMusicView;
+
+/**
+ * 空presenter实现,为了减少各种空判断
+ *
+ * @author tongchenfei
+ */
+public class NoopPresenter extends BaseMediaPresenter {
+ public NoopPresenter(IMusicView view) {
+ super(view);
+ }
+
+ @Override
+ public void init(Context context) {
+
+ }
+
+ @Override
+ public void play(MediaInfoData mediaInfoData) {
+
+ }
+
+ @Override
+ public void pause(MediaInfoData mediaInfoData) {
+
+ }
+
+ @Override
+ public void stop(MediaInfoData mediaInfoData) {
+
+ }
+
+ @Override
+ public void pre() {
+
+ }
+
+ @Override
+ public void next() {
+
+ }
+
+ @Override
+ public void openApp() {
+
+ }
+}
diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/PresenterFactory.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/PresenterFactory.java
new file mode 100644
index 0000000000..c5661387b7
--- /dev/null
+++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/PresenterFactory.java
@@ -0,0 +1,45 @@
+package com.mogo.module.media.presenter;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+
+import com.mogo.module.media.view.IMusicView;
+
+import java.util.List;
+
+/**
+ * Presenter简单工厂,根据包名判断选择哪个presenter
+ *
+ * @author tongchenfei
+ */
+public class PresenterFactory {
+ private static final String KW_PKG_NAME = "cn.kuwo.kwmusiccar";
+ private static final String WE_CAR_FLOW_PKG_NAME = "com.tencent.wecarflow";
+
+ /**
+ * 获取泛型是IMusicView的BaseMediaPresenter
+ *
+ * @param context 上下文,用来遍历机器上的包名
+ * @param view IMusicView,用来做view展示
+ * @return presenter
+ */
+ public static BaseMediaPresenter createMusicViewPresenter(Context context,
+ IMusicView view) {
+ BaseMediaPresenter result = null;
+ PackageManager pkm = context.getPackageManager();
+ List pkgInfoList = pkm.getInstalledPackages(0);
+ // 只做了两级优先级判断,比较简单
+ for (PackageInfo pkgInfo : pkgInfoList) {
+ if (pkgInfo.packageName.equals(KW_PKG_NAME)) {
+ result = new KwPresenter(view);
+ } else if (pkgInfo.packageName.equals(WE_CAR_FLOW_PKG_NAME) && result == null) {
+ result = new WeCarFlowPresenter(view);
+ }
+ }
+ if (result == null) {
+ result = new NoopPresenter(view);
+ }
+ return result;
+ }
+}
diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java
index 55eb757511..5991f1ed25 100644
--- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java
+++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java
@@ -17,7 +17,9 @@ import com.mogo.module.media.ServiceMediaHandler;
import com.mogo.module.media.constants.MusicConstant;
import com.mogo.module.media.listener.NoDoubleClickListener;
import com.mogo.module.media.model.MediaInfoData;
+import com.mogo.module.media.presenter.BaseMediaPresenter;
import com.mogo.module.media.presenter.KwPresenter;
+import com.mogo.module.media.presenter.PresenterFactory;
import com.mogo.module.media.utils.Utils;
import com.mogo.module.media.view.IMusicView;
import com.mogo.module.media.widget.AnimCircleImageView;
@@ -41,7 +43,7 @@ public class MediaWindow2 implements IMusicView {
public static final String TAG = MediaWindow2.class.getName();
private Context mContext;
- private KwPresenter mPresenter;
+ private BaseMediaPresenter mPresenter;
private MediaInfoData mMediaInfoData = new MediaInfoData();
@@ -60,7 +62,7 @@ public class MediaWindow2 implements IMusicView {
public void initMedia(Context context) {
mContext = context;
- mPresenter = new KwPresenter(this);
+ mPresenter = PresenterFactory.createMusicViewPresenter(context, this);
mPresenter.init(context);
if(DebugConfig.isLauncher()) {
diff --git a/modules/mogo-module-push/src/main/java/com/mogo/module/push/activity/PushMessageActivity.kt b/modules/mogo-module-push/src/main/java/com/mogo/module/push/activity/PushMessageActivity.kt
index a77b140ebb..195aa828ab 100644
--- a/modules/mogo-module-push/src/main/java/com/mogo/module/push/activity/PushMessageActivity.kt
+++ b/modules/mogo-module-push/src/main/java/com/mogo/module/push/activity/PushMessageActivity.kt
@@ -1,14 +1,15 @@
package com.mogo.module.push.activity
+import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.module.push.Config
-import com.mogo.module.push.base.PushUIConstants
import com.mogo.module.push.R
import com.mogo.module.push.adapter.PushMessageAdapter
+import com.mogo.module.push.base.PushUIConstants
import com.mogo.module.push.model.PushBean
import com.mogo.module.push.repository.PushRepository
import com.mogo.module.push.utils.AnalyticsUtils
@@ -16,12 +17,15 @@ import com.mogo.module.push.utils.HandlerUtils
import com.mogo.module.push.utils.startClearAnimator
import com.mogo.module.push.view.PushItemAnimator
import com.mogo.module.push.view.SwipeItemLayout
+import com.mogo.module.push.view.getApis
import com.mogo.module.push.viewmodel.MessageViewModel
+import com.mogo.service.intent.IMogoIntentListener
import com.mogo.utils.UiThreadHandler
+import com.mogo.utils.logger.Logger
import kotlinx.android.synthetic.main.module_push_message_activity.*
@Route(path = PushUIConstants.Push_MESSAGE_ACTIVITY_PATH)
-class PushMessageActivity : AppCompatActivity() {
+class PushMessageActivity : AppCompatActivity(), IMogoIntentListener {
private lateinit var viewModel: MessageViewModel
private var adapter = PushMessageAdapter()
private var clearing = false
@@ -54,7 +58,7 @@ class PushMessageActivity : AppCompatActivity() {
}
}
module_push_activity_clear.visibility =
- if (show) View.VISIBLE else View.GONE
+ if (show) View.VISIBLE else View.GONE
}
override fun deleteBean(bean: PushBean, action: Boolean) {
@@ -77,10 +81,10 @@ class PushMessageActivity : AppCompatActivity() {
module_push_activity_recycler_view.adapter = adapter
module_push_activity_recycler_view.itemAnimator = PushItemAnimator()
module_push_activity_recycler_view.addOnItemTouchListener(
- SwipeItemLayout.OnSwipeItemTouchListener(this)
+ SwipeItemLayout.OnSwipeItemTouchListener(this)
)
viewModel = MessageViewModel(object :
- MessageViewModel.MessageListChange {
+ MessageViewModel.MessageListChange {
override fun messageListChange(list: MutableList?) {
runOnUiThread {
var size = list?.size ?: 0
@@ -90,6 +94,8 @@ class PushMessageActivity : AppCompatActivity() {
}
}
})
+
+ getApis(this).intentManagerApi.registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this)
}
private fun updateHistoryMessageCount(){
@@ -105,4 +111,16 @@ class PushMessageActivity : AppCompatActivity() {
super.onResume()
adapter.notifyDataSetChanged()
}
+
+ override fun onIntentReceived(intentStr: String?, intent: Intent?) {
+ if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intentStr)) {
+ Logger.d("PushMessageActivity", "close by home key.")
+ finish()
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ getApis(this).intentManagerApi.unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this)
+ }
}
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java
index 79950ef3c4..3d9d2105b8 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java
@@ -2,58 +2,24 @@ package com.mogo.module.service;
import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
-import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
-import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarkerClickListener;
-import com.mogo.map.marker.IMogoMarkerManager;
-import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
-import com.mogo.map.navi.MogoNaviInfo;
-import com.mogo.map.navi.MogoTraffic;
-import com.mogo.map.uicontroller.EnumMapUI;
-import com.mogo.map.uicontroller.IMogoMapUIController;
-import com.mogo.module.common.MogoModule;
-import com.mogo.module.common.MogoModulePaths;
-import com.mogo.module.service.network.RefreshCallback;
-import com.mogo.module.service.network.RefreshModel;
-import com.mogo.module.service.receiver.MogoReceiver;
-import com.mogo.module.service.refresh.AutoRefreshStrategy;
-import com.mogo.module.service.refresh.CustomRefreshStrategy;
-import com.mogo.service.MogoServicePaths;
-import com.mogo.service.intent.IMogoIntentListener;
-import com.mogo.service.intent.IMogoIntentManager;
-import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoModuleProvider;
-import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.module.ModuleType;
-import com.mogo.service.statusmanager.IMogoStatusChangedListener;
-import com.mogo.service.statusmanager.IMogoStatusManager;
-import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
-import java.util.Iterator;
-import java.util.List;
-
/**
* @author congtaowang
* @since 2020-01-03
@@ -128,6 +94,8 @@ public class MogoServiceProvider implements IMogoModuleProvider {
@Override
public void init( Context context ) {
+ Logger.d( TAG, "init" );
+ MarkerServiceHandler.init( context );
UiThreadHandler.postDelayed( () -> {
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
}, 5_000L );
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
index 0acfe90eae..7e44a00665 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
@@ -56,6 +56,7 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.TipToast;
+import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -63,6 +64,8 @@ import org.json.JSONObject;
import java.util.List;
+import retrofit2.http.HEAD;
+
/**
* @author congtaowang
* @since 2020-01-03
@@ -273,12 +276,13 @@ public class MogoServices implements IMogoMapListener,
private boolean mIsMainPageFirstResume = true;
+ private boolean mIsFirstAccOn = true;
+
public void init( Context context ) {
mContext = context;
initWorkThread();
- MarkerServiceHandler.init( mContext );
mRefreshModel = new RefreshModel( context );
mMogoMapService = MarkerServiceHandler.getMapService();
mUiController = mMogoMapService.getMapUIController();
@@ -366,6 +370,7 @@ public class MogoServices implements IMogoMapListener,
if ( msg.obj instanceof RefreshObject ) {
RefreshObject ro = ( ( RefreshObject ) msg.obj );
if ( ro.mLonLat == null ) {
+ Logger.w( TAG, "lonLat is null." );
return;
}
mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
@@ -619,9 +624,7 @@ public class MogoServices implements IMogoMapListener,
// 自动刷新触发
final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() );
if ( mLastAutoRefreshLocation == null ) {
- mLastAutoRefreshLocation = point;
- mLoopRequest = true;
- notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
+ startFirstLocationRequest( point );
return;
}
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point );
@@ -635,8 +638,27 @@ public class MogoServices implements IMogoMapListener,
}
}
+ /**
+ * 首次定位成功后,执行道路事件的刷新
+ *
+ * @param point
+ */
+ private void startFirstLocationRequest( MogoLatLng point ) {
+ mLastAutoRefreshLocation = point;
+ mLoopRequest = true;
+ notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
+ }
+
@Override
public void onCarLocationChanged2( Location latLng ) {
+ if ( latLng == null ) {
+ return;
+ }
+ // poi 定位无法获取时,使用该定位
+ if ( mLastAutoRefreshLocation == null ) {
+ MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
+ startFirstLocationRequest( point );
+ }
}
@Override
@@ -717,18 +739,20 @@ public class MogoServices implements IMogoMapListener,
break;
case ACC_STATUS:
if ( isTrue ) {
+ if ( mIsFirstAccOn ) {
+ mIsFirstAccOn = false;
+ return;
+ }
initLocationServiceProcess( mContext );
mADASController.showADAS();
- refreshStrategy();
- MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop();
+ MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).start();
+ MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
+ UiThreadHandler.postDelayed( () -> {
+ refreshStrategy();
+ }, 3_000L );
} else {
- try {
- MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
- MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).start();
- } catch ( Exception e ) {
- Logger.e( TAG, e, "error." );
- }
- refreshStrategy();
+ MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop();
+ MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers();
}
break;
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java
index 5a9def8162..38a6de48b4 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java
@@ -3,10 +3,11 @@ package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
+import com.mogo.module.common.utils.CarSeries;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.AccStatusReceiver;
-import com.mogo.module.service.receiver.MogoReceiver;
+import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
public
@@ -18,16 +19,21 @@ public
*/
class AccStatusIntentHandler implements IntentHandler {
+ public static final byte ACC_ON = 1;
+ public static final byte ACC_OFF = 0;
+ public static final byte ACC_OFF_DELAY = 3;
+
private static final String TAG = "AccStatusIntentHandler";
private static volatile AccStatusIntentHandler sInstance;
- private AccStatusIntentHandler(){}
+ private AccStatusIntentHandler() {
+ }
- public static AccStatusIntentHandler getInstance(){
- if( sInstance == null ){
- synchronized( AccStatusIntentHandler.class ) {
- if( sInstance == null ){
+ public static AccStatusIntentHandler getInstance() {
+ if ( sInstance == null ) {
+ synchronized ( AccStatusIntentHandler.class ) {
+ if ( sInstance == null ) {
sInstance = new AccStatusIntentHandler();
}
}
@@ -35,7 +41,7 @@ class AccStatusIntentHandler implements IntentHandler {
return sInstance;
}
- public synchronized void release(){
+ public synchronized void release() {
sInstance = null;
}
@@ -43,15 +49,26 @@ class AccStatusIntentHandler implements IntentHandler {
public void handle( Context context, Intent intent ) {
String action = intent.getAction();
if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) {
- MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true );
- Logger.d( TAG, "acc status: %s", true );
+ if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
+ MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true );
+ Logger.d( TAG, "acc status: %s", true );
+ }
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) {
- MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
- Logger.d( TAG, "acc status: %s", false );
+ if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
+ MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
+ Logger.d( TAG, "acc status: %s", false );
+ }
} else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) {
- int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
- Logger.d( TAG, "acc status: %s", state == 1 );
- MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, state == 1 );
+ int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF );
+ if ( state != ACC_OFF && state != ACC_ON && state != ACC_OFF_DELAY ) {
+ return;
+ }
+ boolean accOn = state == ACC_ON;
+ if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) {
+ return;
+ }
+ Logger.d( TAG, "acc status: %s", state );
+ MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn );
}
}
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
index 9595d20a9b..1d0189338f 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
@@ -77,7 +77,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
private Rect mMarkerDisplayBounds;
private MapMarkerManager() {
- mContext = AbsMogoApplication.getApp();
}
public static synchronized MapMarkerManager getInstance() {
@@ -96,6 +95,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
* @param context
*/
public void init( Context context ) {
+
+ if ( mContext != null ) {
+ return;
+ }
+
+ Logger.d( TAG, "初始化" );
+
+ mContext = context.getApplicationContext();
mRefreshModel = new RefreshModel( mContext );
// 长连接
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java b/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java
index 6f90c84d79..3d0c6ad1fc 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java
@@ -226,4 +226,10 @@ public class MogoServicePaths {
*/
@Deprecated
public static final String PATH_AGREEMENT = "/agreement/showFragment";
+
+ /**
+ * 日志上传
+ */
+ @Deprecated
+ public static final String PATH_LOG_LIB = "/loglib/api";
}