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依赖为AndroidX依赖 #917

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -17,30 +17,30 @@
package com.qihoo360.replugin.gradle.host

/**
* 程序常量定义区
* ������������
* @author RePlugin Team
*/
class AppConstant {

/** 版本号 */
def static final VER = "${RP_VERSION}"
/** �汾�� */
def static final VER = "2.3.3"

/** 打印信息时候的前缀 */
/** ��ӡ��Ϣʱ���ǰ׺ */
def static final TAG = "< replugin-host-v${VER} >"

/** 外部用户配置信息 */
/** �ⲿ�û�������Ϣ */
def static final USER_CONFIG = "repluginHostConfig"

/** 用户Task组 */
/** �û�Task�� */
def static final TASKS_GROUP = "replugin-plugin"

/** Task前缀 */
/** Taskǰ׺ */
def static final TASKS_PREFIX = "rp"

/** 用户Task:安装插件 */
/** �û�Task:��װ��� */
def static final TASK_SHOW_PLUGIN = TASKS_PREFIX + "ShowPlugins"

/** 用户Task:Generate任务 */
/** �û�Task:Generate���� */
def static final TASK_GENERATE = TASKS_PREFIX + "Generate"


Expand Down
8 changes: 5 additions & 3 deletions replugin-host-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}

Expand Down
20 changes: 2 additions & 18 deletions replugin-host-library/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
#
# Copyright (C) 2005-2017 Qihoo 360 Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed To in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#

#Fri Mar 03 10:15:50 CST 2017
#Fri Nov 29 15:48:44 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
16 changes: 8 additions & 8 deletions replugin-host-library/replugin-host-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileSdkVersion 29
buildToolsVersion '29.0.2'

defaultConfig {
minSdkVersion 9
targetSdkVersion 25
minSdkVersion 15
targetSdkVersion 29

versionCode 2
versionName version
Expand All @@ -42,12 +42,12 @@ android {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
api fileTree(include: ['*.jar'], dir: 'libs')

// 以“占位符”(Provided)的方式来引用support-v4,不会编入AAR
// 但宿主需要支持Support-v4(至少应支持LocalBroadcastManager)
provided 'com.android.support:support-v4:25.2.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
}

project.ext.RP_ARTIFACT_ID = 'replugin-host-lib'
apply from: '../../rp-publish.gradle'
//project.ext.RP_ARTIFACT_ID = 'replugin-host-lib'
//apply from: '../../rp-publish.gradle'
2 changes: 1 addition & 1 deletion replugin-host-library/replugin-host-lib/replugin-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public protected *;
}
# LocalBroadcastManager,插件会用
-keep public class android.support.v4.content.LocalBroadcastManager {
-keep public class androidx.localbroadcastmanager.content.LocalBroadcastManager {
public *;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import com.qihoo360.replugin.component.service.server.IPluginServiceServer;
*/
interface IPluginClient {

// 参数 plugin, process 可能有冗余,目前临时使用,后续可能优化

String allocActivityContainer(String plugin, int process, String target, in Intent intent);

// 参数 plugin 用来处理多插件单进程情况

IBinder queryBinder(String plugin, String binder);

void releaseBinder();
Expand All @@ -23,22 +23,10 @@ interface IPluginClient {

IPluginServiceServer fetchServiceServer();

/**
* 插件收到广播
*
* @param plugin 插件名称
* @param receiver Receiver 名称
* @param Intent 广播的 Intent 数据
*/

void onReceive(String plugin, String receiver, in Intent intent);

/**
* dump通过插件化框架启动起来的Service信息
*/
String dumpServices();

/**
* dump插件化框架中存储的详细Activity坑位映射表
*/
String dumpActivities();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,10 @@ interface IPluginHost {

void unregPluginBinder(in PluginBinderInfo info, IBinder binder);

/**
* 注册某插件下所有静态声明的的 receiver 到常驻进程
*/
void regReceiver(String plugin, in Map receiverFilterMap);

void unregReceiver();

/**
* 插件收到广播
*
* @param plugin 插件名称
* @param receiver Receiver 名称
* @param Intent 广播的 Intent 数据
*/
void onReceive(String plugin, String receiver, in Intent intent);

int sumBinders(int index);
Expand All @@ -78,42 +68,17 @@ interface IPluginHost {

IBinder queryPluginBinder(String plugin, String binder);

/**
* 根据 Inent 查询所有插件中的与之匹配的 Receivers
*/
List queryPluginsReceiverList(in Intent intent);

/**
* 获取“全新Service管理方案”在Server端的服务
* Added by Jiongxuan Zhang
*/
IPluginServiceServer fetchServiceServer();

/**
* 获取 IPluginManagerServer(纯APK方案使用)的插件服务
* Added by Jiongxuan Zhang
*/
IPluginManagerServer fetchManagerServer();

/**
* 根据 taskAffinity,判断应该取第几组 TaskAffinity
* 由于 taskAffinity 是跨进程的属性,所以这里要将 taskAffinityGroup 的数据保存在常驻进程中
* Added by hujunjie
*/
int getTaskAffinityGroupIndex(String taskAffinity);

/**
* 通过进程名来获取PID
*/
int getPidByProcessName(String processName);

/**
* 通过PID来获取进程名
*/
String getProcessNameByPid(int pid);

/**
* dump详细的运行时信息
*/
String dump();
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
package com.qihoo360.replugin;

/**
* Binder的获取器,可用于延迟加载IBinder的情况。
* <p>
* 目前用于:
* <p>
* * RePlugin.registerGlobalBinderDelayed
*
* @author RePlugin Team
*/
interface IBinderGetter {

/**
* 获取IBinder对象
*/
IBinder get();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,93 +4,43 @@ import com.qihoo360.replugin.model.PluginInfo;
import com.qihoo360.replugin.packages.PluginRunningList;

/**
* 插件管理器。用来控制插件的安装、卸载、获取等。运行在常驻进程中
* <p>
* 补充:涉及到插件交互、运行机制有关的管理器,在IPluginHost中
*
* @author RePlugin Team
*/
interface IPluginManagerServer {

/**
* 安装一个插件
* <p>
* 注意:若为旧插件(p-n开头),则应使用IPluginHost的pluginDownloaded方法
*
* @return 安装的插件的PluginInfo对象

*/
PluginInfo install(String path);

/**
* 卸载一个插件
* <p>
* 注意:只针对“纯APK”插件方案
*
* @param info 插件信息
* @return 是否成功卸载插件?

*/
boolean uninstall(in PluginInfo info);

/**
* 加载插件列表,方便之后使用
* <p>
* TODO 这里只返回"新版插件",供PmBase使用。将来会合并
*
* @return PluginInfo的列表

*/
List<PluginInfo> load();

/**
* 更新所有插件列表
*
* @return PluginInfo的列表
*/

List<PluginInfo> updateAll();

/**
* 设置isUsed状态,并通知所有进程更新
*
* @param pluginName 插件名
* @param used 是否已经使用
*/

void updateUsed(String pluginName, boolean used);

/**
* 获取正在运行的插件列表
*
* @return 正在运行的插件名列表
*/

PluginRunningList getRunningPlugins();

/**
* 插件是否正在运行?
*
* @param pluginName 插件名
* @param process 指定进程名,如为Null则表示查所有
* @return 是否在运行?
*/

boolean isPluginRunning(String pluginName, String process);

/**
* 当进程启动时,同步正在运行的插件状态到Server端
*
* @param list 正在运行的插件名列表
*/

void syncRunningPlugins(in PluginRunningList list);

/**
* 当进程启动时,同步正在运行的插件状态到Server端
*
* @param processName 进程名
* @param pluginName 正在运行的插件名
*/

void addToRunningPlugins(String processName, int pid, String pluginName);

/**
* 获取正在运行此插件的进程名列表
*
* @param pluginName 要查询的插件名
* @return 正在运行此插件的进程名列表。一定不会为Null
*/
String[] getRunningProcessesByPlugin(String pluginName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.util.Log;

import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.qihoo360.replugin.utils.Charsets;
import com.qihoo360.replugin.utils.CloseableUtils;
import com.qihoo360.mobilesafe.core.BuildConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ private int getThemeId(Activity activity, Intent intent) {
private static int getDefaultThemeId() {
if (HostConfigHelper.ACTIVITY_PIT_USE_APPCOMPAT) {
try {
Class clazz = ReflectUtils.getClass("android.support.v7.appcompat.R$style");
Class clazz = ReflectUtils.getClass("androidx.appcompat.R$style");
return (int) ReflectUtils.readStaticField(clazz, "Theme_AppCompat");
} catch (ClassNotFoundException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;
import com.qihoo360.i.IPluginManager;
import com.qihoo360.replugin.base.IPC;
import com.qihoo360.replugin.component.process.PluginProcessHost;
Expand Down
Loading