add socket status listener and remove unfitable code
This commit is contained in:
@@ -195,16 +195,12 @@ android {
|
||||
// launcher app
|
||||
launcher {
|
||||
dimension "basic"
|
||||
// 是否启动位置服务
|
||||
buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'true'
|
||||
// 是否作为 launcher 运行
|
||||
buildConfigField 'boolean', 'IS_LAUNCHER', 'true'
|
||||
buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"'
|
||||
buildConfigField 'String', 'WORKING_BRANCH_NAME', getWorkingBranchName()
|
||||
buildConfigField 'String', 'WORKING_BRANCH_HASH', getWorkingBranchHash()
|
||||
buildConfigField 'String', 'APP_BUILD_TIME', getBuildTime()
|
||||
// 是否支持目的地导航策略
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'false'
|
||||
}
|
||||
// 配置网络环境,QA、线上、演示
|
||||
qa {
|
||||
|
||||
@@ -8,7 +8,6 @@ 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.storage.SharedPrefsMgr
|
||||
import com.mogo.launcher.BuildConfig
|
||||
import com.mogo.launcher.R
|
||||
import com.mogo.test.crashreport.CrashReportConstants
|
||||
@@ -52,17 +51,11 @@ class ConfigStartUp : AndroidStartup<Boolean>() {
|
||||
}
|
||||
DebugConfig.setNetMode(mode)
|
||||
DebugConfig.setDebug(BuildConfig.DEBUG)
|
||||
DebugConfig.setLaunchLocationService(BuildConfig.LAUNCH_LOCATION_SERVICE)
|
||||
DebugConfig.setLauncher(BuildConfig.IS_LAUNCHER)
|
||||
DebugConfig.setUseMockObuData(false)
|
||||
DebugConfig.setCarMachineType(BuildConfig.CAR_MACHINE_TYPE)
|
||||
DebugConfig.setProductFlavor(BuildConfig.FLAVOR_product)
|
||||
DebugConfig.setSocketAppId(BuildConfig.SOCKET_APP_ID)
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
private fun initOtherConfig(context: Context) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.commons.constants.SharedPrefsConstants
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.device.Devices
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.network.NetConfigUtils
|
||||
import com.mogo.commons.network.Utils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -317,7 +318,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
)
|
||||
override fun onConnectFailure() {
|
||||
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectFailure")
|
||||
DebugConfig.setDownloadSnapshot(false)
|
||||
MogoStatusManager.getInstance().setCloudSocketMode(TAG,false)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
@@ -330,7 +331,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
)
|
||||
override fun onConnectSuccess() {
|
||||
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectSuccess")
|
||||
DebugConfig.setDownloadSnapshot(true)
|
||||
MogoStatusManager.getInstance().setCloudSocketMode(TAG,true)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
@@ -343,7 +344,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
)
|
||||
override fun onConnectLost() {
|
||||
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectLost")
|
||||
DebugConfig.setDownloadSnapshot(false)
|
||||
MogoStatusManager.getInstance().setCloudSocketMode(TAG,false)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
@@ -39,7 +40,7 @@ object SyncConfig {
|
||||
AppConfigInfo.mapSdkVersion = MogoMap.getInstance().mogoMap.mapVersion
|
||||
}
|
||||
AppConfigInfo.isConnectNet = NetworkUtils.isConnected(context)
|
||||
AppConfigInfo.isConnectSocket = DebugConfig.isDownloadSnapshot()
|
||||
AppConfigInfo.isConnectSocket = MogoStatusManager.getInstance().isSocketOnLine
|
||||
when {
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) -> {// 司机端
|
||||
AppConfigInfo.isDriver = true
|
||||
|
||||
@@ -22,6 +22,7 @@ import chassis.VehicleStateOuterClass
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -1721,7 +1722,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
tvServerSocketStatus.text = Html.fromHtml(
|
||||
"服务器Socket状态:${
|
||||
if (DebugConfig.isDownloadSnapshot()) {
|
||||
if (MogoStatusManager.getInstance().isSocketOnLine) {
|
||||
"<font color='blue'>正常"
|
||||
} else {
|
||||
"<font color='red'>异常"
|
||||
|
||||
@@ -91,7 +91,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
EventBus.getDefault().register(this);
|
||||
CallerLogger.INSTANCE.i(M_HMI + TAG, "onCreate");
|
||||
}
|
||||
|
||||
@@ -69,19 +69,6 @@ public class DebugConfig {
|
||||
|
||||
private static int sCarMachineType = CAR_MACHINE_TYPE_SELF_INNOVATE;
|
||||
|
||||
/**
|
||||
* 西迪obu
|
||||
*/
|
||||
public static final int OBU_TYPE_CIDI = 1;
|
||||
/**
|
||||
* 华砺智行obu
|
||||
*/
|
||||
public static final int OBU_TYPE_HUALI = 2;
|
||||
/**
|
||||
* 大唐高鸿obu 11.11国展
|
||||
*/
|
||||
public static final int OBU_TYPE_GOHIGH = 3;
|
||||
|
||||
/**
|
||||
* 获取网络环境类型
|
||||
*
|
||||
@@ -105,19 +92,6 @@ public class DebugConfig {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否拉起位置服务,launcher 需要拉起位置服务,独立 app 不需要
|
||||
*/
|
||||
private static boolean sLaunchLocationService = true;
|
||||
|
||||
public static boolean isLaunchLocationService() {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService(boolean launchLocationService) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前车机类型
|
||||
*
|
||||
@@ -149,26 +123,6 @@ public class DebugConfig {
|
||||
DebugConfig.sIsLauncher = isLauncher;
|
||||
}
|
||||
|
||||
private static boolean sRequestOnlineCarData = true;
|
||||
|
||||
public static boolean isRequestOnlineCarData() {
|
||||
return sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
private static boolean useMockObuData;
|
||||
|
||||
public static void setUseMockObuData(boolean use) {
|
||||
useMockObuData = use;
|
||||
}
|
||||
|
||||
public static boolean isUseMockObuData() {
|
||||
return useMockObuData;
|
||||
}
|
||||
|
||||
private static String sProductFlavor;
|
||||
|
||||
public static String getProductFlavor() {
|
||||
@@ -194,56 +148,6 @@ public class DebugConfig {
|
||||
return sSocketAppId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持目的地导航推送策略
|
||||
*/
|
||||
private static boolean isScheduleCalculateNotHomeCompanyDistanceForPush = false;
|
||||
|
||||
public static void setScheduleCalculateNotHomeCompanyDistanceForPush(boolean isScheduleCalculateNotHomeCompanyDistanceForPush) {
|
||||
DebugConfig.isScheduleCalculateNotHomeCompanyDistanceForPush = isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
public static boolean isIsScheduleCalculateNotHomeCompanyDistanceForPush() {
|
||||
return isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持刷新桌面卡片
|
||||
*/
|
||||
private static boolean isSupportLauncherCardRefreshStrategy = false;
|
||||
|
||||
public static void setSupportLauncherCardRefreshStrategy(boolean isSupportLauncherCardRefreshStrategy) {
|
||||
DebugConfig.isSupportLauncherCardRefreshStrategy = isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
public static boolean isIsSupportLauncherCardRefreshStrategy() {
|
||||
return isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
private static int obuType = OBU_TYPE_HUALI;
|
||||
|
||||
public static int getObuType() {
|
||||
return obuType;
|
||||
}
|
||||
|
||||
public static void setObuType(int type) {
|
||||
obuType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要刷新个人信息
|
||||
*/
|
||||
private static boolean needRequestUserInfo = false;
|
||||
|
||||
public static void setNeedRequestUserInfo(boolean needRequestUserInfo) {
|
||||
DebugConfig.needRequestUserInfo = needRequestUserInfo;
|
||||
}
|
||||
|
||||
public static boolean isNeedRequestUserInfo() {
|
||||
return needRequestUserInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否需要实时上报坐标位置
|
||||
*/
|
||||
@@ -257,37 +161,4 @@ public class DebugConfig {
|
||||
DebugConfig.sIsNeedUploadCoordinatesInTime = sIsNeedUploadCoordinatesInTime;
|
||||
}
|
||||
|
||||
public static boolean isOCHModule() {
|
||||
return sProductFlavor != null && sProductFlavor.startsWith("foch");
|
||||
}
|
||||
|
||||
public static int sSelfCarSpeedYOffset = 20;
|
||||
|
||||
public static void setSelfCarSpeedYOffset(int sSelfCarSpeedYOffset) {
|
||||
DebugConfig.sSelfCarSpeedYOffset = sSelfCarSpeedYOffset;
|
||||
}
|
||||
|
||||
public static int getSelfCarSpeedYOffset() {
|
||||
return sSelfCarSpeedYOffset;
|
||||
}
|
||||
|
||||
private static boolean downloadSnapshot = false;
|
||||
|
||||
public static boolean isDownloadSnapshot() {
|
||||
return downloadSnapshot;
|
||||
}
|
||||
|
||||
public static void setDownloadSnapshot(boolean downloadSnapshot) {
|
||||
DebugConfig.downloadSnapshot = downloadSnapshot;
|
||||
}
|
||||
|
||||
private static boolean isUseAdasRecognize = true;
|
||||
|
||||
public static void setUseAdasRecognize(boolean status) {
|
||||
isUseAdasRecognize = status;
|
||||
}
|
||||
|
||||
public static boolean isUseAdasRecognize() {
|
||||
return isUseAdasRecognize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,19 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isMainPageLaunched();
|
||||
|
||||
/**
|
||||
* 长链是否在线
|
||||
* @return
|
||||
*/
|
||||
boolean isSocketOnLine();
|
||||
|
||||
/**
|
||||
* 设置云端 socket 状态
|
||||
* @param tag 业务类型
|
||||
* @param mode true - 在线 false 不在线
|
||||
*/
|
||||
void setCloudSocketMode(String tag, boolean mode);
|
||||
|
||||
/**
|
||||
* 设置vrMode状态
|
||||
* @param tag 业务类型
|
||||
|
||||
@@ -83,6 +83,16 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val(StatusDescriptor.MAIN_PAGE_CREATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSocketOnLine() {
|
||||
return get_bool_val(StatusDescriptor.CLOUD_SOCKET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCloudSocketMode(String tag, boolean mode) {
|
||||
doSetStatus(tag, StatusDescriptor.CLOUD_SOCKET, mode);
|
||||
}
|
||||
|
||||
private boolean get_bool_val(StatusDescriptor descriptor) {
|
||||
Boolean val = mStatus.get(descriptor);
|
||||
return val != null && val;
|
||||
|
||||
@@ -53,5 +53,9 @@ public enum StatusDescriptor {
|
||||
*/
|
||||
VR_MODE,
|
||||
|
||||
/**
|
||||
* 云 Socket状态
|
||||
*/
|
||||
CLOUD_SOCKET
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user