├── .github └── workflows │ └── android.yml ├── .gitignore ├── LICENSE ├── api ├── build.gradle.kts ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── github │ └── libxposed │ └── api │ ├── XposedInterface.java │ ├── XposedInterfaceWrapper.java │ ├── XposedModule.java │ ├── XposedModuleInterface.java │ ├── errors │ ├── HookFailedError.java │ └── XposedFrameworkError.java │ └── utils │ └── DexParser.java ├── build.gradle.kts ├── checks ├── .gitignore ├── build.gradle.kts └── src │ └── main │ ├── java │ └── io │ │ └── github │ │ └── libxposed │ │ └── lint │ │ └── XposedIssueRegistry.kt │ └── resources │ └── META-INF │ └── services │ └── com.android.tools.lint.client.api.IssueRegistry ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | workflow_dispatch: 7 | 8 | permissions: 9 | contents: read 10 | pages: write 11 | id-token: write 12 | 13 | jobs: 14 | build: 15 | environment: 16 | name: github-pages 17 | url: ${{ steps.deployment.outputs.page_url }} 18 | 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | with: 24 | submodules: 'recursive' 25 | fetch-depth: 0 26 | - name: set up JDK 27 | uses: actions/setup-java@v4 28 | with: 29 | java-version: '21' 30 | distribution: 'temurin' 31 | cache: gradle 32 | 33 | - name: Build with Gradle 34 | run: | 35 | echo 'org.gradle.caching=true' >> gradle.properties 36 | echo 'org.gradle.parallel=true' >> gradle.properties 37 | echo 'org.gradle.vfs.watch=true' >> gradle.properties 38 | echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties 39 | ./gradlew publishToMavenLocal 40 | ./gradlew --stop 41 | env: 42 | ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }} 43 | ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }} 44 | - name: Upload library 45 | uses: actions/upload-artifact@v4 46 | with: 47 | name: library 48 | path: ~/.m2/repository/ 49 | include-hidden-files: true 50 | if-no-files-found: error 51 | - name: Upload pages 52 | uses: actions/upload-pages-artifact@v3 53 | with: 54 | # Upload entire repository 55 | path: 'api/build/intermediates/java_doc_dir/release/javaDocReleaseGeneration' 56 | - name: Deploy to GitHub Pages 57 | id: deployment 58 | uses: actions/deploy-pages@v4 59 | 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .DS_Store 3 | .gradle 4 | /.idea 5 | /captures 6 | /local.properties 7 | build 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /api/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.agp.lib) 3 | `maven-publish` 4 | signing 5 | } 6 | 7 | android { 8 | namespace = "io.github.libxposed.api" 9 | compileSdk = 35 10 | buildToolsVersion = "35.0.0" 11 | 12 | defaultConfig { 13 | minSdk = 24 14 | consumerProguardFiles("proguard-rules.pro") 15 | } 16 | 17 | buildFeatures { 18 | androidResources = false 19 | buildConfig = false 20 | } 21 | 22 | compileOptions { 23 | targetCompatibility = JavaVersion.VERSION_1_8 24 | sourceCompatibility = JavaVersion.VERSION_1_8 25 | } 26 | 27 | publishing { 28 | singleVariant("release") { 29 | withSourcesJar() 30 | withJavadocJar() 31 | } 32 | } 33 | } 34 | 35 | publishing { 36 | publications { 37 | register("api") { 38 | artifactId = "api" 39 | group = "io.github.libxposed" 40 | version = "100" 41 | pom { 42 | name.set("api") 43 | description.set("Modern Xposed API") 44 | url.set("https://github.com/libxposed/api") 45 | licenses { 46 | license { 47 | name.set("Apache License 2.0") 48 | url.set("https://github.com/libxposed/api/blob/master/LICENSE") 49 | } 50 | } 51 | developers { 52 | developer { 53 | name.set("libxposed") 54 | url.set("https://libxposed.github.io") 55 | } 56 | } 57 | scm { 58 | connection.set("scm:git:https://github.com/libxposed/api.git") 59 | url.set("https://github.com/libxposed/api") 60 | } 61 | } 62 | afterEvaluate { 63 | from(components.getByName("release")) 64 | } 65 | } 66 | } 67 | repositories { 68 | maven { 69 | name = "ossrh" 70 | url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") 71 | credentials(PasswordCredentials::class) 72 | } 73 | maven { 74 | name = "GitHubPackages" 75 | url = uri("https://maven.pkg.github.com/libxposed/api") 76 | credentials { 77 | username = System.getenv("GITHUB_ACTOR") 78 | password = System.getenv("GITHUB_TOKEN") 79 | } 80 | } 81 | } 82 | } 83 | 84 | signing { 85 | val signingKey = findProperty("signingKey") as String? 86 | val signingPassword = findProperty("signingPassword") as String? 87 | if (!signingKey.isNullOrBlank() && !signingPassword.isNullOrBlank()) { 88 | useInMemoryPgpKeys(signingKey, signingPassword) 89 | sign(publishing.publications) 90 | } 91 | } 92 | 93 | 94 | dependencies { 95 | compileOnly(libs.annotation) 96 | lintPublish(project(":checks")) 97 | } 98 | -------------------------------------------------------------------------------- /api/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class io.github.libxposed.** { *; } 2 | -keepclassmembers,allowoptimization class ** implements io.github.libxposed.api.XposedInterface$Hooker { 3 | public static *** before(); 4 | public static *** before(io.github.libxposed.api.XposedInterface$BeforeHookCallback); 5 | public static void after(); 6 | public static void after(io.github.libxposed.api.XposedInterface$AfterHookCallback); 7 | public static void after(io.github.libxposed.api.XposedInterface$AfterHookCallback, ***); 8 | } 9 | -------------------------------------------------------------------------------- /api/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/XposedInterface.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api; 2 | 3 | import android.content.SharedPreferences; 4 | import android.content.pm.ApplicationInfo; 5 | import android.os.ParcelFileDescriptor; 6 | 7 | import androidx.annotation.NonNull; 8 | import androidx.annotation.Nullable; 9 | 10 | import java.io.FileNotFoundException; 11 | import java.io.IOException; 12 | import java.lang.reflect.Constructor; 13 | import java.lang.reflect.InvocationTargetException; 14 | import java.lang.reflect.Member; 15 | import java.lang.reflect.Method; 16 | import java.nio.ByteBuffer; 17 | 18 | import io.github.libxposed.api.errors.HookFailedError; 19 | import io.github.libxposed.api.utils.DexParser; 20 | 21 | /** 22 | * Xposed interface for modules to operate on application processes. 23 | */ 24 | @SuppressWarnings("unused") 25 | public interface XposedInterface { 26 | /** 27 | * SDK API version. 28 | */ 29 | int API = 100; 30 | 31 | /** 32 | * Indicates that the framework is running as root. 33 | */ 34 | int FRAMEWORK_PRIVILEGE_ROOT = 0; 35 | /** 36 | * Indicates that the framework is running in a container with a fake system_server. 37 | */ 38 | int FRAMEWORK_PRIVILEGE_CONTAINER = 1; 39 | /** 40 | * Indicates that the framework is running as a different app, which may have at most shell permission. 41 | */ 42 | int FRAMEWORK_PRIVILEGE_APP = 2; 43 | /** 44 | * Indicates that the framework is embedded in the hooked app, 45 | * which means {@link #getRemotePreferences} will be null and remote file is unsupported. 46 | */ 47 | int FRAMEWORK_PRIVILEGE_EMBEDDED = 3; 48 | 49 | /** 50 | * The default hook priority. 51 | */ 52 | int PRIORITY_DEFAULT = 50; 53 | /** 54 | * Execute the hook callback late. 55 | */ 56 | int PRIORITY_LOWEST = -10000; 57 | /** 58 | * Execute the hook callback early. 59 | */ 60 | int PRIORITY_HIGHEST = 10000; 61 | 62 | /** 63 | * Contextual interface for before invocation callbacks. 64 | */ 65 | interface BeforeHookCallback { 66 | /** 67 | * Gets the method / constructor to be hooked. 68 | */ 69 | @NonNull 70 | Member getMember(); 71 | 72 | /** 73 | * Gets the {@code this} object, or {@code null} if the method is static. 74 | */ 75 | @Nullable 76 | Object getThisObject(); 77 | 78 | /** 79 | * Gets the arguments passed to the method / constructor. You can modify the arguments. 80 | */ 81 | @NonNull 82 | Object[] getArgs(); 83 | 84 | /** 85 | * Sets the return value of the method and skip the invocation. If the procedure is a constructor, 86 | * the {@code result} param will be ignored. 87 | * Note that the after invocation callback will still be called. 88 | * 89 | * @param result The return value 90 | */ 91 | void returnAndSkip(@Nullable Object result); 92 | 93 | /** 94 | * Throw an exception from the method / constructor and skip the invocation. 95 | * Note that the after invocation callback will still be called. 96 | * 97 | * @param throwable The exception to be thrown 98 | */ 99 | void throwAndSkip(@Nullable Throwable throwable); 100 | } 101 | 102 | /** 103 | * Contextual interface for after invocation callbacks. 104 | */ 105 | interface AfterHookCallback { 106 | /** 107 | * Gets the method / constructor to be hooked. 108 | */ 109 | @NonNull 110 | Member getMember(); 111 | 112 | /** 113 | * Gets the {@code this} object, or {@code null} if the method is static. 114 | */ 115 | @Nullable 116 | Object getThisObject(); 117 | 118 | /** 119 | * Gets all arguments passed to the method / constructor. 120 | */ 121 | @NonNull 122 | Object[] getArgs(); 123 | 124 | /** 125 | * Gets the return value of the method or the before invocation callback. If the procedure is a 126 | * constructor, a void method or an exception was thrown, the return value will be {@code null}. 127 | */ 128 | @Nullable 129 | Object getResult(); 130 | 131 | /** 132 | * Gets the exception thrown by the method / constructor or the before invocation callback. If the 133 | * procedure call was successful, the return value will be {@code null}. 134 | */ 135 | @Nullable 136 | Throwable getThrowable(); 137 | 138 | /** 139 | * Gets whether the invocation was skipped by the before invocation callback. 140 | */ 141 | boolean isSkipped(); 142 | 143 | /** 144 | * Sets the return value of the method and skip the invocation. If the procedure is a constructor, 145 | * the {@code result} param will be ignored. 146 | * 147 | * @param result The return value 148 | */ 149 | void setResult(@Nullable Object result); 150 | 151 | /** 152 | * Sets the exception thrown by the method / constructor. 153 | * 154 | * @param throwable The exception to be thrown. 155 | */ 156 | void setThrowable(@Nullable Throwable throwable); 157 | } 158 | 159 | /** 160 | * Interface for method / constructor hooking. Xposed modules should define their own hooker class 161 | * and implement this interface. Normally, a hooker class corresponds to a method / constructor, but 162 | * there could also be a single hooker class for all of them. By this way you can implement an interface 163 | * like the old API. 164 | * 165 | *

166 | * Classes implementing this interface should should provide two public static methods named 167 | * before and after for before invocation and after invocation respectively. 168 | *

169 | * 170 | *

171 | * The before invocation method should have the following signature:
172 | * Param {@code callback}: The {@link BeforeHookCallback} of the procedure call.
173 | * Return value: If you want to save contextual information of one procedure call between the before 174 | * and after callback, it could be a self-defined class, otherwise it should be {@code void}. 175 | *

176 | * 177 | *

178 | * The after invocation method should have the following signature:
179 | * Param {@code callback}: The {@link AfterHookCallback} of the procedure call.
180 | * Param {@code context} (optional): The contextual object returned by the before invocation. 181 | *

182 | * 183 | *

Example usage:

184 | * 185 | *
{@code
186 |      *   public class ExampleHooker implements Hooker {
187 |      *
188 |      *       public static void before(@NonNull BeforeHookCallback callback) {
189 |      *           // Pre-hooking logic goes here
190 |      *       }
191 |      *
192 |      *       public static void after(@NonNull AfterHookCallback callback) {
193 |      *           // Post-hooking logic goes here
194 |      *       }
195 |      *   }
196 |      *
197 |      *   public class ExampleHookerWithContext implements Hooker {
198 |      *
199 |      *       public static MyContext before(@NonNull BeforeHookCallback callback) {
200 |      *           // Pre-hooking logic goes here
201 |      *           return new MyContext();
202 |      *       }
203 |      *
204 |      *       public static void after(@NonNull AfterHookCallback callback, MyContext context) {
205 |      *           // Post-hooking logic goes here
206 |      *       }
207 |      *   }
208 |      * }
209 | */ 210 | interface Hooker { 211 | } 212 | 213 | /** 214 | * Interface for canceling a hook. 215 | * 216 | * @param {@link Method} or {@link Constructor} 217 | */ 218 | interface MethodUnhooker { 219 | /** 220 | * Gets the method or constructor being hooked. 221 | */ 222 | @NonNull 223 | T getOrigin(); 224 | 225 | /** 226 | * Cancels the hook. The behavior of calling this method multiple times is undefined. 227 | */ 228 | void unhook(); 229 | } 230 | 231 | /** 232 | * Gets the Xposed framework name of current implementation. 233 | * 234 | * @return Framework name 235 | */ 236 | @NonNull 237 | String getFrameworkName(); 238 | 239 | /** 240 | * Gets the Xposed framework version of current implementation. 241 | * 242 | * @return Framework version 243 | */ 244 | @NonNull 245 | String getFrameworkVersion(); 246 | 247 | /** 248 | * Gets the Xposed framework version code of current implementation. 249 | * 250 | * @return Framework version code 251 | */ 252 | long getFrameworkVersionCode(); 253 | 254 | /** 255 | * Gets the Xposed framework privilege of current implementation. 256 | * 257 | * @return Framework privilege 258 | */ 259 | int getFrameworkPrivilege(); 260 | 261 | /** 262 | * Hook a method with default priority. 263 | * 264 | * @param origin The method to be hooked 265 | * @param hooker The hooker class 266 | * @return Unhooker for canceling the hook 267 | * @throws IllegalArgumentException if origin is abstract, framework internal or {@link Method#invoke}, 268 | * or hooker is invalid 269 | * @throws HookFailedError if hook fails due to framework internal error 270 | */ 271 | @NonNull 272 | MethodUnhooker hook(@NonNull Method origin, @NonNull Class hooker); 273 | 274 | /** 275 | * Hook the static initializer of a class with default priority. 276 | *

277 | * Note: If the class is initialized, the hook will never be called. 278 | *

279 | * 280 | * @param origin The class to be hooked 281 | * @param hooker The hooker class 282 | * @return Unhooker for canceling the hook 283 | * @throws IllegalArgumentException if class has no static initializer or hooker is invalid 284 | * @throws HookFailedError if hook fails due to framework internal error 285 | */ 286 | @NonNull 287 | MethodUnhooker> hookClassInitializer(@NonNull Class origin, @NonNull Class hooker); 288 | 289 | /** 290 | * Hook the static initializer of a class with specified priority. 291 | *

292 | * Note: If the class is initialized, the hook will never be called. 293 | *

294 | * 295 | * @param origin The class to be hooked 296 | * @param priority The hook priority 297 | * @param hooker The hooker class 298 | * @return Unhooker for canceling the hook 299 | * @throws IllegalArgumentException if class has no static initializer or hooker is invalid 300 | * @throws HookFailedError if hook fails due to framework internal error 301 | */ 302 | @NonNull 303 | MethodUnhooker> hookClassInitializer(@NonNull Class origin, int priority, @NonNull Class hooker); 304 | 305 | /** 306 | * Hook a method with specified priority. 307 | * 308 | * @param origin The method to be hooked 309 | * @param priority The hook priority 310 | * @param hooker The hooker class 311 | * @return Unhooker for canceling the hook 312 | * @throws IllegalArgumentException if origin is abstract, framework internal or {@link Method#invoke}, 313 | * or hooker is invalid 314 | * @throws HookFailedError if hook fails due to framework internal error 315 | */ 316 | @NonNull 317 | MethodUnhooker hook(@NonNull Method origin, int priority, @NonNull Class hooker); 318 | 319 | /** 320 | * Hook a constructor with default priority. 321 | * 322 | * @param The type of the constructor 323 | * @param origin The constructor to be hooked 324 | * @param hooker The hooker class 325 | * @return Unhooker for canceling the hook 326 | * @throws IllegalArgumentException if origin is abstract, framework internal or {@link Method#invoke}, 327 | * or hooker is invalid 328 | * @throws HookFailedError if hook fails due to framework internal error 329 | */ 330 | @NonNull 331 | MethodUnhooker> hook(@NonNull Constructor origin, @NonNull Class hooker); 332 | 333 | /** 334 | * Hook a constructor with specified priority. 335 | * 336 | * @param The type of the constructor 337 | * @param origin The constructor to be hooked 338 | * @param priority The hook priority 339 | * @param hooker The hooker class 340 | * @return Unhooker for canceling the hook 341 | * @throws IllegalArgumentException if origin is abstract, framework internal or {@link Method#invoke}, 342 | * or hooker is invalid 343 | * @throws HookFailedError if hook fails due to framework internal error 344 | */ 345 | @NonNull 346 | MethodUnhooker> hook(@NonNull Constructor origin, int priority, @NonNull Class hooker); 347 | 348 | /** 349 | * Deoptimizes a method in case hooked callee is not called because of inline. 350 | * 351 | *

By deoptimizing the method, the method will back all callee without inlining. 352 | * For example, when a short hooked method B is invoked by method A, the callback to B is not invoked 353 | * after hooking, which may mean A has inlined B inside its method body. To force A to call the hooked B, 354 | * you can deoptimize A and then your hook can take effect.

355 | * 356 | *

Generally, you need to find all the callers of your hooked callee and that can be hardly achieve 357 | * (but you can still search all callers by using {@link DexParser}). Use this method if you are sure 358 | * the deoptimized callers are all you need. Otherwise, it would be better to change the hook point or 359 | * to deoptimize the whole app manually (by simply reinstalling the app without uninstall).

360 | * 361 | * @param method The method to deoptimize 362 | * @return Indicate whether the deoptimizing succeed or not 363 | */ 364 | boolean deoptimize(@NonNull Method method); 365 | 366 | /** 367 | * Deoptimizes a constructor in case hooked callee is not called because of inline. 368 | * 369 | * @param The type of the constructor 370 | * @param constructor The constructor to deoptimize 371 | * @return Indicate whether the deoptimizing succeed or not 372 | * @see #deoptimize(Method) 373 | */ 374 | boolean deoptimize(@NonNull Constructor constructor); 375 | 376 | /** 377 | * Basically the same as {@link Method#invoke(Object, Object...)}, but calls the original method 378 | * as it was before the interception by Xposed. 379 | * 380 | * @param method The method to be called 381 | * @param thisObject For non-static calls, the {@code this} pointer, otherwise {@code null} 382 | * @param args The arguments used for the method call 383 | * @return The result returned from the invoked method 384 | * @see Method#invoke(Object, Object...) 385 | */ 386 | @Nullable 387 | Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException; 388 | 389 | /** 390 | * Basically the same as {@link Constructor#newInstance(Object...)}, but calls the original constructor 391 | * as it was before the interception by Xposed. 392 | * 393 | * @param constructor The constructor to create and initialize a new instance 394 | * @param thisObject The instance to be constructed 395 | * @param args The arguments used for the construction 396 | * @param The type of the instance 397 | * @see Constructor#newInstance(Object...) 398 | */ 399 | void invokeOrigin(@NonNull Constructor constructor, @NonNull T thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException; 400 | 401 | /** 402 | * Invokes a special (non-virtual) method on a given object instance, similar to the functionality of 403 | * {@code CallNonVirtualMethod} in JNI, which invokes an instance (nonstatic) method on a Java 404 | * object. This method is useful when you need to call a specific method on an object, bypassing any 405 | * overridden methods in subclasses and directly invoking the method defined in the specified class. 406 | * 407 | *

This method is useful when you need to call {@code super.xxx()} in a hooked constructor.

408 | * 409 | * @param method The method to be called 410 | * @param thisObject For non-static calls, the {@code this} pointer, otherwise {@code null} 411 | * @param args The arguments used for the method call 412 | * @return The result returned from the invoked method 413 | * @see Method#invoke(Object, Object...) 414 | */ 415 | @Nullable 416 | Object invokeSpecial(@NonNull Method method, @NonNull Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException; 417 | 418 | /** 419 | * Invokes a special (non-virtual) method on a given object instance, similar to the functionality of 420 | * {@code CallNonVirtualMethod} in JNI, which invokes an instance (nonstatic) method on a Java 421 | * object. This method is useful when you need to call a specific method on an object, bypassing any 422 | * overridden methods in subclasses and directly invoking the method defined in the specified class. 423 | * 424 | *

This method is useful when you need to call {@code super.xxx()} in a hooked constructor.

425 | * 426 | * @param constructor The constructor to create and initialize a new instance 427 | * @param thisObject The instance to be constructed 428 | * @param args The arguments used for the construction 429 | * @see Constructor#newInstance(Object...) 430 | */ 431 | void invokeSpecial(@NonNull Constructor constructor, @NonNull T thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException; 432 | 433 | /** 434 | * Basically the same as {@link Constructor#newInstance(Object...)}, but calls the original constructor 435 | * as it was before the interception by Xposed. 436 | * 437 | * @param The type of the constructor 438 | * @param constructor The constructor to create and initialize a new instance 439 | * @param args The arguments used for the construction 440 | * @return The instance created and initialized by the constructor 441 | * @see Constructor#newInstance(Object...) 442 | */ 443 | @NonNull 444 | T newInstanceOrigin(@NonNull Constructor constructor, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException; 445 | 446 | /** 447 | * Creates a new instance of the given subclass, but initialize it with a parent constructor. This could 448 | * leave the object in an invalid state, where the subclass constructor are not called and the fields 449 | * of the subclass are not initialized. 450 | * 451 | *

This method is useful when you need to initialize some fields in the subclass by yourself.

452 | * 453 | * @param The type of the parent constructor 454 | * @param The type of the subclass 455 | * @param constructor The parent constructor to initialize a new instance 456 | * @param subClass The subclass to create a new instance 457 | * @param args The arguments used for the construction 458 | * @return The instance of subclass initialized by the constructor 459 | * @see Constructor#newInstance(Object...) 460 | */ 461 | @NonNull 462 | U newInstanceSpecial(@NonNull Constructor constructor, @NonNull Class subClass, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException; 463 | 464 | /** 465 | * Writes a message to the Xposed log. 466 | * 467 | * @param message The log message 468 | */ 469 | void log(@NonNull String message); 470 | 471 | /** 472 | * Writes a message with a stack trace to the Xposed log. 473 | * 474 | * @param message The log message 475 | * @param throwable The Throwable object for the stack trace 476 | */ 477 | void log(@NonNull String message, @NonNull Throwable throwable); 478 | 479 | /** 480 | * Parse a dex file in memory. 481 | * 482 | * @param dexData The content of the dex file 483 | * @param includeAnnotations Whether to include annotations 484 | * @return The {@link DexParser} of the dex file 485 | * @throws IOException if the dex file is invalid 486 | */ 487 | @Nullable 488 | DexParser parseDex(@NonNull ByteBuffer dexData, boolean includeAnnotations) throws IOException; 489 | 490 | /** 491 | * Gets the application info of the module. 492 | */ 493 | @NonNull 494 | ApplicationInfo getApplicationInfo(); 495 | 496 | /** 497 | * Gets remote preferences stored in Xposed framework. Note that those are read-only in hooked apps. 498 | * 499 | * @param group Group name 500 | * @return The preferences 501 | * @throws UnsupportedOperationException If the framework is embedded 502 | */ 503 | @NonNull 504 | SharedPreferences getRemotePreferences(@NonNull String group); 505 | 506 | /** 507 | * List all files in the module's shared data directory. 508 | * 509 | * @return The file list 510 | * @throws UnsupportedOperationException If the framework is embedded 511 | */ 512 | @NonNull 513 | String[] listRemoteFiles(); 514 | 515 | /** 516 | * Open a file in the module's shared data directory. The file is opened in read-only mode. 517 | * 518 | * @param name File name, must not contain path separators and . or .. 519 | * @return The file descriptor 520 | * @throws FileNotFoundException If the file does not exist or the path is forbidden 521 | * @throws UnsupportedOperationException If the framework is embedded 522 | */ 523 | @NonNull 524 | ParcelFileDescriptor openRemoteFile(@NonNull String name) throws FileNotFoundException; 525 | } 526 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/XposedInterfaceWrapper.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api; 2 | 3 | import android.content.SharedPreferences; 4 | import android.content.pm.ApplicationInfo; 5 | import android.os.ParcelFileDescriptor; 6 | 7 | import androidx.annotation.NonNull; 8 | import androidx.annotation.Nullable; 9 | 10 | import java.io.FileNotFoundException; 11 | import java.io.IOException; 12 | import java.lang.reflect.Constructor; 13 | import java.lang.reflect.InvocationTargetException; 14 | import java.lang.reflect.Method; 15 | import java.nio.ByteBuffer; 16 | 17 | import io.github.libxposed.api.utils.DexParser; 18 | 19 | /** 20 | * Wrap of {@link XposedInterface} used by the modules for the purpose of shielding framework implementation details. 21 | */ 22 | public class XposedInterfaceWrapper implements XposedInterface { 23 | 24 | private final XposedInterface mBase; 25 | 26 | XposedInterfaceWrapper(@NonNull XposedInterface base) { 27 | mBase = base; 28 | } 29 | 30 | @NonNull 31 | @Override 32 | public final String getFrameworkName() { 33 | return mBase.getFrameworkName(); 34 | } 35 | 36 | @NonNull 37 | @Override 38 | public final String getFrameworkVersion() { 39 | return mBase.getFrameworkVersion(); 40 | } 41 | 42 | @Override 43 | public final long getFrameworkVersionCode() { 44 | return mBase.getFrameworkVersionCode(); 45 | } 46 | 47 | @Override 48 | public final int getFrameworkPrivilege() { 49 | return mBase.getFrameworkPrivilege(); 50 | } 51 | 52 | @NonNull 53 | @Override 54 | public final MethodUnhooker hook(@NonNull Method origin, @NonNull Class hooker) { 55 | return mBase.hook(origin, hooker); 56 | } 57 | 58 | @NonNull 59 | @Override 60 | public MethodUnhooker> hookClassInitializer(@NonNull Class origin, @NonNull Class hooker) { 61 | return mBase.hookClassInitializer(origin, hooker); 62 | } 63 | 64 | @NonNull 65 | @Override 66 | public MethodUnhooker> hookClassInitializer(@NonNull Class origin, int priority, @NonNull Class hooker) { 67 | return mBase.hookClassInitializer(origin, priority, hooker); 68 | } 69 | 70 | @NonNull 71 | @Override 72 | public final MethodUnhooker hook(@NonNull Method origin, int priority, @NonNull Class hooker) { 73 | return mBase.hook(origin, priority, hooker); 74 | } 75 | 76 | @NonNull 77 | @Override 78 | public final MethodUnhooker> hook(@NonNull Constructor origin, @NonNull Class hooker) { 79 | return mBase.hook(origin, hooker); 80 | } 81 | 82 | @NonNull 83 | @Override 84 | public final MethodUnhooker> hook(@NonNull Constructor origin, int priority, @NonNull Class hooker) { 85 | return mBase.hook(origin, priority, hooker); 86 | } 87 | 88 | @Override 89 | public final boolean deoptimize(@NonNull Method method) { 90 | return mBase.deoptimize(method); 91 | } 92 | 93 | @Override 94 | public final boolean deoptimize(@NonNull Constructor constructor) { 95 | return mBase.deoptimize(constructor); 96 | } 97 | 98 | @Nullable 99 | @Override 100 | public final Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { 101 | return mBase.invokeOrigin(method, thisObject, args); 102 | } 103 | 104 | @Override 105 | public void invokeOrigin(@NonNull Constructor constructor, @NonNull T thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { 106 | mBase.invokeOrigin(constructor, thisObject, args); 107 | } 108 | 109 | @Nullable 110 | @Override 111 | public final Object invokeSpecial(@NonNull Method method, @NonNull Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { 112 | return mBase.invokeSpecial(method, thisObject, args); 113 | } 114 | 115 | @Override 116 | public void invokeSpecial(@NonNull Constructor constructor, @NonNull T thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { 117 | mBase.invokeSpecial(constructor, thisObject, args); 118 | } 119 | 120 | @NonNull 121 | @Override 122 | public final T newInstanceOrigin(@NonNull Constructor constructor, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { 123 | return mBase.newInstanceOrigin(constructor, args); 124 | } 125 | 126 | @NonNull 127 | @Override 128 | public final U newInstanceSpecial(@NonNull Constructor constructor, @NonNull Class subClass, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { 129 | return mBase.newInstanceSpecial(constructor, subClass, args); 130 | } 131 | 132 | @Override 133 | public final void log(@NonNull String message) { 134 | mBase.log(message); 135 | } 136 | 137 | @Override 138 | public final void log(@NonNull String message, @NonNull Throwable throwable) { 139 | mBase.log(message, throwable); 140 | } 141 | 142 | @Nullable 143 | @Override 144 | public final DexParser parseDex(@NonNull ByteBuffer dexData, boolean includeAnnotations) throws IOException { 145 | return mBase.parseDex(dexData, includeAnnotations); 146 | } 147 | 148 | @NonNull 149 | @Override 150 | public SharedPreferences getRemotePreferences(@NonNull String name) { 151 | return mBase.getRemotePreferences(name); 152 | } 153 | 154 | @NonNull 155 | @Override 156 | public ApplicationInfo getApplicationInfo() { 157 | return mBase.getApplicationInfo(); 158 | } 159 | 160 | @NonNull 161 | @Override 162 | public String[] listRemoteFiles() { 163 | return mBase.listRemoteFiles(); 164 | } 165 | 166 | @NonNull 167 | @Override 168 | public ParcelFileDescriptor openRemoteFile(@NonNull String name) throws FileNotFoundException { 169 | return mBase.openRemoteFile(name); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/XposedModule.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | /** 6 | * Super class which all Xposed module entry classes should extend.
7 | * Entry classes will be instantiated exactly once for each process. 8 | */ 9 | @SuppressWarnings("unused") 10 | public abstract class XposedModule extends XposedInterfaceWrapper implements XposedModuleInterface { 11 | /** 12 | * Instantiates a new Xposed module.
13 | * When the module is loaded into the target process, the constructor will be called. 14 | * 15 | * @param base The implementation interface provided by the framework, should not be used by the module 16 | * @param param Information about the process in which the module is loaded 17 | */ 18 | public XposedModule(@NonNull XposedInterface base, @NonNull ModuleLoadedParam param) { 19 | super(base); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/XposedModuleInterface.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api; 2 | 3 | import android.content.pm.ApplicationInfo; 4 | import android.os.Build; 5 | 6 | import androidx.annotation.NonNull; 7 | import androidx.annotation.RequiresApi; 8 | 9 | /** 10 | * Interface for module initialization. 11 | */ 12 | @SuppressWarnings("unused") 13 | public interface XposedModuleInterface { 14 | /** 15 | * Wraps information about the process in which the module is loaded. 16 | */ 17 | interface ModuleLoadedParam { 18 | /** 19 | * Gets information about whether the module is running in system server. 20 | * 21 | * @return {@code true} if the module is running in system server 22 | */ 23 | boolean isSystemServer(); 24 | 25 | /** 26 | * Gets the process name. 27 | * 28 | * @return The process name 29 | */ 30 | @NonNull 31 | String getProcessName(); 32 | } 33 | 34 | /** 35 | * Wraps information about system server. 36 | */ 37 | interface SystemServerLoadedParam { 38 | /** 39 | * Gets the class loader of system server. 40 | * 41 | * @return The class loader 42 | */ 43 | @NonNull 44 | ClassLoader getClassLoader(); 45 | } 46 | 47 | /** 48 | * Wraps information about the package being loaded. 49 | */ 50 | interface PackageLoadedParam { 51 | /** 52 | * Gets the package name of the package being loaded. 53 | * 54 | * @return The package name. 55 | */ 56 | @NonNull 57 | String getPackageName(); 58 | 59 | /** 60 | * Gets the {@link ApplicationInfo} of the package being loaded. 61 | * 62 | * @return The ApplicationInfo. 63 | */ 64 | @NonNull 65 | ApplicationInfo getApplicationInfo(); 66 | 67 | /** 68 | * Gets default class loader. 69 | * 70 | * @return the default class loader 71 | */ 72 | @RequiresApi(Build.VERSION_CODES.Q) 73 | @NonNull 74 | ClassLoader getDefaultClassLoader(); 75 | 76 | /** 77 | * Gets the class loader of the package being loaded. 78 | * 79 | * @return The class loader. 80 | */ 81 | @NonNull 82 | ClassLoader getClassLoader(); 83 | 84 | /** 85 | * Gets information about whether is this package the first and main package of the app process. 86 | * 87 | * @return {@code true} if this is the first package. 88 | */ 89 | boolean isFirstPackage(); 90 | } 91 | 92 | /** 93 | * Gets notified when a package is loaded into the app process.
94 | * This callback could be invoked multiple times for the same process on each package. 95 | * 96 | * @param param Information about the package being loaded 97 | */ 98 | default void onPackageLoaded(@NonNull PackageLoadedParam param) { 99 | } 100 | 101 | /** 102 | * Gets notified when the system server is loaded. 103 | * 104 | * @param param Information about system server 105 | */ 106 | default void onSystemServerLoaded(@NonNull SystemServerLoadedParam param) { 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/errors/HookFailedError.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api.errors; 2 | 3 | /** 4 | * Thrown to indicate that a hook failed due to framework internal error. 5 | */ 6 | @SuppressWarnings("unused") 7 | public class HookFailedError extends XposedFrameworkError { 8 | 9 | public HookFailedError(String message) { 10 | super(message); 11 | } 12 | 13 | public HookFailedError(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | 17 | public HookFailedError(Throwable cause) { 18 | super(cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/errors/XposedFrameworkError.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api.errors; 2 | 3 | /** 4 | * Thrown to indicate that the Xposed framework function is broken. 5 | */ 6 | public class XposedFrameworkError extends Error { 7 | 8 | public XposedFrameworkError(String message) { 9 | super(message); 10 | } 11 | 12 | public XposedFrameworkError(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public XposedFrameworkError(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /api/src/main/java/io/github/libxposed/api/utils/DexParser.java: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.api.utils; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.Nullable; 5 | 6 | import java.io.Closeable; 7 | 8 | /** 9 | * Xposed interface for parsing dex files. 10 | */ 11 | @SuppressWarnings("unused") 12 | public interface DexParser extends Closeable { 13 | /** 14 | * The constant NO_INDEX. 15 | */ 16 | int NO_INDEX = 0xffffffff; 17 | 18 | /** 19 | * The interface Array. 20 | */ 21 | interface Array { 22 | /** 23 | * Get values value [ ]. 24 | * 25 | * @return the value [ ] 26 | */ 27 | @NonNull 28 | Value[] getValues(); 29 | } 30 | 31 | /** 32 | * The interface Annotation. 33 | */ 34 | interface Annotation { 35 | /** 36 | * Gets visibility. 37 | * 38 | * @return the visibility 39 | */ 40 | int getVisibility(); 41 | 42 | /** 43 | * Gets type. 44 | * 45 | * @return the type 46 | */ 47 | @NonNull 48 | TypeId getType(); 49 | 50 | /** 51 | * Get elements element [ ]. 52 | * 53 | * @return the element [ ] 54 | */ 55 | @NonNull 56 | Element[] getElements(); 57 | } 58 | 59 | /** 60 | * The interface Value. 61 | */ 62 | interface Value { 63 | 64 | /** 65 | * Get value byte [ ]. 66 | * 67 | * @return the byte [ ] 68 | */ 69 | @Nullable 70 | byte[] getValue(); 71 | 72 | /** 73 | * Gets value type. 74 | * 75 | * @return the value type 76 | */ 77 | int getValueType(); 78 | } 79 | 80 | /** 81 | * The interface Element. 82 | */ 83 | interface Element extends Value { 84 | /** 85 | * Gets name. 86 | * 87 | * @return the name 88 | */ 89 | @NonNull 90 | StringId getName(); 91 | } 92 | /** 93 | * The interface Id. 94 | */ 95 | interface Id extends Comparable { 96 | /** 97 | * Gets id. 98 | * 99 | * @return the id 100 | */ 101 | int getId(); 102 | } 103 | 104 | /** 105 | * The interface Type id. 106 | */ 107 | interface TypeId extends Id { 108 | /** 109 | * Gets descriptor. 110 | * 111 | * @return the descriptor 112 | */ 113 | @NonNull 114 | StringId getDescriptor(); 115 | } 116 | 117 | 118 | /** 119 | * The interface String id. 120 | */ 121 | interface StringId extends Id { 122 | /** 123 | * Gets string. 124 | * 125 | * @return the string 126 | */ 127 | @NonNull 128 | String getString(); 129 | } 130 | 131 | /** 132 | * The interface Field id. 133 | */ 134 | interface FieldId extends Id { 135 | /** 136 | * Gets type. 137 | * 138 | * @return the type 139 | */ 140 | @NonNull 141 | TypeId getType(); 142 | 143 | /** 144 | * Gets declaring class. 145 | * 146 | * @return the declaring class 147 | */ 148 | @NonNull 149 | TypeId getDeclaringClass(); 150 | 151 | /** 152 | * Gets name. 153 | * 154 | * @return the name 155 | */ 156 | @NonNull 157 | StringId getName(); 158 | } 159 | 160 | /** 161 | * The interface Method id. 162 | */ 163 | interface MethodId extends Id { 164 | /** 165 | * Gets declaring class. 166 | * 167 | * @return the declaring class 168 | */ 169 | @NonNull 170 | TypeId getDeclaringClass(); 171 | 172 | /** 173 | * Gets prototype. 174 | * 175 | * @return the prototype 176 | */ 177 | @NonNull 178 | ProtoId getPrototype(); 179 | 180 | /** 181 | * Gets name. 182 | * 183 | * @return the name 184 | */ 185 | @NonNull 186 | StringId getName(); 187 | } 188 | 189 | /** 190 | * The interface Proto id. 191 | */ 192 | interface ProtoId extends Id { 193 | /** 194 | * Gets shorty. 195 | * 196 | * @return the shorty 197 | */ 198 | @NonNull 199 | StringId getShorty(); 200 | 201 | /** 202 | * Gets return type. 203 | * 204 | * @return the return type 205 | */ 206 | @NonNull 207 | TypeId getReturnType(); 208 | 209 | /** 210 | * Get parameters type id [ ]. 211 | * 212 | * @return the type id [ ] 213 | */ 214 | @Nullable 215 | TypeId[] getParameters(); 216 | } 217 | 218 | /** 219 | * Get string id string id [ ]. 220 | * 221 | * @return the string id [ ] 222 | */ 223 | @NonNull 224 | StringId[] getStringId(); 225 | 226 | /** 227 | * Get type id type id [ ]. 228 | * 229 | * @return the type id [ ] 230 | */ 231 | @NonNull 232 | TypeId[] getTypeId(); 233 | 234 | /** 235 | * Get field id field id [ ]. 236 | * 237 | * @return the field id [ ] 238 | */ 239 | @NonNull 240 | FieldId[] getFieldId(); 241 | 242 | /** 243 | * Get method id method id [ ]. 244 | * 245 | * @return the method id [ ] 246 | */ 247 | @NonNull 248 | MethodId[] getMethodId(); 249 | 250 | /** 251 | * Get proto id proto id [ ]. 252 | * 253 | * @return the proto id [ ] 254 | */ 255 | @NonNull 256 | ProtoId[] getProtoId(); 257 | 258 | /** 259 | * Get annotations annotation [ ]. 260 | * 261 | * @return the annotation [ ] 262 | */ 263 | @NonNull 264 | Annotation[] getAnnotations(); 265 | 266 | /** 267 | * Get arrays array [ ]. 268 | * 269 | * @return the array [ ] 270 | */ 271 | @NonNull 272 | Array[] getArrays(); 273 | 274 | /** 275 | * The interface Early stop visitor. 276 | */ 277 | interface EarlyStopVisitor { 278 | /** 279 | * Stop boolean. 280 | * 281 | * @return the boolean 282 | */ 283 | boolean stop(); 284 | } 285 | 286 | /** 287 | * The interface Member visitor. 288 | */ 289 | interface MemberVisitor extends EarlyStopVisitor { 290 | } 291 | 292 | /** 293 | * The interface Class visitor. 294 | */ 295 | interface ClassVisitor extends EarlyStopVisitor { 296 | /** 297 | * Visit member visitor. 298 | * 299 | * @param clazz the clazz 300 | * @param accessFlags the access flags 301 | * @param superClass the super class 302 | * @param interfaces the interfaces 303 | * @param sourceFile the source file 304 | * @param staticFields the static fields 305 | * @param staticFieldsAccessFlags the static fields access flags 306 | * @param instanceFields the instance fields 307 | * @param instanceFieldsAccessFlags the instance fields access flags 308 | * @param directMethods the direct methods 309 | * @param directMethodsAccessFlags the direct methods access flags 310 | * @param virtualMethods the virtual methods 311 | * @param virtualMethodsAccessFlags the virtual methods access flags 312 | * @param annotations the annotations 313 | * @return the member visitor 314 | */ 315 | @Nullable 316 | MemberVisitor visit(int clazz, int accessFlags, int superClass, @NonNull int[] interfaces, int sourceFile, @NonNull int[] staticFields, @NonNull int[] staticFieldsAccessFlags, @NonNull int[] instanceFields, @NonNull int[] instanceFieldsAccessFlags, @NonNull int[] directMethods, @NonNull int[] directMethodsAccessFlags, @NonNull int[] virtualMethods, @NonNull int[] virtualMethodsAccessFlags, @NonNull int[] annotations); 317 | } 318 | 319 | /** 320 | * The interface Field visitor. 321 | */ 322 | interface FieldVisitor extends MemberVisitor { 323 | /** 324 | * Visit. 325 | * 326 | * @param field the field 327 | * @param accessFlags the access flags 328 | * @param annotations the annotations 329 | */ 330 | void visit(int field, int accessFlags, @NonNull int[] annotations); 331 | } 332 | 333 | /** 334 | * The interface Method visitor. 335 | */ 336 | interface MethodVisitor extends MemberVisitor { 337 | /** 338 | * Visit method body visitor. 339 | * 340 | * @param method the method 341 | * @param accessFlags the access flags 342 | * @param hasBody the has body 343 | * @param annotations the annotations 344 | * @param parameterAnnotations the parameter annotations 345 | * @return the method body visitor 346 | */ 347 | @Nullable 348 | MethodBodyVisitor visit(int method, int accessFlags, boolean hasBody, @NonNull int[] annotations, @NonNull int[] parameterAnnotations); 349 | } 350 | 351 | /** 352 | * The interface Method body visitor. 353 | */ 354 | interface MethodBodyVisitor { 355 | /** 356 | * Visit. 357 | * 358 | * @param method the method 359 | * @param accessFlags the access flags 360 | * @param referredStrings the referred strings 361 | * @param invokedMethods the invoked methods 362 | * @param accessedFields the accessed fields 363 | * @param assignedFields the assigned fields 364 | * @param opcodes the opcodes 365 | */ 366 | void visit(int method, int accessFlags, @NonNull int[] referredStrings, @NonNull int[] invokedMethods, @NonNull int[] accessedFields, @NonNull int[] assignedFields, @NonNull byte[] opcodes); 367 | } 368 | 369 | /** 370 | * Visit defined classes. 371 | * 372 | * @param visitor the visitor 373 | * @throws IllegalStateException the illegal state exception 374 | */ 375 | void visitDefinedClasses(@NonNull ClassVisitor visitor) throws IllegalStateException; 376 | } 377 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.register("Delete", Delete::class) { 2 | delete(rootProject.layout.buildDirectory) 3 | } 4 | -------------------------------------------------------------------------------- /checks/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /checks/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | alias(libs.plugins.kotlin) 4 | } 5 | 6 | java { 7 | sourceCompatibility = JavaVersion.VERSION_21 8 | targetCompatibility = JavaVersion.VERSION_21 9 | } 10 | 11 | dependencies { 12 | compileOnly(libs.lint.api) 13 | compileOnly(libs.lint.checks) 14 | compileOnly(libs.kotlin.stdlib) 15 | } 16 | 17 | -------------------------------------------------------------------------------- /checks/src/main/java/io/github/libxposed/lint/XposedIssueRegistry.kt: -------------------------------------------------------------------------------- 1 | package io.github.libxposed.lint 2 | 3 | import com.android.tools.lint.client.api.IssueRegistry 4 | import com.android.tools.lint.detector.api.Issue 5 | 6 | class XposedIssueRegistry : IssueRegistry() { 7 | override val issues: List 8 | get() = emptyList() 9 | } 10 | -------------------------------------------------------------------------------- /checks/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry: -------------------------------------------------------------------------------- 1 | io.github.libxposed.lint.XposedIssueRegistry 2 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | android.useAndroidX=true 2 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | annotation = "1.8.0" 3 | kotlin = "2.0.0" 4 | lint = "31.5.1" 5 | agp = "8.5.1" 6 | 7 | [plugins] 8 | kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } 9 | agp-lib = { id = "com.android.library", version.ref = "agp" } 10 | 11 | [libraries] 12 | annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" } 13 | lint-api = { module = "com.android.tools.lint:lint-api", version.ref = "lint" } 14 | lint-checks = { module = "com.android.tools.lint:lint-checks", version.ref = "lint" } 15 | kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } 16 | 17 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libxposed/api/b896dbcda3fa1550d04d43d962923318ed5a61a8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | 9 | dependencyResolutionManagement { 10 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 11 | repositories { 12 | google() 13 | mavenCentral() 14 | } 15 | } 16 | 17 | rootProject.name = "libxposed-api" 18 | 19 | include(":api", ":checks") 20 | --------------------------------------------------------------------------------