Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "UI process" as a plug-in management process #296

Merged
merged 3 commits into from
Aug 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ class RepluginConfig {
/** 自定义进程的数量(除 UI 和 Persistent 进程) */
def countProcess = 3

/** 是否使用常驻进程? */
def persistentEnable = true

/** 常驻进程名称(也就是上面说的 Persistent 进程,开发者可自定义)*/
def persistentName = ':GuardService'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public class RePluginHostConfig {
// 常驻进程名字
public static String PERSISTENT_NAME = "${config.persistentName}";

// 是否使用“常驻进程”(见PERSISTENT_NAME)作为插件的管理进程。若为False,则会使用默认进程
public static boolean PERSISTENT_ENABLE = ${config.persistentEnable};

// 背景透明的坑的数量(每种 launchMode 不同)
public static int ACTIVITY_PIT_COUNT_TS_STANDARD = ${config.countTranslucentStandard};
public static int ACTIVITY_PIT_COUNT_TS_SINGLE_TOP = ${config.countTranslucentSingleTop};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,33 @@ class ComponentsGenerator {

/* 需要编译期动态修改进程名的组件*/

String pluginMgrProcessName = config.persistentEnable ? config.persistentName : applicationID

// 常驻进程Provider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否相应的调整下,避免歧义:
should be ? : // 常驻进程(或UI进程)Provider

provider(
"${name}":"com.qihoo360.replugin.component.process.ProcessPitProviderPersist",
"${authorities}":"${applicationID}.loader.p.main",
"${exp}":"false",
"${process}":"${config.persistentName}")
"${process}":"${pluginMgrProcessName}")

provider(
"${name}":"com.qihoo360.replugin.component.provider.PluginPitProviderPersist",
"${authorities}":"${applicationID}.Plugin.NP.PSP",
"${exp}":"false",
"${process}":"${config.persistentName}")
"${process}":"${pluginMgrProcessName}")

// ServiceManager 服务框架
provider(
"${name}":"com.qihoo360.mobilesafe.svcmanager.ServiceProvider",
"${authorities}":"${applicationID}.svcmanager",
"${exp}":"false",
"${multiprocess}":"false",
"${process}":"${config.persistentName}")
"${process}":"${pluginMgrProcessName}")

service(
"${name}":"com.qihoo360.replugin.component.service.server.PluginPitServiceGuard",
"${process}":"${config.persistentName}")
"${process}":"${pluginMgrProcessName}")

/* 透明坑 */
config.countTranslucentStandard.times {
activity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class HostConfigHelper {
// 注意:以下配置项必须和 replugin-host-gradle 插件中的配置相同
//------------------------------------------------------------

// 是否使用“常驻进程”(见PERSISTENT_NAME)作为插件的管理进程
public static boolean PERSISTENT_ENABLE = true;

// 常驻进程名
public static String PERSISTENT_NAME = ":GuardService";

Expand Down Expand Up @@ -76,6 +79,12 @@ public class HostConfigHelper {
// Ignore, Just use default value
}

try {
PERSISTENT_ENABLE = readField("PERSISTENT_ENABLE");
} catch (NoSuchFieldException e) {
// Ignore, Just use default value
}

try {
PERSISTENT_NAME = readField("PERSISTENT_NAME");
} catch (NoSuchFieldException e) {
Expand Down