├── .gitignore ├── .idea └── modules.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── myapplication │ │ └── App.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── bintrayv1.gradle ├── build.gradle ├── cache ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── cache │ │ └── CacheProxy.java │ └── res │ └── values │ └── strings.xml ├── common ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── common │ │ └── LeakCanaryProxy.java │ └── res │ └── values │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── hotfix ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── hotfix │ │ └── HotfixProxy.java │ └── res │ └── values │ └── strings.xml ├── installv1.gradle ├── main ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── main │ │ ├── LoggerProxy.java │ │ └── MainActivity.java │ └── res │ ├── layout │ └── activity_main.xml │ └── values │ └── strings.xml ├── orm ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── orm │ │ └── annotation │ │ └── OrmLiteProxy.java │ └── res │ └── values │ └── strings.xml ├── plugin ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── plugin │ │ └── PluginProxy.java │ └── res │ └── values │ └── strings.xml ├── postprocessing-annotation ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── woaiqw │ └── postprocessingannotation │ └── App.java ├── postprocessing-compiler ├── .gitignore ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── woaiqw │ │ └── appcompiler │ │ ├── AppProcessor.java │ │ └── utils │ │ ├── Constants.java │ │ ├── Logger.java │ │ └── StringUtils.java │ └── resources │ └── META-INF │ └── services │ └── javax.annotation.processing.Processor ├── postprocessing ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── woaiqw │ │ └── postprocessing │ │ ├── AndroidPostProcessing.java │ │ ├── IApp.java │ │ ├── model │ │ └── AppDelegate.java │ │ └── utils │ │ ├── ClassUtils.java │ │ ├── PackageUtils.java │ │ └── WeakHandler.java │ └── res │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | .idea/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # IntelliJ 37 | *.iml 38 | .idea/workspace.xml 39 | .idea/tasks.xml 40 | .idea/gradle.xml 41 | .idea/assetWizardSettings.xml 42 | .idea/dictionaries 43 | .idea/libraries 44 | .idea/caches 45 | 46 | # Keystore files 47 | # Uncomment the following line if you do not want to check your keystore files in. 48 | #*.jks 49 | 50 | # External native build folder generated in Android Studio 2.2 and later 51 | .externalNativeBuild 52 | 53 | # Google Services (e.g. APIs or Firebase) 54 | google-services.json 55 | 56 | # Freeline 57 | freeline.py 58 | freeline/ 59 | freeline_project_description.json 60 | 61 | # fastlane 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | fastlane/readme.md 67 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##### Application后处理器(AndroidPostProcessing): 通过注解配置初始化各模块及应用所需 sdk,按优先级/延时时间/是否只在Debug下有效/执行线程 等条件初始化 sdk 2 | 3 | 通常,我们要在 Application 中处理一堆的三方 SDK 和自定义框架的初始化,下面的处理方式会带来一些问题: 4 | 维护成本,应用启动慢、卡顿,实现方式 low 5 | 6 | ``` 7 | @Override 8 | public void onCreate() { 9 | super.onCreate(); 10 | mContext = getApplicationContext(); 11 | mHandler = new Handler(); 12 | // screen info 13 | registerScreenActionReceiver(); 14 | // UserCenterManager 15 | AccountManager.init(); 16 | // 初始化配置 17 | ConfigManager.init(this); 18 | // token 19 | initToken(); 20 | // 友盟 21 | MobclickAgent.init(); 22 | // Log 23 | LogUtils.init(BuildConfig.DEBUG); 24 | // ShareSdk 25 | ShareSDK.initSDK(mContext); 26 | // 信鸽推送 27 | XGPushConfig.init(this); 28 | // Bugly 29 | if(!BuildConfig.DEBUG){ 30 | initBugly(); 31 | } 32 | // 判断程序是否在前台 33 | registerActivityLifecycleCallbacks(this); 34 | 35 | } 36 | ``` 37 | ### AndroidPostProcessing 38 | Application 的后处理器,利用编译期注解方式,指定线程和任务延时策略处理初始化的问题。 39 | [项目地址](https://github.com/woaigmz/AndroidPostProcessing) 和 demo 40 | ![postprocessing.gif](https://upload-images.jianshu.io/upload_images/8886407-d1cfae4b1bc48b39.gif?imageMogr2/auto-orient/strip) 41 | 42 | ### 使用方式: 43 | 关闭 instant run ,否则会解析失败 44 | 引入AndroidPostProcessing和注解处理器,已经上传maven :) 45 | project/build.gradle 46 | ``` 47 | allprojects { 48 | repositories { 49 | ... 50 | maven { 51 | url "https://dl.bintray.com/woaigmz/AndroidPostProcessing" 52 | } 53 | } 54 | } 55 | ``` 56 | common-lib 模块: 57 | ``` 58 | api 'com.woaigmz.app:postprocessing:0.0.1' 59 | api 'com.woaigmz.app:postprocessing-annotation:0.0.1' 60 | //如果 common 模块需要用 @App 注解 61 | annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 62 | ``` 63 | 其他子模块: 64 | ``` 65 | defaultConfig { 66 | ... 67 | javaCompileOptions { 68 | annotationProcessorOptions { 69 | includeCompileClasspath = true 70 | } 71 | } 72 | } 73 | 74 | implementation project(':common') 75 | annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 76 | ``` 77 | 78 | 1:Application: 79 | ``` 80 | public class App extends Application { 81 | 82 | @Override 83 | public void onCreate() { 84 | super.onCreate(); 85 | AndroidPostProcessing.initialization(this).dispatcher(); 86 | } 87 | 88 | @Override 89 | public void onTerminate() { 90 | super.onTerminate(); 91 | AndroidPostProcessing.release(); 92 | } 93 | } 94 | ``` 95 | 2:各处理模块: 96 | ① 代理类实现 IApp 接口,类名随意; 97 | ② 类头部加 @App() 注解 98 | ``` 99 | @Retention(RetentionPolicy.CLASS) 100 | @Target(ElementType.TYPE) 101 | public @interface App { 102 | boolean RELEASE = false; 103 | boolean DEBUG = true; 104 | String name() default "Main"; //名称 105 | boolean type() default RELEASE; //release起作用还是debug时起作用 106 | int priority() default 0; //优先级 - 执行顺序 107 | boolean async() default false; //是否异步,默认同步,在主线程执行 108 | long delay() default 0; //延时时间,默认为0,不延时执行 109 | } 110 | ``` 111 | ###### 注意: 112 | ① 关于多进程:每个进程都会 onCreate() onTerminate() ,初始化时的任务表,所以互不影响,资源释放也不受影响。该库默认所有进程都存在,如果要有主进程库,可以 onCreate 添加判断条件 113 | ② 关于调试: ctrl + shif t + F ,全局搜索 @App ,每个 IApp 接口对应的对象可以单独 [hugo](https://github.com/JakeWharton/hugo) 出执行时间 114 | ③ 关于 async ,默认主线程,如果为true则运行在子线程,线程优先级为 background 115 | ###### eg: 116 | hotfix: 117 | ``` 118 | @App(name = "Hotfix", priority = 3) 119 | public class HotfixProxy implements IApp { 120 | 121 | @Override 122 | public void dispatcher(@NonNull Application application) { 123 | 124 | Toast.makeText(application, "Hotfix", Toast.LENGTH_SHORT).show(); 125 | 126 | } 127 | } 128 | ``` 129 | cache: 130 | ``` 131 | @App(name = "Cache", priority = 2, async = true, delay = 2000) 132 | public class CacheProxy implements IApp { 133 | 134 | @Override 135 | public void dispatcher(@NonNull Application application) { 136 | 137 | Looper.prepare(); 138 | Toast.makeText(application, "cache", Toast.LENGTH_SHORT).show(); 139 | Looper.loop(); 140 | 141 | } 142 | } 143 | ``` 144 | leakcanary: 145 | ``` 146 | @App(name = "LeakCanary", type = App.DEBUG, priority = 1, delay = 5000) 147 | public class LeakCanaryProxy implements IApp { 148 | 149 | @Override 150 | public void dispatcher(@NonNull Application application) { 151 | 152 | Toast.makeText(application, "LeakCanary", Toast.LENGTH_SHORT).show(); 153 | } 154 | } 155 | ``` 156 | 157 | ### 实现思路: 158 | 159 | ① 注解部分:编译生成的中间代理类,都在 com.iloveq.generate 包下 160 | ``` 161 | package com.iloveq.generate; 162 | 163 | /** 164 | * Generated code from AndroidPostProcessing . Do not modify! 165 | */ 166 | 167 | public final class LeakCanary$$Proxy{ 168 | 169 | public static final String path = "com.woaiqw.common.LeakCanaryProxy"; 170 | public static final String name = "LeakCanary"; 171 | public static final boolean type = true; 172 | public static final int priority = 1; 173 | public static final boolean async = false; 174 | public static final long delay = 5000; 175 | 176 | } 177 | ``` 178 | 179 | ② 注解处理器AbstractProcessor: 180 | [AppProcessor](https://github.com/iloveq/AndroidPostProcessing/blob/master/postprocessing-compiler/src/main/java/com/iloveq/appcompiler/AppProcessor.java) 181 | 182 | ③ [AndroidPostProcessing](https://github.com/iloveq/AndroidPostProcessing/blob/master/postprocessing/src/main/java/com/iloveq/postprocessing/AndroidPostProcessing.java) 的api 183 | 184 | 初始化注解生成的代理类,按 priority 生成代理列表List 185 | dispatcher 任务,WeakHandler + ScheduledThreadPool 186 | SharePreference 缓存第一次解析结果 优化性能 70% demo -- 2~3ms 187 | 资源释放 188 | 189 | 感谢:) 190 | 191 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | applicationId "com.woaiqw.myapplication" 9 | minSdkVersion rootProject.ext.minSdkVersion 10 | targetSdkVersion rootProject.ext.targetSdkVersion 11 | versionCode rootProject.ext.versionCode 12 | versionName rootProject.ext.versionName 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | implementation fileTree(include: ['*.jar'], dir: 'libs') 24 | implementation project(':cache') 25 | implementation project(':common') 26 | implementation project(':hotfix') 27 | implementation project(':main') 28 | implementation project(':plugin') 29 | implementation project(':orm') 30 | implementation project(':plugin') 31 | } 32 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/woaiqw/myapplication/App.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.myapplication; 2 | 3 | import android.app.Application; 4 | 5 | import com.woaiqw.postprocessing.AndroidPostProcessing; 6 | 7 | //import hugo.weaving.DebugLog; 8 | 9 | /** 10 | * Created by haoran on 2018/9/12. 11 | */ 12 | public class App extends Application { 13 | 14 | //@DebugLog 15 | @Override 16 | public void onCreate() { 17 | super.onCreate(); 18 | 19 | AndroidPostProcessing.initialization(this).dispatcher(); 20 | } 21 | 22 | @Override 23 | public void onTerminate() { 24 | super.onTerminate(); 25 | AndroidPostProcessing.release(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | My Application 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /bintrayv1.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.jfrog.bintray' 2 | 3 | version = libraryVersion 4 | 5 | if (project.hasProperty("android")) { // Android libraries 6 | task sourcesJar(type: Jar) { 7 | classifier = 'sources' 8 | from android.sourceSets.main.java.srcDirs 9 | } 10 | 11 | task javadoc(type: Javadoc) { 12 | source = android.sourceSets.main.java.srcDirs 13 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 14 | } 15 | } else { // Java libraries 16 | task sourcesJar(type: Jar, dependsOn: classes) { 17 | classifier = 'sources' 18 | from sourceSets.main.allSource 19 | } 20 | } 21 | 22 | task javadocJar(type: Jar, dependsOn: javadoc) { 23 | classifier = 'javadoc' 24 | from javadoc.destinationDir 25 | } 26 | 27 | artifacts { 28 | archives javadocJar 29 | archives sourcesJar 30 | } 31 | 32 | // Bintray 33 | Properties properties = new Properties() 34 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 35 | 36 | bintray { 37 | user = properties.getProperty("bintray.user") 38 | key = properties.getProperty("bintray.apikey") 39 | 40 | configurations = ['archives'] 41 | pkg { 42 | repo = bintrayRepo 43 | name = bintrayName 44 | desc = libraryDescription 45 | websiteUrl = siteUrl 46 | vcsUrl = gitUrl 47 | licenses = allLicenses 48 | publish = true 49 | publicDownloadNumbers = true 50 | version { 51 | desc = libraryDescription 52 | gpg { 53 | sign = true //Determines whether to GPG sign the files. The default is false 54 | passphrase = properties.getProperty("bintray.gpg.password") 55 | //Optional. The passphrase for GPG signing' 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' 12 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' 13 | //classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' 14 | 15 | // NOTE: Do not place your application dependencies here; they belong 16 | // in the individual module build.gradle files 17 | } 18 | } 19 | 20 | allprojects { 21 | repositories { 22 | google() 23 | jcenter() 24 | mavenCentral() 25 | maven { 26 | url "https://dl.bintray.com/woaigmz/AndroidPostProcessing" 27 | } 28 | } 29 | } 30 | 31 | task clean(type: Delete) { 32 | delete rootProject.buildDir 33 | } 34 | 35 | ext { 36 | versionCode = 7 37 | versionName = "2.4" 38 | buildToolsVersion = "26.0.2" 39 | compileSdkVersion = 26 40 | minSdkVersion = 19 41 | targetSdkVersion = 26 42 | 43 | versions = [ 44 | 'support_library' : '26.1.0' 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /cache/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /cache/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(dir: 'libs', include: ['*.jar']) 25 | implementation project(':common') 26 | //annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 27 | annotationProcessor project(':postprocessing-compiler') 28 | } 29 | -------------------------------------------------------------------------------- /cache/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /cache/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /cache/src/main/java/com/woaiqw/cache/CacheProxy.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.cache; 2 | 3 | import android.app.Application; 4 | import android.os.Looper; 5 | import android.support.annotation.NonNull; 6 | import android.widget.Toast; 7 | 8 | import com.woaiqw.postprocessing.IApp; 9 | import com.woaiqw.postprocessingannotation.App; 10 | 11 | //import hugo.weaving.DebugLog; 12 | 13 | /** 14 | * Created by haoran on 2018/10/10. 15 | */ 16 | @App(name = "Cache", priority = 2, async = true, delay = 2000) 17 | public class CacheProxy implements IApp { 18 | 19 | //@DebugLog 20 | @Override 21 | public void dispatcher(@NonNull Application application) { 22 | 23 | Looper.prepare(); 24 | Toast.makeText(application, "cache", Toast.LENGTH_SHORT).show(); 25 | Looper.loop(); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /cache/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | cache 3 | 4 | -------------------------------------------------------------------------------- /common/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /common/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | //apply plugin: 'com.jakewharton.hugo' 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(include: ['*.jar'], dir: 'libs') 25 | api "com.android.support:appcompat-v7:${versions.support_library}" 26 | api 'com.woaigmz.app:postprocessing:0.0.1' 27 | api 'com.woaigmz.app:postprocessing-annotation:0.0.1' 28 | //annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 29 | annotationProcessor project(':postprocessing-compiler') 30 | } 31 | -------------------------------------------------------------------------------- /common/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /common/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /common/src/main/java/com/woaiqw/common/LeakCanaryProxy.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.common; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.NonNull; 5 | import android.widget.Toast; 6 | 7 | import com.woaiqw.postprocessing.IApp; 8 | import com.woaiqw.postprocessingannotation.App; 9 | 10 | //import hugo.weaving.DebugLog; 11 | 12 | 13 | /** 14 | * Created by haoran on 2018/10/11. 15 | */ 16 | @App(name = "LeakCanary", type = App.DEBUG, priority = 1, delay = 5000) 17 | public class LeakCanaryProxy implements IApp { 18 | 19 | //@DebugLog 20 | @Override 21 | public void dispatcher(@NonNull Application application) { 22 | 23 | Toast.makeText(application, "LeakCanary", Toast.LENGTH_SHORT).show(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | common 3 | 4 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | 19 | compiler_version=0.0.1 20 | api_version=0.0.1 21 | annotation_version=0.0.1 22 | 23 | bintrayRepo=AndroidPostProcessing 24 | 25 | publishedGroupId=com.woaigmz.app 26 | siteUrl=https://github.com/woaigmz/AndroidPostProcessing 27 | gitUrl=https://github.com/woaigmz/AndroidPostProcessing.git 28 | developerId=haoran 29 | developerName=haoran.yang 30 | developerEmail=woaigmz@gmail.com 31 | 32 | licenseName=The Apache Software License, Version 2.0 33 | licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt 34 | allLicenses=["Apache-2.0"] 35 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iloveq/AndroidPostProcessing/85c051251c21a5b64619b8720a1680568c74b7af/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 17 11:09:39 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /hotfix/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /hotfix/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(dir: 'libs', include: ['*.jar']) 25 | implementation project(':common') 26 | //annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 27 | annotationProcessor project(':postprocessing-compiler') 28 | } 29 | -------------------------------------------------------------------------------- /hotfix/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /hotfix/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /hotfix/src/main/java/com/woaiqw/hotfix/HotfixProxy.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.hotfix; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.NonNull; 5 | import android.widget.Toast; 6 | 7 | import com.woaiqw.postprocessing.IApp; 8 | import com.woaiqw.postprocessingannotation.App; 9 | 10 | //import hugo.weaving.DebugLog; 11 | 12 | /** 13 | * Created by haoran on 2018/10/10. 14 | */ 15 | @App(name = "Hotfix", priority = 3) 16 | public class HotfixProxy implements IApp { 17 | 18 | // @DebugLog 19 | @Override 20 | public void dispatcher(@NonNull Application application) { 21 | 22 | Toast.makeText(application, "Hotfix", Toast.LENGTH_SHORT).show(); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /hotfix/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | hotfix 3 | 4 | -------------------------------------------------------------------------------- /installv1.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | 3 | group = publishedGroupId // Maven Group ID for the artifact 4 | 5 | install { 6 | repositories.mavenInstaller { 7 | // This generates POM.xml with proper parameters 8 | pom { 9 | project { 10 | packaging 'aar' 11 | groupId publishedGroupId 12 | artifactId artifact 13 | 14 | // Add your description here 15 | name libraryName 16 | description libraryDescription 17 | url siteUrl 18 | 19 | // Set your license 20 | licenses { 21 | license { 22 | name licenseName 23 | url licenseUrl 24 | } 25 | } 26 | developers { 27 | developer { 28 | id developerId 29 | name developerName 30 | email developerEmail 31 | } 32 | } 33 | scm { 34 | connection gitUrl 35 | developerConnection gitUrl 36 | url siteUrl 37 | 38 | } 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /main/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /main/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation project(':common') 27 | //annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 28 | annotationProcessor project(':postprocessing-compiler') 29 | } 30 | -------------------------------------------------------------------------------- /main/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /main/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /main/src/main/java/com/woaiqw/main/LoggerProxy.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.main; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.NonNull; 5 | import android.widget.Toast; 6 | 7 | import com.woaiqw.postprocessing.IApp; 8 | import com.woaiqw.postprocessingannotation.App; 9 | 10 | /** 11 | * Created by haoran on 2018/10/15. 12 | */ 13 | //@App(name = "Logger",priority = 1) 14 | public class LoggerProxy implements IApp { 15 | 16 | @Override 17 | public void dispatcher(@NonNull Application application) { 18 | Toast.makeText(application, "Logger", Toast.LENGTH_SHORT).show(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /main/src/main/java/com/woaiqw/main/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.main; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /main/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | main 3 | 4 | -------------------------------------------------------------------------------- /orm/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /orm/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation project(':common') 27 | //annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 28 | annotationProcessor project(':postprocessing-compiler') 29 | } 30 | -------------------------------------------------------------------------------- /orm/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /orm/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /orm/src/main/java/com/woaiqw/orm/annotation/OrmLiteProxy.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.orm.annotation; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.NonNull; 5 | import android.widget.Toast; 6 | 7 | import com.woaiqw.postprocessing.IApp; 8 | import com.woaiqw.postprocessingannotation.App; 9 | 10 | /** 11 | * Created by haoran on 2018/10/15. 12 | */ 13 | @App(name = "OrmLite", priority = 2) 14 | public class OrmLiteProxy implements IApp { 15 | @Override 16 | public void dispatcher(@NonNull Application application) { 17 | Toast.makeText(application, "OrmLite", Toast.LENGTH_SHORT).show(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /orm/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | orm 3 | 4 | -------------------------------------------------------------------------------- /plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /plugin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation project(':common') 27 | //annotationProcessor 'com.woaigmz.app:postprocessing-compiler:0.0.1' 28 | annotationProcessor project(':postprocessing-compiler') 29 | } 30 | -------------------------------------------------------------------------------- /plugin/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /plugin/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/woaiqw/plugin/PluginProxy.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.plugin; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.NonNull; 5 | import android.widget.Toast; 6 | 7 | import com.woaiqw.postprocessing.IApp; 8 | import com.woaiqw.postprocessingannotation.App; 9 | 10 | /** 11 | * Created by haoran on 2018/10/15. 12 | */ 13 | 14 | @App(name = "Plugin",priority = 1) 15 | public class PluginProxy implements IApp { 16 | @Override 17 | public void dispatcher(@NonNull Application application) { 18 | Toast.makeText(application, "Plugin", Toast.LENGTH_SHORT).show(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /plugin/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | plugin 3 | 4 | -------------------------------------------------------------------------------- /postprocessing-annotation/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /postprocessing-annotation/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | 3 | ext { 4 | bintrayName = 'postprocessing-annotation' 5 | artifact = bintrayName 6 | libraryName = 'annotation' 7 | libraryDescription = 'annotation used in AndroidPostProcessing' 8 | libraryVersion = annotation_version 9 | } 10 | 11 | dependencies { 12 | implementation fileTree(dir: 'libs', include: ['*.jar']) 13 | } 14 | 15 | sourceCompatibility = "1.8" 16 | targetCompatibility = "1.8" 17 | 18 | apply from: "${rootProject.projectDir}/installv1.gradle" 19 | apply from: "${rootProject.projectDir}/bintrayv1.gradle" 20 | -------------------------------------------------------------------------------- /postprocessing-annotation/src/main/java/com/woaiqw/postprocessingannotation/App.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessingannotation; 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 | * Created by haoran on 2018/10/10. 10 | */ 11 | 12 | @Retention(RetentionPolicy.CLASS) 13 | @Target(ElementType.TYPE) 14 | public @interface App { 15 | 16 | boolean RELEASE = false; 17 | boolean DEBUG = true; 18 | 19 | String name() default "Main"; 20 | 21 | boolean type() default RELEASE; 22 | 23 | int priority() default 0; 24 | 25 | boolean async() default false; 26 | 27 | long delay() default 0; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /postprocessing-compiler/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /postprocessing-compiler/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | 3 | 4 | ext { 5 | bintrayName = 'postprocessing-compiler' 6 | artifact = bintrayName 7 | libraryName = 'compiler' 8 | libraryDescription = 'A compiler for AndroidPostProcessing' 9 | libraryVersion = compiler_version 10 | } 11 | 12 | 13 | dependencies { 14 | implementation fileTree(include: ['*.jar'], dir: 'libs') 15 | implementation project(':postprocessing-annotation') 16 | } 17 | 18 | sourceCompatibility = "1.8" 19 | targetCompatibility = "1.8" 20 | 21 | apply from: "${rootProject.projectDir}/installv1.gradle" 22 | apply from: "${rootProject.projectDir}/bintrayv1.gradle" 23 | 24 | tasks.withType(JavaCompile) { 25 | options.encoding = 'UTF-8' 26 | } 27 | -------------------------------------------------------------------------------- /postprocessing-compiler/src/main/java/com/woaiqw/appcompiler/AppProcessor.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.appcompiler; 2 | 3 | import com.woaiqw.appcompiler.utils.Constants; 4 | import com.woaiqw.appcompiler.utils.Logger; 5 | import com.woaiqw.postprocessingannotation.App; 6 | 7 | import java.io.IOException; 8 | import java.io.Writer; 9 | import java.util.LinkedHashSet; 10 | import java.util.Set; 11 | 12 | import javax.annotation.processing.AbstractProcessor; 13 | import javax.annotation.processing.Filer; 14 | import javax.annotation.processing.ProcessingEnvironment; 15 | import javax.annotation.processing.RoundEnvironment; 16 | import javax.lang.model.SourceVersion; 17 | import javax.lang.model.element.Element; 18 | import javax.lang.model.element.ElementKind; 19 | import javax.lang.model.element.PackageElement; 20 | import javax.lang.model.element.TypeElement; 21 | import javax.tools.JavaFileObject; 22 | 23 | public class AppProcessor extends AbstractProcessor { 24 | 25 | private Logger logger; 26 | private Filer filer; 27 | 28 | @Override 29 | public synchronized void init(ProcessingEnvironment processingEnv) { 30 | super.init(processingEnv); 31 | logger = new Logger(processingEnv.getMessager()); 32 | filer = processingEnv.getFiler(); 33 | 34 | } 35 | 36 | @Override 37 | public boolean process(Set annotations, RoundEnvironment roundEnv) { 38 | 39 | Set elements = roundEnv.getElementsAnnotatedWith(App.class); 40 | 41 | logger.info("start --- processor"); 42 | for (Element element : elements) { 43 | generateJavaAppProxyFile(element); 44 | } 45 | logger.info("generate --- end !!!"); 46 | return true; 47 | } 48 | 49 | private void generateJavaAppProxyFile(Element element) { 50 | if (element.getKind() == ElementKind.CLASS) { 51 | TypeElement classElement = (TypeElement) element; 52 | PackageElement packageElement = (PackageElement) classElement.getEnclosingElement(); 53 | String className = classElement.getSimpleName().toString(); 54 | String path = packageElement.getQualifiedName().toString() + "." + className; 55 | logger.info("path:" + path); 56 | App annotation = element.getAnnotation(App.class); 57 | 58 | String name = annotation.name(); 59 | boolean debug = annotation.type(); 60 | int priority = annotation.priority(); 61 | boolean async = annotation.async(); 62 | long delay = annotation.delay(); 63 | String generateClassName = name + "$$Proxy"; 64 | 65 | StringBuilder builder = new StringBuilder(); 66 | builder.append("package "); 67 | builder.append(Constants.PACKAGE_NAME); 68 | builder.append(";"); 69 | builder.append("\n"); 70 | builder.append("\n"); 71 | 72 | builder.append("/**"); 73 | builder.append("\n"); 74 | builder.append(Constants.EXPLAIN); 75 | builder.append("\n"); 76 | builder.append(" */"); 77 | 78 | builder.append("\n"); 79 | builder.append("\n"); 80 | builder.append("public final class "); 81 | builder.append(generateClassName); 82 | builder.append("{"); 83 | builder.append("\n"); 84 | builder.append("\n"); 85 | 86 | builder.append(" public static String path = \""); 87 | builder.append(path); 88 | builder.append("\";"); 89 | builder.append("\n"); 90 | 91 | builder.append(" public static String name = \""); 92 | builder.append(name); 93 | builder.append("\";"); 94 | builder.append("\n"); 95 | 96 | builder.append(" public static final boolean type = "); 97 | builder.append(debug); 98 | builder.append(";"); 99 | builder.append("\n"); 100 | 101 | builder.append(" public static final int priority = "); 102 | builder.append(priority); 103 | builder.append(";"); 104 | builder.append("\n"); 105 | 106 | builder.append(" public static final boolean async = "); 107 | builder.append(async); 108 | builder.append(";"); 109 | builder.append("\n"); 110 | 111 | builder.append(" public static final long delay = "); 112 | builder.append(delay); 113 | builder.append(";"); 114 | 115 | builder.append("\n"); 116 | builder.append("\n"); 117 | builder.append("}"); 118 | 119 | 120 | try { 121 | JavaFileObject source = filer.createSourceFile(Constants.PACKAGE_NAME + "." + generateClassName); 122 | Writer writer = source.openWriter(); 123 | writer.write(builder.toString()); 124 | writer.flush(); 125 | writer.close(); 126 | } catch (IOException e) { 127 | logger.error(e.getMessage()); 128 | } 129 | logger.info(">>>" + generateClassName + "<<<"); 130 | } 131 | } 132 | 133 | 134 | @Override 135 | public Set getSupportedAnnotationTypes() { 136 | Set types = new LinkedHashSet<>(); 137 | types.add(Constants.ANNOTATION_ACTION_PATH); 138 | return types; 139 | } 140 | 141 | @Override 142 | public SourceVersion getSupportedSourceVersion() { 143 | return SourceVersion.RELEASE_8; 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /postprocessing-compiler/src/main/java/com/woaiqw/appcompiler/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.appcompiler.utils; 2 | 3 | /** 4 | * Created by haoran on 2018/10/10. 5 | */ 6 | public class Constants { 7 | 8 | public static final CharSequence PACKAGE_NAME = "com.woaiqw.generate"; 9 | public static final String EXPLAIN = "* Generated code from AndroidPostProcessing . Do not modify!"; 10 | // Log 11 | static final String PREFIX_OF_LOGGER = "AndroidPostProcessingLogger"; 12 | 13 | public static final String ANNOTATION_ACTION_PATH = "com.woaiqw.postprocessingannotation.App"; 14 | } 15 | -------------------------------------------------------------------------------- /postprocessing-compiler/src/main/java/com/woaiqw/appcompiler/utils/Logger.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.appcompiler.utils; 2 | 3 | 4 | 5 | import javax.annotation.processing.Messager; 6 | import javax.tools.Diagnostic; 7 | 8 | /** 9 | * Created by haoran on 2018/8/16. 10 | */ 11 | 12 | public class Logger { 13 | private Messager msg; 14 | 15 | public Logger(Messager messager) { 16 | msg = messager; 17 | } 18 | 19 | public void info(CharSequence info) { 20 | if (!StringUtils.isEmpty(info)) { 21 | msg.printMessage(Diagnostic.Kind.NOTE, Constants.PREFIX_OF_LOGGER + info); 22 | } 23 | } 24 | 25 | public void error(CharSequence error) { 26 | if (!StringUtils.isEmpty(error)) { 27 | msg.printMessage(Diagnostic.Kind.ERROR, Constants.PREFIX_OF_LOGGER + "An exception is encountered, [" + error + "]"); 28 | } 29 | } 30 | 31 | public void error(Throwable error) { 32 | if (null != error) { 33 | msg.printMessage(Diagnostic.Kind.ERROR, Constants.PREFIX_OF_LOGGER + "An exception is encountered, [" + error.getMessage() + "]" + "\n" + formatStackTrace(error.getStackTrace())); 34 | } 35 | } 36 | 37 | public void warning(CharSequence warning) { 38 | if (!StringUtils.isEmpty(warning)) { 39 | msg.printMessage(Diagnostic.Kind.WARNING, Constants.PREFIX_OF_LOGGER + warning); 40 | } 41 | } 42 | 43 | private String formatStackTrace(StackTraceElement[] stackTrace) { 44 | StringBuilder sb = new StringBuilder(); 45 | for (StackTraceElement element : stackTrace) { 46 | sb.append(" at ").append(element.toString()); 47 | sb.append("\n"); 48 | } 49 | return sb.toString(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /postprocessing-compiler/src/main/java/com/woaiqw/appcompiler/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.appcompiler.utils; 2 | 3 | 4 | /** 5 | * Created by haoran on 2018/8/16. 6 | */ 7 | 8 | class StringUtils { 9 | 10 | private StringUtils() { /* cannot be instantiated */ } 11 | 12 | public static boolean isEmpty(CharSequence str) { 13 | return str == null || str.length() == 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /postprocessing-compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | com.woaiqw.appcompiler.AppProcessor -------------------------------------------------------------------------------- /postprocessing/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /postprocessing/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | bintrayName = 'postprocessing' 5 | artifact = bintrayName 6 | libraryName = 'sdk' 7 | libraryDescription = 'A api for AndroidPostProcessing' 8 | libraryVersion = api_version 9 | } 10 | 11 | android { 12 | 13 | compileSdkVersion rootProject.ext.compileSdkVersion 14 | 15 | defaultConfig { 16 | minSdkVersion rootProject.ext.minSdkVersion 17 | targetSdkVersion rootProject.ext.targetSdkVersion 18 | versionCode rootProject.ext.versionCode 19 | versionName rootProject.ext.versionName 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | 29 | } 30 | 31 | dependencies { 32 | 33 | implementation fileTree(dir: 'libs', include: ['*.jar']) 34 | 35 | implementation "com.android.support:appcompat-v7:${versions.support_library}" 36 | 37 | } 38 | 39 | apply from: "${rootProject.projectDir}/installv1.gradle" 40 | apply from: "${rootProject.projectDir}/bintrayv1.gradle" 41 | -------------------------------------------------------------------------------- /postprocessing/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /postprocessing/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /postprocessing/src/main/java/com/woaiqw/postprocessing/AndroidPostProcessing.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessing; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | import android.os.Handler; 7 | import android.os.Looper; 8 | import android.os.Message; 9 | import android.os.Process; 10 | import android.support.annotation.NonNull; 11 | import android.util.Log; 12 | 13 | import com.woaiqw.postprocessing.model.AppDelegate; 14 | import com.woaiqw.postprocessing.utils.ClassUtils; 15 | import com.woaiqw.postprocessing.utils.PackageUtils; 16 | import com.woaiqw.postprocessing.utils.WeakHandler; 17 | 18 | import java.lang.reflect.Field; 19 | import java.util.ArrayList; 20 | import java.util.Collections; 21 | import java.util.HashSet; 22 | import java.util.List; 23 | import java.util.Set; 24 | import java.util.concurrent.Executors; 25 | import java.util.concurrent.ScheduledExecutorService; 26 | import java.util.concurrent.TimeUnit; 27 | import java.util.concurrent.atomic.AtomicBoolean; 28 | 29 | /** 30 | * Created by haoran on 2018/10/10. 31 | */ 32 | public class AndroidPostProcessing { 33 | 34 | private static final String parsePackageName = "com.woaiqw.generate"; 35 | 36 | private static final String TAG = "AndroidPostProcessing"; 37 | 38 | 39 | private volatile static Application app; 40 | 41 | private volatile static AndroidPostProcessing instance = null; 42 | 43 | private volatile static List agents = new ArrayList<>(); 44 | 45 | private volatile static ScheduledExecutorService taskPool; 46 | 47 | private static AtomicBoolean initCompleted = new AtomicBoolean(false); 48 | 49 | private static WeakHandler h = new WeakHandler(new Handler.Callback() { 50 | @Override 51 | public boolean handleMessage(Message msg) { 52 | return false; 53 | } 54 | }, Looper.getMainLooper()); 55 | 56 | 57 | static { 58 | int CPU_COUNT = Runtime.getRuntime().availableProcessors(); 59 | int CORE_POOL_SIZE = Math.max(2, Math.min(CPU_COUNT - 1, 4)); 60 | taskPool = Executors.newScheduledThreadPool(CORE_POOL_SIZE); 61 | } 62 | 63 | 64 | private AndroidPostProcessing(@NonNull final Application app) { 65 | long start = System.currentTimeMillis(); 66 | initAppDelegateMap(app); 67 | Log.e(TAG, "init map time " + String.valueOf(System.currentTimeMillis() - start) + "ms"); 68 | initCompleted.set(true); 69 | } 70 | 71 | public static AndroidPostProcessing initialization(@NonNull final Application app) { 72 | if (null == instance) { 73 | synchronized (AndroidPostProcessing.class) { 74 | if (null == instance) 75 | instance = new AndroidPostProcessing(app); 76 | } 77 | } 78 | return instance; 79 | } 80 | 81 | 82 | private void initAppDelegateMap(@NonNull final Application application) { 83 | 84 | SharedPreferences sp = application.getSharedPreferences(TAG, Context.MODE_PRIVATE); 85 | SharedPreferences.Editor edit = sp.edit(); 86 | 87 | String code = sp.getString("versionCode", "0"); 88 | String name = sp.getString("versionName", "0.0.0"); 89 | 90 | String versionCode = PackageUtils.getVersionCode(application); 91 | String versionName = PackageUtils.getVersionName(application); 92 | edit.putString("versionCode", versionCode).apply(); 93 | edit.putString("versionName", versionName).apply(); 94 | 95 | boolean versionChanged = !code.equals(versionCode) || !name.equals(versionName); 96 | 97 | app = application; 98 | 99 | try { 100 | Set set; 101 | if (versionChanged) { 102 | set = ClassUtils.getFileNameByPackageName(application, parsePackageName); 103 | edit.putStringSet(TAG, set).apply(); 104 | } else { 105 | set = sp.getStringSet(TAG, new HashSet()); 106 | } 107 | 108 | parseSet2List(set); 109 | 110 | if (agents != null && agents.size() > 0) { 111 | Collections.sort(agents); 112 | } 113 | 114 | } catch (Exception e) { 115 | e.printStackTrace(); 116 | } 117 | 118 | } 119 | 120 | private void parseSet2List(Set set) throws ClassNotFoundException, IllegalAccessException, InstantiationException { 121 | for (String classPath : set) { 122 | Class clazz = Class.forName(classPath); 123 | Field[] fields = clazz.getFields(); 124 | 125 | if (fields != null && fields.length != 0) { 126 | IApp app = null; 127 | String name = "Main"; 128 | boolean type = false; 129 | int priority = 0; 130 | boolean async = false; 131 | long delay = 0; 132 | for (Field field : fields) { 133 | String fieldName = field.getName(); 134 | Object o = field.get(fieldName); 135 | switch (fieldName) { 136 | case "path": 137 | app = (IApp) Class.forName((String) o).newInstance(); 138 | break; 139 | case "name": 140 | name = (String) o; 141 | break; 142 | case "debug": 143 | type = (boolean) o; 144 | break; 145 | case "priority": 146 | priority = (int) o; 147 | break; 148 | case "async": 149 | async = (boolean) o; 150 | break; 151 | case "delay": 152 | delay = (long) o; 153 | break; 154 | } 155 | } 156 | 157 | AppDelegate agent = new AppDelegate(); 158 | agent.setAgent(app); 159 | agent.setName(name); 160 | agent.setType(type); 161 | agent.setPriority(priority); 162 | agent.setAsync(async); 163 | agent.setDelayTime(delay); 164 | agents.add(agent); 165 | } 166 | } 167 | } 168 | 169 | public void dispatcher() { 170 | 171 | if (app == null) 172 | throw new RuntimeException(" AndroidPostProcessing must init "); 173 | 174 | if (agents != null && agents.size() > 0) { 175 | for (final AppDelegate agent : agents) { 176 | if (agent.getType()) { 177 | continue; 178 | } 179 | if (agent.isAsync()) { 180 | taskPool.schedule(new Runnable() { 181 | @Override 182 | public void run() { 183 | Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); 184 | agent.getAgent().dispatcher(app); 185 | } 186 | }, agent.getDelayTime(), TimeUnit.MILLISECONDS); 187 | } else { 188 | h.postDelayed(new Runnable() { 189 | @Override 190 | public void run() { 191 | agent.getAgent().dispatcher(app); 192 | } 193 | }, agent.getDelayTime()); 194 | } 195 | } 196 | } 197 | 198 | } 199 | 200 | public static void release() { 201 | 202 | if (!initCompleted.get()) 203 | throw new RuntimeException(" must init completed before the fun to release "); 204 | agents.clear(); 205 | taskPool.shutdown(); 206 | h.removeCallbacksAndMessages(null); 207 | 208 | } 209 | 210 | 211 | } 212 | -------------------------------------------------------------------------------- /postprocessing/src/main/java/com/woaiqw/postprocessing/IApp.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessing; 2 | 3 | import android.app.Application; 4 | import android.support.annotation.NonNull; 5 | 6 | /** 7 | * Created by haoran on 2018/10/10. 8 | */ 9 | public interface IApp { 10 | void dispatcher(@NonNull Application application); 11 | } 12 | -------------------------------------------------------------------------------- /postprocessing/src/main/java/com/woaiqw/postprocessing/model/AppDelegate.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessing.model; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.woaiqw.postprocessing.IApp; 6 | 7 | /** 8 | * Created by haoran on 2018/10/10. 9 | */ 10 | public class AppDelegate implements Comparable { 11 | 12 | IApp agent; 13 | String name; 14 | boolean type; 15 | int priority; 16 | boolean isAsync; 17 | long delay; 18 | 19 | public IApp getAgent() { 20 | return agent; 21 | } 22 | 23 | public void setAgent(IApp agent) { 24 | this.agent = agent; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public boolean getType() { 36 | return type; 37 | } 38 | 39 | public void setType(boolean debug) { 40 | this.type = debug; 41 | } 42 | 43 | public int getPriority() { 44 | return priority; 45 | } 46 | 47 | public void setPriority(int priority) { 48 | this.priority = priority; 49 | } 50 | 51 | public boolean isAsync() { 52 | return isAsync; 53 | } 54 | 55 | public void setAsync(boolean async) { 56 | isAsync = async; 57 | } 58 | 59 | 60 | public long getDelayTime() { 61 | return delay; 62 | } 63 | 64 | public void setDelayTime(long delay) { 65 | this.delay = delay; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "AppDelegate{" + 71 | "agent=" + agent + 72 | ", name='" + name + '\'' + 73 | ", type=" + type + 74 | ", priority=" + priority + 75 | ", isAsync=" + isAsync + 76 | ", delay=" + delay + 77 | '}'; 78 | } 79 | 80 | @Override 81 | public int compareTo(@NonNull AppDelegate o) { 82 | return this.getPriority() - o.getPriority(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /postprocessing/src/main/java/com/woaiqw/postprocessing/utils/ClassUtils.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessing.utils; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.content.pm.ApplicationInfo; 6 | import android.content.pm.PackageManager; 7 | import android.os.Build; 8 | import android.util.Log; 9 | 10 | import java.io.File; 11 | import java.io.IOException; 12 | import java.util.ArrayList; 13 | import java.util.Enumeration; 14 | import java.util.HashSet; 15 | import java.util.Iterator; 16 | import java.util.List; 17 | import java.util.Set; 18 | import java.util.regex.Matcher; 19 | import java.util.regex.Pattern; 20 | 21 | import dalvik.system.DexFile; 22 | 23 | /** 24 | * Created by haoran on 2018/10/10. 25 | */ 26 | public class ClassUtils { 27 | 28 | private static final String EXTRACTED_NAME_EXT = ".classes"; 29 | private static final String EXTRACTED_SUFFIX = ".zip"; 30 | private static final String SECONDARY_FOLDER_NAME; 31 | private static final String PREFS_FILE = "multidex.version"; 32 | private static final String KEY_DEX_NUMBER = "dex.number"; 33 | 34 | static { 35 | SECONDARY_FOLDER_NAME = "code_cache" + File.separator + "secondary-dexes"; 36 | } 37 | 38 | public ClassUtils() { 39 | } 40 | 41 | private static SharedPreferences getMultiDexPreferences(Context context) { 42 | return context.getSharedPreferences(PREFS_FILE, Build.VERSION.SDK_INT < 11 ? 0 : Context.MODE_MULTI_PROCESS); 43 | } 44 | 45 | 46 | public static Set getFileNameByPackageName(Context context, String packageName) throws PackageManager.NameNotFoundException, IOException { 47 | Set set = new HashSet<>(); 48 | Iterator var3 = getSourcePaths(context).iterator(); 49 | while (var3.hasNext()) { 50 | String path = (String) var3.next(); 51 | DexFile dexfile = null; 52 | try { 53 | if (path.endsWith(EXTRACTED_SUFFIX)) { 54 | dexfile = DexFile.loadDex(path, path + ".tmp", 0); 55 | } else { 56 | dexfile = new DexFile(path); 57 | } 58 | 59 | Enumeration dexEntries = dexfile.entries(); 60 | while (dexEntries.hasMoreElements()) { 61 | String className = (String) dexEntries.nextElement(); 62 | if (className.contains(packageName)) { 63 | set.add(className); 64 | } 65 | } 66 | 67 | } catch (Throwable var16) { 68 | Log.e("ClassUtils", "Scan map file in dex files made error.", var16); 69 | } finally { 70 | if (null != dexfile) { 71 | try { 72 | dexfile.close(); 73 | } catch (Throwable var15) { 74 | Log.e("ClassUtils", "Scan map file in dex files made error.", var15); 75 | } 76 | } 77 | } 78 | } 79 | Log.d("ClassUtils", "Filter " + set.size() + " classes by packageName <" + packageName + ">"); 80 | return set; 81 | } 82 | 83 | private static List getSourcePaths(Context context) throws PackageManager.NameNotFoundException, IOException { 84 | ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0); 85 | File sourceApk = new File(applicationInfo.sourceDir); 86 | List sourcePaths = new ArrayList<>(); 87 | sourcePaths.add(applicationInfo.sourceDir); 88 | String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT; 89 | if (!isVMMultidexCapable()) { 90 | int totalDexNumber = getMultiDexPreferences(context).getInt(KEY_DEX_NUMBER, 1); 91 | File dexDir = new File(applicationInfo.dataDir, SECONDARY_FOLDER_NAME); 92 | for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; ++secondaryNumber) { 93 | String fileName = extractedFilePrefix + secondaryNumber + EXTRACTED_SUFFIX; 94 | File extractedFile = new File(dexDir, fileName); 95 | if (!extractedFile.isFile()) { 96 | throw new IOException("Missing extracted secondary dex file '" + extractedFile.getPath() + "'"); 97 | } 98 | sourcePaths.add(extractedFile.getAbsolutePath()); 99 | } 100 | } 101 | return sourcePaths; 102 | } 103 | 104 | 105 | private static boolean isVMMultidexCapable() { 106 | boolean isMultidexCapable = false; 107 | String vmName; 108 | try { 109 | if (isYunOS()) { 110 | vmName = "'YunOS'"; 111 | isMultidexCapable = Integer.valueOf(System.getProperty("ro.build.version.sdk")) >= 21; 112 | } else { 113 | vmName = "'Android'"; 114 | String versionString = System.getProperty("java.vm.version"); 115 | if (versionString != null) { 116 | Matcher matcher = Pattern.compile("(\\d+)\\.(\\d+)(\\.\\d+)?").matcher(versionString); 117 | if (matcher.matches()) { 118 | try { 119 | int major = Integer.parseInt(matcher.group(1)); 120 | int minor = Integer.parseInt(matcher.group(2)); 121 | isMultidexCapable = major > 2 || major == 2 && minor >= 1; 122 | } catch (NumberFormatException var6) { 123 | return false; 124 | } 125 | } 126 | } 127 | } 128 | } catch (Exception var7) { 129 | return false; 130 | } 131 | Log.i("galaxy", "VM with name " + vmName + (isMultidexCapable ? " has multidex support" : " does not have multidex support")); 132 | return isMultidexCapable; 133 | } 134 | 135 | private static boolean isYunOS() { 136 | try { 137 | String version = System.getProperty("ro.yunos.version"); 138 | String vmName = System.getProperty("java.vm.name"); 139 | return vmName != null && vmName.toLowerCase().contains("lemur") || version != null && version.trim().length() > 0; 140 | } catch (Exception var2) { 141 | return false; 142 | } 143 | } 144 | 145 | 146 | } 147 | -------------------------------------------------------------------------------- /postprocessing/src/main/java/com/woaiqw/postprocessing/utils/PackageUtils.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessing.utils; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageInfo; 5 | import android.content.pm.PackageManager; 6 | 7 | /** 8 | * Created by haoran on 2018/10/15. 9 | */ 10 | public class PackageUtils { 11 | 12 | /** 13 | * get App versionCode 14 | * @param context 15 | * @return 16 | */ 17 | public static String getVersionCode(Context context){ 18 | PackageManager packageManager=context.getPackageManager(); 19 | PackageInfo packageInfo; 20 | String versionCode=""; 21 | try { 22 | packageInfo=packageManager.getPackageInfo(context.getPackageName(),0); 23 | versionCode=packageInfo.versionCode+""; 24 | } catch (PackageManager.NameNotFoundException e) { 25 | e.printStackTrace(); 26 | } 27 | return versionCode; 28 | } 29 | 30 | /** 31 | * get App versionName 32 | * @param context 33 | * @return 34 | */ 35 | public static String getVersionName(Context context){ 36 | PackageManager packageManager=context.getPackageManager(); 37 | PackageInfo packageInfo; 38 | String versionName=""; 39 | try { 40 | packageInfo=packageManager.getPackageInfo(context.getPackageName(),0); 41 | versionName=packageInfo.versionName; 42 | } catch (PackageManager.NameNotFoundException e) { 43 | e.printStackTrace(); 44 | } 45 | return versionName; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /postprocessing/src/main/java/com/woaiqw/postprocessing/utils/WeakHandler.java: -------------------------------------------------------------------------------- 1 | package com.woaiqw.postprocessing.utils; 2 | 3 | import android.os.Handler; 4 | import android.os.Looper; 5 | import android.os.Message; 6 | 7 | import java.lang.ref.WeakReference; 8 | 9 | /** 10 | * Created by haoran on 2018/10/10. 11 | */ 12 | public class WeakHandler extends Handler { 13 | 14 | private WeakReference mWeakReference; 15 | 16 | public WeakHandler(Callback callback) { 17 | mWeakReference = new WeakReference<>(callback); 18 | } 19 | 20 | public WeakHandler(Callback callback, Looper looper) { 21 | super(looper); 22 | mWeakReference = new WeakReference<>(callback); 23 | } 24 | 25 | @Override 26 | public void handleMessage(Message msg) { 27 | if (mWeakReference != null && mWeakReference.get() != null) { 28 | Callback callback = mWeakReference.get(); 29 | callback.handleMessage(msg); 30 | } 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /postprocessing/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidPostProcessing 3 | 4 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':common', ':cache', ':hotfix', ':main', ':main', ':plugin', ':plugin', ':orm', ':postprocessing', ':postprocessing-compiler', ':postprocessing-annotation' 2 | --------------------------------------------------------------------------------