├── .gitignore
├── Andromeda-Lib
├── .gitignore
├── build.gradle
├── gradle.properties
├── proguard-rules.pro
├── src
│ ├── androidTest
│ │ └── java
│ │ │ └── wang
│ │ │ └── imallen
│ │ │ └── blog
│ │ │ └── servicemanagerlib
│ │ │ └── ExampleInstrumentedTest.java
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── aidl
│ │ │ └── org
│ │ │ │ └── qiyi
│ │ │ │ └── video
│ │ │ │ └── svg
│ │ │ │ ├── ICommuStub.aidl
│ │ │ │ ├── IDispatcher.aidl
│ │ │ │ ├── IPCCallback.aidl
│ │ │ │ ├── IRemoteTransfer.aidl
│ │ │ │ ├── bean
│ │ │ │ └── BinderBean.aidl
│ │ │ │ └── event
│ │ │ │ └── Event.aidl
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── qiyi
│ │ │ │ └── video
│ │ │ │ └── svg
│ │ │ │ ├── Andromeda.java
│ │ │ │ ├── BinderWrapper.java
│ │ │ │ ├── backup
│ │ │ │ ├── EmergencyHandler.java
│ │ │ │ └── IEmergencyHandler.java
│ │ │ │ ├── bean
│ │ │ │ ├── BinderBean.java
│ │ │ │ └── ConnectionBean.java
│ │ │ │ ├── callback
│ │ │ │ └── BaseCallback.java
│ │ │ │ ├── config
│ │ │ │ └── Constants.java
│ │ │ │ ├── cursor
│ │ │ │ └── DispatcherCursor.java
│ │ │ │ ├── dispatcher
│ │ │ │ ├── Dispatcher.java
│ │ │ │ ├── DispatcherProvider.java
│ │ │ │ ├── DispatcherService.java
│ │ │ │ ├── RemoteGuardService.java
│ │ │ │ ├── event
│ │ │ │ │ ├── EventDispatcher.java
│ │ │ │ │ └── IEventDispatcher.java
│ │ │ │ └── service
│ │ │ │ │ ├── IServiceDispatcher.java
│ │ │ │ │ └── ServiceDispatcher.java
│ │ │ │ ├── event
│ │ │ │ ├── Event.java
│ │ │ │ └── EventListener.java
│ │ │ │ ├── fragment
│ │ │ │ ├── RemoteManagerFragment.java
│ │ │ │ └── SupportRemoteManagerFragment.java
│ │ │ │ ├── life
│ │ │ │ ├── ActivityFragLifecycle.java
│ │ │ │ ├── ApplicationLifecycle.java
│ │ │ │ ├── Lifecycle.java
│ │ │ │ └── LifecycleListener.java
│ │ │ │ ├── local
│ │ │ │ ├── ILocalServiceHub.java
│ │ │ │ └── LocalServiceHub.java
│ │ │ │ ├── log
│ │ │ │ └── Logger.java
│ │ │ │ ├── remote
│ │ │ │ ├── ConnectionManager.java
│ │ │ │ ├── IRemoteManager.java
│ │ │ │ ├── IRemoteManagerRetriever.java
│ │ │ │ ├── RemoteManager.java
│ │ │ │ └── RemoteManagerRetriever.java
│ │ │ │ ├── stub
│ │ │ │ └── CommuStubService.java
│ │ │ │ ├── transfer
│ │ │ │ ├── RemoteTransfer.java
│ │ │ │ ├── event
│ │ │ │ │ ├── EventTransfer.java
│ │ │ │ │ └── IEventTransfer.java
│ │ │ │ └── service
│ │ │ │ │ ├── IRemoteServiceTransfer.java
│ │ │ │ │ └── RemoteServiceTransfer.java
│ │ │ │ └── utils
│ │ │ │ ├── CollectionUtils.java
│ │ │ │ ├── IOUtils.java
│ │ │ │ ├── Preconditions.java
│ │ │ │ ├── ProcessUtils.java
│ │ │ │ ├── ServiceUtils.java
│ │ │ │ ├── StubServiceMatcher.java
│ │ │ │ └── Utils.java
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ └── test
│ │ └── java
│ │ └── wang
│ │ └── imallen
│ │ └── blog
│ │ └── servicemanagerlib
│ │ └── ExampleUnitTest.java
└── upload.gradle
├── Andromeda-Plugin
├── .gitignore
├── build.gradle
├── src
│ └── main
│ │ ├── groovy
│ │ └── org
│ │ │ └── qiyi
│ │ │ └── video
│ │ │ └── svg
│ │ │ └── plugin
│ │ │ ├── AndromedaPlugin.groovy
│ │ │ ├── AndromedaTransform.groovy
│ │ │ ├── ClassAppender.groovy
│ │ │ ├── extension
│ │ │ └── DispatcherExtension.groovy
│ │ │ ├── injector
│ │ │ └── StubServiceMatchInjector.groovy
│ │ │ ├── manifest
│ │ │ ├── ComponentReader.groovy
│ │ │ ├── IComponentReader.groovy
│ │ │ ├── IManifestParser.groovy
│ │ │ └── ManifestParser.groovy
│ │ │ ├── service
│ │ │ ├── IServiceGenerator.groovy
│ │ │ └── StubServiceGenerator.groovy
│ │ │ └── utils
│ │ │ └── JarUtils.groovy
│ │ └── resources
│ │ └── META-INF
│ │ └── gradle-plugins
│ │ └── org.qiyi.svg.plugin.properties
└── upload.gradle
├── CHINESE_README.md
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── wang
│ │ └── imallen
│ │ └── blog
│ │ └── servicemanager
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── wang
│ │ │ └── imallen
│ │ │ └── blog
│ │ │ └── servicemanager
│ │ │ ├── CheckPearImpl.java
│ │ │ ├── CustomApp.java
│ │ │ ├── ICheckPear.java
│ │ │ ├── MainActivity.java
│ │ │ ├── lifecycle
│ │ │ ├── LifecycleTestActivity.java
│ │ │ ├── ViewPagerActivity.java
│ │ │ ├── ViewTestActivity.java
│ │ │ └── frag
│ │ │ │ ├── CustomFragment.java
│ │ │ │ ├── CustomFragmentAdapter.java
│ │ │ │ ├── CustomSupportFragment.java
│ │ │ │ ├── FragActivity.java
│ │ │ │ ├── MyPicFrag.java
│ │ │ │ ├── MyTextFrag.java
│ │ │ │ ├── PicFrag.java
│ │ │ │ ├── SupportFragActivity.java
│ │ │ │ └── TextFrag.java
│ │ │ ├── test
│ │ │ └── TestActivity1.java
│ │ │ └── utils
│ │ │ ├── ToastUtil.java
│ │ │ └── ToastUtils.java
│ └── res
│ │ ├── color
│ │ └── selector_blue.xml
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable-xxhdpi
│ │ ├── ic_menu_home_normal.png
│ │ └── ic_menu_home_selected.png
│ │ ├── drawable
│ │ ├── begining.jpg
│ │ ├── ghoul.jpeg
│ │ ├── ic_launcher_background.xml
│ │ └── selector_menu_home.xml
│ │ ├── layout
│ │ ├── activity_detail.xml
│ │ ├── activity_frag.xml
│ │ ├── activity_lifecycle_test.xml
│ │ ├── activity_local_service_annotation_demo.xml
│ │ ├── activity_local_service_by_anno_demo.xml
│ │ ├── activity_main.xml
│ │ ├── activity_reg_remote_service_by_anno.xml
│ │ ├── activity_support_frag.xml
│ │ ├── activity_test1.xml
│ │ ├── activity_use_local_service_by_anno.xml
│ │ ├── activity_use_remote_service_by_anno.xml
│ │ ├── activity_view_pager.xml
│ │ ├── activity_view_test.xml
│ │ ├── frag_layout.xml
│ │ ├── pic_layout.xml
│ │ └── support_frag_layout.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── wang
│ └── imallen
│ └── blog
│ └── servicemanager
│ └── ExampleUnitTest.java
├── applemodule
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── wang
│ │ └── imallen
│ │ └── blog
│ │ └── applemodule
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── debug
│ │ └── AndroidManifest.xml
│ ├── java
│ │ └── wang
│ │ │ └── imallen
│ │ │ └── blog
│ │ │ └── applemodule
│ │ │ ├── event
│ │ │ └── EventActivity.java
│ │ │ ├── local
│ │ │ └── LocalServiceDemo.java
│ │ │ ├── remote
│ │ │ ├── Banana2Activity.java
│ │ │ ├── BananaActivity.java
│ │ │ └── RemoteServiceDemo.java
│ │ │ └── service
│ │ │ ├── BuyAppleImpl.java
│ │ │ └── CheckApple.java
│ └── res
│ │ ├── layout
│ │ ├── activity_apple.xml
│ │ ├── activity_banana.xml
│ │ ├── activity_banana2.xml
│ │ ├── activity_debug_main.xml
│ │ ├── activity_event.xml
│ │ ├── activity_inject_demo.xml
│ │ └── activity_local_service_demo.xml
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── wang
│ └── imallen
│ └── blog
│ └── applemodule
│ └── ExampleUnitTest.java
├── build.gradle
├── buildSrc
├── .gitignore
├── build.gradle
└── src
│ └── main
│ ├── groovy
│ └── org
│ │ └── qiyi
│ │ └── video
│ │ └── svg
│ │ └── plugin
│ │ ├── AndromedaPlugin.groovy
│ │ ├── AndromedaTransform.groovy
│ │ ├── ClassAppender.groovy
│ │ ├── extension
│ │ └── DispatcherExtension.groovy
│ │ ├── injector
│ │ └── StubServiceMatchInjector.groovy
│ │ ├── manifest
│ │ ├── ComponentReader.groovy
│ │ ├── IComponentReader.groovy
│ │ ├── IManifestParser.groovy
│ │ └── ManifestParser.groovy
│ │ ├── service
│ │ ├── IServiceGenerator.groovy
│ │ └── StubServiceGenerator.groovy
│ │ └── utils
│ │ └── JarUtils.groovy
│ └── resources
│ └── META-INF
│ └── gradle-plugins
│ └── org.qiyi.svg.buildsrc_plugin.properties
├── cherrymodule
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── wang
│ │ └── imallen
│ │ └── blog
│ │ └── cherrymodule
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── wang
│ │ │ └── imallen
│ │ │ └── blog
│ │ │ └── cherrymodule
│ │ │ └── CherryActivity.java
│ └── res
│ │ ├── layout
│ │ ├── activity_cherry.xml
│ │ ├── activity_use_local_service_from_apple.xml
│ │ └── activity_use_remote_service_from_apple_module.xml
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── wang
│ └── imallen
│ └── blog
│ └── cherrymodule
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── moduleexportlib
├── .gitignore
├── build.gradle
├── gradle.properties
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── wang
│ │ └── imallen
│ │ └── blog
│ │ └── moduleexportlib
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── aidl
│ │ └── wang
│ │ │ └── imallen
│ │ │ └── blog
│ │ │ └── moduleexportlib
│ │ │ ├── apple
│ │ │ └── IBuyApple.aidl
│ │ │ ├── cherry
│ │ │ └── IBuyCherry.aidl
│ │ │ └── show
│ │ │ └── IDisplayTalkShow.aidl
│ ├── java
│ │ └── wang
│ │ │ └── imallen
│ │ │ └── blog
│ │ │ └── moduleexportlib
│ │ │ ├── apple
│ │ │ └── ICheckApple.java
│ │ │ ├── cherry
│ │ │ ├── Cherry.java
│ │ │ └── IDeliverCherry.java
│ │ │ └── event
│ │ │ └── EventConstants.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── wang
│ └── imallen
│ └── blog
│ └── moduleexportlib
│ └── ExampleUnitTest.java
├── res
├── Andromeda_Module_arch.png
├── StarBridge_service_arch.png
├── StarBridge_star_diagram.png
└── qq_group.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 | gradle.properties
18 |
19 |
20 | # Eclipse project files
21 | .classpath
22 | .project
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Intellij project files
28 | *.iml
29 | *.ipr
30 | *.iws
31 | .idea/
32 | out/
33 | build/
34 | **/build/
35 |
36 | .DS_Store
37 | .DS_Store?
38 |
39 | .gradle
40 | production/
41 |
42 | signing.properties
43 |
44 | *~
45 | #extras/external_tagsoup/
46 |
47 | module/
48 | captures/
49 |
50 | *.pub
51 |
52 | freeline/
53 | freeline.py
54 | freeline_project_description.json
--------------------------------------------------------------------------------
/Andromeda-Lib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Andromeda-Lib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'maven'
3 |
4 | android {
5 | compileSdkVersion 26
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 26
10 | versionCode maven_config.version_code
11 | versionName maven_config.version_name
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 |
17 | aidlPackageWhiteList "org/qiyi/video/svg/IPCCallback.aidl"
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | ext{
27 | JAR_NAME='svglib'
28 | JAR_VERSION=maven_config.version_name
29 | JAR_DEST_DIR='build/outputs'
30 | ORIGINAL_JAR_PATH='build/intermediates/bundles/release/classes.jar'
31 | }
32 |
33 | project.afterEvaluate{
34 | Task cleanSdk=tasks.getByPath('clean')
35 | Task bundleSdk=tasks.getByPath('bundleRelease')
36 |
37 | bundleSdk.mustRunAfter cleanSdk
38 | makeJar.dependsOn cleanSdk,bundleSdk
39 | }
40 |
41 | task makeJar(type:Jar){
42 | from zipTree(file(ORIGINAL_JAR_PATH))
43 | baseName "${JAR_NAME}-${JAR_VERSION}"
44 | destinationDir file(JAR_DEST_DIR)
45 | }
46 |
47 | }
48 |
49 | uploadArchives{
50 | repositories.mavenDeployer{
51 | repository(url:NEXUS_REPO_URL){
52 | authentication(userName:maven_config.userName,password:maven_config.passWord)
53 | }
54 | pom.groupId=maven_config.groupId
55 | pom.artifactId="svglib"
56 | pom.version=maven_config.version_name
57 |
58 | }
59 | }
60 |
61 | dependencies {
62 | implementation fileTree(dir: 'libs', include: ['*.jar'])
63 |
64 | implementation 'com.android.support:appcompat-v7:26.0.2'
65 | testImplementation 'junit:junit:4.12'
66 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
67 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
68 | }
69 |
70 | apply from: 'upload.gradle'
--------------------------------------------------------------------------------
/Andromeda-Lib/gradle.properties:
--------------------------------------------------------------------------------
1 | ARTIFACTID=svglib
2 | LIBRARY_VERSION=0.0.8
3 |
4 | LOCAL_REPO_URL=file:///Users/wangallen/Study/Android/local_maven/repo
5 |
6 | URL=http://maven.mbd.qiyi.domain/nexus/content/repositories/mcg-archNEXUS_REPO_U
--------------------------------------------------------------------------------
/Andromeda-Lib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/androidTest/java/wang/imallen/blog/servicemanagerlib/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanagerlib;
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 | * Instrumented 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("wang.imallen.blog.servicemanagerlib.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
15 |
16 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/aidl/org/qiyi/video/svg/ICommuStub.aidl:
--------------------------------------------------------------------------------
1 | // ICommuStub.aidl
2 | package org.qiyi.video.svg;
3 |
4 | // Declare any non-default types here with import statements
5 | //这个接口只是起一个占位作用,暂时是不用的
6 | interface ICommuStub {
7 |
8 | void commu(in Bundle args);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/aidl/org/qiyi/video/svg/IDispatcher.aidl:
--------------------------------------------------------------------------------
1 | // IRemoteService.aidl
2 | package org.qiyi.video.svg;
3 | import org.qiyi.video.svg.event.Event;
4 | // Declare any non-default types here with import statements
5 | import org.qiyi.video.svg.bean.BinderBean;
6 |
7 | interface IDispatcher {
8 |
9 | BinderBean getTargetBinder(String serviceCanonicalName);
10 | //IBinder getTargetBinderLocked(String serviceCanonicalName);
11 | //这个uri其实就是Target Service的action
12 | IBinder fetchTargetBinder(String uri);
13 |
14 | void registerRemoteTransfer(int pid,IBinder remoteTransferBinder);
15 |
16 | void registerRemoteService(String serviceCanonicalName,String processName,IBinder binder);
17 |
18 | void unregisterRemoteService(String serviceCanonicalName);
19 |
20 | void publish(in Event event);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/aidl/org/qiyi/video/svg/IPCCallback.aidl:
--------------------------------------------------------------------------------
1 | // Callback.aidl
2 | package org.qiyi.video.svg;
3 | import android.os.Bundle;
4 | // Declare any non-default types here with import statements
5 |
6 | interface IPCCallback {
7 | void onSuccess(in Bundle result);
8 | void onFail(String reason);
9 | }
10 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/aidl/org/qiyi/video/svg/IRemoteTransfer.aidl:
--------------------------------------------------------------------------------
1 | // IServiceRegister.aidl
2 | package org.qiyi.video.svg;
3 | import org.qiyi.video.svg.event.Event;
4 | // Declare any non-default types here with import statements
5 | //由于主要是起一个转接的作用,所以取名Transfer
6 | interface IRemoteTransfer {
7 | //这个要加上oneway关键字比较好,反正我们又不需要返回值
8 | oneway void registerDispatcher(IBinder dispatcherBinder);
9 | //从Dispatcher发往各个进程,如果进程中有相应IBinder的缓存,则要马上清除
10 | oneway void unregisterRemoteService(String serviceCanonicalName);
11 |
12 | oneway void notify(in Event event);
13 | }
14 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/aidl/org/qiyi/video/svg/bean/BinderBean.aidl:
--------------------------------------------------------------------------------
1 | // BinderBean.aidl
2 | package org.qiyi.video.svg.bean;
3 |
4 | // Declare any non-default types here with import statements
5 |
6 | parcelable BinderBean;
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/aidl/org/qiyi/video/svg/event/Event.aidl:
--------------------------------------------------------------------------------
1 | // Event.aidl
2 | package org.qiyi.video.svg.event;
3 |
4 | // Declare any non-default types here with import statements
5 |
6 | parcelable Event;
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/BinderWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg;
26 |
27 | import android.os.IBinder;
28 | import android.os.Parcel;
29 | import android.os.Parcelable;
30 |
31 | /**
32 | * Created by wangallen on 2018/1/8.
33 | */
34 |
35 | public class BinderWrapper implements Parcelable {
36 |
37 | private final IBinder binder;
38 |
39 | public BinderWrapper(IBinder binder) {
40 | this.binder = binder;
41 | }
42 |
43 | public BinderWrapper(Parcel in) {
44 | this.binder = in.readStrongBinder();
45 | }
46 |
47 | public IBinder getBinder() {
48 | return binder;
49 | }
50 |
51 | @Override
52 | public int describeContents() {
53 | return 0;
54 | }
55 |
56 | @Override
57 | public void writeToParcel(Parcel dest, int flags) {
58 | dest.writeStrongBinder(binder);
59 | }
60 |
61 | public static final Creator CREATOR = new Creator() {
62 | @Override
63 | public BinderWrapper createFromParcel(Parcel source) {
64 | return new BinderWrapper(source);
65 | }
66 |
67 | @Override
68 | public BinderWrapper[] newArray(int size) {
69 | return new BinderWrapper[size];
70 | }
71 | };
72 | }
73 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/backup/EmergencyHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.backup;
26 |
27 | import android.content.Context;
28 | import android.content.Intent;
29 |
30 | import org.qiyi.video.svg.utils.ServiceUtils;
31 | import org.qiyi.video.svg.utils.StubServiceMatcher;
32 |
33 | /**
34 | * Created by wangallen on 2018/4/18.
35 | */
36 |
37 | public class EmergencyHandler implements IEmergencyHandler {
38 |
39 | @Override
40 | public void handleBinderDied(Context context, String serverProcessName) {
41 | Intent intent = StubServiceMatcher.matchIntent(context, serverProcessName);
42 | if (intent != null) {
43 | ServiceUtils.startServiceSafely(context, intent);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/backup/IEmergencyHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.backup;
26 |
27 | import android.content.Context;
28 |
29 | /**
30 | * Created by wangallen on 2018/4/18.
31 | */
32 |
33 | public interface IEmergencyHandler {
34 | void handleBinderDied(Context context, String serverProcessName);
35 | }
36 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/bean/BinderBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.bean;
26 |
27 | import android.os.IBinder;
28 | import android.os.Parcel;
29 | import android.os.Parcelable;
30 |
31 | /**
32 | * Created by wangallen on 2018/1/10.
33 | */
34 |
35 | public class BinderBean implements Parcelable {
36 |
37 | private IBinder binder;
38 | private String processName;
39 |
40 | public BinderBean() {
41 |
42 | }
43 |
44 | public BinderBean(IBinder binder, String processName) {
45 | this.binder = binder;
46 | this.processName = processName;
47 | }
48 |
49 | public BinderBean(Parcel in) {
50 | this.binder = in.readStrongBinder();
51 | this.processName = in.readString();
52 | }
53 |
54 | @Override
55 | public int describeContents() {
56 | return 0;
57 | }
58 |
59 | @Override
60 | public void writeToParcel(Parcel dest, int flags) {
61 | dest.writeStrongBinder(binder);
62 | dest.writeString(processName);
63 | }
64 |
65 | public static final Parcelable.Creator CREATOR = new Creator() {
66 | @Override
67 | public BinderBean createFromParcel(Parcel source) {
68 | return new BinderBean(source);
69 | }
70 |
71 | @Override
72 | public BinderBean[] newArray(int size) {
73 | return new BinderBean[size];
74 | }
75 | };
76 |
77 | public IBinder getBinder() {
78 | return binder;
79 | }
80 |
81 | public String getProcessName() {
82 | return processName;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/bean/ConnectionBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.bean;
26 |
27 | import android.content.ServiceConnection;
28 |
29 | /**
30 | * Created by wangallen on 2018/3/29.
31 | */
32 |
33 | public class ConnectionBean {
34 |
35 | private ServiceConnection serviceConnection;
36 |
37 | private int refCount;
38 |
39 | public ConnectionBean(ServiceConnection connection) {
40 | this.serviceConnection = connection;
41 | this.refCount = 1;
42 | }
43 |
44 | public void increaseRef() {
45 | ++refCount;
46 | }
47 |
48 | public void decreaseRef() {
49 | --refCount;
50 | }
51 |
52 | public ServiceConnection getServiceConnection() {
53 | return serviceConnection;
54 | }
55 |
56 | public int getRefCount() {
57 | return refCount;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/callback/BaseCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.callback;
26 |
27 | import android.os.Bundle;
28 | import android.os.Handler;
29 | import android.os.Looper;
30 | import android.os.RemoteException;
31 |
32 | import org.qiyi.video.svg.IPCCallback;
33 |
34 | /**
35 | * Created by wangallen on 2018/1/17.
36 | */
37 |
38 | public abstract class BaseCallback extends IPCCallback.Stub {
39 |
40 | private Handler handler = new Handler(Looper.getMainLooper());
41 |
42 | @Override
43 | public final void onSuccess(final Bundle result) throws RemoteException {
44 | handler.post(new Runnable() {
45 | @Override
46 | public void run() {
47 | onSucceed(result);
48 | }
49 | });
50 | }
51 |
52 | @Override
53 | public final void onFail(final String reason) throws RemoteException {
54 | handler.post(new Runnable() {
55 | @Override
56 | public void run() {
57 | onFailed(reason);
58 | }
59 | });
60 | }
61 |
62 | public abstract void onSucceed(Bundle result);
63 |
64 | public abstract void onFailed(String reason);
65 | }
66 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/config/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.config;
26 |
27 | /**
28 | * Created by wangallen on 2018/1/8.
29 | */
30 |
31 | public class Constants {
32 |
33 | public static final String KEY_MODULE = "KeyModule";
34 |
35 | public static final String KEY_SERVICE_NAME = "KeyServiceName";
36 |
37 | public static final String KEY_BINDER_WRAPPER = "KeyBinderWrapper";
38 |
39 | public static final String REMOTE_GUARD_SERVICE_MODULE = "RemoteGuardServiceModule";
40 |
41 | public static final String APPLE_PROCESS_SEVICE_ACTION = "qiyi.apple.process.stub";
42 |
43 | public static final String PLUGIN1_PROCESS_SERVICE_ACTION = "qiyi.plugin1.process.stub";
44 |
45 | ////////////////////////////
46 | public static final String DISPATCH_REGISTER_SERVICE_ACTION = "org.qiyi.video.svg.dispatch_register_service";
47 |
48 | public static final String DISPATCH_UNREGISTER_SERVICE_ACTION = "org.qiyi.video.svg.dispatch_unregister_service";
49 |
50 | public static final String DISPATCH_EVENT_ACTION = "org.qiyi.video.svg.dispatch_event";
51 |
52 | public static final String KEY_REMOTE_TRANSFER_WRAPPER = "KeyDispatcherRegisterWrapper";
53 |
54 | public static final String KEY_BUSINESS_BINDER_WRAPPER = "KeyBusinessBinder";
55 | //public static final String KEY_MESSENGER_BINDER_WRAPPER = "KeyMessengerBinder";
56 |
57 | public static final String KEY_POSTMAN_BINDER_WRAPPER = "KeyPostmanBinder";
58 |
59 | public static final String KEY_PID = "KeyPid";
60 |
61 | public static final String KEY_PROCESS_NAME = "KeyProcessName";
62 |
63 | public static final String KEY_EVENT = "KeyEvent";
64 |
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/dispatcher/DispatcherProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.dispatcher;
26 |
27 | import android.content.ContentProvider;
28 | import android.content.ContentValues;
29 | import android.database.Cursor;
30 | import android.net.Uri;
31 |
32 | import org.qiyi.video.svg.cursor.DispatcherCursor;
33 | import org.qiyi.video.svg.log.Logger;
34 |
35 |
36 | /**
37 | * Created by wangallen on 2018/3/19.
38 | */
39 |
40 | public class DispatcherProvider extends ContentProvider {
41 |
42 | public static final String PROJECTION_MAIN[] = {"main"};
43 |
44 | //public static final Uri URI = Uri.parse("content://org.qiyi.video.svg.dispatcher/main");
45 | public static final String URI_SUFFIX="qiyi.svg.dispatcher";
46 |
47 | @Override
48 | public boolean onCreate() {
49 | return false;
50 | }
51 |
52 | @Override
53 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
54 | Logger.d("DispatcherProvider-->query,uri:" + uri.getAuthority());
55 | return DispatcherCursor.generateCursor(Dispatcher.getInstance().asBinder());
56 | }
57 |
58 |
59 | @Override
60 | public String getType(Uri uri) {
61 | return null;
62 | }
63 |
64 |
65 | @Override
66 | public Uri insert(Uri uri, ContentValues values) {
67 | return null;
68 | }
69 |
70 | @Override
71 | public int delete(Uri uri, String selection, String[] selectionArgs) {
72 | return 0;
73 | }
74 |
75 | @Override
76 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
77 | return 0;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/dispatcher/event/IEventDispatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.dispatcher.event;
26 |
27 | import android.os.IBinder;
28 | import android.os.RemoteException;
29 |
30 | import org.qiyi.video.svg.event.Event;
31 |
32 | /**
33 | * Created by wangallen on 2018/1/24.
34 | */
35 |
36 | public interface IEventDispatcher {
37 |
38 | void registerRemoteTransferLocked(int pid, IBinder transferBinder);
39 |
40 | void publishLocked(Event event) throws RemoteException;
41 |
42 | void unregisterRemoteServiceLocked(String serviceCanonicalName) throws RemoteException;
43 | }
44 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/dispatcher/service/IServiceDispatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.dispatcher.service;
26 |
27 | import android.os.IBinder;
28 | import android.os.RemoteException;
29 |
30 | import org.qiyi.video.svg.bean.BinderBean;
31 |
32 | /**
33 | * Created by wangallen on 2018/1/24.
34 | */
35 |
36 | public interface IServiceDispatcher {
37 |
38 | //IBinder getTargetBinderLocked(String serviceCanonicalName) throws RemoteException;
39 | BinderBean getTargetBinderLocked(String serviceCanonicalName) throws RemoteException;
40 |
41 | void registerRemoteServiceLocked(String serviceCanonicalName, String processName, IBinder binder) throws RemoteException;
42 |
43 | //void unregisterRemoteServiceLocked(String serviceCanonicalName) throws RemoteException;
44 | void removeBinderCacheLocked(String serviceCanonicalName);
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/event/Event.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.event;
26 |
27 | import android.os.Bundle;
28 | import android.os.Parcel;
29 | import android.os.Parcelable;
30 |
31 | /**
32 | * Created by wangallen on 2018/1/24.
33 | */
34 |
35 | public class Event implements Parcelable {
36 |
37 | private String name;
38 |
39 | private Bundle data;
40 |
41 | public Event() {
42 | }
43 |
44 | public Event(String name, Bundle data) {
45 | this.name = name;
46 | this.data = data;
47 | }
48 |
49 | public Event(Parcel in) {
50 | this.name = in.readString();
51 | this.data = in.readBundle(Event.class.getClassLoader());
52 | }
53 |
54 | public static final Creator CREATOR = new Creator() {
55 | @Override
56 | public Event createFromParcel(Parcel source) {
57 | return new Event(source);
58 | }
59 |
60 | @Override
61 | public Event[] newArray(int size) {
62 | return new Event[size];
63 | }
64 | };
65 |
66 | @Override
67 | public int describeContents() {
68 | return 0;
69 | }
70 |
71 | @Override
72 | public void writeToParcel(Parcel dest, int flags) {
73 | dest.writeString(name);
74 | dest.writeBundle(data);
75 | }
76 |
77 | public String getName() {
78 | return name;
79 | }
80 |
81 | public void setName(String name) {
82 | this.name = name;
83 | }
84 |
85 | public Bundle getData() {
86 | return data;
87 | }
88 |
89 | public void setData(Bundle data) {
90 | this.data = data;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/event/EventListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.event;
26 |
27 | /**
28 | * Created by wangallen on 2018/1/24.
29 | */
30 |
31 | public interface EventListener {
32 |
33 | void onNotify(Event event);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/life/ApplicationLifecycle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.life;
26 |
27 | /**
28 | * Created by wangallen on 2018/3/27.
29 | */
30 |
31 | public class ApplicationLifecycle implements Lifecycle{
32 |
33 | @Override
34 | public void addListener(LifecycleListener listener) {
35 | listener.onStart();
36 | }
37 |
38 | @Override
39 | public void removeListener(LifecycleListener listener) {
40 |
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/life/Lifecycle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.life;
26 |
27 | /**
28 | * Created by wangallen on 2018/3/27.
29 | */
30 |
31 | public interface Lifecycle {
32 |
33 | void addListener(LifecycleListener listener);
34 |
35 | void removeListener(LifecycleListener listener);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/life/LifecycleListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.life;
26 |
27 | /**
28 | * Created by wangallen on 2018/3/27.
29 | */
30 |
31 | public interface LifecycleListener {
32 |
33 | void onStart();
34 |
35 | void onStop();
36 |
37 | void onDestroy();
38 | }
39 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/local/ILocalServiceHub.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.local;
26 |
27 | /**
28 | * Created by wangallen on 2018/1/8.
29 | */
30 |
31 | public interface ILocalServiceHub {
32 |
33 | Object getLocalService(String module);
34 |
35 | void registerService(String module, Object serviceImpl);
36 |
37 | void unregisterService(String module);
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/local/LocalServiceHub.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.local;
26 |
27 | import java.util.Map;
28 | import java.util.concurrent.ConcurrentHashMap;
29 |
30 | /**
31 | * Created by wangallen on 2018/1/8.
32 | */
33 |
34 | public class LocalServiceHub implements ILocalServiceHub {
35 |
36 | private static LocalServiceHub sInstance;
37 |
38 | public static LocalServiceHub getInstance() {
39 | if (null == sInstance) {
40 | synchronized (LocalServiceHub.class) {
41 | if (null == sInstance) {
42 | sInstance = new LocalServiceHub();
43 | }
44 | }
45 | }
46 | return sInstance;
47 | }
48 |
49 | private Map serviceMap = new ConcurrentHashMap<>();
50 |
51 | private LocalServiceHub() {
52 | }
53 |
54 |
55 | @Override
56 | public Object getLocalService(String module) {
57 | return serviceMap.get(module);
58 | }
59 |
60 | @Override
61 | public void registerService(String module, Object serviceImpl) {
62 | serviceMap.put(module, serviceImpl);
63 | }
64 |
65 | @Override
66 | public void unregisterService(String module) {
67 | serviceMap.remove(module);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/log/Logger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.log;
26 |
27 | import android.util.Log;
28 |
29 | /**
30 | * Created by wangallen on 2018/1/15.
31 | */
32 |
33 | public class Logger {
34 |
35 | private static final String TAG = "Andromeda";
36 |
37 | public static void i(String msg) {
38 | Log.i(TAG, msg);
39 | }
40 |
41 | public static void d(String msg) {
42 | Log.d(TAG, msg);
43 | }
44 |
45 | public static void e(String msg) {
46 | Log.e(TAG, msg);
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/remote/IRemoteManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.remote;
26 |
27 | import android.os.IBinder;
28 |
29 | /**
30 | * Created by wangallen on 2018/3/26.
31 | */
32 |
33 | public interface IRemoteManager {
34 |
35 | IBinder getRemoteService(Class> serviceClass);
36 |
37 | @Deprecated
38 | IBinder getRemoteService(String serviceCanonicalName);
39 |
40 | /*
41 | void unbind(Class> serviceClass);
42 |
43 | @Deprecated
44 | void unbind(String serviceCanonicalName);
45 | */
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/remote/IRemoteManagerRetriever.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.remote;
26 |
27 | import android.app.Activity;
28 | import android.content.Context;
29 | import android.support.v4.app.Fragment;
30 | import android.support.v4.app.FragmentActivity;
31 | import android.view.View;
32 |
33 | /**
34 | * Created by wangallen on 2018/3/27.
35 | */
36 |
37 | public interface IRemoteManagerRetriever {
38 |
39 | IRemoteManager get(Fragment fragment);
40 |
41 | IRemoteManager get(android.app.Fragment fragment);
42 |
43 | IRemoteManager get(FragmentActivity fragActivity);
44 |
45 | IRemoteManager get(Activity activity);
46 |
47 | IRemoteManager get(Context context);
48 |
49 | IRemoteManager get(View view);
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/transfer/event/IEventTransfer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.transfer.event;
26 |
27 | import org.qiyi.video.svg.event.Event;
28 | import org.qiyi.video.svg.event.EventListener;
29 |
30 | /**
31 | * Created by wangallen on 2018/1/25.
32 | */
33 |
34 | public interface IEventTransfer {
35 |
36 | void subscribeEvent(String name, EventListener listener);
37 |
38 | void unsubscribeEvent(EventListener listener);
39 |
40 | void publish(Event event);
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/transfer/service/IRemoteServiceTransfer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.transfer.service;
26 |
27 | import android.os.IBinder;
28 |
29 | import org.qiyi.video.svg.bean.BinderBean;
30 |
31 | /**
32 | * Created by wangallen on 2018/1/9.
33 | */
34 |
35 | public interface IRemoteServiceTransfer {
36 |
37 | //IBinder getRemoteService(LifecycleOwner owner, String serviceCanonicalName);
38 |
39 | //IBinder getRemoteService(String serviceCanonicalName);
40 | BinderBean getRemoteServiceBean(String serviceCanonicalName);
41 |
42 | //其实是registerStubService
43 | void registerStubService(String serviceCanonicalName, IBinder stubBinder);
44 |
45 | /**
46 | * 要注销本进程的某个服务,注意它与
47 | *
48 | * @param serviceCanonicalName
49 | */
50 | void unregisterStubService(String serviceCanonicalName);
51 | }
52 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/utils/CollectionUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.utils;
26 |
27 | import android.support.annotation.NonNull;
28 |
29 | import java.util.ArrayList;
30 | import java.util.Collection;
31 | import java.util.List;
32 |
33 | /**
34 | * Created by wangallen on 2018/3/27.
35 | */
36 |
37 | public final class CollectionUtils {
38 |
39 | private CollectionUtils() {
40 | }
41 |
42 | public static List getSnapshot(@NonNull Collection other) {
43 | // toArray creates a new ArrayList internally and does not guarantee that the values it contains
44 | // are non-null. Collections.addAll in ArrayList uses toArray internally and therefore also
45 | // doesn't guarantee that entries are non-null. WeakHashMap's iterator does avoid returning null
46 | // and is therefore safe to use. See #322, #2262.
47 | List result = new ArrayList<>(other.size());
48 | for (T item : other) {
49 | if (item != null) {
50 | result.add(item);
51 | }
52 | }
53 | return result;
54 | }
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/utils/IOUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.utils;
26 |
27 | import android.database.Cursor;
28 |
29 | /**
30 | * Created by wangallen on 2018/3/20.
31 | */
32 |
33 | public final class IOUtils {
34 |
35 | private IOUtils() {
36 | }
37 |
38 | public static void closeQuietly(Cursor cursor) {
39 | try {
40 | if (cursor != null) {
41 | cursor.close();
42 | }
43 | } catch (Exception ex) {
44 | ex.printStackTrace();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/utils/Preconditions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.utils;
26 |
27 | import android.support.annotation.NonNull;
28 | import android.support.annotation.Nullable;
29 | import android.text.TextUtils;
30 |
31 | import java.util.Collection;
32 |
33 | /**
34 | * Contains common assertions.
35 | */
36 | public final class Preconditions {
37 |
38 | private Preconditions() {
39 | // Utility class.
40 | }
41 |
42 | public static void checkArgument(boolean expression, @NonNull String message) {
43 | if (!expression) {
44 | throw new IllegalArgumentException(message);
45 | }
46 | }
47 |
48 | @NonNull
49 | public static T checkNotNull(@Nullable T arg) {
50 | return checkNotNull(arg, "Argument must not be null");
51 | }
52 |
53 | @NonNull
54 | public static T checkNotNull(@Nullable T arg, @NonNull String message) {
55 | if (arg == null) {
56 | throw new NullPointerException(message);
57 | }
58 | return arg;
59 | }
60 |
61 | @NonNull
62 | public static String checkNotEmpty(@Nullable String string) {
63 | if (TextUtils.isEmpty(string)) {
64 | throw new IllegalArgumentException("Must not be null or empty");
65 | }
66 | return string;
67 | }
68 |
69 | @NonNull
70 | public static , Y> T checkNotEmpty(@NonNull T collection) {
71 | if (collection.isEmpty()) {
72 | throw new IllegalArgumentException("Must not be empty.");
73 | }
74 | return collection;
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/utils/ServiceUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.utils;
26 |
27 | import android.content.Context;
28 | import android.content.Intent;
29 | import android.content.ServiceConnection;
30 |
31 | import org.qiyi.video.svg.log.Logger;
32 |
33 | /**
34 | * Created by wangallen on 2018/2/26.
35 | */
36 |
37 | public class ServiceUtils {
38 |
39 | private ServiceUtils() {
40 | }
41 |
42 | /**
43 | * 考虑到Android 8.0在后台调用startService时会抛出IllegalStateException
44 | *
45 | * @param context
46 | * @param intent
47 | */
48 | public static void startServiceSafely(Context context, Intent intent) {
49 | if (null == context) {
50 | return;
51 | }
52 | try {
53 | context.startService(intent);
54 | } catch (IllegalStateException ex) {
55 | ex.printStackTrace();
56 | }
57 | }
58 |
59 | public static void unbindSafely(Context context, ServiceConnection connection) {
60 | if (context == null || connection == null) {
61 | return;
62 | }
63 | try {
64 | context.unbindService(connection);
65 | } catch (Exception ex) {
66 | Logger.e("unbind service exception:" + ex.getMessage());
67 | ex.printStackTrace();
68 | }
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/java/org/qiyi/video/svg/utils/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.utils;
26 |
27 | import android.os.Looper;
28 |
29 | /**
30 | * Created by wangallen on 2018/3/27.
31 | */
32 |
33 | public final class Utils {
34 |
35 | private Utils() {
36 | }
37 |
38 | public static boolean isOnBackgroundThread() {
39 | return !isOnMainThread();
40 | }
41 |
42 | public static boolean isOnMainThread() {
43 | return Looper.myLooper() == Looper.getMainLooper();
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ServiceManagerLib
3 |
4 |
--------------------------------------------------------------------------------
/Andromeda-Lib/src/test/java/wang/imallen/blog/servicemanagerlib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanagerlib;
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 | }
--------------------------------------------------------------------------------
/Andromeda-Lib/upload.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.novoda.bintray-release'
2 |
3 | def libDesc='A lightweight library to make Android IPC convenient'
4 | def libLicense='BSD 3-Clause'
5 |
6 | publish{
7 | repoName="starbridge"
8 | userOrg='allenwang'
9 | groupId='org.qiyi.video.svg'
10 | artifactId='core'
11 | publishVersion=maven_config.version_name
12 | desc="$libDesc"
13 | }
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Andromeda-Plugin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Andromeda-Plugin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'groovy'
2 | apply plugin: 'maven'
3 |
4 | uploadArchives{
5 | repositories.mavenDeployer{
6 | repository(url:'http://maven.mbd.qiyi.domain/nexus/content/repositories/mcg-arch'){
7 | authentication(userName:maven_config.userName,password:maven_config.passWord)
8 | }
9 | pom.groupId='org.qiyi.video.svg'
10 | pom.artifactId='plugin'
11 | pom.version=maven_config.version_name
12 | }
13 | }
14 |
15 |
16 | dependencies {
17 |
18 | //build tools
19 | compile 'com.android.tools.build:gradle:3.0.1'
20 |
21 | //gradle sdk
22 | compile gradleApi()
23 | //groovy sdk
24 | compile localGroovy()
25 |
26 | //transform
27 | compile 'com.android.tools.build:transform-api:1.9.0'
28 | //javassist,可以对字节码进行编辑
29 | compile 'javassist:javassist:3.12.1.GA'
30 |
31 | //开源框架,io操作
32 | compile 'commons-io:commons-io:2.5'
33 |
34 | compile 'com.google.code.gson:gson:2.8.2'
35 | }
36 |
37 | repositories{
38 | mavenCentral()
39 | jcenter()
40 | google()
41 | }
42 |
43 | apply from: 'upload.gradle'
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/AndromedaPlugin.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin
26 |
27 | import com.android.build.gradle.AppExtension
28 | import org.gradle.api.Plugin
29 | import org.gradle.api.Project
30 | import org.qiyi.video.svg.plugin.extension.DispatcherExtension
31 | import org.qiyi.video.svg.plugin.service.IServiceGenerator
32 | import org.qiyi.video.svg.plugin.service.StubServiceGenerator
33 |
34 | class AndromedaPlugin implements Plugin {
35 |
36 | private IServiceGenerator stubServiceGenerator = new StubServiceGenerator()
37 |
38 | public static final String DISPATCHER_EXTENSION_NAME = "dispatcher"
39 |
40 | @Override
41 | void apply(Project project) {
42 |
43 | project.extensions.create(DISPATCHER_EXTENSION_NAME, DispatcherExtension)
44 |
45 | def android = project.extensions.getByType(AppExtension)
46 |
47 | stubServiceGenerator.injectStubServiceToManifest(project)
48 |
49 | //注册一个Transform
50 | def classTransform = new AndromedaTransform(project, stubServiceGenerator)
51 |
52 | android.registerTransform(classTransform)
53 |
54 | System.out.println("-------------end of buildSrc AndromedaTransform-----------------")
55 | }
56 |
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/ClassAppender.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin
26 |
27 | import com.android.build.api.transform.TransformInput
28 | import javassist.ClassPool
29 |
30 | class ClassAppender {
31 |
32 | static void appendAllClasses(Collection inputs, ClassPool classPool) {
33 | inputs.each {
34 | it.directoryInputs.each {
35 | def dirPath = it.file.absolutePath
36 | classPool.insertClassPath(dirPath)
37 | }
38 |
39 | it.jarInputs.each {
40 | classPool.insertClassPath(it.file.absolutePath)
41 | }
42 | }
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/extension/DispatcherExtension.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.extension
26 |
27 | public class DispatcherExtension{
28 | //默认为主进程
29 | String process=''
30 | }
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/manifest/ComponentReader.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.manifest
26 |
27 |
28 | class ComponentReader implements IComponentReader {
29 |
30 | def manifest
31 |
32 | ComponentReader(String filePath) {
33 | manifest = new XmlSlurper().parse(filePath)
34 | }
35 |
36 | @Override
37 | void readActivities(Set processNames) {
38 | manifest.application.activity.each {
39 | addProcess(processNames, it)
40 | }
41 | }
42 |
43 | @Override
44 | void readServices(Set processNames) {
45 | manifest.application.service.each {
46 | addProcess(processNames, it)
47 | }
48 | }
49 |
50 | private void addProcess(Set processNames, def it) {
51 | String processName = it.'@android:process'
52 | if (processName != null && processName.length() > 0) {
53 | processNames.add(processName)
54 | }
55 | }
56 |
57 | @Override
58 | void readBroadcastReceivers(Set processNames) {
59 | manifest.application.receiver.each {
60 | addProcess(processNames, it)
61 | }
62 | }
63 |
64 | @Override
65 | void readProviders(Set processNames) {
66 | manifest.application.provider.each {
67 | addProcess(processNames, it)
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/manifest/IComponentReader.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.manifest
26 |
27 | interface IComponentReader {
28 |
29 | void readActivities(Set processNames)
30 |
31 | void readServices(Set processNames)
32 |
33 | void readBroadcastReceivers(Set processNames)
34 |
35 | void readProviders(Set processNames)
36 |
37 | }
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/manifest/IManifestParser.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.manifest
26 |
27 | interface IManifestParser {
28 | Set getCustomProcessNames(String manifestPath)
29 | }
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/groovy/org/qiyi/video/svg/plugin/service/IServiceGenerator.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.service
26 |
27 | import org.gradle.api.Project
28 |
29 | public interface IServiceGenerator {
30 |
31 | void injectStubServiceToManifest(Project project)
32 |
33 | /**
34 | * 获取匹配,key为进程名,value为对应的CommuStubService名称
35 | * @return
36 | */
37 | MapgetMatchServices()
38 | }
--------------------------------------------------------------------------------
/Andromeda-Plugin/src/main/resources/META-INF/gradle-plugins/org.qiyi.svg.plugin.properties:
--------------------------------------------------------------------------------
1 | implementation-class=org.qiyi.video.svg.plugin.AndromedaPlugin
--------------------------------------------------------------------------------
/Andromeda-Plugin/upload.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.novoda.bintray-release'
2 |
3 | def libDesc='A lightweight library to make Android IPC convenient'
4 | def libLicense='BSD 3-Clause'
5 |
6 | publish{
7 | repoName="starbridge"
8 | userOrg='allenwang'
9 | groupId='org.qiyi.video.svg'
10 | artifactId='plugin'
11 | publishVersion=maven_config.version_name
12 | desc="$libDesc"
13 | }
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | //apply plugin: org.qiyi.video.svg.plugin.AndromedaPlugin
3 | apply plugin: 'org.qiyi.svg.plugin'
4 |
5 | android {
6 | compileSdkVersion 26
7 | defaultConfig {
8 | applicationId "wang.imallen.blog.servicemanager"
9 | minSdkVersion 15
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dispatcher{
24 | process ":downloader"
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | api project(":applemodule")
31 | api project(":cherrymodule")
32 |
33 | implementation 'com.android.support:design:26.0.2'
34 |
35 | implementation 'com.android.support:appcompat-v7:26.0.2'
36 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
37 | testImplementation 'junit:junit:4.12'
38 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
39 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
40 | }
41 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/wang/imallen/blog/servicemanager/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager;
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 | * Instrumented 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("wang.imallen.blog.servicemanager", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
29 |
32 |
35 |
38 |
41 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/CheckPearImpl.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager;
2 |
3 | /**
4 | * Created by wangallen on 2018/2/12.
5 | */
6 |
7 | public class CheckPearImpl implements ICheckPear {
8 | @Override
9 | public int getCalories(int pearNum) {
10 | return pearNum * 50;
11 | }
12 |
13 | @Override
14 | public String getPearDesc(int pearType) {
15 | return "Big pear!";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/CustomApp.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager;
2 |
3 | import android.app.ActivityManager;
4 | import android.app.Application;
5 | import android.content.Context;
6 |
7 | import org.qiyi.video.svg.Andromeda;
8 | import org.qiyi.video.svg.log.Logger;
9 |
10 | import wang.imallen.blog.servicemanager.utils.ToastUtils;
11 |
12 | /**
13 | * Created by wangallen on 2018/1/8.
14 | */
15 |
16 | public class CustomApp extends Application {
17 |
18 | @Override
19 | public void onCreate() {
20 | Logger.d("CustomApp-->onCreate(),pid:" + android.os.Process.myPid() + ",processName:" + getCurrentProcessName());
21 | super.onCreate();
22 |
23 | ToastUtils.init(this);
24 |
25 | Andromeda.init(this);
26 | }
27 |
28 | private boolean isMainProcess() {
29 | String processName = getCurrentProcessName();
30 | if (processName.equals(getPackageName())) {
31 | return true;
32 | }
33 | return false;
34 | }
35 |
36 | public String getCurrentProcessName() {
37 | ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
38 | if (activityManager == null) {
39 | return null;
40 | }
41 | for (ActivityManager.RunningAppProcessInfo processInfo : activityManager.getRunningAppProcesses()) {
42 | if (processInfo.pid == android.os.Process.myPid()) {
43 | return processInfo.processName;
44 | }
45 | }
46 | return null;
47 | }
48 |
49 | @Override
50 | public void onTerminate() {
51 | super.onTerminate();
52 | Logger.d("onTerminate,pid:" + android.os.Process.myPid());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/ICheckPear.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager;
2 |
3 | /**
4 | * Created by wangallen on 2018/2/12.
5 | */
6 |
7 | public interface ICheckPear {
8 |
9 | int getCalories(int pearNum);
10 |
11 | String getPearDesc(int pearType);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/ViewPagerActivity.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.view.ViewPager;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import wang.imallen.blog.servicemanager.R;
12 | import wang.imallen.blog.servicemanager.lifecycle.frag.CustomFragmentAdapter;
13 | import wang.imallen.blog.servicemanager.lifecycle.frag.MyPicFrag;
14 | import wang.imallen.blog.servicemanager.lifecycle.frag.MyTextFrag;
15 | import wang.imallen.blog.servicemanager.lifecycle.frag.PicFrag;
16 | import wang.imallen.blog.servicemanager.lifecycle.frag.TextFrag;
17 |
18 | public class ViewPagerActivity extends AppCompatActivity {
19 |
20 | private ViewPager viewPager;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_view_pager);
26 |
27 | viewPager=findViewById(R.id.viewPager);
28 |
29 | Listfragments=new ArrayList<>();
30 | fragments.add(new TextFrag());
31 | fragments.add(new PicFrag());
32 | fragments.add(new MyTextFrag());
33 | fragments.add(new MyPicFrag());
34 | CustomFragmentAdapter adapter=new CustomFragmentAdapter(getSupportFragmentManager(),fragments);
35 | viewPager.setAdapter(adapter);
36 |
37 | viewPager.setOffscreenPageLimit(2);
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/ViewTestActivity.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle;
2 |
3 | import android.os.IBinder;
4 | import android.os.RemoteException;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.widget.TextView;
8 |
9 | import org.qiyi.video.svg.Andromeda;
10 |
11 | import wang.imallen.blog.moduleexportlib.apple.IBuyApple;
12 | import wang.imallen.blog.servicemanager.R;
13 |
14 | public class ViewTestActivity extends AppCompatActivity {
15 |
16 | private TextView textView;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_view_test);
22 |
23 | textView=findViewById(R.id.textView);
24 |
25 | useBuyAppleService();
26 | }
27 |
28 | private void useBuyAppleService() {
29 | IBinder binder = Andromeda.with(textView).getRemoteService(IBuyApple.class);
30 | if (binder == null) {
31 | return;
32 | }
33 | IBuyApple buyApple = IBuyApple.Stub.asInterface(binder);
34 | if (buyApple == null) {
35 | return;
36 | }
37 | try {
38 | buyApple.buyAppleInShop(29);
39 | } catch (RemoteException ex) {
40 | ex.printStackTrace();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/CustomFragmentAdapter.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by wangallen on 2018/4/10.
11 | */
12 |
13 | public class CustomFragmentAdapter extends FragmentPagerAdapter{
14 |
15 | private Listfragments;
16 |
17 | public CustomFragmentAdapter(FragmentManager fm,Listfragments){
18 | super(fm);
19 | this.fragments=fragments;
20 | }
21 |
22 | @Override
23 | public Fragment getItem(int position) {
24 | return fragments==null?null:fragments.get(position);
25 | }
26 |
27 | @Override
28 | public int getCount() {
29 | return fragments==null?0:fragments.size();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/CustomSupportFragment.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.os.IBinder;
6 | import android.os.RemoteException;
7 | import android.support.annotation.Nullable;
8 | import android.support.v4.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.TextView;
13 |
14 | import org.qiyi.video.svg.Andromeda;
15 | import org.qiyi.video.svg.log.Logger;
16 |
17 | import wang.imallen.blog.moduleexportlib.apple.IBuyApple;
18 | import wang.imallen.blog.servicemanager.R;
19 |
20 | /**
21 | * Created by wangallen on 2018/4/9.
22 | */
23 |
24 | public class CustomSupportFragment extends Fragment{
25 |
26 | public static CustomSupportFragment newInstance(){
27 | return new CustomSupportFragment();
28 | }
29 |
30 | @Override
31 | public void onAttach(Context context) {
32 | super.onAttach(context);
33 | }
34 |
35 | @Override
36 | public void onCreate(@Nullable Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | }
39 |
40 | @Nullable
41 | @Override
42 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
43 | View rootView = inflater.inflate(R.layout.frag_layout, container, false);
44 |
45 | TextView textView = rootView.findViewById(R.id.textView);
46 | textView.setText("This is a TextView in CustomSupportFragment");
47 |
48 | //KP 此时当前Fragment还不可见,这就是RemoteManager在初始时会被调用一次onStop()的原因.
49 | //KP 而到后面创建的root fragment,是由activity的可见性来决定的,而Activity此时已经可见,所以它的lifecycle会调用onStart();
50 | //useBuyAppleService();
51 |
52 | return rootView;
53 | }
54 |
55 | private void useBuyAppleService() {
56 | IBinder binder = Andromeda.with(this).getRemoteService(IBuyApple.class);
57 | if (binder == null) {
58 | return;
59 | }
60 | IBuyApple buyApple = IBuyApple.Stub.asInterface(binder);
61 | if (buyApple == null) {
62 | return;
63 | }
64 | try {
65 | buyApple.buyAppleInShop(29);
66 | } catch (RemoteException ex) {
67 | ex.printStackTrace();
68 | }
69 | }
70 |
71 |
72 | @Override
73 | public void onStart() {
74 | Logger.d("CustomSupportFragment-->onStart()");
75 | super.onStart();
76 | }
77 |
78 | @Override
79 | public void onResume() {
80 | useBuyAppleService();
81 | super.onResume();
82 | }
83 |
84 | @Override
85 | public void onPause() {
86 | super.onPause();
87 | }
88 |
89 | @Override
90 | public void onStop() {
91 | super.onStop();
92 | }
93 |
94 | @Override
95 | public void onDestroyView() {
96 | super.onDestroyView();
97 | }
98 |
99 | @Override
100 | public void onDestroy() {
101 | super.onDestroy();
102 | }
103 |
104 | @Override
105 | public void onDetach() {
106 | super.onDetach();
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/FragActivity.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.os.IBinder;
6 | import android.os.RemoteException;
7 | import android.view.View;
8 |
9 | import org.qiyi.video.svg.Andromeda;
10 | import org.qiyi.video.svg.log.Logger;
11 |
12 | import wang.imallen.blog.moduleexportlib.apple.IBuyApple;
13 | import wang.imallen.blog.servicemanager.R;
14 |
15 | public class FragActivity extends Activity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_support_frag);
21 |
22 | //TODO 这样做是有问题的,在FragmentActivity中只能管理support v4 Fragment,而不能管理android.app.Fragment
23 | findViewById(R.id.showFragBtn).setOnClickListener(new View.OnClickListener() {
24 | @Override
25 | public void onClick(View v) {
26 | showFrag();
27 | }
28 | });
29 |
30 | findViewById(R.id.useRemoteServiceBtn).setOnClickListener(new View.OnClickListener() {
31 | @Override
32 | public void onClick(View v) {
33 | useBuyAppleService();
34 | }
35 | });
36 |
37 | }
38 |
39 | private void useBuyAppleService() {
40 | IBinder binder = Andromeda.with(this).getRemoteService(IBuyApple.class);
41 | if (binder == null) {
42 | return;
43 | }
44 | IBuyApple buyApple = IBuyApple.Stub.asInterface(binder);
45 | if (buyApple == null) {
46 | return;
47 | }
48 | try {
49 | buyApple.buyAppleInShop(29);
50 | } catch (RemoteException ex) {
51 | ex.printStackTrace();
52 | }
53 | }
54 |
55 | private void showFrag() {
56 | getFragmentManager().beginTransaction().replace(R.id.frameLayout,
57 | CustomFragment.newInstance()).commitAllowingStateLoss();
58 | }
59 |
60 | @Override
61 | protected void onDestroy() {
62 | super.onDestroy();
63 | Logger.d("FragActivity-->onDestroy()");
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/MyTextFrag.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | import org.qiyi.video.svg.log.Logger;
13 |
14 | import wang.imallen.blog.servicemanager.R;
15 |
16 | /**
17 | * Created by wangallen on 2018/4/10.
18 | */
19 |
20 | public class MyTextFrag extends Fragment {
21 |
22 | private static final String TAG = "MyTextFrag";
23 |
24 | @Override
25 | public void onAttach(Context context) {
26 | super.onAttach(context);
27 | }
28 |
29 | @Override
30 | public void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | }
33 |
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | View rootView = inflater.inflate(R.layout.frag_layout, container, false);
38 |
39 | TextView textView = rootView.findViewById(R.id.textView);
40 | textView.setText("This is a TextView in MyTextFrag");
41 |
42 | return rootView;
43 | }
44 |
45 | @Override
46 | public void onStart() {
47 | Logger.d(TAG + "-->onStart()");
48 | super.onStart();
49 | }
50 |
51 | @Override
52 | public void onResume() {
53 | Logger.d(TAG + "-->onResume()");
54 | super.onResume();
55 | }
56 |
57 | @Override
58 | public void onPause() {
59 | Logger.d(TAG + "-->onPause()");
60 | super.onPause();
61 | }
62 |
63 | @Override
64 | public void onStop() {
65 | Logger.d(TAG + "-->onStop()");
66 | super.onStop();
67 | }
68 |
69 | @Override
70 | public void onDestroyView() {
71 | Logger.d(TAG + "-->onDestroyView()");
72 | super.onDestroyView();
73 | }
74 |
75 | @Override
76 | public void setUserVisibleHint(boolean isVisibleToUser) {
77 | Logger.d(TAG + "-->setuserVisibleHint()");
78 | super.setUserVisibleHint(isVisibleToUser);
79 | }
80 |
81 | @Override
82 | public void onHiddenChanged(boolean hidden) {
83 | Logger.d(TAG + "-->onHiddenChanged()");
84 | super.onHiddenChanged(hidden);
85 | }
86 |
87 | @Override
88 | public void onDestroy() {
89 | Logger.d(TAG + "-->onDestroy()");
90 | super.onDestroy();
91 | }
92 |
93 | @Override
94 | public void onDetach() {
95 | super.onDetach();
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/PicFrag.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.ImageView;
11 |
12 | import org.qiyi.video.svg.log.Logger;
13 |
14 | import wang.imallen.blog.servicemanager.R;
15 |
16 | /**
17 | * Created by wangallen on 2018/4/10.
18 | */
19 |
20 | public class PicFrag extends Fragment {
21 |
22 | private static final String TAG = "PicFrag";
23 |
24 | @Override
25 | public void onAttach(Context context) {
26 | super.onAttach(context);
27 | }
28 |
29 | @Override
30 | public void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | }
33 |
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | View rootView = inflater.inflate(R.layout.pic_layout, container, false);
38 |
39 | ImageView imageView = rootView.findViewById(R.id.imageView);
40 | imageView.setImageResource(R.drawable.begining);
41 |
42 | return rootView;
43 | }
44 |
45 | @Override
46 | public void onStart() {
47 | Logger.d(TAG + "-->onStart()");
48 | super.onStart();
49 | }
50 |
51 | @Override
52 | public void onResume() {
53 | Logger.d(TAG + "-->onResume()");
54 | super.onResume();
55 | }
56 |
57 | @Override
58 | public void onPause() {
59 | Logger.d(TAG + "-->onPause()");
60 | super.onPause();
61 | }
62 |
63 | @Override
64 | public void onStop() {
65 | Logger.d(TAG + "-->onStop()");
66 | super.onStop();
67 | }
68 |
69 | @Override
70 | public void onDestroyView() {
71 | Logger.d(TAG + "-->onDestroyView()");
72 | super.onDestroyView();
73 | }
74 |
75 | @Override
76 | public void setUserVisibleHint(boolean isVisibleToUser) {
77 | Logger.d(TAG + "-->setuserVisibleHint()");
78 | super.setUserVisibleHint(isVisibleToUser);
79 | }
80 |
81 | @Override
82 | public void onHiddenChanged(boolean hidden) {
83 | Logger.d(TAG + "-->onHiddenChanged()");
84 | super.onHiddenChanged(hidden);
85 | }
86 |
87 | @Override
88 | public void onDestroy() {
89 | Logger.d(TAG + "-->onDestroy()");
90 | super.onDestroy();
91 | }
92 |
93 | @Override
94 | public void onDetach() {
95 | super.onDetach();
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/SupportFragActivity.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.os.Bundle;
4 | import android.os.IBinder;
5 | import android.os.RemoteException;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 |
9 | import org.qiyi.video.svg.Andromeda;
10 | import org.qiyi.video.svg.log.Logger;
11 |
12 | import wang.imallen.blog.moduleexportlib.apple.IBuyApple;
13 | import wang.imallen.blog.servicemanager.R;
14 |
15 | public class SupportFragActivity extends AppCompatActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_frag);
21 |
22 | findViewById(R.id.showSupportFragBtn).setOnClickListener(new View.OnClickListener() {
23 | @Override
24 | public void onClick(View v) {
25 | showSupportFrag();
26 | }
27 | });
28 |
29 | findViewById(R.id.useRemoteServiceBtn).setOnClickListener(new View.OnClickListener() {
30 | @Override
31 | public void onClick(View v) {
32 | useBuyAppleService();
33 | }
34 | });
35 |
36 | }
37 |
38 | private void useBuyAppleService() {
39 | IBinder binder = Andromeda.with(this).getRemoteService(IBuyApple.class);
40 | if (binder == null) {
41 | return;
42 | }
43 | IBuyApple buyApple = IBuyApple.Stub.asInterface(binder);
44 | if (buyApple == null) {
45 | return;
46 | }
47 | try {
48 | buyApple.buyAppleInShop(29);
49 | } catch (RemoteException ex) {
50 | ex.printStackTrace();
51 | }
52 | }
53 |
54 | @Override
55 | protected void onStop() {
56 | super.onStop();
57 | }
58 |
59 | @Override
60 | protected void onDestroy() {
61 | super.onDestroy();
62 | Logger.d("SupportFragActivity-->onDestroy()");
63 | }
64 |
65 | private void showSupportFrag() {
66 | getSupportFragmentManager().beginTransaction().replace(R.id.frameLayout,
67 | CustomSupportFragment.newInstance()).commitAllowingStateLoss();
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/lifecycle/frag/TextFrag.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.lifecycle.frag;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | import org.qiyi.video.svg.log.Logger;
13 |
14 | import wang.imallen.blog.servicemanager.R;
15 |
16 | /**
17 | * Created by wangallen on 2018/4/10.
18 | */
19 |
20 | public class TextFrag extends Fragment{
21 |
22 | @Override
23 | public void onAttach(Context context) {
24 | super.onAttach(context);
25 | }
26 |
27 | @Override
28 | public void onCreate(@Nullable Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | }
31 |
32 | @Nullable
33 | @Override
34 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
35 | View rootView = inflater.inflate(R.layout.frag_layout, container, false);
36 |
37 | TextView textView = rootView.findViewById(R.id.textView);
38 | textView.setText("This is a TextView in TextFrag");
39 |
40 | return rootView;
41 | }
42 |
43 | @Override
44 | public void onStart() {
45 | Logger.d("TextFrag-->onStart()");
46 | super.onStart();
47 | }
48 |
49 | @Override
50 | public void onResume() {
51 | Logger.d("TextFrag-->onResume()");
52 | super.onResume();
53 | }
54 |
55 | @Override
56 | public void onPause() {
57 | Logger.d("TextFrag-->onPause()");
58 | super.onPause();
59 | }
60 |
61 | @Override
62 | public void onStop() {
63 | Logger.d("TextFrag-->onStop()");
64 | super.onStop();
65 | }
66 |
67 | @Override
68 | public void onDestroyView() {
69 | Logger.d("TextFrag-->onDestroyView()");
70 | super.onDestroyView();
71 | }
72 |
73 | @Override
74 | public void setUserVisibleHint(boolean isVisibleToUser) {
75 | Logger.d("TextFrag-->setuserVisibleHint()");
76 | super.setUserVisibleHint(isVisibleToUser);
77 | }
78 |
79 | @Override
80 | public void onHiddenChanged(boolean hidden) {
81 | Logger.d("TextFrag-->onHiddenChanged()");
82 | super.onHiddenChanged(hidden);
83 | }
84 |
85 | @Override
86 | public void onDestroy() {
87 | Logger.d("TextFrag-->onDestroy()");
88 | super.onDestroy();
89 | }
90 |
91 | @Override
92 | public void onDetach() {
93 | super.onDetach();
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/test/TestActivity1.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.test;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import wang.imallen.blog.servicemanager.R;
7 |
8 | public class TestActivity1 extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_test1);
14 | }
15 |
16 | public static class TestActivity2 extends TestActivity1{}
17 |
18 |
19 | public static class TestActivity3 extends TestActivity1{}
20 |
21 | public static class TestActivity4 extends TestActivity1{}
22 |
23 | public static class TestActivity5 extends TestActivity1{}
24 |
25 | public static class TestActivity6 extends TestActivity1{}
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/utils/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.utils;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Looper;
6 | import android.widget.Toast;
7 |
8 | /**
9 | * Created by guofeng05 on 2018/6/5.
10 | */
11 |
12 | public class ToastUtil {
13 | private static Handler mainHandler = new Handler(Looper.getMainLooper());
14 |
15 | public static void postToast(final Context context, final String str) {
16 | mainHandler.post(new Runnable() {
17 | @Override
18 | public void run() {
19 | Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
20 | }
21 | });
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/wang/imallen/blog/servicemanager/utils/ToastUtils.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager.utils;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.os.Looper;
6 | import android.text.TextUtils;
7 | import android.widget.Toast;
8 |
9 | public class ToastUtils {
10 |
11 | public static void init(Context context){
12 | appContext=context;
13 | }
14 |
15 | private static Context appContext;
16 |
17 | private static final Handler HANDLER = new Handler(Looper.getMainLooper());
18 | private static Toast mToast;
19 |
20 | private static Runnable CANCEL_RUN = new Runnable() {
21 | @Override public void run() {
22 | mToast.cancel();
23 | }
24 | };
25 |
26 | private ToastUtils() {
27 | }
28 |
29 |
30 | public static void showShortToast(CharSequence msg) {
31 | showToast(msg, Toast.LENGTH_SHORT);
32 | }
33 |
34 | public static void showLongToast(CharSequence msg) {
35 | showToast(msg, Toast.LENGTH_LONG);
36 | }
37 |
38 | private static void showToast(CharSequence msg, int duration) {
39 | if (TextUtils.isEmpty(msg)) {
40 | return;
41 | }
42 | HANDLER.removeCallbacks(CANCEL_RUN);
43 | if (null == mToast) {
44 | mToast = Toast.makeText(appContext, msg, duration);
45 | } else {
46 | mToast.setDuration(duration);
47 | mToast.setText(msg);
48 | }
49 | HANDLER.postDelayed(CANCEL_RUN, duration == Toast.LENGTH_SHORT ? 1000 : 3000);
50 | mToast.show();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/res/color/selector_blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_menu_home_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/drawable-xxhdpi/ic_menu_home_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_menu_home_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/drawable-xxhdpi/ic_menu_home_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/begining.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/drawable/begining.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ghoul.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/drawable/ghoul.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_menu_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_frag.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
22 |
23 |
24 |
30 |
31 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_lifecycle_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
29 |
30 |
36 |
37 |
43 |
44 |
50 |
51 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_local_service_annotation_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_local_service_by_anno_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
21 |
22 |
28 |
29 |
34 |
35 |
40 |
41 |
46 |
47 |
52 |
53 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_reg_remote_service_by_anno.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_support_frag.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
30 |
31 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_test1.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_use_local_service_by_anno.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_use_remote_service_by_anno.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_pager.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/frag_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/pic_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/support_frag_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #3F51B5
8 | #303F9F
9 |
10 | #FF4081
11 |
12 | #0000
13 |
14 | #000
15 |
16 | #fff
17 |
18 | #999
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Andromeda
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/wang/imallen/blog/servicemanager/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.servicemanager;
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 | }
--------------------------------------------------------------------------------
/applemodule/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/applemodule/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 |
6 | defaultConfig {
7 | minSdkVersion 15
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 |
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 |
14 | }
15 |
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 |
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 |
28 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
29 |
30 | api project(":moduleexportlib")
31 |
32 | implementation 'com.android.support:appcompat-v7:26.0.2'
33 | testImplementation 'junit:junit:4.12'
34 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
35 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
36 | }
37 |
--------------------------------------------------------------------------------
/applemodule/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/applemodule/src/androidTest/java/wang/imallen/blog/applemodule/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.applemodule;
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 | * Instrumented 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("wang.imallen.blog.applemodule.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/applemodule/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
10 |
13 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/applemodule/src/main/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
12 |
15 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/applemodule/src/main/java/wang/imallen/blog/applemodule/event/EventActivity.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.applemodule.event;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 |
7 | import org.qiyi.video.svg.Andromeda;
8 | import org.qiyi.video.svg.event.Event;
9 | import org.qiyi.video.svg.event.EventListener;
10 | import org.qiyi.video.svg.log.Logger;
11 |
12 | import wang.imallen.blog.applemodule.R;
13 | import wang.imallen.blog.moduleexportlib.event.EventConstants;
14 |
15 | public class EventActivity extends AppCompatActivity implements EventListener {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_event);
21 |
22 | //测试弱引用是否起作用
23 | Andromeda.getInstance().subscribe(EventConstants.APPLE_EVENT, this);
24 |
25 | findViewById(R.id.publishEventBtn).setOnClickListener(new View.OnClickListener() {
26 | @Override
27 | public void onClick(View v) {
28 | Bundle bundle = new Bundle();
29 | bundle.putString("Result", "gave u five apples!");
30 | Andromeda.getInstance().publish(new Event(EventConstants.APPLE_EVENT, bundle));
31 | }
32 | });
33 |
34 | }
35 |
36 | @Override
37 | public void onNotify(Event event) {
38 | Logger.d("EventActivity-->onNotify,event.name:" + event.getName());
39 | }
40 |
41 | @Override
42 | protected void onDestroy() {
43 | super.onDestroy();
44 | Logger.d("onDestroy");
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/applemodule/src/main/java/wang/imallen/blog/applemodule/local/LocalServiceDemo.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.applemodule.local;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import org.qiyi.video.svg.Andromeda;
9 |
10 | import wang.imallen.blog.applemodule.service.CheckApple;
11 | import wang.imallen.blog.applemodule.R;
12 | import wang.imallen.blog.moduleexportlib.apple.ICheckApple;
13 |
14 | public class LocalServiceDemo extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_local_service_demo);
20 |
21 | findViewById(R.id.registerLocalServiceBtn).setOnClickListener(new View.OnClickListener() {
22 | @Override
23 | public void onClick(View v) {
24 |
25 | Andromeda.getInstance().registerLocalService(ICheckApple.class, new CheckApple());
26 | Toast.makeText(LocalServiceDemo.this, "registered ICheckApple service", Toast.LENGTH_SHORT).show();
27 | }
28 | });
29 |
30 | findViewById(R.id.useLocalServiceBtn).setOnClickListener(new View.OnClickListener() {
31 | @Override
32 | public void onClick(View v) {
33 | ICheckApple checkApple = Andromeda.getInstance().getLocalService(ICheckApple.class);
34 | if (checkApple != null) {
35 | int calories = checkApple.getAppleCalories(3);
36 | String desc = checkApple.getAppleDescription(2);
37 | Toast.makeText(LocalServiceDemo.this,
38 | "got ICheckApple service,calories:" + calories + ",description:" + desc, Toast.LENGTH_SHORT).show();
39 | } else {
40 | Toast.makeText(LocalServiceDemo.this, "found no ICheckApple service, it may be cancelled!", Toast.LENGTH_SHORT).show();
41 | }
42 | }
43 | });
44 |
45 | findViewById(R.id.unregisterLocalServiceBtn).setOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View v) {
48 | Andromeda.getInstance().unregisterLocalService(ICheckApple.class);
49 | Toast.makeText(LocalServiceDemo.this, "just unregistered ICheckApple service", Toast.LENGTH_SHORT).show();
50 | }
51 | });
52 |
53 | }
54 |
55 | @Override
56 | protected void onStart() {
57 | super.onStart();
58 | }
59 |
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/applemodule/src/main/java/wang/imallen/blog/applemodule/service/BuyAppleImpl.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.applemodule.service;
2 |
3 | import android.os.Bundle;
4 | import android.os.RemoteException;
5 |
6 | import org.qiyi.video.svg.IPCCallback;
7 | import org.qiyi.video.svg.log.Logger;
8 |
9 | import wang.imallen.blog.moduleexportlib.apple.IBuyApple;
10 |
11 | /**
12 | * Created by wangallen on 2018/1/18.
13 | */
14 | public class BuyAppleImpl extends IBuyApple.Stub {
15 |
16 | private static BuyAppleImpl instance;
17 |
18 | public static BuyAppleImpl getInstance() {
19 | if (null == instance) {
20 | synchronized (BuyAppleImpl.class) {
21 | if (null == instance) {
22 | instance = new BuyAppleImpl();
23 | }
24 | }
25 | }
26 | return instance;
27 | }
28 |
29 | private BuyAppleImpl() {
30 | }
31 |
32 | @Override
33 | public int buyAppleInShop(int userId) throws RemoteException {
34 | Logger.d("BuyAppleImpl-->buyAppleInShop,userId:" + userId);
35 | if (userId == 10) {
36 | return 20;
37 | } else if (userId == 20) {
38 | return 30;
39 | } else {
40 | return -1;
41 | }
42 | }
43 |
44 | @Override
45 | public void buyAppleOnNet(int userId, IPCCallback callback) throws RemoteException {
46 | Logger.d("BuyAppleImpl-->buyAppleOnNet,userId:" + userId);
47 |
48 |
49 | try {
50 | Thread.sleep(100);
51 | } catch (InterruptedException ex) {
52 | ex.printStackTrace();
53 | }
54 |
55 |
56 | Bundle result = new Bundle();
57 | if (userId == 10) {
58 | result.putInt("Result", 20);
59 | callback.onSuccess(result);
60 | } else if (userId == 20) {
61 | result.putInt("Result", 30);
62 | callback.onSuccess(result);
63 | } else {
64 | callback.onFail("Sorry, u are not authorized!");
65 | }
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/applemodule/src/main/java/wang/imallen/blog/applemodule/service/CheckApple.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.applemodule.service;
2 |
3 | import wang.imallen.blog.moduleexportlib.apple.ICheckApple;
4 |
5 | /**
6 | * Created by wangallen on 2018/1/18.
7 | */
8 |
9 | public class CheckApple implements ICheckApple {
10 |
11 | private static CheckApple instance;
12 |
13 | public CheckApple() {
14 | }
15 |
16 | @Override
17 | public int getAppleCalories(int appleNum) {
18 | return appleNum * 50;
19 | }
20 |
21 | @Override
22 | public String getAppleDescription(int appleType) {
23 | switch (appleType) {
24 | case 1: {
25 | return "Yellow apple";
26 | }
27 | case 2: {
28 | return "Green apple";
29 | }
30 | case 3: {
31 | return "Red apple";
32 | }
33 | default:
34 | return "Unknown apple";
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_apple.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
20 |
21 |
26 |
27 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_banana.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
22 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_banana2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_debug_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_event.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_inject_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/layout/activity_local_service_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
19 |
20 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/applemodule/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AppleModule
3 |
4 |
--------------------------------------------------------------------------------
/applemodule/src/test/java/wang/imallen/blog/applemodule/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.applemodule;
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 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | ext.maven_config=[
6 | 'nexus_repo_url':NEXUS_REPO_URL,
7 | 'userName':USER_NAME,
8 | 'groupId':GROUP_ID,
9 | 'passWord':PASS_WORD,
10 | 'version_code':118,
11 | 'version_name':'1.1.8',
12 | 'core_build_version':'1.1.8',
13 | 'plugin_build_version':'1.1.1'
14 | ]
15 |
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | dependencies {
21 | classpath 'com.android.tools.build:gradle:3.0.1'
22 | classpath "org.qiyi.video.svg:plugin:$maven_config.plugin_build_version"
23 |
24 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
25 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
26 | classpath 'com.novoda:bintray-release:0.8.1'
27 | // NOTE: Do not place your application dependencies here; they belong
28 | // in the individual module build.gradle files
29 | }
30 | }
31 |
32 | allprojects {
33 | repositories {
34 | google()
35 | jcenter()
36 | }
37 |
38 | tasks.withType(Javadoc) {
39 | options{ encoding "UTF-8"
40 | charSet 'UTF-8'
41 | links "http://docs.oracle.com/javase/7/docs/api"
42 | }
43 | }
44 |
45 | }
46 |
47 | task clean(type: Delete) {
48 | delete rootProject.buildDir
49 | }
50 |
51 | subprojects{pro->
52 | println "project name:"+pro.name
53 | }
54 |
--------------------------------------------------------------------------------
/buildSrc/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/buildSrc/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'groovy'
2 | apply plugin: 'maven'
3 |
4 | dependencies {
5 |
6 | //build tools
7 | compile 'com.android.tools.build:gradle:3.0.1'
8 |
9 | //gradle sdk
10 | compile gradleApi()
11 | //groovy sdk
12 | compile localGroovy()
13 |
14 | //transform
15 | compile 'com.android.tools.build:transform-api:1.9.0'
16 | //javassist,可以对字节码进行编辑
17 | compile 'javassist:javassist:3.12.1.GA'
18 |
19 | //开源框架,io操作
20 | compile 'commons-io:commons-io:2.5'
21 |
22 | compile 'com.google.code.gson:gson:2.8.2'
23 | }
24 |
25 | repositories{
26 | mavenCentral()
27 | jcenter()
28 | google()
29 | }
30 |
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/AndromedaPlugin.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin
26 |
27 | import com.android.build.gradle.AppExtension
28 | import org.gradle.api.Plugin
29 | import org.gradle.api.Project
30 | import org.qiyi.video.svg.plugin.extension.DispatcherExtension
31 | import org.qiyi.video.svg.plugin.service.IServiceGenerator
32 | import org.qiyi.video.svg.plugin.service.StubServiceGenerator
33 |
34 | class AndromedaPlugin implements Plugin {
35 |
36 | private IServiceGenerator stubServiceGenerator = new StubServiceGenerator()
37 |
38 | public static final String DISPATCHER_EXTENSION_NAME = "dispatcher"
39 |
40 | @Override
41 | void apply(Project project) {
42 |
43 | project.extensions.create(DISPATCHER_EXTENSION_NAME, DispatcherExtension)
44 |
45 | def android = project.extensions.getByType(AppExtension)
46 |
47 | stubServiceGenerator.injectStubServiceToManifest(project)
48 |
49 | //注册一个Transform
50 | def classTransform = new AndromedaTransform(project, stubServiceGenerator)
51 |
52 | android.registerTransform(classTransform)
53 |
54 | System.out.println("-------------end of buildSrc AndromedaTransform-----------------")
55 | }
56 |
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/ClassAppender.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin
26 |
27 | import com.android.build.api.transform.TransformInput
28 | import javassist.ClassPool
29 |
30 | class ClassAppender {
31 |
32 | static void appendAllClasses(Collection inputs, ClassPool classPool) {
33 | inputs.each {
34 | it.directoryInputs.each {
35 | def dirPath = it.file.absolutePath
36 | classPool.insertClassPath(dirPath)
37 | }
38 |
39 | it.jarInputs.each {
40 | classPool.insertClassPath(it.file.absolutePath)
41 | }
42 | }
43 | }
44 |
45 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/extension/DispatcherExtension.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.extension
26 |
27 | public class DispatcherExtension{
28 | //默认为主进程
29 | String process=''
30 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/manifest/ComponentReader.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.manifest
26 |
27 |
28 | class ComponentReader implements IComponentReader {
29 |
30 | def manifest
31 |
32 | ComponentReader(String filePath) {
33 | manifest = new XmlSlurper().parse(filePath)
34 | }
35 |
36 | @Override
37 | void readActivities(Set processNames) {
38 | manifest.application.activity.each {
39 | addProcess(processNames, it)
40 | }
41 | }
42 |
43 | @Override
44 | void readServices(Set processNames) {
45 | manifest.application.service.each {
46 | addProcess(processNames, it)
47 | }
48 | }
49 |
50 | private void addProcess(Set processNames, def it) {
51 | String processName = it.'@android:process'
52 | if (processName != null && processName.length() > 0) {
53 | processNames.add(processName)
54 | }
55 | }
56 |
57 | @Override
58 | void readBroadcastReceivers(Set processNames) {
59 | manifest.application.receiver.each {
60 | addProcess(processNames, it)
61 | }
62 | }
63 |
64 | @Override
65 | void readProviders(Set processNames) {
66 | manifest.application.provider.each {
67 | addProcess(processNames, it)
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/manifest/IComponentReader.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.manifest
26 |
27 | interface IComponentReader {
28 |
29 | void readActivities(Set processNames)
30 |
31 | void readServices(Set processNames)
32 |
33 | void readBroadcastReceivers(Set processNames)
34 |
35 | void readProviders(Set processNames)
36 |
37 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/manifest/IManifestParser.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.manifest
26 |
27 | interface IManifestParser {
28 | Set getCustomProcessNames(String manifestPath)
29 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/groovy/org/qiyi/video/svg/plugin/service/IServiceGenerator.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-present, iQIYI, Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without modification,
5 | * are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | *
10 | * 2. Redistributions in binary form must reproduce the above copyright notice,
11 | * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | *
13 | * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
14 | * from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 | *
24 | */
25 | package org.qiyi.video.svg.plugin.service
26 |
27 | import org.gradle.api.Project
28 |
29 | public interface IServiceGenerator {
30 |
31 | void injectStubServiceToManifest(Project project)
32 |
33 | /**
34 | * 获取匹配,key为进程名,value为对应的CommuStubService名称
35 | * @return
36 | */
37 | MapgetMatchServices()
38 | }
--------------------------------------------------------------------------------
/buildSrc/src/main/resources/META-INF/gradle-plugins/org.qiyi.svg.buildsrc_plugin.properties:
--------------------------------------------------------------------------------
1 | implementation-class=org.qiyi.video.svg.plugin.AndromedaPlugin
--------------------------------------------------------------------------------
/cherrymodule/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/cherrymodule/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 15
10 | targetSdkVersion 26
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | api project(":moduleexportlib")
31 |
32 | implementation 'com.android.support:appcompat-v7:26.0.2'
33 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
34 | testImplementation 'junit:junit:4.12'
35 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
36 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
37 | }
38 |
--------------------------------------------------------------------------------
/cherrymodule/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/cherrymodule/src/androidTest/java/wang/imallen/blog/cherrymodule/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.cherrymodule;
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 | * Instrumented 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("wang.imallen.blog.cherrymodule.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/cherrymodule/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/cherrymodule/src/main/res/layout/activity_cherry.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/cherrymodule/src/main/res/layout/activity_use_local_service_from_apple.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/cherrymodule/src/main/res/layout/activity_use_remote_service_from_apple_module.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/cherrymodule/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CherryModule
3 |
4 |
--------------------------------------------------------------------------------
/cherrymodule/src/test/java/wang/imallen/blog/cherrymodule/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.cherrymodule;
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 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | GROUP_ID=org.qiyi.video.svg
20 |
21 | PROJ_LICENCE_NAME=The Apache Software License, Version 2.0
22 | PROJ_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
23 | PROJ_LICENCE_DEST=repo
24 |
25 | NEXUS_REPO_URL=http://maven.mbd.qiyi.domain/nexus/content/repositories/mcg-arch
26 |
27 | USER_NAME=xxxxx
28 | PASS_WORD=xxxxx
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Jan 07 23:31:56 CST 2018
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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/moduleexportlib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/moduleexportlib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'maven'
3 |
4 | def lib_version="0.0.5"
5 |
6 | android {
7 | compileSdkVersion 26
8 |
9 | defaultConfig {
10 | minSdkVersion 14
11 | targetSdkVersion 26
12 | versionCode 2
13 | versionName "$lib_version"
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 |
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 |
26 | ext{
27 | JAR_NAME='export'
28 | JAR_VERSION="$lib_version"
29 | JAR_DEST_DIR='build/outputs'
30 | ORIGINAL_JAR_PATH='build/intermediates/bundles/release/classes.jar'
31 | }
32 |
33 | project.afterEvaluate {
34 | Task cleanSdk=tasks.getByPath('clean')
35 | Task bundleSdk=tasks.getByPath('bundleRelease')
36 |
37 | bundleSdk.mustRunAfter cleanSdk
38 | makeJar.dependsOn cleanSdk,bundleSdk
39 |
40 | }
41 |
42 | task makeJar(type:Jar){
43 | from zipTree(file(ORIGINAL_JAR_PATH))
44 | //添加assets文件夹,如果不需要则移除
45 | //from fileTree(dir:'src/main', includes:['assets/**'])
46 | baseName "${JAR_NAME}-${JAR_VERSION}"
47 | destinationDir file(JAR_DEST_DIR)
48 | }
49 |
50 |
51 | }
52 |
53 | uploadArchives{
54 | repositories.mavenDeployer{
55 | repository(url:LOCAL_REPO_URL)
56 | pom.groupId=GROUP_ID
57 | pom.artifactId=ARTIFACTID
58 | pom.version="$lib_version"
59 | }
60 | }
61 |
62 |
63 | dependencies {
64 | implementation fileTree(dir: 'libs', include: ['*.jar'])
65 |
66 | //api project(':Andromeda-Lib')
67 | api "org.qiyi.video.svg:core:$maven_config.core_build_version"
68 |
69 | compileOnly 'com.android.support:appcompat-v7:26.0.2'
70 | testImplementation 'junit:junit:4.12'
71 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
72 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
73 | }
74 |
--------------------------------------------------------------------------------
/moduleexportlib/gradle.properties:
--------------------------------------------------------------------------------
1 | ARTIFACTID=exportlib
2 | LIBRARY_VERSION=0.0.2
3 |
4 | LOCAL_REPO_URL=file:///Users/wangallen/Study/Android/local_maven/repo
--------------------------------------------------------------------------------
/moduleexportlib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/moduleexportlib/src/androidTest/java/wang/imallen/blog/moduleexportlib/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.moduleexportlib;
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 | * Instrumented 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("wang.imallen.blog.moduleexportlib.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/aidl/wang/imallen/blog/moduleexportlib/apple/IBuyApple.aidl:
--------------------------------------------------------------------------------
1 | // IBuyApple.aidl
2 | package wang.imallen.blog.moduleexportlib.apple;
3 | import org.qiyi.video.svg.IPCCallback;
4 |
5 | interface IBuyApple {
6 | int buyAppleInShop(int userId);
7 | void buyAppleOnNet(int userId,IPCCallback callback);
8 | }
9 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/aidl/wang/imallen/blog/moduleexportlib/cherry/IBuyCherry.aidl:
--------------------------------------------------------------------------------
1 | // IBuyCherry.aidl
2 | package wang.imallen.blog.moduleexportlib.cherry;
3 | import org.qiyi.video.svg.IPCCallback;
4 | // Declare any non-default types here with import statements
5 |
6 | interface IBuyCherry {
7 |
8 | int buyCherryInShop(int userId);
9 | void buyCherryOnNet(int userId,IPCCallback callback);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/aidl/wang/imallen/blog/moduleexportlib/show/IDisplayTalkShow.aidl:
--------------------------------------------------------------------------------
1 | // IDisplayTalkShow.aidl
2 | package wang.imallen.blog.moduleexportlib.show;
3 |
4 | // Declare any non-default types here with import statements
5 |
6 | interface IDisplayTalkShow {
7 | String getShowName();
8 |
9 | String[]getHostNames();
10 |
11 | void startTalkShow(int userId);
12 | }
13 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/java/wang/imallen/blog/moduleexportlib/apple/ICheckApple.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.moduleexportlib.apple;
2 |
3 | /**
4 | * Created by wangallen on 2018/1/18.
5 | */
6 |
7 | public interface ICheckApple {
8 | int getAppleCalories(int appleNum);
9 |
10 | String getAppleDescription(int appleType);
11 | }
12 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/java/wang/imallen/blog/moduleexportlib/cherry/Cherry.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.moduleexportlib.cherry;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * Created by wangallen on 2018/1/8.
8 | */
9 |
10 | public class Cherry implements Parcelable {
11 |
12 | private String color;
13 | private float weight;
14 |
15 | public Cherry() {
16 |
17 | }
18 |
19 | public Cherry(String color, float weight) {
20 | this.color = color;
21 | this.weight = weight;
22 | }
23 |
24 | public Cherry(Parcel in) {
25 | this.color = in.readString();
26 | this.weight = in.readFloat();
27 | }
28 |
29 | @Override
30 | public int describeContents() {
31 | return 0;
32 | }
33 |
34 | @Override
35 | public void writeToParcel(Parcel out, int flags) {
36 | out.writeString(color);
37 | out.writeFloat(weight);
38 | }
39 |
40 |
41 | public static final Parcelable.Creator CREATOR = new Creator() {
42 | @Override
43 | public Cherry createFromParcel(Parcel source) {
44 | return new Cherry(source);
45 | }
46 |
47 | @Override
48 | public Cherry[] newArray(int size) {
49 | return new Cherry[size];
50 | }
51 | };
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/java/wang/imallen/blog/moduleexportlib/cherry/IDeliverCherry.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.moduleexportlib.cherry;
2 |
3 | import java.util.List;
4 |
5 | //import wang.imallen.blog.serviceannotation.Remote;
6 |
7 | /**
8 | * Created by wangallen on 2018/1/8.
9 | */
10 | //@Remote
11 | public interface IDeliverCherry {
12 |
13 | List getCherries(int userId);
14 |
15 | //void sendCherry(int saleId, List cherries);
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/java/wang/imallen/blog/moduleexportlib/event/EventConstants.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.moduleexportlib.event;
2 |
3 | /**
4 | * Created by wangallen on 2018/1/25.
5 | */
6 |
7 | public class EventConstants {
8 |
9 | public static final String APPLE_EVENT = "Apple";
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/moduleexportlib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ModuleExportLib
3 |
4 |
--------------------------------------------------------------------------------
/moduleexportlib/src/test/java/wang/imallen/blog/moduleexportlib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package wang.imallen.blog.moduleexportlib;
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 | }
--------------------------------------------------------------------------------
/res/Andromeda_Module_arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/res/Andromeda_Module_arch.png
--------------------------------------------------------------------------------
/res/StarBridge_service_arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/res/StarBridge_service_arch.png
--------------------------------------------------------------------------------
/res/StarBridge_star_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/res/StarBridge_star_diagram.png
--------------------------------------------------------------------------------
/res/qq_group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iqiyi/Andromeda/9a6dfd099e033c184eaef69f164fbdc60782bd55/res/qq_group.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':moduleexportlib', ':applemodule', ':cherrymodule', ':Andromeda-Lib', ':buildSrc', ':Andromeda-Plugin'
2 |
--------------------------------------------------------------------------------