16 | * 作者 coder
17 | * 创建时间 2017/7/5
18 | */
19 |
20 | public class DemoFragment extends Fragment {
21 |
22 | public DemoFragment() {
23 | }
24 |
25 | private static final String TAG = "DemoFragment";
26 |
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
29 | Log.d(TAG, "onCreateView() called with: inflater = [" + inflater + "], container = [" + container + "], savedInstanceState = [" + savedInstanceState + "]");
30 | /**
31 | * 需要注意不能使用inflater及container因为他们的Context是宿主的
32 | */
33 | return LayoutInflater.from(RePlugin.getPluginContext()).inflate(R.layout.main_fragment, container, false);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/receivers/PluginDemo1Receiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo1.receivers;
18 |
19 | import android.content.BroadcastReceiver;
20 | import android.content.Context;
21 | import android.content.Intent;
22 | import android.text.TextUtils;
23 | import android.widget.Toast;
24 |
25 | /**
26 | * @author RePlugin Team
27 | */
28 | public class PluginDemo1Receiver extends BroadcastReceiver {
29 |
30 | public static final String ACTION = "com.qihoo360.repluginapp.replugin.receiver.ACTION1";
31 |
32 | @Override
33 | public void onReceive(Context context, Intent intent) {
34 | String action = intent.getAction();
35 | if (!TextUtils.isEmpty(action)) {
36 | if (action.equals(ACTION)) {
37 | String name = intent.getStringExtra("name");
38 | Toast.makeText(context, "Plugin1-action: " + action + ", name = " + name, Toast.LENGTH_LONG).show();
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/webview/IWebPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo1.webview;
18 |
19 | import android.webkit.WebView;
20 |
21 | /**
22 | * @author RePlugin Team
23 | */
24 | public interface IWebPage {
25 |
26 | /**
27 | * 获取WebView对象
28 | * @return
29 | */
30 | WebView getWebView();
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/java/com/qihoo360/replugin/sample/demo1/webview/WebPageProxy.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.sample.demo1.webview;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.webkit.WebView;
6 |
7 | import java.lang.reflect.Method;
8 |
9 | /**
10 | * @author RePlugin Team
11 | */
12 | public class WebPageProxy extends ViewProxy implements IWebPage {
13 |
14 | private static final String PLUGIN_NAME = "webview";
15 |
16 | private static final String CLASS_NAME = "com.qihoo360.replugin.sample.webview.views.SimpleWebPage";
17 |
18 | private static Method sGetWebViewMethod;
19 |
20 | private static final ViewProxy.Creator CREATOR = new ViewProxy.Creator(PLUGIN_NAME, CLASS_NAME);
21 |
22 | protected WebPageProxy(View view) {
23 | super(view);
24 | }
25 |
26 | public static WebPageProxy create(Context c) {
27 | boolean b = CREATOR.init();
28 | if (!b) {
29 | return null;
30 | }
31 | View v = CREATOR.newViewInstance(c);
32 | return new WebPageProxy(v);
33 | }
34 |
35 | static WebPageProxy createByObject(View wv) {
36 | boolean b = CREATOR.init();
37 | if (!b) {
38 | return null;
39 | }
40 | return new WebPageProxy(wv);
41 | }
42 |
43 | @Override
44 | public WebView getWebView() {
45 | if (sGetWebViewMethod == null) {
46 | sGetWebViewMethod = CREATOR.fetchMethodByName("getWebView");
47 | }
48 | if (sGetWebViewMethod == null) {
49 | return null;
50 | }
51 | Object obj = invoke(sGetWebViewMethod);
52 | if (obj instanceof WebView) {
53 | return (WebView) obj;
54 | }
55 | return null;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/activity_plugin_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
16 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/layout_notify.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
33 |
34 |
41 |
42 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/main_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/simple.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
30 |
31 |
37 |
38 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/simple_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/layout/simple_4.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
23 |
28 |
29 |
33 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/mipmap-xhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo1/app/src/main/res/mipmap-xhdpi/app_icon.png
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | DEMO1
19 |
20 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/xml/fileprovider_path.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/app/src/main/res/xml/pref_headers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | buildscript {
17 | { p, cfg = "rp-config.gradle" -> if (new File(p, cfg).exists()) apply from: "${p}/${cfg}" else if (p.exists()) call(p.parentFile) }(buildscript.sourceFile.parentFile)
18 | repositories {
19 | // mavenLocal()
20 | jcenter()
21 | google()
22 | maven{
23 | url "https://dl.bintray.com/froyo-github/Replugin-AndroidX"
24 | }
25 | }
26 | dependencies {
27 | classpath 'com.android.tools.build:gradle:3.3.1'
28 | classpath "io.github.froyohuang:replugin-plugin-gradle-androidx:${RP_VERSION}"
29 | }
30 | }
31 |
32 | allprojects {
33 | repositories {
34 | // mavenLocal()
35 | jcenter()
36 | google()
37 | maven{
38 | url "https://dl.bintray.com/froyo-github/Replugin-AndroidX"
39 | }
40 | }
41 | }
42 |
43 | task clean(type: Delete) {
44 | delete rootProject.buildDir
45 | }
46 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
30 | org.gradle.jvmargs=-Xmx1536M
31 | # When configured, Gradle will run in incubating parallel mode.
32 | # This option should only be used with decoupled projects. More details, visit
33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
34 | # org.gradle.parallel=true
35 | android.useAndroidX=true
36 | # Automatically convert third-party libraries to use AndroidX
37 | android.enableJetifier=true
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo1/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Feb 12 14:37:05 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 29
5 | //buildToolsVersion "25.0.0"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
9 | targetSdkVersion 29
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 |
23 | lintOptions {
24 | abortOnError false
25 | }
26 | }
27 |
28 | dependencies {
29 | compile fileTree(dir: 'libs', include: ['*.jar'])
30 | // androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
31 | // exclude group: 'com.android.support', module: 'support-annotations'
32 | // })
33 | implementation 'androidx.appcompat:appcompat:1.1.0'
34 | testCompile 'junit:junit:4.12'
35 | }
36 |
37 |
38 | //task to copy library to libs
39 | task copyLibrary(type: Copy) {
40 |
41 | from('build/outputs/aar/library-debug.aar')
42 | into('../app/libs')
43 | ///Rename the aar
44 | rename('library-debug.aar', 'plugin-library.aar')
45 | }
46 |
47 | copyLibrary.dependsOn(build)
48 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/androidTest/java/com/qihoo360/replugin/sample/library/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.sample.library;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.qihoo360.replugin.sample.library.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/main/java/com/qihoo360/replugin/sample/library/LibMainActivity.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.sample.library;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | public class LibMainActivity extends Activity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.lib_activity_main);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/main/res/layout/content_lib_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/main/res/layout/lib_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | library
3 |
4 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/library/src/test/java/com/qihoo360/replugin/sample/library/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.sample.library;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo1/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | include ':app', ':library'
18 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo2/README.md
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/case.gradle:
--------------------------------------------------------------------------------
1 |
2 | dependencies {
3 |
4 | if (android.defaultConfig.multiDexEnabled){
5 |
6 | compile 'com.squareup.okhttp3:okhttp:3.4.1'
7 | compile 'com.google.code.gson:gson:2.6.2'
8 | compile 'com.squareup.pagerduty:pagerduty-incidents:2.0.0'
9 | compile 'com.google.android.gms:play-services:9.6.1'
10 |
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\***\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # ---------------------------------------------
20 | # **不要改动**
21 | # 插件框架、崩溃后台等需要
22 | -repackageclasses 'demo2'
23 | -allowaccessmodification
24 |
25 | -renamesourcefileattribute demo2
26 | -keepattributes SourceFile,LineNumberTable
27 |
28 | # ---------------------------------------------
29 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/aidl/com/qihoo360/replugin/sample/demo2/IDemo2.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | package com.qihoo360.replugin.sample.demo2;
17 |
18 | /**
19 | * @author RePlugin Team
20 | */
21 | interface IDemo2 {
22 | void hello(String str);
23 | }
24 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/Demo2Impl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | package com.qihoo360.replugin.sample.demo2;
17 |
18 | import android.os.RemoteException;
19 | import android.widget.Toast;
20 |
21 | import com.qihoo360.replugin.RePlugin;
22 |
23 | /**
24 | * @author RePlugin Team
25 | */
26 | public class Demo2Impl extends IDemo2.Stub {
27 | @Override
28 | public void hello(String str) throws RemoteException {
29 | Toast.makeText(RePlugin.getPluginContext(), str, Toast.LENGTH_SHORT).show();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/MainApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo2;
18 |
19 | import android.app.Application;
20 | import android.content.Context;
21 | import android.widget.Toast;
22 |
23 | import com.qihoo360.replugin.RePlugin;
24 |
25 | /**
26 | * @author RePlugin Team
27 | */
28 | public class MainApp extends Application {
29 |
30 | @Override
31 | public void onCreate() {
32 | super.onCreate();
33 |
34 | RePlugin.registerPluginBinder("demo2test", new Demo2Impl());
35 | }
36 |
37 | public static void helloFromDemo1(Context c, String text) {
38 | Toast.makeText(c, "Demo2: hello! " + text, Toast.LENGTH_SHORT).show();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/activity/appcompat/AppCompatActivityDemo.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.sample.demo2.activity.appcompat;
2 |
3 | import android.os.Bundle;
4 |
5 | import android.view.Gravity;
6 | import android.widget.FrameLayout;
7 | import android.widget.TextView;
8 |
9 | import androidx.annotation.Nullable;
10 | import androidx.appcompat.app.AppCompatActivity;
11 |
12 | import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
13 |
14 | /**
15 | * @author RePlugin Team
16 | */
17 | public class AppCompatActivityDemo extends AppCompatActivity {
18 |
19 | @Override
20 | protected void onCreate(@Nullable Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | TextView textView = new TextView(this);
23 | textView.setText("This is an AppCompactActivity");
24 | textView.setGravity(Gravity.CENTER);
25 | FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
26 | textView.setLayoutParams(layoutParams);
27 | setContentView(textView);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/activity/for_result/ForResultActivity.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.sample.demo2.activity.for_result;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 |
6 | import com.qihoo360.replugin.loader.a.PluginActivity;
7 |
8 | /**
9 | * @author RePlugin Team
10 | */
11 | public class ForResultActivity extends PluginActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 |
17 | Intent intent = new Intent();
18 | intent.putExtra("data", "data from demo2 plugin, resultCode is 0x022");
19 | setResult(0x022, intent);
20 |
21 | finish();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/databinding/DataBindingActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo2.databinding;
18 |
19 | import android.app.Activity;
20 |
21 | import android.os.Bundle;
22 |
23 | import androidx.databinding.DataBindingUtil;
24 |
25 | import com.qihoo360.replugin.sample.demo2.R;
26 |
27 | /**
28 | * @author RePlugin Team
29 | */
30 | public class DataBindingActivity extends Activity {
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | DatabindingTestBinding binding = DataBindingUtil.setContentView(this, R.layout.databinding_test);
36 | Entry entry = new Entry();
37 | entry.setText("文本数据1");
38 | entry.setColor(0xff0000ff);
39 | //设置测试字符串
40 | binding.setStr("我是监听绑定的数据测试");
41 | binding.setEntry(entry);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/databinding/Entry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo2.databinding;
18 |
19 | import android.view.View;
20 | import android.widget.Toast;
21 |
22 | /**
23 | * @author RePlugin Team
24 | */
25 | public class Entry {
26 | private String text;
27 | private int color;
28 |
29 | public String getText() {
30 | return text;
31 | }
32 |
33 | public void setText(String text) {
34 | this.text = text;
35 | }
36 |
37 | public int getColor() {
38 | return color;
39 | }
40 |
41 | public void setColor(int color) {
42 | this.color = color;
43 | }
44 |
45 | //将点击监听事件中添加了一个参数
46 | public void onClick(View view,String str){
47 | Toast.makeText(view.getContext(),"已点击,产生了" + str,Toast.LENGTH_SHORT).show();
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/receivers/PluginDemo2Receiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo2.receivers;
18 |
19 | import android.content.BroadcastReceiver;
20 | import android.content.Context;
21 | import android.content.Intent;
22 | import android.text.TextUtils;
23 | import android.widget.Toast;
24 |
25 | /**
26 | * @author RePlugin Team
27 | */
28 | public class PluginDemo2Receiver extends BroadcastReceiver {
29 |
30 | public static final String ACTION = "com.qihoo360.repluginapp.receiver.ACTION1";
31 |
32 | @Override
33 | public void onReceive(Context context, Intent intent) {
34 | String action = intent.getAction();
35 | if (!TextUtils.isEmpty(action)) {
36 | if (action.equals(ACTION)) {
37 | String name = intent.getStringExtra("name");
38 | Toast.makeText(context, "Plugin2-action: " + action + ", name = " + name, Toast.LENGTH_LONG).show();
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/java/com/qihoo360/replugin/sample/demo2/service/PluginDemo2Service.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo2.service;
18 |
19 | import android.app.Service;
20 | import android.content.Intent;
21 | import android.os.IBinder;
22 |
23 | import android.widget.Toast;
24 |
25 | import androidx.annotation.Nullable;
26 |
27 | /**
28 | * @author RePlugin Team
29 | */
30 | public class PluginDemo2Service extends Service {
31 |
32 | @Override
33 | public int onStartCommand(Intent intent, int flags, int startId) {
34 | String action = intent.getAction();
35 | Toast.makeText(this, "PluginDemo2Service.action = " + action, Toast.LENGTH_SHORT).show();
36 | return super.onStartCommand(intent, flags, startId);
37 | }
38 |
39 |
40 | @Nullable
41 | @Override
42 | public IBinder onBind(Intent intent) {
43 | return null;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/res/layout/databinding_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
24 |
27 |
28 |
32 |
40 |
41 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/res/layout/from_demo1.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/res/mipmap-xhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo2/app/src/main/res/mipmap-xhdpi/app_icon.png
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | DEMO2
19 |
20 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | buildscript {
17 | { p, cfg = "rp-config.gradle" -> if (new File(p, cfg).exists()) apply from: "${p}/${cfg}" else if (p.exists()) call(p.parentFile) }(buildscript.sourceFile.parentFile)
18 | repositories {
19 | // mavenLocal()
20 | jcenter()
21 | google()
22 | maven{
23 | url "https://dl.bintray.com/froyo-github/Replugin-AndroidX"
24 | }
25 | }
26 | dependencies {
27 | classpath 'com.android.tools.build:gradle:3.5.3'
28 | classpath "io.github.froyohuang:replugin-plugin-gradle-androidx:${RP_VERSION}"
29 | }
30 | }
31 |
32 | allprojects {
33 | repositories {
34 | // mavenLocal()
35 | jcenter()
36 | google()
37 | maven{
38 | url "https://dl.bintray.com/froyo-github/Replugin-AndroidX"
39 | }
40 | }
41 | }
42 |
43 | task clean(type: Delete) {
44 | delete rootProject.buildDir
45 | }
46 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
30 | org.gradle.jvmargs=-Xmx1536M
31 | # When configured, Gradle will run in incubating parallel mode.
32 | # This option should only be used with decoupled projects. More details, visit
33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
34 | # org.gradle.parallel=true
35 | android.useAndroidX=true
36 | # Automatically convert third-party libraries to use AndroidX
37 | android.enableJetifier=true
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jul 05 11:57:44 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo2/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | include ':app'
18 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo3-kotlin/README.md
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/libs/fragment.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo3-kotlin/app/libs/fragment.jar
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\***\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # ---------------------------------------------
20 | # **不要改动**
21 | # 插件框架、崩溃后台等需要
22 | -repackageclasses 'demo1'
23 | -allowaccessmodification
24 |
25 | -renamesourcefileattribute demo1
26 | -keepattributes SourceFile,LineNumberTable
27 |
28 | # ---------------------------------------------
29 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/aidl/com/qihoo360/replugin/sample/demo2/IDemo2.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | package com.qihoo360.replugin.sample.demo2;
17 |
18 | /**
19 | * @author RePlugin Team
20 | */
21 | interface IDemo2 {
22 | void hello(String str);
23 | }
24 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/BaseActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo3
18 |
19 | import android.app.Activity
20 | import android.os.Bundle
21 |
22 | /**
23 | * @author RePlugin Team
24 | */
25 | abstract class BaseActivity : Activity() {
26 |
27 | override fun onCreate(savedInstanceState: Bundle?) {
28 | super.onCreate(savedInstanceState)
29 | setContentView(R.layout.simple)
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/MainApp.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo3
18 |
19 | import android.app.Application
20 |
21 | /**
22 | * @author RePlugin Team
23 | */
24 | class MainApp : Application() {
25 |
26 | override fun onCreate() {
27 | super.onCreate()
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/TestItem.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo3
18 |
19 | import android.view.View
20 |
21 | /**
22 | * @author RePlugin Team
23 | */
24 | class TestItem(var title: String, var mClickListener: View.OnClickListener)
25 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/java/com/qihoo360/replugin/sample/demo3/receivers/PluginDemo3Receiver.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.sample.demo3.receivers
18 |
19 | import android.content.BroadcastReceiver
20 | import android.content.Context
21 | import android.content.Intent
22 | import android.text.TextUtils
23 | import android.widget.Toast
24 |
25 | /**
26 | * @author RePlugin Team
27 | */
28 | class PluginDemo3Receiver : BroadcastReceiver() {
29 |
30 | override fun onReceive(context: Context, intent: Intent) {
31 | val action = intent.action
32 | if (!TextUtils.isEmpty(action)) {
33 | if (action == ACTION) {
34 | val name = intent.getStringExtra("name")
35 | Toast.makeText(context, "Plugin3-action: $action, name = $name", Toast.LENGTH_LONG).show()
36 | }
37 | }
38 | }
39 |
40 | companion object {
41 |
42 | val ACTION = "com.qihoo360.repluginapp.replugin.receiver.ACTION3"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
23 |
24 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/res/layout/main_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/res/layout/simple.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
31 |
32 |
38 |
39 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/res/mipmap-xhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo3-kotlin/app/src/main/res/mipmap-xhdpi/app_icon.png
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | DEMO3
19 |
20 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | buildscript {
17 | { p, cfg = "rp-config.gradle" -> if (new File(p, cfg).exists()) apply from: "${p}/${cfg}" else if (p.exists()) call(p.parentFile) }(buildscript.sourceFile.parentFile)
18 | ext.kotlin_version = '1.3.21'
19 | repositories {
20 | mavenLocal()
21 | google()
22 | jcenter()
23 | // maven{
24 | // url "https://dl.bintray.com/froyo-github/Replugin-AndroidX"
25 | // }
26 | }
27 | dependencies {
28 | classpath "io.github.froyohuang:replugin-plugin-gradle-androidx:${RP_VERSION}"
29 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
30 | }
31 | }
32 |
33 | allprojects {
34 | repositories {
35 | mavenLocal()
36 | google()
37 | jcenter()
38 | // maven{
39 | // url "https://dl.bintray.com/froyo-github/Replugin-AndroidX"
40 | // }
41 | }
42 | }
43 |
44 | task clean(type: Delete) {
45 | delete rootProject.buildDir
46 | }
47 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Tue Jul 11 21:08:48 CST 2017
16 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/plugin-sample/plugin-demo3-kotlin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jul 05 11:29:37 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/plugin-sample/plugin-demo3-kotlin/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | include ':app'
18 |
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/README.md:
--------------------------------------------------------------------------------
1 | # RePlugin Host Gradle
2 |
3 | RePlugin Host Gradle是一个Gradle插件,由 **主程序** 负责引入。
4 |
5 | 该Gradle插件主要负责在主程序的编译期中做一些事情,此外,开发者可通过修改其属性而做一些自定义的操作。
6 |
7 | 大致包括:
8 |
9 | * 生成带 RePlugin 插件坑位的 AndroidManifest.xml(允许自定义数量)
10 | * 生成HostBuildConfig类,方便插件框架读取并自定义其属性
11 |
12 | 开发者需要依赖此Gradle插件,以实现对RePlugin的接入。请参见WiKi以了解接入方法。
13 |
14 | 有关RePlugin Host Gradle的详细描述,请访问我们的WiKi,以了解更多的内容。
15 | (文档正在完善,请耐心等待)
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | org.gradle.jvmargs=-Xmx1536m
29 |
30 | # When configured, Gradle will run in incubating parallel mode.
31 | # This option should only be used with decoupled projects. More details, visit
32 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
33 | # org.gradle.parallel=true
34 |
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/replugin-host-gradle-androidx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | #Mon Dec 28 10:00:20 PST 2015
18 | distributionBase=GRADLE_USER_HOME
19 | distributionPath=wrapper/dists
20 | zipStoreBase=GRADLE_USER_HOME
21 | zipStorePath=wrapper/dists
22 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
23 |
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/compat/ScopeCompat.groovy:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.gradle.compat
2 |
3 | import com.android.sdklib.IAndroidTarget
4 |
5 | /**
6 | * @author hyongbai
7 | */
8 | class ScopeCompat {
9 | static def getAdbExecutable(def scope) {
10 | final MetaClass scopeClz = scope.metaClass
11 | if (scopeClz.hasProperty(scope, "androidBuilder")) {
12 | return scope.androidBuilder.sdkInfo.adb
13 | }
14 | if (scopeClz.hasProperty(scope, "sdkComponents")) {
15 | return scope.sdkComponents.adbExecutableProvider.get()
16 | }
17 | }
18 |
19 | // TODO: getBuilderTarget
20 | // static def getBuilderTarget(def scope, def target){
21 | // final MetaClass scopeClz = scope.metaClass
22 | //
23 | // if (scopeClz.hasProperty(scope, "androidBuilder")) {
24 | // return scope.getAndroidBuilder().getTarget().getPath(target) //IAndroidTarget.ANDROID_JAR
25 | // }
26 | //
27 | // return globalScope.getAndroidBuilder().getTarget().getPath(IAndroidTarget.ANDROID_JAR)
28 | // }
29 |
30 | static def getAndroidJar(def scope){
31 | final MetaClass scopeClz = scope.metaClass
32 |
33 | if (scopeClz.hasProperty(scope, "androidBuilder")) {
34 | return scope.getAndroidBuilder().getTarget().getPath(IAndroidTarget.ANDROID_JAR)
35 | }
36 | if (scopeClz.hasProperty(scope, "sdkComponents")) {
37 | return scope.sdkComponents.androidJarProvider.get().getAbsolutePath()
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/compat/VariantCompat.groovy:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.gradle.compat
2 |
3 | import org.gradle.api.Task
4 |
5 | /**
6 | * @author hyongbai
7 | */
8 | class VariantCompat {
9 | static def getAssembleTask(def variant) {
10 | return compatGetTask(variant, "getAssembleProvider", "getAssemble")
11 | }
12 |
13 | static def getMergeAssetsTask(def variant) {
14 | return compatGetTask(variant, "getMergeAssetsProvider", "getMergeAssets")
15 | }
16 |
17 | static def getGenerateBuildConfigTask(def variant) {
18 | return compatGetTask(variant, "getGenerateBuildConfigProvider", "getGenerateBuildConfig")
19 | }
20 |
21 | static def getProcessManifestTask(def variant) {
22 | return compatGetTask(variant, "getProcessManifestProvider", "getProcessManifest")
23 | }
24 |
25 | static def compatGetTask(def variant, String... candidates) {
26 | candidates?.findResult {
27 | variant.metaClass.respondsTo(variant, it).with {
28 | if (!it.isEmpty()) return it
29 | }
30 | }?.find {
31 | it.getParameterTypes().length == 0
32 | }?.invoke(variant)?.with {
33 | //TODO: check if is provider!!!
34 | Task.class.isInstance(it) ? it : it?.get()
35 | }
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/host/AppConstant.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.gradle.host
18 |
19 | /**
20 | * 程序常量定义区
21 | * @author RePlugin Team
22 | */
23 | class AppConstant {
24 |
25 | /** 版本号 */
26 | def static final VER = "2.3.3.0"
27 |
28 | /** 打印信息时候的前缀 */
29 | def static final TAG = "< replugin-host-v${VER} >"
30 |
31 | /** 外部用户配置信息 */
32 | def static final USER_CONFIG = "repluginHostConfig"
33 |
34 | /** 用户Task组 */
35 | def static final TASKS_GROUP = "replugin-plugin"
36 |
37 | /** Task前缀 */
38 | def static final TASKS_PREFIX = "rp"
39 |
40 | /** 用户Task:安装插件 */
41 | def static final TASK_SHOW_PLUGIN = TASKS_PREFIX + "ShowPlugins"
42 |
43 | /** 用户Task:Generate任务 */
44 | def static final TASK_GENERATE = TASKS_PREFIX + "Generate"
45 |
46 |
47 | private AppConstant() {}
48 | }
49 |
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/IFileCreator.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.gradle.host.creator;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public interface IFileCreator {
23 |
24 | /**
25 | * 要生成的文件所在目录
26 | */
27 | File getFileDir()
28 |
29 | /**
30 | * 要生成的文件的名称
31 | */
32 | String getFileName()
33 |
34 | /**
35 | * 要生成的文件内容
36 | */
37 | String getFileContent()
38 | }
39 |
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/json/PluginInfo.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.gradle.host.creator.impl.json
18 |
19 | /**
20 | * 插件信息模型
21 | * @author RePlugin Team
22 | */
23 | class PluginInfo {
24 |
25 | /** 插件文件路径 */
26 | def path
27 | /** 插件包名 */
28 | def pkg
29 | /** 插件名 */
30 | def name
31 | /** 插件最低兼容版本 */
32 | Long low
33 | /** 插件最高兼容版本 */
34 | Long high
35 | /** 插件版本号 */
36 | Long ver
37 | /** 框架版本号 */
38 | Long frm
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/replugin-host-gradle-androidx/src/main/resources/META-INF/gradle-plugins/replugin-host-gradle-androidx.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 | implementation-class=com.qihoo360.replugin.gradle.host.Replugin
17 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/README.md:
--------------------------------------------------------------------------------
1 | # RePlugin Host Library
2 |
3 | RePlugin Host Library是一个Java工程,由 **主程序** 负责引入。
4 |
5 | 几乎所有和RePlugin相关的代码都在其中,是核心工程。
6 |
7 | 开发者需要依赖此Library,以实现对RePlugin的接入。请参见WiKi以了解接入方法。
8 |
9 | 有关RePlugin Host Library的详细描述,请访问我们的WiKi,以了解更多的内容。
--------------------------------------------------------------------------------
/replugin-host-library-androidx/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
18 |
19 | buildscript {
20 | repositories {
21 | jcenter()
22 | google()
23 | }
24 | dependencies {
25 | classpath 'com.android.tools.build:gradle:3.5.3'
26 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
27 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
28 | }
29 | }
30 |
31 | allprojects {
32 | repositories {
33 | jcenter()
34 | google()
35 | }
36 | }
37 |
38 | task clean(type: Delete) {
39 | delete rootProject.buildDir
40 | }
41 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | org.gradle.jvmargs=-Xmx1536m
29 |
30 | # When configured, Gradle will run in incubating parallel mode.
31 | # This option should only be used with decoupled projects. More details, visit
32 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
33 | # org.gradle.parallel=true
34 | android.useAndroidX=true
35 | # Automatically convert third-party libraries to use AndroidX
36 | android.enableJetifier=true
--------------------------------------------------------------------------------
/replugin-host-library-androidx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/replugin-host-library-androidx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/replugin-host-library-androidx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | #Fri Mar 03 10:15:50 CST 2017
18 | distributionBase=GRADLE_USER_HOME
19 | distributionPath=wrapper/dists
20 | zipStoreBase=GRADLE_USER_HOME
21 | zipStorePath=wrapper/dists
22 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
23 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | /**
18 | * @author RePlugin Team
19 | */
20 | apply plugin: 'com.android.library'
21 |
22 | android {
23 | compileSdkVersion 29
24 | buildToolsVersion '29.0.2'
25 |
26 | defaultConfig {
27 | minSdkVersion 14
28 | targetSdkVersion 29
29 |
30 | versionCode 2
31 | versionName version
32 | consumerProguardFiles 'replugin-rules.pro'
33 |
34 | }
35 |
36 | lintOptions {
37 | abortOnError false
38 | }
39 |
40 | // 务必要加上此段话,这样默认会出Debug版AAR,会带上日志方便定位
41 | defaultPublishConfig "debug"
42 | }
43 |
44 | dependencies {
45 | implementation fileTree(include: ['*.jar'], dir: 'libs')
46 |
47 | // 以“占位符”(Provided)的方式来引用support-v4,不会编入AAR
48 | // 但宿主需要支持Support-v4(至少应支持LocalBroadcastManager)
49 | compileOnly 'androidx.appcompat:appcompat:1.1.0'
50 | compileOnly 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
51 | }
52 |
53 | project.ext.RP_ARTIFACT_ID = 'replugin-host-lib-androidx'
54 | apply from: '../../rp-publish.gradle'
55 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/loader2/IPlugin.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.loader2;
2 |
3 | /**
4 | * @author RePlugin Team
5 | */
6 | interface IPlugin {
7 |
8 | IBinder query(String name);
9 | }
10 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/loader2/IPluginClient.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.loader2;
2 |
3 | import com.qihoo360.replugin.component.service.server.IPluginServiceServer;
4 |
5 | /**
6 | * @author RePlugin Team
7 | */
8 | interface IPluginClient {
9 |
10 | // 参数 plugin, process 可能有冗余,目前临时使用,后续可能优化
11 | String allocActivityContainer(String plugin, int process, String target, in Intent intent);
12 |
13 | // 参数 plugin 用来处理多插件单进程情况
14 | IBinder queryBinder(String plugin, String binder);
15 |
16 | void releaseBinder();
17 |
18 | oneway void sendIntent(in Intent intent);
19 |
20 | void sendIntentSync(in Intent intent);
21 |
22 | int sumActivities();
23 |
24 | IPluginServiceServer fetchServiceServer();
25 |
26 | /**
27 | * 插件收到广播
28 | *
29 | * @param plugin 插件名称
30 | * @param receiver Receiver 名称
31 | * @param Intent 广播的 Intent 数据
32 | */
33 | void onReceive(String plugin, String receiver, in Intent intent);
34 |
35 | /**
36 | * dump通过插件化框架启动起来的Service信息
37 | */
38 | String dumpServices();
39 |
40 | /**
41 | * dump插件化框架中存储的详细Activity坑位映射表
42 | */
43 | String dumpActivities();
44 | }
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/loader2/PluginBinderInfo.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.loader2;
2 |
3 | parcelable PluginBinderInfo;
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/loader2/mgr/IServiceConnection.aidl:
--------------------------------------------------------------------------------
1 | // IServiceConnection.aidl
2 | // Same as android.app.IServiceConnection
3 | package com.qihoo360.loader2.mgr;
4 |
5 | import android.content.ComponentName;
6 |
7 | /** @hide */
8 | oneway interface IServiceConnection {
9 | void connected(in ComponentName name, IBinder service);
10 | }
11 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/loader2/sp/IPref.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.loader2.sp;
2 |
3 | import android.os.Bundle;
4 |
5 | /**
6 | * @author RePlugin Team
7 | */
8 | interface IPref {
9 |
10 | String get(String category, String key, String defValue);
11 |
12 | void set(String category, String key, String value);
13 |
14 | Bundle getAll(String category);
15 | }
16 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/mobilesafe/svcmanager/IServiceChannel.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.mobilesafe.svcmanager;
2 |
3 | import com.qihoo360.replugin.IBinderGetter;
4 |
5 | interface IServiceChannel {
6 |
7 | IBinder getService(String serviceName);
8 |
9 | void addService(String serviceName, IBinder service);
10 |
11 | void addServiceDelayed(String serviceName, IBinderGetter getter);
12 |
13 | void removeService(String serviceName);
14 |
15 | IBinder getPluginService(String pluginName, String serviceName, IBinder deathMonitor);
16 |
17 | void onPluginServiceRefReleased(String pluginName, String serviceName);
18 | }
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/replugin/IBinderGetter.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin;
2 |
3 | /**
4 | * Binder的获取器,可用于延迟加载IBinder的情况。
5 | *
6 | * 目前用于:
7 | *
8 | * * RePlugin.registerGlobalBinderDelayed
9 | *
10 | * @author RePlugin Team
11 | */
12 | interface IBinderGetter {
13 |
14 | /**
15 | * 获取IBinder对象
16 | */
17 | IBinder get();
18 | }
19 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/replugin/component/service/server/IPluginServiceServer.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.component.service.server;
2 |
3 | import android.content.ComponentName;
4 | import android.os.Messenger;
5 |
6 | import com.qihoo360.loader2.mgr.IServiceConnection;
7 |
8 | /**
9 | * 负责Server端的服务调度、提供等工作,是服务的提供方,核心类之一
10 | *
11 | * @hide 框架内部使用
12 | * @author RePlugin Team
13 | */
14 | interface IPluginServiceServer {
15 | ComponentName startService(in Intent intent, in Messenger client);
16 | int stopService(in Intent intent, in Messenger client);
17 |
18 | int bindService(in Intent intent, in IServiceConnection conn, int flags, in Messenger client);
19 | boolean unbindService(in IServiceConnection conn);
20 |
21 | String dump();
22 | }
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/replugin/model/PluginInfo.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.model;
2 |
3 | parcelable PluginInfo;
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/aidl/com/qihoo360/replugin/packages/PluginRunningList.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin.packages;
2 |
3 | parcelable PluginRunningList;
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/i/IModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.i;
18 |
19 | /**
20 | * 所有可查询的接口都从此interface继承
21 | * 在插件体系中,module是一种略高于interface的概念
22 | * 一个插件可导出一个到多个module,这些module可输出自己业务的各种interface
23 | *
24 | * @author RePlugin Team
25 | *
26 | */
27 | public interface IModule {
28 |
29 | /**
30 | * 万能接口:当不能升级adapter.jar的时候再考虑使用
31 | * @param args
32 | * @return
33 | */
34 | Object invoke(Object...args);
35 | }
36 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/i/IPlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.i;
18 |
19 |
20 | /**
21 | * 此接口由插件负责导出
22 | * 表示一个具体的物理上的插件实体,例如barcode.jar
23 | * 具体导出细节可看Factory
24 | *
25 | * @author RePlugin Team
26 | *
27 | */
28 | public interface IPlugin {
29 |
30 | /**
31 | * @param c 需要查询的interface的类
32 | * @return
33 | */
34 | IModule query(Class extends IModule> c);
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/loader/utils/PackageUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.loader.utils;
18 |
19 | import android.content.pm.PackageInfo;
20 | import android.content.pm.PackageManager;
21 |
22 | import com.qihoo360.replugin.helper.LogDebug;
23 |
24 | /**
25 | * @author RePlugin Team
26 | */
27 | public class PackageUtils {
28 |
29 | /**
30 | * 获取PackageInfo对象
31 | *
32 | * 注:getPackageArchiveInfo Android 2.x上,可能拿不到signatures,本可以通过反射去获取,但是考虑到会触发Android 的灰/黑名单,这个方法就不再继续适配2.X了
33 | *
34 | * @return
35 | */
36 | public static PackageInfo getPackageArchiveInfo(PackageManager pm, String pkgFilePath, int flags) {
37 | PackageInfo info = null;
38 | try {
39 | info = pm.getPackageArchiveInfo(pkgFilePath, flags);
40 | } catch (Throwable e) {
41 | if (LogDebug.LOG) {
42 | e.printStackTrace();
43 | }
44 | }
45 |
46 | return info;
47 | }
48 | }
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/loader2/ProcessStates.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.loader2;
18 |
19 | /**
20 | * 保存自定义进程中,每个进程里的坑位信息
21 | *
22 | * @author RePlugin Team
23 | */
24 |
25 | class ProcessStates {
26 |
27 | /**
28 | * 保存非默认 TaskAffinity 下,坑位的状态信息。
29 | */
30 | TaskAffinityStates mTaskAffinityStates = new TaskAffinityStates();
31 |
32 | /**
33 | * 保存默认 TaskAffinity 下,坑位的状态信息。
34 | */
35 | LaunchModeStates mLaunchModeStates = new LaunchModeStates();
36 | }
37 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/mobilesafe/api/AppVar.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.mobilesafe.api;
18 |
19 | import android.content.Context;
20 |
21 | /**
22 | * @author RePlugin Team
23 | */
24 | public class AppVar {
25 |
26 | /**
27 | * API模块内部使用,记得初始化
28 | */
29 | public static Context sAppContext;
30 | }
31 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/mobilesafe/loader/a/DummyActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.mobilesafe.loader.a;
18 |
19 | import android.app.Activity;
20 | import android.os.Bundle;
21 |
22 | import com.qihoo360.replugin.helper.LogRelease;
23 |
24 | import static com.qihoo360.replugin.helper.LogDebug.PLUGIN_TAG;
25 | import static com.qihoo360.replugin.helper.LogRelease.LOGR;
26 |
27 | /**
28 | * @author RePlugin Team
29 | */
30 | public class DummyActivity extends Activity {
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | // INFO dummy activity on create finish me.
35 | if (LOGR) {
36 | LogRelease.i(PLUGIN_TAG, "d a o c f m");
37 | }
38 |
39 | // 之所以传Null,是因为系统会直接解析savedInstanceState
40 | // 这时如果常驻进程已被杀,这时立即恢复后,由于插件还没有准备好,故会出现崩溃情况
41 | // 详细见:Crash Hash = 5C863A3E0CACDAEA9DBD05B9A7D353FE
42 | super.onCreate(null);
43 |
44 | finish();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/mobilesafe/loader/s/DummyService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.mobilesafe.loader.s;
18 |
19 | import android.app.Service;
20 | import android.content.Intent;
21 | import android.os.IBinder;
22 |
23 | /**
24 | * @author RePlugin Team
25 | */
26 | public class DummyService extends Service {
27 |
28 | @Override
29 | public IBinder onBind(Intent intent) {
30 | return null;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/mobilesafe/parser/manifest/bean/ComponentBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.mobilesafe.parser.manifest.bean;
18 |
19 | import android.content.IntentFilter;
20 |
21 | import java.util.List;
22 |
23 | /**
24 | * @author RePlugin Team
25 | */
26 | public class ComponentBean {
27 |
28 | public String name;
29 | public List intentFilters;
30 |
31 | @Override
32 | public String toString() {
33 | return String.format("{name:%s, intent-filter.size():%s}", name, intentFilters.size());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/DefaultRePluginCallbacks.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * @deprecated Use RePluginCallbacks instead
7 | * @see RePluginCallbacks
8 | * @author RePlugin Team
9 | */
10 |
11 | public class DefaultRePluginCallbacks extends RePluginCallbacks {
12 |
13 | /**
14 | * @deprecated Use RePluginCallbacks instead
15 | * @see RePluginCallbacks#RePluginCallbacks(Context)
16 | */
17 | public DefaultRePluginCallbacks(Context context) {
18 | super(context);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/DefaultRePluginEventCallbacks.java:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * @deprecated Use RePluginEventCallbacks instead
7 | * @see RePluginEventCallbacks
8 | * @author RePlugin Team
9 | */
10 |
11 | public class DefaultRePluginEventCallbacks extends RePluginEventCallbacks {
12 |
13 | /**
14 | * @deprecated Use RePluginEventCallbacks instead
15 | * @see RePluginEventCallbacks#RePluginEventCallbacks(Context)
16 | */
17 | public DefaultRePluginEventCallbacks(Context context) {
18 | super(context);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/IHostBinderFetcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin;
18 |
19 | import android.os.IBinder;
20 |
21 | /**
22 | * 用来实现主程序提供IBinder给其他插件
23 | *
26 | * TODO 未来会废弃Factory类,并做些调整
27 | *
28 | * @author RePlugin Team
29 | */
30 | public interface IHostBinderFetcher {
31 |
32 | /**
33 | * 主程序需实现此方法,来返回一个IBinder对象,供插件使用
34 | *
35 | * @param module 模块名
36 | * @return 一个IBinder对象
37 | */
38 | IBinder query(String module);
39 | }
40 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/RePluginInternal.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin;
18 |
19 | import android.app.Application;
20 | import android.content.Context;
21 |
22 | import com.qihoo360.mobilesafe.core.BuildConfig;
23 |
24 | /**
25 | * 对框架暴露的一些通用的接口。
26 | *
27 | * 注意:插件框架内部使用,外界请不要调用。
28 | *
29 | * @author RePlugin Team
30 | */
31 | public class RePluginInternal {
32 |
33 | public static final boolean FOR_DEV = BuildConfig.DEBUG;
34 |
35 | // FIXME 不建议缓存Application对象,容易导致InstantRun失效(警告中写着,具体原因待分析)
36 | static Context sAppContext;
37 |
38 | static void init(Application app) {
39 | sAppContext = app;
40 | }
41 |
42 | /**
43 | * 获取宿主注册时的Context对象
44 | */
45 | public static Context getAppContext() {
46 | return sAppContext;
47 | }
48 |
49 | /**
50 | * 获取宿主注册时的ClassLoader
51 | */
52 | public static ClassLoader getAppClassLoader() {
53 | return getAppContext().getClassLoader();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/base/AMSUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.base;
18 |
19 | import android.app.ActivityManager;
20 | import android.content.Context;
21 |
22 | import java.util.List;
23 |
24 | /**
25 | * 和ActivityManagerService快速封装的一些接口
26 | *
27 | * @author RePlugin Team
28 | */
29 |
30 | public class AMSUtils {
31 |
32 | /**
33 | * 无需抛出异常而调用getRunningAppProcesses方法
34 | * @param context context对象
35 | * @return RunningAppProcessInfo列表
36 | */
37 | public static List getRunningAppProcessesNoThrows(Context context) {
38 | try {
39 | ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
40 | return am.getRunningAppProcesses();
41 | } catch (Throwable e) {
42 | // 可能AMS挂了,但最多返回空列表即可。毕竟不是很重要的流程
43 | e.printStackTrace();
44 | }
45 | return null;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/dummy/DummyReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.dummy;
18 |
19 | import android.content.BroadcastReceiver;
20 | import android.content.ComponentName;
21 | import android.content.Context;
22 | import android.content.Intent;
23 |
24 | import com.qihoo360.replugin.helper.LogRelease;
25 |
26 | import static com.qihoo360.replugin.helper.LogDebug.PLUGIN_TAG;
27 | import static com.qihoo360.replugin.helper.LogRelease.LOGR;
28 |
29 | /**
30 | * 表示一个“仿造的”BroadcastReceiver,收到消息后什么事情也不做
31 | * 此类可防止系统调用插件时因类找不到而崩溃。请参见 registerHookingClass 的说明
32 | *
33 | * @see com.qihoo360.replugin.RePlugin#registerHookingClass(String, ComponentName, Class)
34 | * @author RePlugin Team
35 | */
36 | public class DummyReceiver extends BroadcastReceiver {
37 |
38 | @Override
39 | public void onReceive(Context context, Intent intent) {
40 | // INFO dummy receiver on receive occur
41 | if (LOGR) {
42 | LogRelease.i(PLUGIN_TAG, "d.r o.c f");
43 | }
44 |
45 | // Nothing
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/dummy/DummyService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.dummy;
18 |
19 | import android.app.Service;
20 | import android.content.ComponentName;
21 | import android.content.Intent;
22 | import android.os.IBinder;
23 |
24 | /**
25 | * 表示一个“仿造的”Service,启动后什么事情也不做
26 | * 此类可防止系统调用插件时因类找不到而崩溃。请参见 registerHookingClass 的说明
27 | *
28 | * @see com.qihoo360.replugin.RePlugin#registerHookingClass(String, ComponentName, Class)
29 | * @author RePlugin Team
30 | */
31 | public class DummyService extends Service {
32 |
33 | @Override
34 | public void onCreate() {
35 | super.onCreate();
36 | stopSelf();
37 | }
38 |
39 | @Override
40 | public IBinder onBind(Intent intent) {
41 | return null;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/dummy/ForwardActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.dummy;
18 |
19 | import android.app.Activity;
20 | import android.content.Intent;
21 | import android.os.Bundle;
22 |
23 | import com.qihoo360.loader2.PMF;
24 | import com.qihoo360.replugin.helper.LogRelease;
25 |
26 | import static com.qihoo360.replugin.helper.LogDebug.PLUGIN_TAG;
27 | import static com.qihoo360.replugin.helper.LogRelease.LOGR;
28 |
29 | /**
30 | * 若坑位出现丢失或错乱,则通过读取Intent.Category来做个中转
31 | *
32 | * @author RePlugin Team
33 | */
34 | public class ForwardActivity extends Activity {
35 |
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(null);
39 |
40 | // INFO forward activity on Create
41 | if (LOGR) {
42 | LogRelease.i(PLUGIN_TAG, "f.a: o.c");
43 | }
44 |
45 | Intent intent = getIntent();
46 | if (intent == null) {
47 | if (LOGR) {
48 | LogRelease.e(PLUGIN_TAG, "f.a: nul i");
49 | }
50 | }
51 |
52 | PMF.forward(this, intent);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/process/ProcessPitProviderLoader0.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.process;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class ProcessPitProviderLoader0 extends ProcessPitProviderBase {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/process/ProcessPitProviderLoader1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.process;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class ProcessPitProviderLoader1 extends ProcessPitProviderBase {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/process/ProcessPitProviderP0.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.process;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class ProcessPitProviderP0 extends ProcessPitProviderBase {
23 | }
24 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/process/ProcessPitProviderP1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.process;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class ProcessPitProviderP1 extends ProcessPitProviderBase {
23 | }
24 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/process/ProcessPitProviderP2.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.process;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class ProcessPitProviderP2 extends ProcessPitProviderBase {
23 | }
24 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/process/ProcessPitProviderUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.process;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class ProcessPitProviderUI extends ProcessPitProviderBase {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/provider/PluginPitProviderP0.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.provider;
18 |
19 | /**
20 | * ProcessPitProviderLoader0
21 | *
22 | * @author RePlugin Team
23 | */
24 | public class PluginPitProviderP0 extends PluginPitProviderBase {
25 | public static final String AUTHORITY = AUTHORITY_PREFIX + "0";
26 |
27 | public PluginPitProviderP0() {
28 | super(AUTHORITY);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/provider/PluginPitProviderP1.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.provider;
18 |
19 | /**
20 | * ProcessPitProviderLoader1
21 | *
22 | * @author RePlugin Team
23 | */
24 | public class PluginPitProviderP1 extends PluginPitProviderBase {
25 | public static final String AUTHORITY = AUTHORITY_PREFIX + "1";
26 |
27 | public PluginPitProviderP1() {
28 | super(AUTHORITY);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/provider/PluginPitProviderP2.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.provider;
18 |
19 | /**
20 | * ProcessProviderLoader2
21 | *
22 | * @author RePlugin Team
23 | */
24 | public class PluginPitProviderP2 extends PluginPitProviderBase {
25 | public static final String AUTHORITY = AUTHORITY_PREFIX + "2";
26 |
27 | public PluginPitProviderP2() {
28 | super(AUTHORITY);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/provider/PluginPitProviderPersist.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.provider;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class PluginPitProviderPersist extends PluginPitProviderBase {
23 | public static final String AUTHORITY = AUTHORITY_PREFIX + "PSP";
24 |
25 | public PluginPitProviderPersist() {
26 | super(AUTHORITY);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/replugin-host-lib-androidx/src/main/java/com/qihoo360/replugin/component/provider/PluginPitProviderUI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.component.provider;
18 |
19 | /**
20 | * @author RePlugin Team
21 | */
22 | public class PluginPitProviderUI extends PluginPitProviderBase {
23 | public static final String AUTHORITY = AUTHORITY_PREFIX + "UIP";
24 |
25 | public PluginPitProviderUI() {
26 | super(AUTHORITY);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/replugin-host-library-androidx/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | include ':replugin-host-lib-androidx'
17 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/README.md:
--------------------------------------------------------------------------------
1 | # RePlugin Plugin Gradle
2 |
3 | RePlugin Plugin Gradle是一个Gradle插件,由 **插件** 负责引入。
4 |
5 | 该Gradle插件主要负责在插件的编译期中做一些事情,是“动态编译方案”的主要实现者。此外,开发者可通过修改其属性而做一些自定义的操作。
6 |
7 | 大致包括:
8 |
9 | * 动态修改主要调用代码,改为调用RePlugin Plugin Gradle(如Activity的继承、Provider的重定向等)
10 |
11 | 开发者需要依赖此Gradle插件,以实现对RePlugin的接入。请参见WiKi以了解接入方法。
12 |
13 | 有关RePlugin Host Gradle的详细描述,请访问我们的WiKi,以了解更多的内容。
14 | (文档正在完善,请耐心等待)
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/config.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | ext {
19 | config = this.&readConfig()
20 | }
21 |
22 | def readConfig() {
23 | Properties configProperties = new Properties()
24 | file('config.properties').withInputStream {
25 | configProperties.load(it)
26 | }
27 | configProperties
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/config.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 | #
17 |
18 | repoUrl =
19 |
20 | groupId = com.qihoo360.replugin
21 | artifactId = replugin-plugin-gradle
22 |
23 | # --- android config ---
24 | compileSdkVersion = 21
25 | buildToolsVersion = 23.0.3
26 | minSdkVersion = 10
27 | targetSdkVersion = 21
28 |
29 | # --- user info ---
30 | # 注意:1、仅研发一组同事能修改此URL;
31 | # 2、切勿去除,以免误上传到Maven中心库,引发代码泄露危机。
32 | username =
33 | password =
34 |
35 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 | #
17 |
18 | # Project-wide Gradle settings.
19 |
20 | # IDE (e.g. Android Studio) users:
21 | # Gradle settings configured through the IDE *will override*
22 | # any settings specified in this file.
23 |
24 | # For more details on how to configure your build environment visit
25 | # http://www.gradle.org/docs/current/userguide/build_environment.html
26 |
27 | # Specifies the JVM arguments used for the daemon process.
28 | # The setting is particularly useful for tweaking memory settings.
29 | org.gradle.jvmargs=-Xmx1536m
30 |
31 | # When configured, Gradle will run in incubating parallel mode.
32 | # This option should only be used with decoupled projects. More details, visit
33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
34 | # org.gradle.parallel=true
35 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/replugin-plugin-gradle-androidx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 | #
17 |
18 | #Mon Dec 28 10:00:20 PST 2015
19 | distributionBase=GRADLE_USER_HOME
20 | distributionPath=wrapper/dists
21 | zipStoreBase=GRADLE_USER_HOME
22 | zipStorePath=wrapper/dists
23 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
24 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/injector/BaseInjector.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.injector
19 |
20 | import org.gradle.api.Project
21 |
22 | /**
23 | * @author RePlugin Team
24 | */
25 | public abstract class BaseInjector implements IClassInjector {
26 |
27 | protected Project project
28 |
29 | protected String variantDir
30 |
31 | @Override
32 | public Object name() {
33 | return getClass().getSimpleName()
34 | }
35 |
36 | public void setProject(Project project) {
37 | this.project = project;
38 | }
39 |
40 | public void setVariantDir(String variantDir) {
41 | this.variantDir = variantDir;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/injector/IClassInjector.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.injector
19 |
20 | import javassist.ClassPool
21 | import org.gradle.api.Project
22 |
23 | /**
24 | * @author RePlugin Team
25 | */
26 | interface IClassInjector {
27 |
28 | /**
29 | * 设置project对象
30 | * @param project
31 | */
32 | void setProject(Project project)
33 |
34 | /**
35 | * 设置variant目录关键串
36 | * @param variantDir
37 | */
38 | void setVariantDir(String variantDir)
39 | /**
40 | * 注入器名称
41 | */
42 | def name()
43 |
44 | /**
45 | * 对 dir 目录中的 Class 进行注入
46 | */
47 | def injectClass(ClassPool pool, String dir, Map config)
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/injector/identifier/GetIdentifierExprEditor.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.injector.identifier
19 |
20 | import com.qihoo360.replugin.gradle.plugin.inner.CommonData
21 | import javassist.CannotCompileException
22 | import javassist.expr.ExprEditor
23 | import javassist.expr.MethodCall
24 |
25 | /**
26 | * @author RePlugin Team
27 | */
28 | public class GetIdentifierExprEditor extends ExprEditor {
29 |
30 | public def filePath
31 |
32 | @Override
33 | void edit(MethodCall m) throws CannotCompileException {
34 | String clsName = m.getClassName()
35 | String methodName = m.getMethodName()
36 |
37 | if (clsName.equalsIgnoreCase('android.content.res.Resources')) {
38 | if (methodName == 'getIdentifier') {
39 | m.replace('{ $3 = \"' + CommonData.appPackage + '\"; ' +
40 | '$_ = $proceed($$);' +
41 | ' }')
42 | println " GetIdentifierCall => ${filePath} ${methodName}():${m.lineNumber}"
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/inner/ClassFileVisitor.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.inner
19 |
20 | import java.nio.file.FileVisitResult
21 | import java.nio.file.Path
22 | import java.nio.file.SimpleFileVisitor
23 | import java.nio.file.attribute.BasicFileAttributes;
24 |
25 | /**
26 | * @author RePlugin Team
27 | */
28 | public class ClassFileVisitor extends SimpleFileVisitor {
29 |
30 | def baseDir
31 |
32 | @Override
33 | FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
34 | String path = file.toString()
35 | if (path.endsWith('.class')
36 | && !path.contains(File.separator + 'R$')
37 | && !path.endsWith(File.separator + 'R.class')) {
38 |
39 | def index = baseDir.length() + 1
40 | def className = path.substring(index).replace('\\', '.').replace('/', '.').replace('.class', '')
41 |
42 | CommonData.putClassAndPath(className, baseDir)
43 | // println className + ' -> ' + baseDir
44 | }
45 | return super.visitFile(file, attrs)
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/inner/CommonData.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.inner
19 |
20 | /**
21 | * @author RePlugin Team
22 | */
23 | public class CommonData {
24 |
25 | /** 保存类文件名和 class 文件路径的关系 */
26 | def static classAndPath = [:]
27 |
28 | /** App Module 的名称, 如 ':app', 传 '' 时,使用项目根目录为 App Module */
29 | def static String appModule
30 |
31 | def static String appPackage
32 |
33 | /** 执行 LoaderActivity 替换时,不需要替换的 Activity */
34 | def static ignoredActivities = []
35 |
36 | def static putClassAndPath(def className, def classFilePath) {
37 | classAndPath.put(className, classFilePath)
38 | }
39 |
40 | def static getClassPath(def className) {
41 | return classAndPath.get(className)
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/manifest/IManifest.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.manifest;
19 |
20 | /**
21 | * @author RePlugin Team
22 | */
23 | public interface IManifest {
24 |
25 | /**
26 | * 获取 AndroidManifest 中声明的所有 Activity
27 | */
28 | List getActivities()
29 |
30 | /**
31 | * 应用程序包名
32 | */
33 | String getPackageName()
34 | }
35 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/groovy/com/qihoo360/replugin/gradle/plugin/util/CmdUtil.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | *
16 | */
17 |
18 | package com.qihoo360.replugin.gradle.plugin.util
19 |
20 | import com.qihoo360.replugin.gradle.plugin.AppConstant
21 |
22 | /**
23 | * @author RePlugin Team
24 | */
25 | class CmdUtil {
26 |
27 | /**
28 | * 同步阻塞执行命令
29 | * @param cmd 命令
30 | * @return 命令执行完毕返回码
31 | */
32 | public static int syncExecute(String cmd){
33 |
34 | int cmdReturnCode
35 |
36 | try {
37 | println "${AppConstant.TAG} \$ ${cmd}"
38 |
39 | Process process = cmd.execute()
40 | process.inputStream.eachLine {
41 | println "${AppConstant.TAG} - ${it}"
42 | }
43 | process.waitFor()
44 |
45 | cmdReturnCode = process.exitValue()
46 |
47 | }catch (Exception e){
48 | System.err.println "${AppConstant.TAG} the cmd run error !!!"
49 | System.err.println "${AppConstant.TAG} ${e}"
50 | return -1
51 | }
52 |
53 | return cmdReturnCode
54 | }
55 |
56 | private CmdUtil() {}
57 | }
58 |
--------------------------------------------------------------------------------
/replugin-plugin-gradle-androidx/src/main/resources/META-INF/gradle-plugins/replugin-plugin-gradle-androidx.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 | #
17 |
18 | implementation-class=com.qihoo360.replugin.gradle.plugin.ReClassPlugin
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/README.md:
--------------------------------------------------------------------------------
1 | # RePlugin Plugin Library
2 |
3 | RePlugin Plugin Library是一个Java工程,由 **插件** 负责引入。
4 |
5 | 该类主要提供通过“Java反射”来调用主程序中 RePlugin Host Library 的相关接口,并提供“双向通信”的能力。
6 |
7 | 开发者需要依赖此Library,以让您的单品工程变成“插件”。请参见WiKi以了解接入方法。
8 |
9 | 有关RePlugin Plugin Library的详细描述,请访问我们的WiKi,以了解更多的内容。
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
18 |
19 | buildscript {
20 | repositories {
21 | jcenter()
22 | google()
23 | }
24 | dependencies {
25 | classpath 'com.android.tools.build:gradle:3.5.3'
26 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
27 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
28 | }
29 | }
30 |
31 | allprojects {
32 | repositories {
33 | jcenter()
34 | google()
35 | }
36 | }
37 |
38 | task clean(type: Delete) {
39 | delete rootProject.buildDir
40 | }
41 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | # use this file except in compliance with the License. You may obtain a copy of
6 | # the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed To in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations under
14 | # the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Gradle settings configured through the IDE *will override*
21 | # any settings specified in this file.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
30 |
31 | # When configured, Gradle will run in incubating parallel mode.
32 | # This option should only be used with decoupled projects. More details, visit
33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
34 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/froyohuang/RePlugin-AndroidX/5fc59fe4e573609dfd8fb01aa00a07f84b743c33/replugin-plugin-library-androidx/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Feb 19 16:02:46 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | apply plugin: 'com.android.library'
18 |
19 | android {
20 | compileSdkVersion 29
21 | buildToolsVersion "29.0.2"
22 |
23 | defaultConfig {
24 | minSdkVersion 14
25 | versionCode 1
26 | versionName "1.0"
27 | consumerProguardFiles 'replugin-library-rules.pro'
28 | }
29 |
30 | buildTypes {
31 | release {
32 | minifyEnabled true
33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34 | }
35 | }
36 |
37 | lintOptions {
38 | abortOnError false
39 | }
40 | }
41 |
42 | dependencies {
43 | implementation fileTree(dir: 'libs', include: ['*.jar'])
44 | compileOnly 'androidx.appcompat:appcompat:1.1.0'
45 | }
46 |
47 | project.ext.RP_ARTIFACT_ID = 'replugin-plugin-lib-androidx'
48 | apply from: '../../rp-publish.gradle'
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in ./sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 | -repackageclasses 'library'
27 |
28 | -keep class com.qihoo360.replugin.loader.a.** { public *; }
29 | -keep class com.qihoo360.replugin.loader.b.** { public *; }
30 | -keep class com.qihoo360.replugin.loader.p.** { public *; }
31 | -keep class com.qihoo360.replugin.loader.s.** { public *; }
32 | -keep class com.qihoo360.replugin.base.IPC { public *; }
33 | -keep class com.qihoo360.replugin.Entry { *; }
34 | -keep class com.qihoo360.replugin.RePlugin { public *; }
35 | -keep class com.qihoo360.replugin.model.PluginInfo { public *; }
36 |
37 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/replugin-library-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in ./sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 | -keep class com.qihoo360.replugin.Entry { *; }
27 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/src/main/aidl/com/qihoo360/loader2/IPlugin.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.loader2;
2 |
3 | /**
4 | * @author RePlugin Team
5 | */
6 | interface IPlugin {
7 |
8 | IBinder query(String name);
9 | }
10 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/src/main/aidl/com/qihoo360/replugin/IBinderGetter.aidl:
--------------------------------------------------------------------------------
1 | package com.qihoo360.replugin;
2 |
3 | /**
4 | * Binder的获取器,可用于延迟加载IBinder的情况。
5 | *
6 | * 目前用于:
7 | *
8 | * * RePlugin.registerGlobalBinderDelayed
9 | *
10 | * @author RePlugin Team
11 | */
12 | interface IBinderGetter {
13 |
14 | /**
15 | * 获取IBinder对象
16 | */
17 | IBinder get();
18 | }
19 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/src/main/java/com/qihoo360/replugin/Entry.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 | * use this file except in compliance with the License. You may obtain a copy of
7 | * the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed To in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations under
15 | * the License.
16 | */
17 |
18 | package com.qihoo360.replugin;
19 |
20 | import android.content.Context;
21 | import android.os.IBinder;
22 | import android.os.RemoteException;
23 |
24 | import com.qihoo360.loader2.IPlugin;
25 |
26 | /**
27 | * @author RePlugin Team
28 | */
29 | public class Entry {
30 |
31 | /**
32 | * @param context 插件上下文
33 | * @param cl HOST程序的类加载器
34 | * @param manager 插件管理器
35 | * @return
36 | */
37 | public static final IBinder create(Context context, ClassLoader cl, IBinder manager) {
38 | // 初始化插件框架
39 | RePluginFramework.init(cl);
40 | // 初始化Env
41 | RePluginEnv.init(context, cl, manager);
42 |
43 | return new IPlugin.Stub() {
44 | @Override
45 | public IBinder query(String name) throws RemoteException {
46 | return RePluginServiceManager.getInstance().getService(name);
47 | }
48 | };
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/replugin-plugin-lib-androidx/src/main/java/com/qihoo360/replugin/i/IPluginManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package com.qihoo360.replugin.i;
18 |
19 |
20 | /**
21 | * 负责插件和插件之间的interface互通,可通过插件Entry得到,也可通过wrapper类Factory直接调用
22 | *
23 | * @author RePlugin Team
24 | */
25 | public interface IPluginManager {
26 |
27 | /**
28 | * 自动分配插件进程
29 | */
30 | int PROCESS_AUTO = Integer.MIN_VALUE;
31 |
32 | /**
33 | * UI进程
34 | */
35 | int PROCESS_UI = -1;
36 |
37 | /**
38 | * 常驻进程
39 | */
40 | int PROCESS_PERSIST = -2;
41 | }
42 |
--------------------------------------------------------------------------------
/replugin-plugin-library-androidx/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2005-2017 Qihoo 360 Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed To in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | include ':replugin-plugin-lib-androidx'
--------------------------------------------------------------------------------
/rp-config-key.gradle:
--------------------------------------------------------------------------------
1 | // 此配置不要上传
2 | project.ext{
3 | // RP_BINTRAY_KEY = ''
4 | }
--------------------------------------------------------------------------------
/rp-config.gradle:
--------------------------------------------------------------------------------
1 | project.ext{
2 | RP_USER = 'froyohuang'
3 | RP_REPO = 'Replugin-AndroidX'
4 | RP_USERORG = 'froyo-github' // unset this if you an't belong to any orgnization
5 | //
6 | RP_SITE = 'https://github.com/froyohuang/RePlugin-AndroidX'
7 | RP_DESC = 'RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework'
8 | RP_EMAIL = 'alexhx87@gmail.com'
9 | RP_GIT_URL = 'https://github.com/froyohuang/RePlugin-AndroidX'
10 | RP_LICENSES_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
11 | RP_LICENSES_NAME = 'Apache-2.0'
12 | //
13 | RP_GROUP = 'io.github.froyohuang'
14 | RP_VERSION = '2.3.3.0'
15 | }
--------------------------------------------------------------------------------