Skip to content

Commit 35bdae3

Browse files
committed
Add SandHook-hooklib to source tree
1 parent 8aa619f commit 35bdae3

File tree

87 files changed

+6887
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+6887
-31
lines changed

Diff for: build.gradle

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ allprojects {
2424
templateLib64Path = templateRootPath + "/system/lib64/"
2525
templateEtcPath = templateRootPath + "/system/etc/"
2626
hiddenApiStubJarFilePath = project(":hiddenapi-stubs").buildDir.absolutePath + "/libs/framework-stub.jar"
27+
zipPathMagiskReleasePath = project(":edxp-core").projectDir.path + "/build/tmp/release/magisk"
2728
}
2829
repositories {
2930
google()
@@ -34,8 +35,3 @@ allprojects {
3435
task clean(type: Delete) {
3536
delete rootProject.buildDir
3637
}
37-
38-
ext {
39-
minSdkVersion = 23
40-
targetSdkVersion = 28
41-
}

Diff for: edxp-common/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ android {
44
compileSdkVersion androidCompileSdkVersion.toInteger()
55

66
defaultConfig {
7-
minSdkVersion 26
8-
targetSdkVersion 28
7+
minSdkVersion minSdkVersion
8+
targetSdkVersion targetSdkVersion
99
versionCode 1
1010
versionName "1.0"
1111
}

Diff for: edxp-core/build.gradle

+16-11
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ ext {
4141
sandhook_authors = "solohsu, MlgmXyysd & ganyao114"
4242

4343
riruModuleId = "edxp"
44-
zipPathMagiskRelease = "$buildDir/tmp/release/magisk"
4544

4645
moduleMinRiruApiVersion = 10
4746
moduleMinRiruVersionName = "v23.0"
@@ -120,13 +119,16 @@ afterEvaluate {
120119
def variantLowered = variant.name.toLowerCase()
121120

122121
backends.each { backend ->
123-
124122
def backendLowered = backend.toLowerCase()
125123
def backendCapped = backendLowered.capitalize()
126124
def authorList = property("${backendLowered}" + "_authors")
127125
def magiskModuleId = property("${backendLowered}" + "_module_id")
128126

127+
project.logger.lifecycle("delete file")
128+
delete file(zipPathMagiskReleasePath)
129+
129130
def prepareJarsTask = task("prepareJars${backendCapped}${variantCapped}") {
131+
project.logger.lifecycle("prepareJarsTask")
130132
dependsOn cleanTemplate
131133
dependsOn tasks.getByPath(":dexmaker:copyDex${variantCapped}")
132134
dependsOn tasks.getByPath(":dalvikdx:copyDex${variantCapped}")
@@ -136,7 +138,6 @@ afterEvaluate {
136138

137139
def prepareMagiskFilesTask = task("prepareMagiskFiles${backendCapped}${variantCapped}", type: Delete) {
138140
dependsOn prepareJarsTask, "assemble${variantCapped}"
139-
delete file(zipPathMagiskRelease)
140141
doFirst {
141142
copy {
142143
from "${projectDir}/tpl/edconfig.tpl"
@@ -169,12 +170,12 @@ afterEvaluate {
169170
doLast {
170171
copy {
171172
from "${projectDir}/template_override"
172-
into zipPathMagiskRelease
173+
into zipPathMagiskReleasePath
173174
exclude exclude_list
174175
}
175176
copy {
176177
from "${projectDir}/template_override"
177-
into zipPathMagiskRelease
178+
into zipPathMagiskReleasePath
178179
include 'riru.sh'
179180
filter { line ->
180181
line.replaceAll('%%%RIRU_MODULE_ID%%%', riruModuleId)
@@ -185,23 +186,27 @@ afterEvaluate {
185186
eol: FixCrLfFilter.CrLf.newInstance("lf"))
186187
}
187188
copy {
189+
include "libriru_edxp.so"
188190
from "$libPathRelease/armeabi-v7a"
189-
into "$zipPathMagiskRelease/system/lib"
191+
into "$zipPathMagiskReleasePath/system/lib"
190192
}
191193
copy {
194+
include "libriru_edxp.so"
192195
from "$libPathRelease/arm64-v8a"
193-
into "$zipPathMagiskRelease/system/lib64"
196+
into "$zipPathMagiskReleasePath/system/lib64"
194197
}
195198
copy {
199+
include "libriru_edxp.so"
196200
from "$libPathRelease/x86"
197-
into "$zipPathMagiskRelease/system_x86/lib"
201+
into "$zipPathMagiskReleasePath/system_x86/lib"
198202
}
199203
copy {
204+
include "libriru_edxp.so"
200205
from "$libPathRelease/x86_64"
201-
into "$zipPathMagiskRelease/system_x86/lib64"
206+
into "$zipPathMagiskReleasePath/system_x86/lib64"
202207
}
203208
// generate sha1sum
204-
fileTree(zipPathMagiskRelease).matching {
209+
fileTree(zipPathMagiskReleasePath).matching {
205210
exclude "README.md", "META-INF"
206211
}.visit { f ->
207212
if (f.directory) return
@@ -214,7 +219,7 @@ afterEvaluate {
214219
dependsOn prepareMagiskFilesTask
215220
archiveName "${module_name}-${backend}-${project.version}-${variantLowered}.zip"
216221
destinationDir file("$projectDir/release")
217-
from "$zipPathMagiskRelease"
222+
from "$zipPathMagiskReleasePath"
218223
}
219224

220225
task("push${backendCapped}${variantCapped}", type: Exec) {

Diff for: edxp-sandhook/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88

99
defaultConfig {
1010
applicationId "com.elderdrivers.riru.edxp.sandhook"
11-
minSdkVersion 26
12-
targetSdkVersion 28
11+
minSdkVersion minSdkVersion
12+
targetSdkVersion targetSdkVersion
1313
versionCode 1
1414
versionName "1.0"
1515
multiDexEnabled false
@@ -28,7 +28,7 @@ android {
2828
dependencies {
2929
compileOnly project(':hiddenapi-stubs')
3030
implementation project(':edxp-common')
31-
implementation 'com.swift.sandhook:hooklib:4.2.1'
31+
implementation project(':sandhook-hooklib')
3232
compileOnly files(project(":dexmaker").tasks.getByName("makeJarRelease").outputs)
3333
}
3434

@@ -62,21 +62,21 @@ afterEvaluate {
6262
task("copyDex${variantNameCapped}", type: Copy) {
6363
dependsOn "assemble${variantNameCapped}"
6464
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
65+
dependsOn tasks.getByPath(":sandhook-hooklib:copySandHook${variantNameCapped}LibraryToMagiskTemplate")
6566
def dexOutPath = variant.name.contains("release") ?
6667
"${buildDir}/intermediates/dex/${variantNameLowered}/minify${variantNameCapped}WithR8" :
6768
"${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}"
6869
from (dexOutPath){
6970
rename("classes.dex", "edxp.dex")
7071
}
71-
destinationDir file(templateRootPath + "system/framework/")
72+
destinationDir file(zipPathMagiskReleasePath + "/system/framework/")
7273
outputs.upToDateWhen { false }
7374
doLast {
7475
copy {
7576
from file(myTemplatePath)
76-
into file(templateRootPath)
77+
into file(zipPathMagiskReleasePath)
7778
}
7879
}
7980
}
80-
8181
}
8282
}
-194 KB
Binary file not shown.
Binary file not shown.

Diff for: edxp-service/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88

99
defaultConfig {
1010
applicationId "com.elderdrivers.riru.edxp.yahfa"
11-
minSdkVersion 26
12-
targetSdkVersion 28
11+
minSdkVersion minSdkVersion
12+
targetSdkVersion targetSdkVersion
1313
versionCode 1
1414
versionName "1.0"
1515
multiDexEnabled false

Diff for: edxp-yahfa/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88

99
defaultConfig {
1010
applicationId "com.elderdrivers.riru.edxp.yahfa"
11-
minSdkVersion 26
12-
targetSdkVersion 28
11+
minSdkVersion minSdkVersion
12+
targetSdkVersion targetSdkVersion
1313
versionCode 1
1414
versionName "1.0"
1515
multiDexEnabled false

Diff for: gradle.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
androidCompileSdkVersion=30
22
androidCompileNdkVersion=22.0.6917172
33
android.prefabVersion=1.1.2
4-
apiCode=93
4+
apiCode=93
5+
minSdkVersion=26
6+
targetSdkVersion=30

Diff for: sandhook-annotation/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

Diff for: sandhook-annotation/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apply plugin: 'java-library'
2+
3+
dependencies {
4+
implementation fileTree(dir: 'libs', include: ['*.jar'])
5+
}
6+
7+
sourceCompatibility = "1.7"
8+
targetCompatibility = "1.7"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.TYPE})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface HookClass {
11+
Class<?> value();
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.METHOD})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface HookMethod {
11+
String value() default "<init>";
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.METHOD,ElementType.FIELD})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface HookMethodBackup {
11+
String value() default "<init>";
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.METHOD})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface HookMode {
11+
12+
int AUTO = 0;
13+
int INLINE = 1;
14+
int REPLACE = 2;
15+
16+
int value() default AUTO;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.TYPE})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface HookReflectClass {
11+
String value();
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.METHOD,ElementType.FIELD})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface MethodParams {
11+
Class<?>[] value();
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.METHOD,ElementType.FIELD})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface MethodReflectParams {
11+
12+
String BOOLEAN = "boolean";
13+
String BYTE = "byte";
14+
String CHAR = "char";
15+
String DOUBLE = "double";
16+
String FLOAT = "float";
17+
String INT = "int";
18+
String LONG = "long";
19+
String SHORT = "short";
20+
21+
String[] value();
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.PARAMETER})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface Param {
11+
String value() default "";
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.METHOD, ElementType.FIELD})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface SkipParamCheck {
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.swift.sandhook.annotation;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.PARAMETER})
9+
@Retention(RetentionPolicy.RUNTIME)
10+
public @interface ThisObject {
11+
}

Diff for: sandhook-hooklib/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/.cxx

0 commit comments

Comments
 (0)