diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt
index e2ba5ec9e0..7a241e03da 100644
--- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt
+++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt
@@ -23,7 +23,7 @@ class BusPassengerConst {
}
// OCH arouter 路由path
- const val PATH = "/och/api"
+ const val PATH = "/passenger/api"
// 轮询line
const val LOOP_LINE_2S = 2 * 1000L
diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt
index 686e08b4e4..87f4af8649 100644
--- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt
+++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/BusConst.kt
@@ -23,7 +23,7 @@ class BusConst {
}
// OCH arouter 路由path
- const val PATH = "/och/api"
+ const val PATH = "/driver/api"
// 测试用的广播
const val BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType"
diff --git a/OCH/mogo-och-noop/src/main/java/com/mogo/och/bus/OCHConstants.java b/OCH/mogo-och-noop/src/main/java/com/mogo/och/bus/OCHConstants.java
index 28e5686048..e403d542bc 100644
--- a/OCH/mogo-och-noop/src/main/java/com/mogo/och/bus/OCHConstants.java
+++ b/OCH/mogo-och-noop/src/main/java/com/mogo/och/bus/OCHConstants.java
@@ -12,5 +12,5 @@ class OCHConstants {
/**
* arouter 路由地址
*/
- public static final String PATH = "/och/api";
+ public static final String PATH = "/driver/api";
}
diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SweeperConst.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SweeperConst.kt
index 9a534d3a85..8397cddf95 100644
--- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SweeperConst.kt
+++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/constant/SweeperConst.kt
@@ -23,7 +23,7 @@ class SweeperConst {
}
// OCH arouter 路由path
- const val PATH = "/och/api"
+ const val PATH = "/driver/api"
// 测试用的广播
const val BROADCAST_TEST_SWEEPER_CONTROL_TYPE_EXTRA_KEY = "sceneType"
diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt
index b303ea69e0..68d352758c 100644
--- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt
+++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt
@@ -23,7 +23,7 @@ class TaxiPassengerConst {
}
// OCH arouter 路由path
- const val PATH = "/och/api"
+ const val PATH = "/passenger/api"
// 上报心跳轮询ms
const val LOOP_PERIOD_60S = 60 * 1000L
diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/OverlayLeftViewUtils.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/OverlayLeftViewUtils.kt
index 8964d0907b..6dece1ffdf 100644
--- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/OverlayLeftViewUtils.kt
+++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/OverlayLeftViewUtils.kt
@@ -274,9 +274,10 @@ object OverlayLeftViewUtils {
*
*/
fun transmissionIndex(index:Int){
- if(!ProcessUtils.isMainProcess(Utils.getApp())) {
+ // TODO 需要与,杨亚坤,确认为啥要限制仅在主进程
+// if(!ProcessUtils.isMainProcess(Utils.getApp())) {
LeftMenuOpen.transmissionIndex(index)
- }
+// }
}
fun transmissionIndexGet(index: Int){
diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/constant/TaxiConst.kt b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/constant/TaxiConst.kt
index 68f2379a42..7b77013fb3 100644
--- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/constant/TaxiConst.kt
+++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/constant/TaxiConst.kt
@@ -23,7 +23,7 @@ class TaxiConst {
}
// OCH arouter 路由path
- const val PATH = "/och/api"
+ const val PATH = "/driver/api"
// 到达起始点围栏
const val ARRIVE_AT_START_STATION_DISTANCE = 15 //围栏由20m改为50m 再次改为15m
diff --git a/app/functions/och.gradle b/app/functions/och.gradle
index 6a3e9f0776..692970d733 100644
--- a/app/functions/och.gradle
+++ b/app/functions/och.gradle
@@ -78,7 +78,7 @@ project.dependencies {
}
// Bus乘客端
- fPadLenovoOchBusPassengerImplementation (project(':OCH:mogo-och-bus-passenger')) {
+ fPadLenovoOchBusImplementation (project(':OCH:mogo-och-bus-passenger')) {
exclude group: 'com.mogo.commons' //by group
exclude group: 'com.mogo.module' //by group
exclude group: 'com.mogo.map' //by group
@@ -96,7 +96,7 @@ project.dependencies {
}
// taxi乘客端
- fPadLenovoOchTaxiPassengerImplementation (project(':OCH:mogo-och-taxi-passenger')) {
+ fPadLenovoOchTaxiImplementation (project(':OCH:mogo-och-taxi-passenger')) {
exclude group: 'com.mogo.commons' //by group
exclude group: 'com.mogo.module' //by group
exclude group: 'com.mogo.map' //by group
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 078577e71e..ed485f3a03 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -25,17 +25,17 @@
android:name="design_height_in_dp"
android:value="3200"/>
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java
index 547e5c243f..ebca79073b 100644
--- a/app/src/main/java/com/mogo/launcher/MogoApplication.java
+++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java
@@ -1,13 +1,22 @@
package com.mogo.launcher;
-import com.mogo.eagle.core.function.main.MainMoGoApplication;
import android.content.Context;
+import com.mogo.commons.debug.DebugConfig;
+import com.mogo.eagle.core.function.main.MainMoGoApplication;
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.launcher.crash.CrashSystem;
+import com.mogo.launcher.stageone.APMStartup;
+import com.mogo.launcher.stageone.ARouterStartUp;
+import com.mogo.launcher.stageone.ConfigStartUp;
+import com.mogo.launcher.stageone.HttpDnsStartUp;
+import com.rousetime.android_startup.StartupListener;
+import com.rousetime.android_startup.StartupManager;
+import com.rousetime.android_startup.model.LoggerLevel;
+import com.rousetime.android_startup.model.StartupConfig;
-import java.util.concurrent.ThreadPoolExecutor;
+import org.greenrobot.eventbus.EventBus;
/**
* @author congtaowang
@@ -17,6 +26,45 @@ import java.util.concurrent.ThreadPoolExecutor;
*/
public class MogoApplication extends MainMoGoApplication {
+ @Override
+ public void onCreate() {
+ startUpInStage1();
+ super.onCreate();
+ }
+
+ private final StartupListener startupListener = (l, costTimesModels) -> EventBus.getDefault().postSticky(costTimesModels);
+
+ /**
+ * 第一阶段初始化
+ */
+ public void startUpInStage1() {
+ StartupConfig config = null;
+ if (DebugConfig.isDebug()) {
+ config = new StartupConfig.Builder()
+ .setLoggerLevel(LoggerLevel.DEBUG)
+ .setOpenStatistics(true)
+ .setListener(startupListener)
+ .build();
+ } else {
+ config = new StartupConfig.Builder()
+ .setLoggerLevel(LoggerLevel.NONE)
+ .setOpenStatistics(false)
+ .setAwaitTimeout(10000L)
+ .setListener(startupListener)
+ .build();
+ }
+ new StartupManager.Builder()
+ .addStartup(new ConfigStartUp())
+ .addStartup(new ARouterStartUp())
+ .addStartup(new APMStartup())
+ .addStartup(new HttpDnsStartUp())
+ .setConfig(config)
+ .build(this)
+ .start()
+ .await();
+ }
+
+
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
diff --git a/app/src/main/java/com/mogo/launcher/stageone/ConfigStartUp.kt b/app/src/main/java/com/mogo/launcher/stageone/ConfigStartUp.kt
index a30215a190..4048c3950d 100644
--- a/app/src/main/java/com/mogo/launcher/stageone/ConfigStartUp.kt
+++ b/app/src/main/java/com/mogo/launcher/stageone/ConfigStartUp.kt
@@ -1,6 +1,7 @@
package com.mogo.launcher.stageone
import android.content.Context
+import android.util.Log
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.app.AppConfigInfo.appBuildTime
import com.mogo.eagle.core.data.app.AppConfigInfo.workingBranchHash
@@ -8,7 +9,9 @@ import com.mogo.eagle.core.data.app.AppConfigInfo.workingBranchName
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
+import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
+import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.launcher.BuildConfig
import com.mogo.launcher.R
import com.mogo.test.crashreport.CrashReportConstants
@@ -38,8 +41,23 @@ class ConfigStartUp : AndroidStartup() {
// FunctionBuildConfig.gpsProvider = 2
// 演示模式,上一次勾选的数据
FunctionBuildConfig.isDemoMode = BuildConfig.IS_DEMO_MODE
- // app安装的身份信息
- FunctionBuildConfig.appIdentityMode = BuildConfig.APP_IDENTITY_MODE
+
+ Log.d("ConfigStartUp", "ProcessUtils.getCurrentProcessName():" + ProcessUtils.getCurrentProcessName())
+
+ // TODO:这里影响当前Activity的身份信息,多进程先保持与原来于洋,
+ if (ProcessUtils.getCurrentProcessName().contains(":sub")) {
+ if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
+ FunctionBuildConfig.appIdentityMode = 0xA1
+ } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
+ FunctionBuildConfig.appIdentityMode = 0x01
+ }
+ } else {
+ if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
+ FunctionBuildConfig.appIdentityMode = 0xA0
+ } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
+ FunctionBuildConfig.appIdentityMode = 0x00
+ }
+ }
// 不同身份对应不同的IP地址
FunctionBuildConfig.adasConnectIP = BuildConfig.ADAS_CONNECT_IP
}
@@ -61,7 +79,7 @@ class ConfigStartUp : AndroidStartup() {
DebugConfig.setScheduleCalculateNotHomeCompanyDistanceForPush(BuildConfig.IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH)
DebugConfig.setNeedUploadCoordinatesInTime(BuildConfig.IS_NEED_UPLOAD_COORDINATES_IN_TIME)
DebugConfig.setObuType(
- SharedPrefsMgr.getInstance(context).getInt("OBU_TYPE", DebugConfig.OBU_TYPE_CIDI)
+ SharedPrefsMgr.getInstance(context).getInt("OBU_TYPE", DebugConfig.OBU_TYPE_CIDI)
)
}
@@ -69,10 +87,11 @@ class ConfigStartUp : AndroidStartup() {
// 配置BuglyAppID:MoGoEagleEye
CrashReportConstants.buglyAppID = "ac71228f85"
+ // TODO: @王明君 ,这里判断方式可以替换为使用 AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)等进行替换
if (DebugConfig.getProductFlavor() == "fPadLenovoOchTaxi" || DebugConfig.getProductFlavor() == "fPadLenovoOchBus"
- || DebugConfig.getProductFlavor() == "fPadLenovoOchTaxiPassenger"
- || DebugConfig.getProductFlavor() == "fPadLenovoOchBusPassenger"
- || DebugConfig.getProductFlavor() == "fPadLenovoOchSweeper") {
+ || DebugConfig.getProductFlavor() == "fPadLenovoOchTaxiPassenger"
+ || DebugConfig.getProductFlavor() == "fPadLenovoOchBusPassenger"
+ || DebugConfig.getProductFlavor() == "fPadLenovoOchSweeper") {
//控制HMI展示元素 将不用手动调用setXXXXXViewVisibility
HmiBuildConfig.isShowSpeedView = false
HmiBuildConfig.isShowAutopilotStatusView = false
@@ -85,7 +104,7 @@ class ConfigStartUp : AndroidStartup() {
if (DebugConfig.getProductFlavor() == "fPadLenovoOchTaxi" || DebugConfig.getProductFlavor() == "fPadLenovoOchTaxiPassenger") {
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
} else if (DebugConfig.getProductFlavor() == "fPadLenovoOchBus" || DebugConfig.getProductFlavor() == "fPadLenovoOchBusPassenger"
- || DebugConfig.getProductFlavor() == "fPadLenovoOchSweeper") {
+ || DebugConfig.getProductFlavor() == "fPadLenovoOchSweeper") {
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
HmiBuildConfig.isShowBrakeLightView = false
HmiBuildConfig.isShowTurnLightView = false
@@ -108,6 +127,25 @@ class ConfigStartUp : AndroidStartup() {
//白天模式
FunctionBuildConfig.skinMode = 1
}
+ if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
+ if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
+ //是否显示 红绿等
+ HmiBuildConfig.isShowTrafficLightView = false
+ //是否显示 限速UI
+ HmiBuildConfig.isShowLimitingVelocityView = false
+ //是否显示 路侧监控
+ HmiBuildConfig.isShowCameraView = false
+ //白天模式
+ FunctionBuildConfig.skinMode = 1
+ } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
+ //是否显示 红绿等
+ HmiBuildConfig.isShowTrafficLightView = false
+ //是否显示 限速UI
+ HmiBuildConfig.isShowLimitingVelocityView = false
+ //是否显示 路侧监控
+ HmiBuildConfig.isShowCameraView = false
+ }
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mogo/launcher/stageone/HttpDnsStartUp.kt b/app/src/main/java/com/mogo/launcher/stageone/HttpDnsStartUp.kt
index 4e8ad77f6a..82fafbf823 100644
--- a/app/src/main/java/com/mogo/launcher/stageone/HttpDnsStartUp.kt
+++ b/app/src/main/java/com/mogo/launcher/stageone/HttpDnsStartUp.kt
@@ -76,11 +76,12 @@ class HttpDnsStartUp : AndroidStartup() {
override fun create(context: Context): Boolean {
this.context = context
- if (ProcessUtils.isMainProcess(context)) {
+ // TODO 需要与,陈扶风,确认为啥要限制仅在主进程
+// if (ProcessUtils.isMainProcess(context)) {
initGDLoc()
initHttpDns()
initCloudClientConfig()
- }
+// }
return true
}
diff --git a/config.gradle b/config.gradle
index d4ec3c05d0..6c32c17051 100644
--- a/config.gradle
+++ b/config.gradle
@@ -258,10 +258,10 @@ ext {
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
compileSdkVersion : 29,
buildToolsVersion : "29.0.2",
- minSdkVersion : 21,
- targetSdkVersion : 21,
- minSdkVersionPadLenovo : 23,
- targetSdkVersionPadLenovo : 23,
+ minSdkVersion : 27,
+ targetSdkVersion : 27,
+ minSdkVersionPadLenovo : 27,
+ targetSdkVersionPadLenovo : 27,
koomxhook : "com.kuaishou.koom:xhook-static:2.2.0",
]
}
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml
index ce62c801cf..28ed89a7c9 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/AndroidManifest.xml
@@ -65,6 +65,38 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
index 792050b5f6..4692c112f4 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
@@ -15,7 +15,6 @@ import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
-import android.view.MotionEvent;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
@@ -32,7 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver;
-import com.mogo.eagle.core.function.main.moujie.ConnectBluetoothEvent;
+import com.mogo.eagle.core.function.main.utils.MultiDisplayUtils;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
@@ -43,9 +42,7 @@ import com.zhjt.service.chain.TracingConstants;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
-import org.greenrobot.eventbus.ThreadMode;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
@@ -148,11 +145,19 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
*/
private void loadOCHModule() {
IMoGoFunctionProvider ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
- .build("/och/api")
+ .build("/driver/api")
.navigation(getContext());
if (ochProvider != null) {
ochProvider.createCoverage(this, R.id.module_main_id_och_fragment);
}
+ // TODO:这里只针对目前有的 Bus、Taxi业务进行异屏幕启动,这里需要考虑现有方案如何兼容
+ if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) ||
+ AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
+ MultiDisplayUtils.INSTANCE.startActWithProcess(
+ this,
+ 2,
+ PassengerLauncherActivity.class);
+ }
}
@Subscribe(sticky = true)
@@ -253,7 +258,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis();
Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
- if ((pressAUpTime - startPressTime) < 300 && !isCombinationKey) {
+ if ((pressAUpTime - startPressTime) < 300 && !isCombinationKey) {
ToastUtils.showShort("方块 单击A -1 ");
sendAcc(true, -1);
}
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java
index 8e88df6202..292e64ddf5 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java
@@ -10,6 +10,7 @@ import android.os.Process;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
+import com.alibaba.android.arouter.launcher.ARouter;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.elegant.utils.UiThreadHandler;
import com.mogo.cloud.socket.SocketBuildConfig;
@@ -21,6 +22,7 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
+import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
@@ -82,7 +84,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
@Override
protected boolean shouldInit() {
CallerLogger.INSTANCE.w(M_HMI + TAG, "evaluate shouldInit() with: " + ProcessUtils.getProcessName(Process.myPid()));
- return ProcessUtils.isMainProcess(this);
+ return true;
}
private void queryAppUpgrade() {
@@ -209,7 +211,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
private void initModules() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
//och模块
- MogoModulePaths.addModuleFunction(new MogoModule("/och/api", "IMoGoFunctionProvider"));
+// MogoModulePaths.addModuleFunction(new MogoModule("/driver/api", "IMoGoFunctionProvider"));
+// MogoModulePaths.addModuleFunction(new MogoModule("/passenger/api", "IMoGoFunctionProvider"));
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
@@ -244,9 +247,9 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
/*如果是主进程**/
- if (ProcessUtils.isMainProcess(this)) {
+// if (ProcessUtils.isMainProcess(this)) {
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.COLD_START);
- }
+// }
BoostMultiDex.install(base);
AbsMogoApplication.sApp = this;
}
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/PassengerLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/PassengerLauncherActivity.java
new file mode 100644
index 0000000000..a513dcbd41
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/PassengerLauncherActivity.java
@@ -0,0 +1,427 @@
+package com.mogo.eagle.core.function.main;
+
+import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_START_UP;
+import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
+import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
+import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Process;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.widget.FrameLayout;
+
+import androidx.annotation.Nullable;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.commons.debug.DebugConfig;
+import com.mogo.commons.module.intent.IMogoIntentListener;
+import com.mogo.commons.module.intent.IntentManager;
+import com.mogo.eagle.core.data.config.FunctionBuildConfig;
+import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
+import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
+import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
+import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
+import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
+import com.mogo.eagle.core.function.hmi.R;
+import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver;
+import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
+import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
+import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
+import com.mogo.eagle.core.utilcode.util.ToastUtils;
+import com.rousetime.android_startup.model.CostTimesModel;
+import com.zhjt.service.chain.ChainLog;
+import com.zhjt.service.chain.TracingConstants;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import me.jessyan.autosize.utils.AutoSizeUtils;
+
+/**
+ * 针对作为Launcher的情况,做个性化操作
+ *
+ * @author tongchenfei
+ */
+public class PassengerLauncherActivity extends MainActivity implements IMogoIntentListener, IMoGoSkinModeChangeListener {
+ private static final String TAG = "PassengerLauncherActivity";
+ protected boolean mIsHomeKeyDown = false;
+ private final static Handler handlerV2XEvent = new Handler();
+ private static Runnable runnableV2XEvent;
+
+ private volatile double accelerated;//加速度
+ private Timer timerHorn;
+ private Timer timerAcc;
+
+ private BluetoothMonitorReceiver mBluetoothReceiver = null;
+ private BluetoothAdapter mBluetoothAdapter;
+
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ DebugConfig.setNeedRequestUserInfo(true);
+ EventBus.getDefault().register(this);
+ CallerLogger.INSTANCE.i(M_HMI + TAG, "onCreate");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ initBluetooth();
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (!mBluetoothAdapter.isEnabled()) {
+ mBluetoothAdapter.enable();
+ }
+ mBluetoothAdapter.startDiscovery();
+ showBondedDevice(mBluetoothAdapter);
+ }
+
+ @Override
+ protected void initViews() {
+ super.initViews();
+ // 这里在初始化完GUI后,做一些个性化的定制
+ // 小巴车的乘客屏幕
+ if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
+ AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
+ FrameLayout frameLayout = findViewById(R.id.module_main_id_map_fragment_container);
+ frameLayout.setPadding(0, 0, AutoSizeUtils.dp2px(getContext(),700), 0);
+ }
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ IntentManager.getInstance().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
+ // 添加换肤监听
+ CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
+ //ActivityLifecycleManager.getInstance().setAppActive(true);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ mIsHomeKeyDown = false;
+ unregisterReceiver(this.mBluetoothReceiver);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ IntentManager.getInstance().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
+ //ActivityLifecycleManager.getInstance().setAppActive(false);
+ }
+
+ @Override
+ public void onIntentReceived(String intentStr, Intent intent) {
+ if (TextUtils.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr)) {
+ mIsHomeKeyDown = intent.getBooleanExtra("isHomeKeyDown", true);
+ }
+ }
+
+ @Override
+ protected void loadOthersModules() {
+ super.loadOthersModules();
+ CallerLogger.INSTANCE.d(M_HMI + TAG, "loadOthersModules");
+ loadOCHModule();
+ }
+
+ /**
+ * 加载网约车模块
+ */
+ private void loadOCHModule() {
+ IMoGoFunctionProvider ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
+ .build("/passenger/api")
+ .navigation(getContext());
+ if (ochProvider != null) {
+ ochProvider.createCoverage(this, R.id.module_main_id_och_fragment);
+ }
+ }
+
+ @Subscribe(sticky = true)
+ public void handleStartUp(List costTimesModels) {
+ for (CostTimesModel costModel : costTimesModels) {
+ traceStartUp(costModel.toString());
+ }
+ EventBus.getDefault().removeStickyEvent(costTimesModels);
+ }
+
+ @ChainLog(
+ linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
+ linkCode = CHAIN_LINK_INIT,
+ endpoint = TracingConstants.Endpoint.PAD,
+ nodeAliasCode = CHAIN_ALIAS_CODE_START_UP,
+ paramIndexes = {0},
+ clientPkFileName = "sn"
+ )
+ private void traceStartUp(String content) {
+ CallerLogger.INSTANCE.d(M_HMI + TAG, content);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ stopCountDown();
+ try {
+ // acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
+ Process.killProcess(Process.myPid());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // 移除换肤监听
+ CallerSkinModeListenerManager.INSTANCE.removeListener(TAG);
+ EventBus.getDefault().unregister(this);
+ }
+
+ private void stopCountDown() {
+ if (runnableV2XEvent != null) {
+ handlerV2XEvent.removeCallbacks(runnableV2XEvent);
+ runnableV2XEvent = null;
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ return super.onKeyDown(keyCode, event);
+ }
+
+ private long startPressTime = 0; //开始按减时间
+ private boolean isPressEnd = false; //按键是否结束
+ private boolean isCombinationKey = false; //是否是组合按键
+
+ private long pressADownTime = 0;
+ private long pressAUpTime = 0;
+ private long pressBDownTime = 0;
+ private long pressBUpTime = 0;
+ private long pressCDownTime = 0;
+ private long pressCUpTime = 0;
+ private long pressDDownTime = 0;
+ private long pressDUpTime = 0;
+ private long pressEDownTime = 0;
+ private long pressEUpTime = 0;
+
+
+ /**
+ * 魔方按键分发 提测前注释 ToastUtils TODO
+ * @param event
+ * @return
+ */
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+// Log.d(TAG, "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
+ String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString("BLUETOOTH");
+ if (!isPressEnd) {
+ Log.e(TAG, "dispatchKeyEvent bluetoothName = " + bluetoothName);
+ }
+ if (bluetoothName.equals("MINI_KEYBOARD")) {
+ if (!isPressEnd) {
+ isPressEnd = true;
+ startPressTime = System.currentTimeMillis();
+ }
+
+ if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ pressADownTime = System.currentTimeMillis();
+ Log.d(TAG, "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
+ if ((pressADownTime - startPressTime) > 350 && (pressADownTime - startPressTime) < 1800 && pressBDownTime > 0) {
+ ToastUtils.showShort("方块 A 按AB组合 -2 ");
+ sendAcc(true, -2);
+ isCombinationKey = true;
+ }
+ if (!isCombinationKey) {
+ if ((pressADownTime - startPressTime) > 1900) {
+ ToastUtils.showShort("方块 长按A 无 操作 ");
+ }
+ }
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ pressAUpTime = System.currentTimeMillis();
+ isPressEnd = false;
+ isCombinationKey = false;
+ Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
+ if ((pressAUpTime - startPressTime) < 300) {
+ ToastUtils.showShort("方块 单击A -1 ");
+ sendAcc(true, -1);
+ }
+ pressAUpTime = 0;
+ }
+
+ return true;
+ } else if (event.getKeyCode() == KeyEvent.KEYCODE_B) {//单击复原,长按+1,AB组合-2
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ pressBDownTime = System.currentTimeMillis();
+ Log.d(TAG, "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
+ if ((pressBDownTime - startPressTime) > 350 && (pressBDownTime - startPressTime) < 1800 && pressADownTime > 0) {
+ ToastUtils.showShort("方块 B 按AB组合 ");
+ sendAcc(true, -2);
+ isCombinationKey = true;
+ }
+ if (!isCombinationKey) {
+ if ((pressBDownTime - startPressTime) > 1900) {
+ ToastUtils.showShort("方块 长按B =1 ");
+ sendAcc(true, +1);
+ }
+ }
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ pressBUpTime = System.currentTimeMillis();
+ isPressEnd = false;
+ isCombinationKey = false;
+ Log.e(TAG, "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
+ if ((pressBUpTime - startPressTime) < 300) {
+ ToastUtils.showShort("方块 单击B 0 ");
+ sendAcc(false, 0.0);
+ }
+ pressBDownTime = 0;
+ }
+
+ return true;
+ } else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ pressCDownTime = System.currentTimeMillis();
+ if (!isCombinationKey) {
+ if ((pressCDownTime - startPressTime) > 1900) {
+ ToastUtils.showShort("方块 长按C 无操作 ");
+ }
+ }
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ pressCUpTime = System.currentTimeMillis();
+ isPressEnd = false;
+ isCombinationKey = false;
+ if ((pressCUpTime - startPressTime) < 300) {
+ ToastUtils.showShort("方块 单击C ← 向左变道 ");
+ CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
+ }
+ }
+ return true;
+ } else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ pressDDownTime = System.currentTimeMillis();
+ if (!isCombinationKey) {
+ if ((pressDDownTime - startPressTime) > 1900) {
+ ToastUtils.showShort("方块 长按D 无操作 ");
+ }
+ }
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ pressDUpTime = System.currentTimeMillis();
+ isPressEnd = false;
+ isCombinationKey = false;
+ if ((pressDUpTime - startPressTime) < 300) {
+ ToastUtils.showShort("方块 单击D → 向右变道 ");
+ CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
+ }
+ }
+
+ return true;
+ } else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ pressEDownTime = System.currentTimeMillis();
+ if (!isCombinationKey) {
+ if ((pressEDownTime - startPressTime) > 1900) {
+ ToastUtils.showShort("方块 长按E 鸣笛 ");
+ CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
+ if (timerHorn == null) {
+ timerHorn = new Timer();
+ }
+ timerHorn.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
+ timerHorn = null;
+ }
+ }, 500);
+ }
+ }
+ } else if (event.getAction() == KeyEvent.ACTION_UP) {
+ pressEUpTime = System.currentTimeMillis();
+ isPressEnd = false;
+ isCombinationKey = false;
+ if ((pressEUpTime - startPressTime) < 300) {
+ ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
+ CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
+ }
+ }
+
+ return true;
+ }
+ }
+
+ return super.dispatchKeyEvent(event);
+ }
+
+ @Override
+ public void onSkinModeChange(int skinMode) {
+
+ }
+
+ private synchronized void sendAcc(boolean isSend, double acc) {
+ if (isSend) {
+ accelerated = acc;
+ if (timerAcc == null) {
+ timerAcc = new Timer();
+ timerAcc.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ CallerAutoPilotManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
+ }
+ }, 0, 500);
+ }
+ } else {
+ if (timerAcc != null) {
+ timerAcc.cancel();
+ timerAcc = null;
+ }
+ CallerAutoPilotManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
+ }
+ }
+
+ /**
+ * 初始化蓝牙广播
+ */
+ private void initBluetooth() {
+ this.mBluetoothReceiver = new BluetoothMonitorReceiver();
+ IntentFilter intentFilter = new IntentFilter();
+ // 监视蓝牙关闭和打开的状态
+ intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+
+ // 监视蓝牙设备与APP连接的状态
+ intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
+ intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
+
+ // 注册广播
+ registerReceiver(this.mBluetoothReceiver, intentFilter);
+ }
+
+ /**
+ * 查找蓝牙连接过的蓝牙设备
+ */
+ private void showBondedDevice(BluetoothAdapter bluetoothAdapter) {
+ Set deviceList = bluetoothAdapter.getBondedDevices();
+ for (BluetoothDevice device : deviceList) {
+ try {
+ //使用反射调用获取设备连接状态方法
+ Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null);
+ isConnectedMethod.setAccessible(true);
+// boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null);
+ Log.d(TAG, "-- device.getName() = " + device.getName()); //device.getAddress()
+ if (device.getName().equals("MINI_KEYBOARD")) {
+ SharedPrefsMgr.getInstance(getContext()).putString("BLUETOOTH", device.getName());
+ }
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/utils/MultiDisplayUtils.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/utils/MultiDisplayUtils.kt
new file mode 100644
index 0000000000..5993453954
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/utils/MultiDisplayUtils.kt
@@ -0,0 +1,61 @@
+package com.mogo.eagle.core.function.main.utils
+
+import android.app.ActivityOptions
+import android.content.Context
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.hardware.display.DisplayManager
+import android.view.Display
+import androidx.appcompat.app.AppCompatActivity
+
+/**
+ * 多屏幕操作工具类
+ */
+object MultiDisplayUtils {
+ private val TAG: String = "MultiDisplayUtils"
+
+ // 获取 是否支持扩展屏幕打开应用
+ fun isSupportMultiDisplay(context: Context): Boolean {
+ // 先检查一下是不是支持在第二屏上显示activity这个特性,
+ // 在ActivityOptions.java setLaunchDisplayId 上面有相关的说明
+ val packageManager = context.packageManager
+ return packageManager.hasSystemFeature(PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS)
+ }
+
+ // 获取 当前接入的屏幕集合(含主屏幕)
+ fun getMultiDisplay(context: Context): Array {
+ // 多次创建副屏 则副屏的id都是增加的,所以不一定是1,这里还是获取一下
+ val displayManager =
+ context.getSystemService(AppCompatActivity.DISPLAY_SERVICE) as DisplayManager
+ return displayManager.displays
+ }
+
+ /**
+ * 在指定ID的屏幕打开Activity,当前应用的,当前进程
+ * @param context
+ * @param launchDisplayId 指定屏幕ID
+ */
+ fun startActWithProcess(context: Context, launchDisplayId: Int, activity: Class<*>) {
+ // 要加上Intent.FLAG_ACTIVITY_NEW_TASK
+ val options = ActivityOptions.makeBasic()
+ options.launchDisplayId = launchDisplayId
+ val intent = Intent(context, activity)
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ context.startActivity(intent, options.toBundle())
+ }
+
+ /**
+ * 在指定ID的屏幕打开Activity,当前应用的,新开进程启动
+ * @param context
+ * @param launchDisplayId 指定屏幕ID
+ */
+ fun startActWithOtherProcess(context: Context, launchDisplayId: Int, activity: Class<*>) {
+ // 要加上Intent.FLAG_ACTIVITY_NEW_TASK
+ val options = ActivityOptions.makeBasic()
+ options.launchDisplayId = launchDisplayId
+ val intent = Intent(context, activity)
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ context.startActivity(intent, options.toBundle())
+ }
+
+}
\ No newline at end of file
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java
index da32bdba3d..f48819b07f 100644
--- a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java
@@ -43,9 +43,10 @@ public abstract class AbsMogoApplication extends Application {
AppStateManager.INSTANCE.init(this);
initRxJavaErrorHandler();
FinalizeCrashFixer.fix();
- if (!shouldInit()) {
- AutoSize.checkAndInit(this);
- }
+// if (!shouldInit()) {
+ AutoSize.checkAndInit(this);
+// }
+
ScreenHelper.setScreenConfig(this);
Utils.init(this);
MogoServices.getInstance().init(this);