[6.6.0] note the main process

This commit is contained in:
EmArrow
2024-08-28 18:21:01 +08:00
parent 684cec78a9
commit b1279a2f0f
9 changed files with 51 additions and 25 deletions

View File

@@ -42,7 +42,7 @@ object ConfigStartUp {
FunctionBuildConfig.gpsProvider = BuildConfig.GPS_PROVIDER
// 演示模式,上一次勾选的数据
FunctionBuildConfig.isDemoMode = BuildConfig.IS_DEMO_MODE
// app安装的身份信息
// app安装的身份信息 todo yakun 多进程
FunctionBuildConfig.appIdentityMode = "Product_${BuildConfig.APP_IDENTITY_MODE_BODY}_${BuildConfig.APP_IDENTITY_MODE_TAIL}"
FunctionBuildConfig.ttsLanguage = BuildConfig.ttsLanguage
// 支持的业务类型

View File

@@ -221,9 +221,9 @@ object DataManager {
* 从本地数据库中查询数据
*/
fun queryAllMessages(context: Context) {
if (!ProcessUtils.isMainProcess(context)) {
return
}
// if (!ProcessUtils.isMainProcess(context)) {
// return
// }
clearMessageBoxTable(context)
scope.launch {
initCache()

View File

@@ -48,6 +48,8 @@ public class MainLauncherActivity extends MainActivity {
try {
// 在第二个屏幕启动乘客端app
// 多进程方案
CallerLogger.i(M_HMI + TAG, "MultiDisplayUtils startActWithSecond");
// MultiDisplayUtils.INSTANCE.startActWithSecond(this, "com.mogo.launcher.passenger");
MultiDisplayUtils.INSTANCE.startActWithSecond(this, PassengerLauncherActivity.class);
} catch (Exception e) {
e.printStackTrace();
@@ -102,15 +104,9 @@ public class MainLauncherActivity extends MainActivity {
}
} else {
// 目前只有金旅星辰乘客屏是连接的双屏
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/passenger/api")
.navigation(getContext());
} else {
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/driver/api")
.navigation(getContext());
}
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/passenger/api")
.navigation(getContext());
}
if (ochProvider != null) {

View File

@@ -31,9 +31,9 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
@Override
public void onCreate() {
super.onCreate();
if (!shouldInit()) {
return;
}
// if (!shouldInit()) {
// return;
// }
start = System.currentTimeMillis();
//启动业务
CallerStartUpManager.initStageOne();

View File

@@ -39,7 +39,7 @@ import java.util.List;
import java.util.Set;
/**
* 多进程乘客屏启动launcher
* 多进程乘客屏启动launcher 亿金 司乘 activity 互换
*
* @author tongchenfei
*/
@@ -66,7 +66,7 @@ public class PassengerLauncherActivity extends MainActivity {
private void loadOCHModule() {
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
IMoGoFunctionProvider ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/passenger/api")
.build("/driver/api")
.navigation(getContext());
if (ochProvider != null) {
ochProvider.createCoverage(this, R.id.module_main_id_och_fragment);

View File

@@ -154,7 +154,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>(), IMoGoCloudListener {
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
// TODO 现在这块逻辑因为网约车业务那后台的限制,还没有更换,条件成熟后替换为 DeviceIdUtils.getWidevineIDWithMd5(context)
// 这里影响当前Activity的身份信息多进程先保持与原来一样主进程为司机端:passenger 进程为乘客端
if (ProcessUtils.getCurrentProcessName().contains(":passenger")) {
if (ProcessUtils.getCurrentProcessName().contains(":passenger")) { //todo emArrow passenger需要放到下面,司乘互换
clientConfig.thirdPartyDeviceId = DeviceUtils.getDeviceSN() + "_passenger"
} else {
clientConfig.thirdPartyDeviceId = DeviceUtils.getDeviceSN()

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.utilcode.util
import android.annotation.SuppressLint
import android.app.ActivityOptions
import android.content.Context
import android.content.Intent
@@ -96,6 +97,7 @@ object MultiDisplayUtils {
* @param context
* @param activity 要在第二个屏幕启动的页面
*/
@SuppressLint("NewApi")
fun startActWithSecond(context: Context, activity: Class<*>) {
if (isSupportMultiDisplay(context)) {
if (getOtherDisplay().isNotEmpty() && getOtherDisplay()[0] != null) {
@@ -114,12 +116,40 @@ object MultiDisplayUtils {
}
}
/**
* 在指定ID的屏幕打开Activity当前应用的当前进程
* @param context
* @param activity 要在第二个屏幕启动的页面
*/
@SuppressLint("NewApi")
fun startActWithSecond(context: Context, packageName: String) {
if (isSupportMultiDisplay(context)) {
if (getOtherDisplay().isNotEmpty() && getOtherDisplay()[0] != null) {
val launchDisplayId = getOtherDisplay()[0]!!.displayId
// 要加上Intent.FLAG_ACTIVITY_NEW_TASK
val options = ActivityOptions.makeBasic()
options.launchDisplayId = launchDisplayId
val intent = LaunchUtils.getLaunchIntentForPackage(context,packageName)
// intent.action = "android.intent.action.MAIN"
// intent.addCategory("android.intent.category.LAUNCHER")
// intent.setData(Uri.parse(packageName))
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent, options.toBundle())
} else {
Log.e(TAG, "当前没有外接屏幕,只有一个屏幕")
}
} else {
Log.e(TAG, "当前设备,不支持多个屏幕交互显示")
}
}
/**
* 在指定ID的屏幕打开Activity当前应用的当前进程
* @param context
* @param launchDisplayId 指定屏幕ID
* @param activity 要在副屏幕启动的页面
*/
@SuppressLint("NewApi")
fun startActWithOther(context: Context, launchDisplayId: Int, activity: Class<*>) {
// 要加上Intent.FLAG_ACTIVITY_NEW_TASK
val options = ActivityOptions.makeBasic()

View File

@@ -49,9 +49,9 @@ public abstract class AbsMogoApplication extends Application {
if (DebugConfig.isDebug()) {
KoomInitTask.INSTANCE.init(AbsMogoApplication.getApp());
}
if (!shouldInit()) {
return;
}
// if (!shouldInit()) {
// return;
// }
AppStateManager.INSTANCE.init(this);
initRxJavaErrorHandler();
FinalizeCrashFixer.fix();

View File

@@ -35,9 +35,9 @@ public abstract class MvpActivity<V extends IView, P extends Presenter<V>> exten
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
super.onCreate(savedInstanceState);
if (!ProcessUtils.isMainProcess(this)) {
return;
}
// if (!ProcessUtils.isMainProcess(this)) {
// return;
// }
setContentView(getLayoutId());
initViews();
mPresenter = createPresenter();