├── empty ├── .gitignore └── build.gradle ├── sp ├── .gitignore ├── src │ ├── test │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ ├── com.aicaigroup.servicepool.DependencyManager │ │ │ │ ├── chao.java.tools.servicepool.IServiceFactory │ │ │ │ └── chao.java.tools.servicepool.IService │ │ └── java │ │ │ └── chao │ │ │ └── test │ │ │ └── servicepool │ │ │ └── test │ │ │ └── noop │ │ │ ├── TestNoOpObject.java │ │ │ ├── test │ │ │ ├── service │ │ │ │ ├── NoOp.java │ │ │ │ ├── II.java │ │ │ │ ├── TestService2.java │ │ │ │ ├── TestLazyService.java │ │ │ │ ├── TestWeakService.java │ │ │ │ ├── TestLazyService1.java │ │ │ │ ├── TestLazyService2.java │ │ │ │ ├── TestAbsService.java │ │ │ │ ├── TestService.java │ │ │ │ ├── NoPublicService.java │ │ │ │ ├── IPrinter.java │ │ │ │ ├── TestNoOpService.java │ │ │ │ ├── TestAbsImplService.java │ │ │ │ ├── Printer.java │ │ │ │ └── TestLazyServiceFactory.java │ │ │ ├── noop │ │ │ │ ├── TestNoOpObjectWithDefaultConstructor.java │ │ │ │ ├── TestNoOpObjectWithProtectedConstructor.java │ │ │ │ ├── TestNoOpObjectWithPrivateConstructor.java │ │ │ │ └── TestNoOpObjectWithArgumentsConstructor.java │ │ │ ├── DependencyTest.java │ │ │ ├── SampleTest.java │ │ │ ├── TestLazy.java │ │ │ ├── NoOpTest.java │ │ │ └── TestOpInstanceFactory.java │ │ │ └── NoOpInstanceFactoryForTest.java │ └── main │ │ └── java │ │ └── chao │ │ └── java │ │ └── tools │ │ └── servicepool │ │ ├── LazyHolder.java │ │ ├── NoOpInstance.java │ │ ├── NoOpConstructorArg.java │ │ ├── event │ │ └── EventService.java │ │ ├── IServices.java │ │ ├── IInitService.java │ │ ├── Sp.java │ │ ├── ExceptionHandler.java │ │ ├── IServiceLoader.java │ │ ├── DefaultInitService.java │ │ ├── combine │ │ ├── CombineEmptyHandler.java │ │ ├── CombineService.java │ │ ├── CombineCallback.java │ │ ├── CombineThreadExecutor.java │ │ ├── DefaultCombineStrategy.java │ │ ├── CombineStrategy.java │ │ └── CombineThreadFactory.java │ │ ├── Constant.java │ │ ├── cache │ │ ├── ServiceCacheStrategy.java │ │ ├── custom │ │ │ ├── CustomCacheStrategy.java │ │ │ ├── Custom.java │ │ │ └── CustomCombineStrategy.java │ │ ├── Specific.java │ │ ├── Once.java │ │ ├── Global.java │ │ ├── Weak.java │ │ └── Soft.java │ │ ├── NoOpInstantiator.java │ │ ├── IServiceInterceptor.java │ │ ├── ServicePoolException.java │ │ ├── IPathService.java │ │ ├── DependencyManager.java │ │ ├── IServiceFactories.java │ │ ├── DefaultService.java │ │ ├── ILogger.java │ │ ├── annotation │ │ ├── Event.java │ │ ├── Services.java │ │ ├── Init.java │ │ └── Service.java │ │ ├── ServiceController.java │ │ ├── IServiceFactory.java │ │ ├── InitServiceManager.java │ │ ├── ServiceThreadFactory.java │ │ ├── IServiceInterceptorCallback.java │ │ ├── InnerProxy.java │ │ ├── PathServices.java │ │ ├── ServiceFactories.java │ │ ├── debug │ │ └── Debug.java │ │ ├── thirdparty │ │ └── CancelableCountDownLatch.java │ │ ├── AbsInitServiceManager.java │ │ ├── BuildInServiceLoader.java │ │ ├── ReflectUtil.java │ │ ├── IService.java │ │ └── ClassTypeAdapter.java ├── gradle.properties └── build.gradle ├── spa ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── chao │ │ │ └── android │ │ │ └── tools │ │ │ └── servicepool │ │ │ ├── init │ │ │ └── AndroidInitService.java │ │ │ └── Spa.java │ └── test │ │ └── java │ │ └── chao │ │ └── test │ │ └── servicepool │ │ └── android │ │ ├── ExampleUnitTest.java │ │ └── ExampleInstrumentedTest.java ├── gradle.properties ├── proguard-rules.pro └── build.gradle ├── sprpc ├── .gitignore ├── readme.md ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── chao │ │ │ └── android │ │ │ └── tools │ │ │ └── rpc │ │ │ ├── RemoteCallbackHandler.java │ │ │ ├── RemoteService.java │ │ │ ├── RemoteServiceException.java │ │ │ ├── RemoteHandler.java │ │ │ ├── annotation │ │ │ └── RemoteServiceConfig.java │ │ │ ├── RemoteMessageService.java │ │ │ └── RemoteClientMethod.java │ ├── test │ │ └── java │ │ │ └── chao │ │ │ └── android │ │ │ └── tools │ │ │ └── servicepool │ │ │ └── rpc │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── chao │ │ └── android │ │ └── tools │ │ └── servicepool │ │ └── rpc │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── autoservice ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── gradle-plugins │ │ │ └── sp.autoservice.properties │ │ └── groovy │ │ └── chao │ │ └── android │ │ └── gradle │ │ └── servicepool │ │ ├── hunter │ │ ├── package-info.java │ │ ├── RunVariant.java │ │ └── asm │ │ │ └── IWeaver.java │ │ ├── compiler │ │ ├── AutoServiceAnnotation.java │ │ ├── ClassUtil.java │ │ ├── AutoServicePlugin.groovy │ │ ├── AutoServiceField.java │ │ ├── AutoServiceEventVisitor.groovy │ │ ├── AutoServiceVisitor.java │ │ ├── AutoServiceTransform.groovy │ │ └── AutoServiceExtension.java │ │ └── Logger.java ├── gradle.properties └── build.gradle ├── sprouter ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── chao │ │ │ └── android │ │ │ └── tools │ │ │ └── router │ │ │ ├── RouterService.java │ │ │ ├── RouteInterceptorCallback.java │ │ │ ├── RouteInterceptor.java │ │ │ ├── RouteParamParse.java │ │ │ ├── RouteException.java │ │ │ ├── annotation │ │ │ ├── RouteAction.java │ │ │ ├── RouteFlags.java │ │ │ ├── RouteType.java │ │ │ ├── RouteData.java │ │ │ ├── RouteExitAnim.java │ │ │ ├── RouteEnterAnim.java │ │ │ ├── RouteRequestCode.java │ │ │ ├── RouteParam.java │ │ │ └── Route.java │ │ │ ├── Autowired.java │ │ │ ├── RouteNavigationCallback.java │ │ │ └── RouteArgs.java │ ├── test │ │ └── java │ │ │ └── chao │ │ │ └── android │ │ │ └── tools │ │ │ └── router │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── chao │ │ └── android │ │ └── tools │ │ └── router │ │ └── ExampleInstrumentedTest.java ├── gradle.properties ├── proguard-rules.pro └── build.gradle ├── tests ├── pool │ ├── .gitignore │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── chao │ │ │ └── app │ │ │ └── pool │ │ │ ├── IA.java │ │ │ ├── IB.java │ │ │ ├── LifecycleService.java │ │ │ ├── IPriorityService.java │ │ │ └── IPathInstanceService.java │ └── build.gradle ├── applib1 │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── chao │ │ │ │ └── test │ │ │ │ └── applib1 │ │ │ │ ├── OnceService.java │ │ │ │ ├── TempService.java │ │ │ │ ├── AService.java │ │ │ │ ├── GlobalService.java │ │ │ │ ├── PriorityService1.java │ │ │ │ ├── PriorityService2.java │ │ │ │ └── PathService.java │ │ ├── test │ │ │ └── java │ │ │ │ └── chao │ │ │ │ └── test │ │ │ │ └── applib1 │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── chao │ │ │ └── test │ │ │ └── applib1 │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── applib2 │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── chao │ │ │ │ └── app │ │ │ │ └── applib2 │ │ │ │ └── BService.java │ │ ├── test │ │ │ └── java │ │ │ │ └── chao │ │ │ │ └── app │ │ │ │ └── applib2 │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── chao │ │ │ └── app │ │ │ └── applib2 │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── appservice │ ├── .gitignore │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── chao │ │ │ └── test │ │ │ └── appservice │ │ │ ├── AppServiceFactory.java │ │ │ ├── IAppLib.java │ │ │ └── IJavaLib.java │ └── build.gradle ├── remoteexample │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── java │ │ │ │ └── chao │ │ │ │ │ └── app │ │ │ │ │ └── remoteexample │ │ │ │ │ ├── ExampleService.java │ │ │ │ │ ├── serviceimpl │ │ │ │ │ ├── LocalFirstServiceImpl.java │ │ │ │ │ ├── ExampleServiceImpl.java │ │ │ │ │ └── RPCForceMainServiceImpl.java │ │ │ │ │ └── LaunchActivity.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── chao │ │ │ │ └── app │ │ │ │ └── remoteexample │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── chao │ │ │ └── app │ │ │ └── remoteexample │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── testpluginlib │ ├── .gitignore │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── chao.java.tools.servicepool.IService │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── testpluginlib │ │ │ ├── MyClass.java │ │ │ ├── TestPluginService2.java │ │ │ ├── TestPluginService.java │ │ │ └── TestPluginService3.java │ └── build.gradle └── testremoteapi │ ├── .gitignore │ ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── chao │ │ │ └── app │ │ │ └── remoteapi │ │ │ ├── RPCForceMainService.java │ │ │ ├── LocalFirstService.java │ │ │ └── IExampleService.java │ ├── test │ │ └── java │ │ │ └── chao │ │ │ └── app │ │ │ └── remoteapi │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── chao │ │ └── app │ │ └── remoteapi │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── app ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── my-services │ │ │ └── test.txt │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.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 │ │ ├── raw │ │ │ └── ami_config.xml │ │ ├── layout │ │ │ ├── empty.xml │ │ │ ├── device_info_settings.xml │ │ │ ├── init_sync_sample.xml │ │ │ ├── test_route_activity.xml │ │ │ ├── rpc_page.xml │ │ │ └── main.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ └── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ └── chao │ │ │ └── android │ │ │ └── tools │ │ │ └── service_pools │ │ │ ├── path │ │ │ ├── IRepeat.java │ │ │ ├── TestPathServices.java │ │ │ ├── PathService2.java │ │ │ ├── PathService.java │ │ │ └── RepeatePathService.java │ │ │ ├── route │ │ │ ├── AppRouters.java │ │ │ ├── RouteField.java │ │ │ ├── RouteDefine.java │ │ │ ├── TestRouteTargetActivity.java │ │ │ └── interceptor │ │ │ │ ├── RouteContinueInterceptor5.java │ │ │ │ ├── RouteInterruptInterceptor4.java │ │ │ │ └── RouteExceptionInterceptor1.java │ │ │ ├── IA.java │ │ │ ├── Printer2.java │ │ │ ├── cache │ │ │ ├── IPoolInstance.java │ │ │ ├── PoolInstance.java │ │ │ └── Pool.java │ │ │ ├── inherited │ │ │ ├── InheritedInheritedActivity2.java │ │ │ ├── BaseInheritedActivity.java │ │ │ ├── InheritedInheritedActivity1.java │ │ │ ├── InheritedInheritedActivity111.java │ │ │ └── InheritedInheritedActivity11.java │ │ │ ├── abs │ │ │ └── Abs.java │ │ │ ├── event │ │ │ ├── HisEvent.java │ │ │ ├── MyEvent.java │ │ │ └── EventSample.java │ │ │ ├── Printer.java │ │ │ ├── xxxxx │ │ │ ├── ServiceProxyBean.java │ │ │ ├── ASMStaticClass.java │ │ │ └── ASMServiceProxy.java │ │ │ ├── init │ │ │ ├── Test.java │ │ │ ├── TestInitService.java │ │ │ ├── TestLazyInitServicePriorityNormal.java │ │ │ ├── TestLazyInitServicePriorityMax.java │ │ │ ├── TestLazyInitServicePriorityMin.java │ │ │ └── InitSampleActivity.java │ │ │ ├── CommonPrinter.java │ │ │ ├── rpc │ │ │ ├── TestService.java │ │ │ └── impl │ │ │ │ └── LocalFirstServiceImpl.java │ │ │ ├── AppService2.java │ │ │ ├── AppService.java │ │ │ ├── sample │ │ │ └── SimpleBaseActivity.java │ │ │ ├── A.java │ │ │ ├── LauncherActivity.java │ │ │ ├── test │ │ │ ├── InitService5.java │ │ │ ├── InitService3.java │ │ │ ├── InitService4.java │ │ │ ├── InitService1.java │ │ │ └── InitService2.java │ │ │ ├── BaseActivity.java │ │ │ ├── fragments │ │ │ ├── HisEventFragment.java │ │ │ └── EventFragment.java │ │ │ ├── serviceinterceptor │ │ │ ├── ServiceDirectReturnInterceptor.java │ │ │ ├── NormalServiceInterceptor.java │ │ │ └── MinPriorityServiceInterceptor.java │ │ │ ├── SimpleFragment.java │ │ │ ├── SecondActivity.java │ │ │ ├── router2 │ │ │ └── RouteApi.java │ │ │ └── App.java │ │ └── AndroidManifest.xml └── proguard-rules.pro ├── empty.gradle ├── release.keystore ├── assembleDebug.sh ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── transformJarDir.sh ├── .gitignore ├── debug.sh ├── settings.gradle ├── changelog.md ├── gradle.properties └── modules.gradle /empty/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sp/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /spa/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sprpc/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /autoservice/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sprouter/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /tests/pool/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | -------------------------------------------------------------------------------- /tests/applib1/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /tests/applib2/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /tests/appservice/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /tests/remoteexample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /tests/testpluginlib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /tests/testremoteapi/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/src/main/resources/META-INF/my-services/test.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /empty.gradle: -------------------------------------------------------------------------------- 1 | 2 | 3 | //module("app").project(":app").include() -------------------------------------------------------------------------------- /release.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/release.keystore -------------------------------------------------------------------------------- /sprpc/readme.md: -------------------------------------------------------------------------------- 1 | #后续将推出XBinder, 一个轻量、高效、功能完善的替代aidl的跨进程框架 2 | 这个组件只是一个跨进程的尝试,不再更新 -------------------------------------------------------------------------------- /assembleDebug.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #/bin/sh 3 | ./gradlew :app:assembleDebug -xlint -xtest --stacktrace -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sprpc/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | spRpc 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | service-pools 3 | 4 | -------------------------------------------------------------------------------- /sprouter/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SpRouter 3 | 4 | -------------------------------------------------------------------------------- /tests/applib1/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | applib1 3 | 4 | -------------------------------------------------------------------------------- /tests/applib2/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | applib2 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /spa/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | servicepool_android 3 | 4 | -------------------------------------------------------------------------------- /transformJarDir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | open /Users/chao/codes/mycode/sp/app/build/intermediates/transforms/AutoServiceTransform/debug -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /tests/testpluginlib/src/main/resources/META-INF/services/chao.java.tools.servicepool.IService: -------------------------------------------------------------------------------- 1 | com.example.testpluginlib.TestPluginService3 -------------------------------------------------------------------------------- /tests/testremoteapi/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RemoteApi 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sp/src/test/resources/META-INF/services/com.aicaigroup.servicepool.DependencyManager: -------------------------------------------------------------------------------- 1 | chao.test.servicepool.test.service.TestDependencyManager -------------------------------------------------------------------------------- /tests/remoteexample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RemoteExample 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /spa/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luqinx/sp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sp/src/test/resources/META-INF/services/chao.java.tools.servicepool.IServiceFactory: -------------------------------------------------------------------------------- 1 | chao.test.servicepool.test.noop.test.service.TestLazyServiceFactory -------------------------------------------------------------------------------- /tests/applib2/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /tests/testpluginlib/src/main/java/com/example/testpluginlib/MyClass.java: -------------------------------------------------------------------------------- 1 | package com.example.testpluginlib; 2 | 3 | public class MyClass { 4 | } 5 | -------------------------------------------------------------------------------- /sprouter/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /tests/applib1/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /sprpc/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /tests/appservice/src/main/java/chao/test/appservice/AppServiceFactory.java: -------------------------------------------------------------------------------- 1 | package chao.test.appservice; 2 | 3 | public class AppServiceFactory { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /tests/testremoteapi/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /autoservice/src/main/resources/META-INF/gradle-plugins/sp.autoservice.properties: -------------------------------------------------------------------------------- 1 | implementation-class=chao.android.gradle.servicepool.compiler.AutoServicePlugin 2 | -------------------------------------------------------------------------------- /tests/pool/src/main/java/chao/app/pool/IA.java: -------------------------------------------------------------------------------- 1 | package chao.app.pool; 2 | 3 | /** 4 | * IA.java 5 | */ 6 | public interface IA { 7 | String aName(); 8 | } 9 | -------------------------------------------------------------------------------- /tests/pool/src/main/java/chao/app/pool/IB.java: -------------------------------------------------------------------------------- 1 | package chao.app.pool; 2 | 3 | /** 4 | * IB.java 5 | */ 6 | public interface IB { 7 | String bName(); 8 | } 9 | -------------------------------------------------------------------------------- /tests/pool/src/main/java/chao/app/pool/LifecycleService.java: -------------------------------------------------------------------------------- 1 | package chao.app.pool; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-01-09 6 | */ 7 | public interface LifecycleService { 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/res/raw/ami_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/LazyHolder.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2023/2/5 6 | */ 7 | class LazyHolder { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/NoOpInstance.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/1 6 | */ 7 | public interface NoOpInstance { 8 | } 9 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/RouterService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-07-28 6 | */ 7 | public interface RouterService { 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/path/IRepeat.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.path; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-06-16 6 | */ 7 | public interface IRepeat { 8 | } 9 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/hunter/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * copy form git@github.com:Leaking/Hunter.git 4 | * 5 | */ 6 | 7 | package chao.android.gradle.servicepool.hunter; 8 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/NoOpConstructorArg.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/3 6 | */ 7 | public class NoOpConstructorArg { 8 | } 9 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/TestNoOpObject.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/5 6 | */ 7 | public class TestNoOpObject { 8 | } 9 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/event/EventService.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.event; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-08-27 6 | */ 7 | public interface EventService { 8 | } 9 | -------------------------------------------------------------------------------- /tests/pool/src/main/java/chao/app/pool/IPriorityService.java: -------------------------------------------------------------------------------- 1 | package chao.app.pool; 2 | 3 | /** 4 | * 5 | * IPriorityService.java 6 | */ 7 | public interface IPriorityService { 8 | int getPriority(); 9 | } 10 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IServices.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-07-26 6 | */ 7 | public interface IServices extends IService, Iterable { 8 | } 9 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/NoOp.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/5 6 | */ 7 | public interface NoOp { 8 | } 9 | -------------------------------------------------------------------------------- /tests/testpluginlib/src/main/java/com/example/testpluginlib/TestPluginService2.java: -------------------------------------------------------------------------------- 1 | package com.example.testpluginlib; 2 | 3 | /** 4 | * @author luqin 5 | * @date 2019-07-09 6 | */ 7 | public class TestPluginService2 { 8 | } 9 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IInitService.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * InitService默认scope为global 5 | */ 6 | public interface IInitService extends IService { 7 | void onInit(); 8 | } 9 | -------------------------------------------------------------------------------- /tests/pool/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | 3 | dependencies { 4 | implementation fileTree(dir: 'libs', include: ['*.jar']) 5 | api sp 6 | } 7 | 8 | sourceCompatibility = "7" 9 | targetCompatibility = "7" 10 | -------------------------------------------------------------------------------- /tests/appservice/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | 3 | dependencies { 4 | implementation fileTree(dir: 'libs', include: ['*.jar']) 5 | api sp 6 | } 7 | 8 | sourceCompatibility = "7" 9 | targetCompatibility = "7" 10 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/compiler/AutoServiceAnnotation.java: -------------------------------------------------------------------------------- 1 | package chao.android.gradle.servicepool.compiler; 2 | 3 | /** 4 | * @author luqin 2019-07-15 5 | */ 6 | public class AutoServiceAnnotation { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | /.idea/caches/build_file_checksums.ser 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | .DS_Store 10 | /build 11 | /captures 12 | .externalNativeBuild 13 | 14 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/Sp.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * 5 | * Service Pool 别名 6 | * 7 | * @author luqin 8 | * @since 2020-08-06 9 | */ 10 | public final class Sp extends ServicePool { 11 | } 12 | -------------------------------------------------------------------------------- /tests/testpluginlib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | 3 | dependencies { 4 | implementation fileTree(dir: 'libs', include: ['*.jar']) 5 | implementation sp 6 | } 7 | 8 | sourceCompatibility = "7" 9 | targetCompatibility = "7" 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/hunter/RunVariant.java: -------------------------------------------------------------------------------- 1 | package chao.android.gradle.servicepool.hunter; 2 | 3 | /** 4 | * Created by Quinn on 10/05/2018 5 | */ 6 | public enum RunVariant { 7 | DEBUG, RELEASE, ALWAYS, NEVER 8 | } 9 | -------------------------------------------------------------------------------- /sprpc/src/main/java/chao/android/tools/rpc/RemoteCallbackHandler.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.rpc; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-08-03 6 | */ 7 | public interface RemoteCallbackHandler { 8 | void resolve(T result); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/route/AppRouters.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.route; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-09-03 6 | */ 7 | public interface AppRouters { 8 | 9 | void startActivity(); 10 | } 11 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-08-20 6 | */ 7 | public interface ExceptionHandler { 8 | void onException(Throwable e, String message); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jul 10 15:27:33 CST 2019 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-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/IA.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-12 8 | */ 9 | public interface IA extends IService { 10 | int getInt(); 11 | } 12 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IServiceLoader.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020/9/6 6 | */ 7 | public interface IServiceLoader extends IService { 8 | 9 | Iterable> getServices(); 10 | } 11 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/II.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/5 8 | */ 9 | public interface II extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/device_info_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #./gradlew buildDebug -xlint -xtest --stacktrace -Dorg.gradle.debug=true 4 | ./gradlew clean && ./gradlew :app:assembleDebug -xlint -xtest --stacktrace -Dorg.gradle.daemon=false -Dorg.gradle.debug=true 5 | #./gradlew clean && ./gradlew :app:assembleDebug -Dorg.gradle.debug=true 6 | -------------------------------------------------------------------------------- /tests/pool/src/main/java/chao/app/pool/IPathInstanceService.java: -------------------------------------------------------------------------------- 1 | package chao.app.pool; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * IPathInstanceService.java 7 | */ 8 | public interface IPathInstanceService extends IService { 9 | String pathServiceName(); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/Printer2.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | /** 4 | * @author luqin qinchao@mochongsoft.com 5 | * @project: zmjx-sp 6 | * @description: 7 | * @date 2019-07-16 8 | */ 9 | public interface Printer2 { 10 | void print(); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/cache/IPoolInstance.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.cache; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-08-06 8 | */ 9 | public interface IPoolInstance extends IService { 10 | } 11 | -------------------------------------------------------------------------------- /sprpc/src/main/java/chao/android/tools/rpc/RemoteService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.rpc; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-27 8 | */ 9 | public interface RemoteService extends IService { 10 | boolean remoteExist(); 11 | } 12 | -------------------------------------------------------------------------------- /tests/appservice/src/main/java/chao/test/appservice/IAppLib.java: -------------------------------------------------------------------------------- 1 | package chao.test.appservice; 2 | 3 | import chao.java.tools.servicepool.IInitService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/4/30 8 | */ 9 | public interface IAppLib extends IInitService { 10 | void appPrint(); 11 | } 12 | -------------------------------------------------------------------------------- /tests/appservice/src/main/java/chao/test/appservice/IJavaLib.java: -------------------------------------------------------------------------------- 1 | package chao.test.appservice; 2 | 3 | import chao.java.tools.servicepool.IInitService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/4/30 8 | */ 9 | public interface IJavaLib extends IInitService { 10 | void javaPrint(); 11 | } 12 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestService2.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/3 8 | */ 9 | public class TestService2 implements IService { 10 | } 11 | -------------------------------------------------------------------------------- /tests/remoteexample/src/main/java/chao/app/remoteexample/ExampleService.java: -------------------------------------------------------------------------------- 1 | package chao.app.remoteexample; 2 | 3 | 4 | import chao.android.tools.rpc.RemoteMessageService; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-07-23 9 | */ 10 | public class ExampleService extends RemoteMessageService { 11 | } 12 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestLazyService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/4 8 | */ 9 | public class TestLazyService implements IService { 10 | } 11 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestWeakService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/5 8 | */ 9 | public class TestWeakService implements IService { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/inherited/InheritedInheritedActivity2.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.inherited; 2 | 3 | import android.app.Activity; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-13 8 | */ 9 | public class InheritedInheritedActivity2 extends Activity { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestLazyService1.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/4 8 | */ 9 | public class TestLazyService1 implements IService{ 10 | } 11 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestLazyService2.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/4 8 | */ 9 | public class TestLazyService2 implements IService { 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/abs/Abs.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.abs; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-09-26 8 | */ 9 | public abstract class Abs implements IService { 10 | public abstract void method(); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/event/HisEvent.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.event; 2 | 3 | import chao.java.tools.servicepool.annotation.Event; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-08-29 8 | */ 9 | @Event 10 | public interface HisEvent { 11 | void postHisEvent(); 12 | } 13 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestAbsService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/5 8 | */ 9 | public abstract class TestAbsService implements IService { 10 | } 11 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/RouteInterceptorCallback.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-09-30 6 | */ 7 | public interface RouteInterceptorCallback { 8 | void onContinue(RouteBuilder route); 9 | 10 | void onInterrupt(Throwable e); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.DefaultInitService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/4/29 8 | */ 9 | public class TestService extends DefaultInitService { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/DefaultInitService.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/4/30 6 | */ 7 | public class DefaultInitService extends DefaultService implements IInitService { 8 | 9 | @Override 10 | public void onInit() { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/cache/PoolInstance.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.cache; 2 | 3 | import chao.java.tools.servicepool.annotation.Service; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-08-06 8 | */ 9 | @Service(scope = 10) 10 | public class PoolInstance implements IPoolInstance { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/combine/CombineEmptyHandler.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.combine; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-31 8 | */ 9 | public interface CombineEmptyHandler { 10 | void onHandleEmpty(T source, Method method, Object[] args); 11 | } 12 | -------------------------------------------------------------------------------- /empty/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | dependencies { 4 | implementation fileTree(dir: 'libs', include: ['*.jar']) 5 | } 6 | 7 | sourceCompatibility = "7" 8 | targetCompatibility = "7" 9 | 10 | 11 | abkit { 12 | maven { 13 | groupId "chao.java.tools" 14 | artifactId "empty" 15 | versionName "1.0.0" 16 | } 17 | } -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/noop/TestNoOpObjectWithDefaultConstructor.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.noop; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/5 6 | */ 7 | public class TestNoOpObjectWithDefaultConstructor { 8 | 9 | public TestNoOpObjectWithDefaultConstructor() { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/noop/TestNoOpObjectWithProtectedConstructor.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.noop; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/5 6 | */ 7 | public class TestNoOpObjectWithProtectedConstructor { 8 | 9 | TestNoOpObjectWithProtectedConstructor() { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/noop/TestNoOpObjectWithPrivateConstructor.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.noop; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/5 6 | */ 7 | public class TestNoOpObjectWithPrivateConstructor { 8 | 9 | private TestNoOpObjectWithPrivateConstructor() { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/NoPublicService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/5 8 | */ 9 | class NoPublicService implements IService { 10 | 11 | // public NoPublicService() {} 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/RouteInterceptor.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-10-08 8 | */ 9 | public interface RouteInterceptor extends IService { 10 | void intercept(RouteBuilder route, RouteInterceptorCallback callback); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/Printer.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin qinchao@mochongsoft.com 7 | * @project: zmjx-sp 8 | * @description: 9 | * @date 2019-07-16 10 | */ 11 | public interface Printer extends IService { 12 | void print(); 13 | } 14 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/combine/CombineService.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.combine; 2 | 3 | 4 | /** 5 | * @author luqin 6 | * @since 2019-09-30 7 | */ 8 | public interface CombineService extends Iterable { 9 | int size(); 10 | 11 | T get(int index); 12 | 13 | T setEmptyHandler(CombineEmptyHandler handler); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/event/MyEvent.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.event; 2 | 3 | import chao.java.tools.servicepool.annotation.Event; 4 | import chao.java.tools.servicepool.event.EventService; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2019-08-27 9 | */ 10 | @Event 11 | public interface MyEvent { 12 | void postEvent(); 13 | } 14 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/compiler/ClassUtil.java: -------------------------------------------------------------------------------- 1 | package chao.android.gradle.servicepool.compiler; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-07-17 6 | */ 7 | public class ClassUtil { 8 | 9 | public static String class2Desc(Class clazz) { 10 | return "L" + clazz.getName().replaceAll("\\.", "/") + ";"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /sp/src/test/resources/META-INF/services/chao.java.tools.servicepool.IService: -------------------------------------------------------------------------------- 1 | chao.test.servicepool.test.noop.test.service.TestService 2 | chao.test.servicepool.test.noop.test.service.TestService2 3 | chao.test.servicepool.test.noop.test.service.TestLazyService 4 | chao.test.servicepool.test.noop.test.service.NoPublicService 5 | chao.test.servicepool.test.noop.test.service.TestAbsImplService 6 | 7 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/RouteParamParse.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | import java.lang.annotation.Annotation; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-28 8 | */ 9 | class RouteParamParse { 10 | 11 | public static T parse(Annotation annotation, T value, Object... except) { 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/Constant.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/4/30 6 | */ 7 | public interface Constant { 8 | 9 | interface initState { 10 | int UNINIT = 0; 11 | int TRYING = 1; 12 | int INITING = 2; 13 | int INITED = 3; 14 | int FAILED = 4; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/IPrinter.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IInitService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/4/30 8 | */ 9 | public interface IPrinter extends IInitService { 10 | 11 | void setName(String name); 12 | 13 | void printName(); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/xxxxx/ServiceProxyBean.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.xxxxx; 2 | 3 | import java.util.List; 4 | 5 | import chao.java.tools.servicepool.IInitService; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2019-08-28 10 | */ 11 | public class ServiceProxyBean { 12 | 13 | public List> services; 14 | } 15 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/cache/ServiceCacheStrategy.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.cache; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * Service缓存策略 7 | * 8 | * @author qinchao 9 | * @since 2019/6/25 10 | */ 11 | public interface ServiceCacheStrategy { 12 | T getService(Class serviceClass, Class originClass); 13 | } 14 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestNoOpService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/5 8 | */ 9 | public class TestNoOpService implements NoOp, IService { 10 | 11 | public Integer getInteger() { 12 | return 10086; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/OnceService.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.LifecycleService; 4 | import chao.java.tools.servicepool.IService; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * 9 | * OnceService.java 10 | */ 11 | @Service(scope = IService.Scope.once) 12 | public class OnceService implements LifecycleService { 13 | } 14 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/TempService.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.LifecycleService; 4 | import chao.java.tools.servicepool.IService; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * 9 | * TempService.java 10 | */ 11 | @Service(scope = IService.Scope.temp) 12 | public class TempService implements LifecycleService { 13 | } 14 | -------------------------------------------------------------------------------- /tests/testpluginlib/src/main/java/com/example/testpluginlib/TestPluginService.java: -------------------------------------------------------------------------------- 1 | package com.example.testpluginlib; 2 | 3 | import chao.java.tools.servicepool.annotation.Service; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-07-09 8 | */ 9 | @Service 10 | public class TestPluginService { 11 | public void print() { 12 | System.out.println("I'm a test service."); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/init/Test.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.init; 2 | 3 | import chao.java.tools.servicepool.AbsInitServiceManager; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-09-17 8 | */ 9 | public class Test extends AbsInitServiceManager { 10 | 11 | public Test(){ 12 | addInitService(TestInitService.class); 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/RouteException.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-07-28 6 | */ 7 | public class RouteException extends RuntimeException { 8 | public RouteException(String m) { 9 | super(m); 10 | } 11 | 12 | public RouteException(String m, Throwable e) { 13 | super(m, e); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/AService.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.IA; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-01-09 9 | */ 10 | @Service 11 | public class AService implements IA { 12 | 13 | @Override 14 | public String aName() { 15 | return "A Service"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/applib2/src/main/java/chao/app/applib2/BService.java: -------------------------------------------------------------------------------- 1 | package chao.app.applib2; 2 | 3 | import chao.app.pool.IB; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-01-09 9 | */ 10 | @Service 11 | public class BService implements IB { 12 | 13 | @Override 14 | public String bName() { 15 | return "B Service"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/path/TestPathServices.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.path; 2 | 3 | import chao.java.tools.servicepool.PathServices; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-09-18 8 | */ 9 | public class TestPathServices extends PathServices { 10 | 11 | public TestPathServices() { 12 | put("/app/path", PathService.class); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/combine/CombineCallback.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.combine; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-09-30 8 | */ 9 | public interface CombineCallback { 10 | void onContinue(T t); 11 | void onUserInterrupt(T t, IService service); 12 | void onInterrupt(T t, Throwable e); 13 | } 14 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/GlobalService.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.LifecycleService; 4 | import chao.java.tools.servicepool.IService; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * 9 | * GlobalService.java 10 | */ 11 | @Service(scope = IService.Scope.global) 12 | public class GlobalService implements LifecycleService { 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/CommonPrinter.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | import chao.java.tools.servicepool.annotation.Service; 4 | 5 | /** 6 | * @author luqin 7 | * @date 2019-07-17 8 | */ 9 | @Service 10 | public class CommonPrinter implements Printer { 11 | 12 | public void print() { 13 | System.out.println("I'm a common Printer."); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/service/TestAbsImplService.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.service; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/5 8 | */ 9 | public class TestAbsImplService extends TestAbsService implements IService, II { 10 | public String tag() { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/PriorityService1.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.IPriorityService; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * 8 | * PriorityService1.java 9 | */ 10 | @Service(priority = 1) 11 | public class PriorityService1 implements IPriorityService { 12 | @Override 13 | public int getPriority() { 14 | return 1; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/NoOpInstantiator.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | import java.lang.reflect.Constructor; 4 | import java.util.concurrent.atomic.AtomicInteger; 5 | 6 | /** 7 | * @author qinchao 8 | * @since 2019/6/19 9 | */ 10 | public interface NoOpInstantiator extends IService{ 11 | Class make(Class clazz, Constructor constructor, Object[] params, AtomicInteger noOpCount); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IServiceInterceptor.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | /** 6 | * 7 | * 拦截器 8 | * 9 | * @author luqin 10 | * @since 2020-07-12 11 | */ 12 | public interface IServiceInterceptor extends IService { 13 | void intercept(Class originClass, IService source, Method method, Object[] args, IServiceInterceptorCallback callback); 14 | } 15 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/PriorityService2.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.IPriorityService; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-01-09 9 | */ 10 | @Service(priority = 1) 11 | public class PriorityService2 implements IPriorityService { 12 | @Override 13 | public int getPriority() { 14 | return 2; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/ServicePoolException.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/3 6 | */ 7 | public class ServicePoolException extends RuntimeException { 8 | 9 | public ServicePoolException(String message) { 10 | super(message); 11 | } 12 | 13 | public ServicePoolException(String message, Throwable t) { 14 | super(message, t); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/NoOpInstanceFactoryForTest.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop; 2 | 3 | 4 | import chao.java.tools.servicepool.NoOpInstanceFactory; 5 | 6 | /** 7 | * @author qinchao 8 | * @since 2019/5/5 9 | */ 10 | public class NoOpInstanceFactoryForTest extends NoOpInstanceFactory { 11 | 12 | @Override 13 | public T newInstance(Class clazz) { 14 | return super.newInstance(clazz); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IPathService.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * 实现类由插件AutoService生成 5 | * 6 | * chao/java/tools/servicepool/gen/PathServicesInstance 7 | * 8 | * 9 | * @author luqin 10 | * @since 2019-09-26 11 | */ 12 | public interface IPathService extends IService { 13 | 14 | void put(String path, Class service); 15 | 16 | Class get(String path); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /tests/applib1/src/main/java/chao/test/applib1/PathService.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import chao.app.pool.IPathInstanceService; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * 组件A中 8 | * 9 | * PathService 10 | */ 11 | @Service(path = "pathService") 12 | public class PathService implements IPathInstanceService { 13 | @Override 14 | public String pathServiceName() { 15 | return "Path Service"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/DependencyManager.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/4/30 8 | */ 9 | public interface DependencyManager extends IService { 10 | // void addService(IInitService service); 11 | // 12 | // void servicesInit(); 13 | 14 | void tryInitService(IInitService service, List> dependencies, boolean async); 15 | } 16 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IServiceFactories.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * 实现类由插件AutoService生成: 5 | * 6 | * chao/java/tools/servicepool/gen/ServiceFactoriesInstance 7 | * 8 | * @author luqin 9 | * @since 2019-07-13 10 | */ 11 | public interface IServiceFactories extends IService { 12 | void addFactory(String pkgName, IServiceFactory serviceFactory); 13 | 14 | IServiceFactory getServiceFactory(String packageName); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/route/RouteField.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.route; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2019-09-03 11 | */ 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.CLASS) 14 | public @interface RouteField { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteAction.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteAction { 15 | } 16 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteFlags.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteFlags { 15 | } 16 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteType.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteType { 15 | } 16 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteData.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteData { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteExitAnim.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteExitAnim { 15 | } 16 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenLocal() 4 | mavenCentral() 5 | google() 6 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public/'} 7 | } 8 | 9 | dependencies { 10 | classpath 'io.github.luqinx:abkit:0.0.1' 11 | } 12 | } 13 | 14 | /** 使用ABKit将依赖管理转移到modules.gradle **/ 15 | /** ABKit可以将模块管理统一聚合到modules.gradle中 **/ 16 | import chao.android.gradle.plugin.api.ABKit 17 | ABKit.inject(getSettings(), getGradle()) -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/DefaultService.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | 4 | /** 5 | * @author qinchao 6 | * @since 2019/5/1 7 | */ 8 | public class DefaultService implements IService { 9 | public String path() { 10 | return getClass().getName(); 11 | } 12 | 13 | public int priority() { 14 | return IService.Priority.NORMAL_PRIORITY; 15 | } 16 | 17 | public int scope() { 18 | return Scope.once; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/ILogger.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-08-06 6 | */ 7 | public interface ILogger extends IService { 8 | void e(String tag, String message); 9 | void w(String tag, String message); 10 | void d(String tag, String message); 11 | void i(String tag, String message); 12 | void v(String tag, String message); 13 | void log(Object... messages); 14 | void method(); 15 | } 16 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/annotation/Event.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2019-08-27 11 | */ 12 | @Target({ElementType.TYPE, ElementType.FIELD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Event { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteEnterAnim.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteEnterAnim { 15 | } 16 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteRequestCode.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteRequestCode { 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/rpc/TestService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.rpc; 2 | 3 | import chao.android.tools.rpc.RemoteCallbackHandler; 4 | import chao.android.tools.service_pools.router2.RouteFragment; 5 | import chao.java.tools.servicepool.IService; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2020-08-03 10 | */ 11 | public interface TestService extends IService { 12 | void test(RemoteCallbackHandler callbackHandler); 13 | } 14 | -------------------------------------------------------------------------------- /tests/applib2/src/test/java/chao/app/applib2/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.app.applib2; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/annotation/RouteParam.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020-07-28 11 | */ 12 | @Target(ElementType.PARAMETER) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RouteParam { 15 | String value(); 16 | } 17 | -------------------------------------------------------------------------------- /tests/testremoteapi/src/test/java/chao/app/remoteapi/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.app.remoteapi; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/cache/custom/CustomCacheStrategy.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.cache.custom; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | import chao.java.tools.servicepool.IServiceFactory; 5 | 6 | /** 7 | * 8 | * 9 | * 10 | * 11 | * @author luqin 12 | * @since 2020-08-06 13 | */ 14 | public interface CustomCacheStrategy extends IService { 15 | T getService(IServiceFactory factory, Class originClass, Class serviceClass); 16 | } 17 | -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/Autowired.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 10 | * todo impl 11 | * 12 | * @author luqin 13 | * @since 2019-10-17 14 | */ 15 | @Retention(RetentionPolicy.CLASS) 16 | @Target(ElementType.FIELD) 17 | public @interface Autowired { 18 | String value(); 19 | } 20 | -------------------------------------------------------------------------------- /sprouter/src/test/java/chao/android/tools/router/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/AppService2.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * @author qinchao 8 | * @since 2019/4/29 9 | */ 10 | @Service(priority = IService.Priority.MAX_PRIORITY) 11 | public class AppService2 implements Printer2 { 12 | 13 | @Override 14 | public void print() { 15 | System.out.println("I'm app service 2"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/DependencyTest.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test; 2 | 3 | import chao.java.tools.servicepool.ServicePool; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | /** 8 | * @author qinchao 9 | * @since 2019/4/30 10 | */ 11 | public class DependencyTest { 12 | 13 | @Before 14 | public void init() { 15 | ServicePool.loadServices(); 16 | } 17 | 18 | @Test 19 | public void testDependency() { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/applib1/src/test/java/chao/test/applib1/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.test.applib1; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | 6 | import org.junit.Test; 7 | 8 | /** 9 | * Example local unit test, which will execute on the development machine (host). 10 | * 11 | * @see Testing documentation 12 | */ 13 | public class ExampleUnitTest { 14 | @Test 15 | public void addition_isCorrect() { 16 | assertEquals(4, 2 + 2); 17 | } 18 | } -------------------------------------------------------------------------------- /tests/remoteexample/src/test/java/chao/app/remoteexample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.app.remoteexample; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sprouter/src/main/java/chao/android/tools/router/RouteNavigationCallback.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.router; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2019-09-30 8 | */ 9 | public interface RouteNavigationCallback { 10 | void onLost(RouteBuilder route); 11 | 12 | void onFound(Class service, RouteBuilder builder); 13 | 14 | void onInterrupt(RouteBuilder route, Throwable e); 15 | 16 | void onArrival(RouteBuilder route); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/inherited/BaseInheritedActivity.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.inherited; 2 | 3 | import chao.app.ami.base.AMIActivity; 4 | import chao.java.tools.servicepool.IService; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2020-07-13 10 | */ 11 | @Service(inherited = true, priority = IService.Priority.MIN_PRIORITY) 12 | public abstract class BaseInheritedActivity extends AMIActivity implements IService { 13 | } 14 | -------------------------------------------------------------------------------- /sprpc/src/test/java/chao/android/tools/servicepool/rpc/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.servicepool.rpc; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /tests/testremoteapi/src/main/java/chao/app/remoteapi/RPCForceMainService.java: -------------------------------------------------------------------------------- 1 | package chao.app.remoteapi; 2 | 3 | import chao.android.tools.rpc.annotation.RemoteServiceConfig; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-23 8 | */ 9 | @RemoteServiceConfig(remotePackageName = "chao.app.remoteexample", 10 | remoteComponentName = "chao.app.remoteexample.ExampleService", 11 | forceMainThread = true, 12 | timeout = 3001 13 | ) 14 | public interface RPCForceMainService extends IExampleService { 15 | } 16 | -------------------------------------------------------------------------------- /spa/src/test/java/chao/test/servicepool/android/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.android; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | 6 | import org.junit.Test; 7 | 8 | /** 9 | * Example local unit test, which will execute on the development machine (host). 10 | * 11 | * @see Testing documentation 12 | */ 13 | public class ExampleUnitTest { 14 | @Test 15 | public void addition_isCorrect() { 16 | assertEquals(4, 2 + 2); 17 | } 18 | } -------------------------------------------------------------------------------- /sprpc/src/main/java/chao/android/tools/rpc/RemoteServiceException.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.rpc; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2020-07-23 6 | */ 7 | public class RemoteServiceException extends RuntimeException { 8 | public RemoteServiceException() { 9 | super(); 10 | } 11 | 12 | public RemoteServiceException(String message) { 13 | super(message); 14 | } 15 | 16 | public RemoteServiceException(String message, Throwable e) { 17 | super(message, e); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/ServiceController.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/4/29 6 | */ 7 | public interface ServiceController { 8 | 9 | 10 | T getFixedServiceByClass(Class t); 11 | 12 | T getServiceByClass(Class t); 13 | 14 | void loadFinished(); 15 | 16 | ServiceProxy getProxy(Class clazz); 17 | 18 | void recycleService(Class clazz); 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/AppService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * @author qinchao 8 | * @since 2019/4/29 9 | */ 10 | @Service(priority = IService.Priority.MAX_PRIORITY, scope = IService.Scope.once) 11 | public class AppService implements Printer { 12 | 13 | @Override 14 | public void print() { 15 | System.out.println("I'm app service"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/route/RouteDefine.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.route; 2 | 3 | import android.os.Bundle; 4 | 5 | /** 6 | * 7 | * 动画animation 8 | * 参数 9 | * path 10 | * Activity 11 | * 12 | * flag 13 | * 14 | * 15 | * 16 | * @author luqin 17 | * @since 2019-09-03 18 | */ 19 | public class RouteDefine { 20 | 21 | private int inAnim; 22 | 23 | private int outAnim; 24 | 25 | private String path; 26 | 27 | private int flag; 28 | 29 | private Bundle extras; 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/route/TestRouteTargetActivity.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.route; 2 | 3 | import chao.android.tools.service_pools.R; 4 | import chao.app.ami.annotations.LayoutID; 5 | import chao.app.ami.base.AMIActivity; 6 | import chao.java.tools.servicepool.annotation.Service; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2019-10-09 11 | */ 12 | @LayoutID(R.layout.empty) 13 | @Service(path = "/app/routeTarget") 14 | public class TestRouteTargetActivity extends AMIActivity { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/sample/SimpleBaseActivity.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.sample; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2020-01-09 10 | */ 11 | public class SimpleBaseActivity extends AppCompatActivity { 12 | 13 | @Override 14 | protected void onCreate(@Nullable Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/Logger.java: -------------------------------------------------------------------------------- 1 | package chao.android.gradle.servicepool; 2 | 3 | /** 4 | * @author luqin 5 | * @since 2019-07-09 6 | */ 7 | public class Logger { 8 | 9 | public static void log(String tag, Object... args) { 10 | StringBuilder sbuilder = new StringBuilder(); 11 | sbuilder.append(tag).append(": "); 12 | for (Object arg: args) { 13 | sbuilder.append(arg).append(","); 14 | } 15 | System.out.println(sbuilder.toString()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/A.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | import chao.java.tools.servicepool.annotation.Service; 5 | 6 | /** 7 | * @author qinchao 8 | * @since 2019/6/25 9 | */ 10 | @Service 11 | public class A implements IA, IService { 12 | 13 | private int a; 14 | 15 | { 16 | a = 10; 17 | } 18 | 19 | public A() { 20 | a = 100; 21 | } 22 | 23 | public int getInt() { 24 | return 10086; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IServiceFactory.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | import java.util.HashSet; 4 | 5 | /** 6 | * @author qinchao 7 | * @since 2019/5/4 8 | * 9 | */ 10 | public interface IServiceFactory { 11 | 12 | HashSet createServiceProxies(Class clazz); 13 | 14 | ServiceProxy createFixedServiceProxy(Class clazz); 15 | 16 | ServiceProxy createServiceProxy(Class clazz); 17 | 18 | IService createInstance(Class clazz); 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/inherited/InheritedInheritedActivity1.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.inherited; 2 | 3 | import android.os.Bundle; 4 | import android.os.PersistableBundle; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-07-13 9 | */ 10 | public class InheritedInheritedActivity1 extends BaseInheritedActivity { 11 | 12 | @Override 13 | public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { 14 | super.onCreate(savedInstanceState, persistentState); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/path/PathService2.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.path; 2 | 3 | import chao.android.tools.service_pools.Printer; 4 | import chao.java.tools.servicepool.IService; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2019-09-18 10 | */ 11 | @Service(path = "/app/path2") 12 | public class PathService2 implements Printer, IService { 13 | 14 | public void print(){ 15 | System.out.println("this is a path service 2."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/annotation/Services.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 11 | * 12 | * @author luqin 13 | * @since 2020-06-15 14 | */ 15 | @Target(ElementType.TYPE) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface Services { 18 | Service[] value(); 19 | } 20 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/InitServiceManager.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | /** 4 | * 5 | * 实现类由插件AutoService生成 6 | * 7 | * chao/java/tools/servicepool/gen/InitServiceManagerInstance 8 | * 9 | * 10 | * InitService默认使用懒加载,但有的场景需要启动时直接加载 11 | * 12 | * 这里加载的是非懒加载的InitService (lazy=false) 13 | * 14 | * @author luqin 15 | * @since 2019-09-26 16 | */ 17 | public interface InitServiceManager extends IService { 18 | 19 | void initService(); 20 | 21 | void addInitService(Class initService); 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/inherited/InheritedInheritedActivity111.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.inherited; 2 | 3 | import android.os.Bundle; 4 | import android.os.PersistableBundle; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-07-13 9 | */ 10 | public class InheritedInheritedActivity111 extends InheritedInheritedActivity11 { 11 | 12 | @Override 13 | public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { 14 | super.onCreate(savedInstanceState, persistentState); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/init/TestInitService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.init; 2 | 3 | import chao.java.tools.servicepool.IInitService; 4 | import chao.java.tools.servicepool.annotation.Init; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2019-09-17 10 | */ 11 | @Init(lazy = false) 12 | @Service 13 | public class TestInitService implements IInitService { 14 | @Override 15 | public void onInit() { 16 | System.out.println("lazy service inited."); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/testremoteapi/src/main/java/chao/app/remoteapi/LocalFirstService.java: -------------------------------------------------------------------------------- 1 | package chao.app.remoteapi; 2 | 3 | import chao.android.tools.rpc.annotation.RemoteServiceConfig; 4 | import chao.java.tools.servicepool.IService; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2020-07-27 9 | */ 10 | @RemoteServiceConfig(remotePackageName = "chao.app.remoteexample", remoteComponentName = "chao.app.remoteexample.ExampleService") 11 | public interface LocalFirstService extends IService { 12 | int getInt(); 13 | 14 | String getString(); 15 | 16 | void function(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/path/PathService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.path; 2 | 3 | import chao.android.tools.service_pools.Printer; 4 | import chao.java.tools.servicepool.IService; 5 | import chao.java.tools.servicepool.annotation.Service; 6 | 7 | /** 8 | * @author luqin 9 | * @since 2019-09-18 10 | */ 11 | @Service(path = "/app/path", scope = IService.Scope.global) 12 | public class PathService implements Printer, IService { 13 | 14 | public void print(){ 15 | System.out.println("this is a path service."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spa/src/main/java/chao/android/tools/servicepool/init/AndroidInitService.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.servicepool.init; 2 | 3 | import android.content.Context; 4 | 5 | import chao.android.tools.servicepool.Spa; 6 | import chao.java.tools.servicepool.IInitService; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2020/8/21 11 | */ 12 | public abstract class AndroidInitService implements IInitService { 13 | 14 | @Override 15 | public void onInit() { 16 | onInit(Spa.getContext()); 17 | } 18 | 19 | protected abstract void onInit(Context applicationContext); 20 | } 21 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/ServiceThreadFactory.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | import java.util.concurrent.ThreadFactory; 4 | import java.util.concurrent.atomic.AtomicInteger; 5 | 6 | /** 7 | * @author qinchao 8 | * @since 2019/4/30 9 | */ 10 | public class ServiceThreadFactory implements ThreadFactory { 11 | 12 | private final AtomicInteger mCount = new AtomicInteger(1); 13 | 14 | @Override 15 | public Thread newThread(Runnable runnable) { 16 | return new Thread(runnable, "servicepool-" + mCount.getAndIncrement()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/compiler/AutoServicePlugin.groovy: -------------------------------------------------------------------------------- 1 | package chao.android.gradle.servicepool.compiler 2 | 3 | import com.android.build.gradle.AppExtension 4 | import org.gradle.api.Plugin 5 | import org.gradle.api.Project 6 | 7 | /** 8 | * @author qinchao 9 | * @since 2019/6/25 10 | */ 11 | class AutoServicePlugin implements Plugin { 12 | 13 | @Override 14 | void apply(Project project) { 15 | AppExtension android = project.extensions.getByName("android") 16 | android.registerTransform(new AutoServiceTransform(project)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/cache/Specific.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool.cache; 2 | 3 | import chao.java.tools.servicepool.IService; 4 | 5 | /** 6 | * @author luqin 7 | * @since 2020-07-23 8 | */ 9 | public final class Specific extends AbsServiceCacheStrategy { 10 | 11 | private T service; 12 | 13 | public Specific(T service) { 14 | this.service = service; 15 | } 16 | 17 | @Override 18 | public T getService(Class serviceClass, Class originClass) { 19 | return getProxyService(originClass, service); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sp/src/main/java/chao/java/tools/servicepool/IServiceInterceptorCallback.java: -------------------------------------------------------------------------------- 1 | package chao.java.tools.servicepool; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | /** 6 | * 7 | * 拦截器 8 | * 9 | * @author luqin 10 | * @since 2020-07-12 11 | */ 12 | public interface IServiceInterceptorCallback { 13 | 14 | /** 15 | * @param method next method 16 | * 继续执行下一个拦截策略, 如果没有下一个拦截,执行源对象方法 17 | * @param args args 18 | */ 19 | void onContinue(Method method, Object... args); 20 | 21 | /** 22 | * 拦截,并返回指定result 23 | * 24 | * @param result 拦截返回值 25 | */ 26 | void onInterrupt(Object result); 27 | } 28 | -------------------------------------------------------------------------------- /sp/src/test/java/chao/test/servicepool/test/noop/test/noop/TestNoOpObjectWithArgumentsConstructor.java: -------------------------------------------------------------------------------- 1 | package chao.test.servicepool.test.noop.test.noop; 2 | 3 | /** 4 | * @author qinchao 5 | * @since 2019/5/5 6 | */ 7 | public class TestNoOpObjectWithArgumentsConstructor { 8 | 9 | private final Double db; 10 | private final Short s; 11 | private long l; 12 | private float f; 13 | 14 | public TestNoOpObjectWithArgumentsConstructor(int a, String b, boolean c, Object d, Long l, Float f, Short s, Double db) { 15 | this.f = f; 16 | this.l = l; 17 | this.s = s; 18 | this.db = db; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/chao/android/tools/service_pools/init/TestLazyInitServicePriorityNormal.java: -------------------------------------------------------------------------------- 1 | package chao.android.tools.service_pools.init; 2 | 3 | import chao.java.tools.servicepool.IInitService; 4 | import chao.java.tools.servicepool.Sp; 5 | import chao.java.tools.servicepool.annotation.Init; 6 | import chao.java.tools.servicepool.annotation.Service; 7 | 8 | /** 9 | * @author luqin 10 | * @since 2019-09-17 11 | */ 12 | @Init(lazy = false) 13 | @Service 14 | public class TestLazyInitServicePriorityNormal implements IInitService { 15 | @Override 16 | public void onInit() { 17 | System.out.println("normal lazy service inited."); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /autoservice/src/main/groovy/chao/android/gradle/servicepool/hunter/asm/IWeaver.java: -------------------------------------------------------------------------------- 1 | package chao.android.gradle.servicepool.hunter.asm; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | /** 7 | * Created by quinn on 06/09/2018 8 | */ 9 | public interface IWeaver { 10 | 11 | int NO_JAR_ID = -1; 12 | 13 | /** 14 | * Check a certain file is weavable 15 | */ 16 | boolean isWeavableClass(String filePath) throws IOException; 17 | 18 | /** 19 | * Weave single class to byte array 20 | */ 21 | byte[] weaveSingleClassToByteArray(int jarId, InputStream inputStream) throws IOException; 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/testpluginlib/src/main/java/com/example/testpluginlib/TestPluginService3.java: -------------------------------------------------------------------------------- 1 | package com.example.testpluginlib; 2 | 3 | import chao.java.tools.servicepool.DefaultService; 4 | import chao.java.tools.servicepool.IService; 5 | 6 | /** 7 | * @author luqin 8 | * @since 2019-07-09 9 | */ 10 | public class TestPluginService3 extends DefaultService implements IService { 11 | 12 | @Override 13 | public String path() { 14 | return "path"; 15 | } 16 | 17 | @Override 18 | public int priority() { 19 | return Integer.valueOf(100); 20 | } 21 | 22 | @Override 23 | public int scope() { 24 | return Scope.once; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sp/gradle.properties: -------------------------------------------------------------------------------- 1 | GROUP_ID=io.github.luqinx 2 | # POM文件中指向你网站的地址 3 | POM_URL=https://github.com/luqinx 4 | POM_DESCRIPTION="advance SPI for java" 5 | # SCM是指版本管理工具,一下说他的相关信息 6 | POM_SCM_URL=https://github.com/ 7 | POM_SCM_CONNECTION=https://github.com/luqinx 8 | POM_SCM_DEV_CONNECTION=https://github.com/luqinx 9 | # 你的开放协议相关信息 10 | POM_LICENCE_NAME= Apache License Version 2.0 11 | POM_LICENCE_URL= https://github.com/luqinx/abkit/blob/master/LICENSE 12 | POM_LICENCE_DIST=Apache License Version 2.0 13 | # 开发者的相关信息 14 | POM_DEVELOPER_ID=luqinx 15 | POM_DEVELOPER_NAME=luqinx 16 | POM_DEVELOPER_EMAIL=qch5240@163.com 17 | 18 | POM_PACKAGING=jar 19 | VERSION_NAME=1.9.0 20 | ARTIFACT_ID=sp 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/init_sync_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |