opt
This commit is contained in:
@@ -196,6 +196,7 @@ dependencies {
|
||||
debugImplementation rootProject.ext.dependencies.gpssimulatordebug
|
||||
releaseImplementation rootProject.ext.dependencies.gpssimulatornoop
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
} else {
|
||||
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
|
||||
// launcherImplementation project(':modules:mogo-module-main')
|
||||
@@ -208,6 +209,7 @@ dependencies {
|
||||
debugImplementation project(':modules:mogo-module-gps-simulator-debug')
|
||||
releaseImplementation project(':modules:mogo-module-gps-simulator-noop')
|
||||
implementation project(':modules:mogo-module-media')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.media.MediaConstants;
|
||||
import com.mogo.module.push.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -35,37 +36,39 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
DebugConfig.setNetMode(BuildConfig.NET_ENV);
|
||||
DebugConfig.setDebug(BuildConfig.DEBUG);
|
||||
DebugConfig.setAIType(BuildConfig.AIType);
|
||||
DebugConfig.setNetMode( BuildConfig.NET_ENV );
|
||||
DebugConfig.setDebug( BuildConfig.DEBUG );
|
||||
DebugConfig.setAIType( BuildConfig.AIType );
|
||||
DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE );
|
||||
DebugConfig.setUseCustomNavi( BuildConfig.USE_CUSTOM_NAVI );
|
||||
DebugConfig.setLauncher( BuildConfig.IS_LAUNCHER );
|
||||
super.onCreate();
|
||||
// Crash 日志收集
|
||||
final long start = System.currentTimeMillis();
|
||||
CrashSystem crashSystem = CrashSystem.getInstance(this);
|
||||
CrashSystem crashSystem = CrashSystem.getInstance( this );
|
||||
crashSystem.init();
|
||||
//设置debug模式,日志不上传
|
||||
crashSystem.setDebug(BuildConfig.DEBUG);
|
||||
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
|
||||
crashSystem.setDebug( BuildConfig.DEBUG );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||
|
||||
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule( AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME));
|
||||
MogoModulePaths.addModule( new MogoModule( AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
|
||||
//运营位卡片,需要默认显示,放在第一个加载
|
||||
MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME));
|
||||
if(DebugConfig.isLauncher()) {
|
||||
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
|
||||
MogoModulePaths.addModule( new MogoModule( AdCardConstants.TAG, AdCardConstants.MODULE_NAME ) );
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
MogoModulePaths.addModule( new MogoModule( MediaConstants.TAG, MediaConstants.MODULE_TYPE ) );
|
||||
}
|
||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
|
||||
|
||||
MogoModulePaths.addModule(new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI));
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
|
||||
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
|
||||
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.TAG, PushUIConstants.TAG));
|
||||
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,15 +76,15 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
super.init();
|
||||
IMogoSocketManager mMogoSocketManager = ARouter.getInstance().navigation( IMogoSocketManager.class );
|
||||
if ( mMogoSocketManager != null ) {
|
||||
mMogoSocketManager.init(getApplicationContext(), "com.mogo.launcher");
|
||||
mMogoSocketManager.init( getApplicationContext(), "com.mogo.launcher" );
|
||||
} else {
|
||||
Logger.e( TAG, "init socket server error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
MultiDex.install(base);
|
||||
protected void attachBaseContext( Context base ) {
|
||||
super.attachBaseContext( base );
|
||||
MultiDex.install( base );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ ext {
|
||||
android = [
|
||||
// applicationId : "com.mogo.launcher",
|
||||
// zhidadoApplicationId: "com.zhidao.launcher",
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId: "com.mogo.launcher.app",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId: "com.mogo.launcher.app",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
@@ -147,7 +147,7 @@ targetSdkVersion : 22,
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.1-SNAPSHOT",
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.1",
|
||||
|
||||
// 个人中心的SDK
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
|
||||
@@ -15,10 +15,10 @@ import com.mogo.module.main.MainActivity;
|
||||
*/
|
||||
public class MainIndependentActivity extends MainActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
// 独立app需要在onCreate里面增加处理scheme的情况
|
||||
mPresenter.handleSchemeIntent(getIntent());
|
||||
mPresenter.handleSchemeIntent( getIntent() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,4 +34,18 @@ public class MainIndependentActivity extends MainActivity {
|
||||
|
||||
mApps.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if ( mCoverUpLayout.getVisibility() != View.VISIBLE ) {
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.extensions.utils.ExtensionsConfig;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ public class MainLauncherActivity extends MainActivity {
|
||||
super.loadContainerModules();
|
||||
// 显示左边遮罩
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mMogoModuleHandler.loadAppsListModule( com.mogo.module.main.R.id.module_main_id_apps_fragment_container );
|
||||
MogoModulesManager.getInstance().loadAppsListModule( com.mogo.module.main.R.id.module_main_id_apps_fragment_container );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,9 @@ public class MogoModulePaths {
|
||||
|
||||
private static List< MogoModule > mMogoModules = new ArrayList<>();
|
||||
|
||||
// 不需要启动APP也能运行的模块
|
||||
private static List< MogoModule > mMogoBaseModules = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 地图模块 fragment 路径
|
||||
*/
|
||||
@@ -50,7 +53,23 @@ public class MogoModulePaths {
|
||||
mMogoModules.add( module );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加卡片模块
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
public static void addBaseModule( MogoModule module ) {
|
||||
if ( module == null || TextUtils.isEmpty( module.getPath().replace( " ", "" ) ) ) {
|
||||
throw new IllegalArgumentException( "module path can't be empty or null or blank" );
|
||||
}
|
||||
mMogoBaseModules.add( module );
|
||||
}
|
||||
|
||||
public static List< MogoModule > getModules() {
|
||||
return mMogoModules;
|
||||
}
|
||||
|
||||
public static List< MogoModule > getBaseModules() {
|
||||
return mMogoBaseModules;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
package="com.mogo.module.main">
|
||||
|
||||
<application>
|
||||
|
||||
<service
|
||||
android:name=".service.MogoMainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.mogo.launcher.action.MAIN_SERVICE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -36,6 +37,8 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -53,7 +56,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected IMogoServiceApis mServiceApis;
|
||||
protected IMogoMapService mMogoMapService;
|
||||
protected IMogoMapUIController mMogoMapUIController;
|
||||
protected MogoModulesHandler mMogoModuleHandler;
|
||||
protected IMogoFragmentManager mMogoFragmentManager;
|
||||
protected IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
@@ -64,11 +66,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected FrameLayout mCoverUpLayout;
|
||||
protected View mLeftShadowFrame;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
*/
|
||||
private IMogoLocationClient mLocationClient;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_main_activity_main;
|
||||
@@ -124,7 +121,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
public void loadModules() {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager( this, getApis() );
|
||||
MogoModulesManager.getInstance().init( this, getApis() );
|
||||
mMogoMapService = mServiceApis.getMapServiceApi();
|
||||
if ( mMogoMapService != null ) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener( EventDispatchCenter.getInstance() );
|
||||
@@ -139,19 +136,18 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
addModule();
|
||||
loadContainerModules();
|
||||
mMogoModuleHandler.loadModules();
|
||||
MogoModulesManager.getInstance().loadModules();
|
||||
mPresenter.delayOperations();
|
||||
mPresenter.initADAS();
|
||||
hideCoverUpLayout();
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMogoMapUIController, Scene.AIMLESS );
|
||||
|
||||
// 开启定位
|
||||
startLocation();
|
||||
// 启动一些基本的服务:定位等
|
||||
startBaseService();
|
||||
} );
|
||||
mMogoModuleHandler.loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
|
||||
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
@@ -166,22 +162,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
private void startBaseService() {
|
||||
Intent intent = new Intent( this, MogoMainService.class );
|
||||
startService( intent );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加模块
|
||||
*/
|
||||
protected void addModule(){
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
}
|
||||
protected void addModule() {
|
||||
|
||||
private void startLocation() {
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
}
|
||||
|
||||
protected void loadContainerModules() {
|
||||
mMogoModuleHandler.loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
mMogoModuleHandler.loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
MogoModulesManager.getInstance().loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
MogoModulesManager.getInstance().loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,7 +188,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void loadCardModules() {
|
||||
|
||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||
List< IMogoModuleProvider > providers = MogoModulesManager.getInstance().loadCardsModule();
|
||||
// mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||
// mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||
// mCardsContainer.setPageTransformer( true, mTransformer );
|
||||
@@ -236,9 +231,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( mMogoFragmentManager.getStackSize() == 0 ) {
|
||||
if(DebugConfig.isLauncher()) {
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
@@ -264,15 +259,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
mLocationClient.destroy();
|
||||
if ( MogoModulesManager.getInstance() != null ) {
|
||||
MogoModulesManager.getInstance().destroy();
|
||||
}
|
||||
mLocationClient = null;
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.destroy();
|
||||
}
|
||||
mMogoModuleHandler = null;
|
||||
mMogoMapService = null;
|
||||
mMogoMapUIController = null;
|
||||
mMogoFragmentManager = null;
|
||||
|
||||
@@ -52,6 +52,14 @@ public interface MogoModulesHandler {
|
||||
*/
|
||||
void loadEntrancesModule( int containerId );
|
||||
|
||||
/**
|
||||
* 加载基本服务模块,需要不启动页面就能运行
|
||||
* <p>
|
||||
* 1. v2x
|
||||
* 2. mogo-module-service
|
||||
*/
|
||||
void loadBaseModule();
|
||||
|
||||
/**
|
||||
* 销毁
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,27 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
|
||||
// 空间换效率
|
||||
private Map< String, IMogoModuleProvider > mModuleNameProviders = new HashMap<>();
|
||||
|
||||
private static volatile MogoModulesManager sInstance;
|
||||
|
||||
private MogoModulesManager(){}
|
||||
|
||||
public static MogoModulesManager getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoModulesManager.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoModulesManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public MogoModulesManager( MainActivity activity, IMogoServiceApis apis ) {
|
||||
public void init( MainActivity activity, IMogoServiceApis apis ) {
|
||||
if ( activity == null ) {
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
}
|
||||
@@ -111,6 +130,18 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List<MogoModule> baseModules = MogoModulePaths.getBaseModules();
|
||||
for ( MogoModule baseModule : baseModules ) {
|
||||
if ( baseModule == null ) {
|
||||
continue;
|
||||
}
|
||||
load( baseModule.getPath() );
|
||||
Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() );
|
||||
}
|
||||
}
|
||||
|
||||
private IMogoModuleProvider load( String path ) {
|
||||
return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.mogo.module.main.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.main.EventDispatchCenter;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = "/service/base/info" )
|
||||
class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
private static final String TAG = "MogoMainService";
|
||||
private IMogoServiceApis mServiceApis;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
*/
|
||||
private IMogoLocationClient mLocationClient;
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind( Intent intent ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand( Intent intent, int flags, int startId ) {
|
||||
Logger.d( TAG, "基本服务启动" );
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
initAndStartLocation();
|
||||
loadBaseModules();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d( TAG, "开始定位" );
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d( TAG, "加载基本模块" );
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged( location );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
mLocationClient.stop();
|
||||
mLocationClient.destroy();
|
||||
mLocationClient = null;
|
||||
}
|
||||
mServiceApis = null;
|
||||
}
|
||||
}
|
||||
@@ -31,5 +31,17 @@ public interface IMogoADASController extends IProvider {
|
||||
*/
|
||||
void killADAS();
|
||||
|
||||
void setSettingStatus(boolean show);
|
||||
/**
|
||||
* adas 设置页面控制
|
||||
*
|
||||
* @param show
|
||||
*/
|
||||
void setSettingStatus( boolean show );
|
||||
|
||||
/**
|
||||
* 控制算法
|
||||
*
|
||||
* @param open
|
||||
*/
|
||||
void setUseAlgorithm( boolean open );
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
Logger.d( TAG, "show adas" );
|
||||
if ( !isProcessRunning( AbsMogoApplication.getApp(), getPackageUid( AbsMogoApplication.getApp(), "com.zhidiao.autopilot" ) ) ) {
|
||||
init( AbsMogoApplication.getApp() );
|
||||
}
|
||||
init( AbsMogoApplication.getApp() );
|
||||
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
@@ -172,4 +172,9 @@ public class MogoADASController implements IMogoADASController {
|
||||
public void setSettingStatus( boolean show ) {
|
||||
AutopilotServiceManage.getInstance().setSettingStatus( show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseAlgorithm( boolean open ) {
|
||||
AutopilotServiceManage.getInstance().setUseAlgorithm( open );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user