[core] Remove unused codes
This commit is contained in:
parent
690f2c05f9
commit
96fbd2d045
|
|
@ -18,7 +18,6 @@
|
|||
* Copyright (C) 2021 LSPosed Contributors
|
||||
*/
|
||||
|
||||
import groovy.xml.XmlUtil
|
||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
|
|
@ -133,49 +132,16 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
task cleanTemplate(type: Delete) {
|
||||
delete file(templateSystemx86Path)
|
||||
}
|
||||
|
||||
preBuild.doLast {
|
||||
def imlFile = file(project.name + ".iml")
|
||||
try {
|
||||
def parsedXml = (new XmlParser()).parse(imlFile)
|
||||
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
|
||||
parsedXml.component[1].remove(jdkNode)
|
||||
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
|
||||
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
|
||||
XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
|
||||
} catch (FileNotFoundException ignored) {
|
||||
// nop, iml not found
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
task("copyCommonProperties", type: Copy) {
|
||||
from file("${projectDir}/template_override/")
|
||||
into file(templateRootPath)
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
def variantCapped = variant.name.capitalize()
|
||||
def variantLowered = variant.name.toLowerCase()
|
||||
def zipFileName = "${module_name}-${rootProject.ext.versionName}-${rootProject.ext.versionCode}-${variantLowered}.zip"
|
||||
|
||||
task("copyMainDex${variantCapped}", type: Copy) {
|
||||
def dexOutPath = variant.name.contains("release") ?
|
||||
"${buildDir}/intermediates/dex/${variantLowered}/minify${variantCapped}WithR8" :
|
||||
"${buildDir}/intermediates/dex/${variantLowered}/mergeDex${variantCapped}"
|
||||
from (dexOutPath){
|
||||
rename("classes.dex", "lspd.dex")
|
||||
}
|
||||
destinationDir file(zipPathMagiskReleasePath + "system/framework/")
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
delete file(zipPathMagiskReleasePath)
|
||||
|
||||
def prepareMagiskFilesTask = task("prepareMagiskFiles${variantCapped}", type: Delete) {
|
||||
def prepareMagiskFilesTask = task("prepareMagiskFiles${variantCapped}") {
|
||||
dependsOn "assemble${variantCapped}"
|
||||
dependsOn tasks.getByPath(":key-selector:copyKeySelector${variantCapped}LibraryToMagiskTemplate")
|
||||
doFirst {
|
||||
|
|
@ -195,7 +161,7 @@ afterEvaluate {
|
|||
}
|
||||
}
|
||||
def libPathRelease = "${buildDir}/intermediates/cmake/${variantLowered}/obj"
|
||||
def exclude_list = ["riru.sh"]
|
||||
def exclude_list = ["util_functions.sh"]
|
||||
doLast {
|
||||
def dexOutPath = variant.name.contains("release") ?
|
||||
"${buildDir}/intermediates/dex/${variantLowered}/minify${variantCapped}WithR8" :
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This file is part of LSPosed.
|
||||
*
|
||||
* LSPosed is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LSPosed is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) 2020 EdXposed Contributors
|
||||
* Copyright (C) 2021 LSPosed Contributors
|
||||
*/
|
||||
|
||||
package io.github.lsposed.lspd.sandhook.hooker;
|
||||
|
||||
import android.app.ActivityThread;
|
||||
import android.app.LoadedApk;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.res.CompatibilityInfo;
|
||||
|
||||
import io.github.lsposed.common.KeepMembers;
|
||||
import io.github.lsposed.lspd.hooker.LoadedApkCstrHooker;
|
||||
import com.swift.sandhook.SandHook;
|
||||
import com.swift.sandhook.annotation.HookClass;
|
||||
import com.swift.sandhook.annotation.HookMethod;
|
||||
import com.swift.sandhook.annotation.HookMethodBackup;
|
||||
import com.swift.sandhook.annotation.SkipParamCheck;
|
||||
import com.swift.sandhook.annotation.ThisObject;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.annotation.ApiSensitive;
|
||||
import de.robv.android.xposed.annotation.Level;
|
||||
|
||||
@ApiSensitive(Level.LOW)
|
||||
@HookClass(LoadedApk.class)
|
||||
public class LoadedApkConstructorHooker implements KeepMembers {
|
||||
public static String className = "android.app.LoadedApk";
|
||||
public static String methodName = "<init>";
|
||||
public static String methodSig = "(Landroid/app/ActivityThread;" +
|
||||
"Landroid/content/pm/ApplicationInfo;" +
|
||||
"Landroid/content/res/CompatibilityInfo;" +
|
||||
"Ljava/lang/ClassLoader;ZZZ)V";
|
||||
|
||||
@HookMethodBackup
|
||||
@SkipParamCheck
|
||||
static Method backup;
|
||||
|
||||
@HookMethod
|
||||
public static void hook(@ThisObject Object thiz, ActivityThread activityThread,
|
||||
ApplicationInfo aInfo, CompatibilityInfo compatInfo,
|
||||
ClassLoader baseLoader, boolean securityViolation,
|
||||
boolean includeCode, boolean registerPackage) throws Throwable {
|
||||
final XC_MethodHook methodHook = new LoadedApkCstrHooker();
|
||||
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
|
||||
param.thisObject = thiz;
|
||||
param.args = new Object[]{activityThread, aInfo, compatInfo, baseLoader, securityViolation,
|
||||
includeCode, registerPackage};
|
||||
methodHook.callBeforeHookedMethod(param);
|
||||
if (!param.returnEarly) {
|
||||
backup(thiz, activityThread, aInfo, compatInfo, baseLoader, securityViolation,
|
||||
includeCode, registerPackage);
|
||||
}
|
||||
methodHook.callAfterHookedMethod(param);
|
||||
}
|
||||
|
||||
public static void backup(Object thiz, ActivityThread activityThread,
|
||||
ApplicationInfo aInfo, CompatibilityInfo compatInfo,
|
||||
ClassLoader baseLoader, boolean securityViolation,
|
||||
boolean includeCode, boolean registerPackage) throws Throwable {
|
||||
SandHook.callOriginByBackup(backup, thiz, activityThread, aInfo, compatInfo, baseLoader, securityViolation, includeCode, registerPackage);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* This file is part of LSPosed.
|
||||
*
|
||||
* LSPosed is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LSPosed is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) 2020 EdXposed Contributors
|
||||
* Copyright (C) 2021 LSPosed Contributors
|
||||
*/
|
||||
|
||||
package io.github.lsposed.lspd.sandhook.hooker;
|
||||
|
||||
import io.github.lsposed.common.KeepMembers;
|
||||
|
||||
import com.swift.sandhook.SandHook;
|
||||
import com.swift.sandhook.annotation.HookMethod;
|
||||
import com.swift.sandhook.annotation.HookMethodBackup;
|
||||
import com.swift.sandhook.annotation.HookReflectClass;
|
||||
import com.swift.sandhook.annotation.SkipParamCheck;
|
||||
import com.swift.sandhook.annotation.ThisObject;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
|
||||
@HookReflectClass("com.android.server.SystemServer")
|
||||
public class StartBootstrapServicesHooker implements KeepMembers {
|
||||
public static String className = "com.android.server.SystemServer";
|
||||
public static String methodName = "startBootstrapServices";
|
||||
public static String methodSig = "()V";
|
||||
|
||||
@HookMethodBackup("startBootstrapServices")
|
||||
@SkipParamCheck
|
||||
static Method backup;
|
||||
|
||||
@HookMethod("startBootstrapServices")
|
||||
public static void hook(@ThisObject Object systemServer) throws Throwable {
|
||||
final XC_MethodHook methodHook = new io.github.lsposed.lspd.hooker.StartBootstrapServicesHooker();
|
||||
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
|
||||
param.thisObject = systemServer;
|
||||
param.args = new Object[]{};
|
||||
methodHook.callBeforeHookedMethod(param);
|
||||
if (!param.returnEarly) {
|
||||
backup(systemServer);
|
||||
}
|
||||
methodHook.callAfterHookedMethod(param);
|
||||
}
|
||||
|
||||
public static void backup(Object systemServer) throws Throwable {
|
||||
SandHook.callOriginByBackup(backup, systemServer);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* This file is part of LSPosed.
|
||||
*
|
||||
* LSPosed is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LSPosed is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) 2020 EdXposed Contributors
|
||||
* Copyright (C) 2021 LSPosed Contributors
|
||||
*/
|
||||
|
||||
package io.github.lsposed.lspd.sandhook.hooker;
|
||||
|
||||
import io.github.lsposed.common.KeepMembers;
|
||||
import io.github.lsposed.lspd.hooker.StartBootstrapServicesHooker;
|
||||
import com.swift.sandhook.SandHook;
|
||||
import com.swift.sandhook.annotation.HookMethod;
|
||||
import com.swift.sandhook.annotation.HookMethodBackup;
|
||||
import com.swift.sandhook.annotation.HookReflectClass;
|
||||
import com.swift.sandhook.annotation.Param;
|
||||
import com.swift.sandhook.annotation.SkipParamCheck;
|
||||
import com.swift.sandhook.annotation.ThisObject;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.annotation.ApiSensitive;
|
||||
import de.robv.android.xposed.annotation.Level;
|
||||
|
||||
@ApiSensitive(Level.LOW)
|
||||
@HookReflectClass("com.android.server.SystemServer")
|
||||
public class StartBootstrapServicesHooker11 implements KeepMembers {
|
||||
public static String className = "com.android.server.SystemServer";
|
||||
public static String methodName = "startBootstrapServices";
|
||||
public static String methodSig = "(Lcom/android/server/utils/TimingsTraceAndSlog;)V";
|
||||
|
||||
@HookMethodBackup("startBootstrapServices")
|
||||
@SkipParamCheck
|
||||
static Method backup;
|
||||
|
||||
@HookMethod("startBootstrapServices")
|
||||
public static void hook(@ThisObject Object systemServer, @Param("com.android.server.utils.TimingsTraceAndSlog") Object traceAndSlog) throws Throwable {
|
||||
final XC_MethodHook methodHook = new StartBootstrapServicesHooker();
|
||||
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
|
||||
param.thisObject = systemServer;
|
||||
param.args = new Object[]{traceAndSlog};
|
||||
methodHook.callBeforeHookedMethod(param);
|
||||
if (!param.returnEarly) {
|
||||
backup(systemServer, traceAndSlog);
|
||||
}
|
||||
methodHook.callAfterHookedMethod(param);
|
||||
}
|
||||
|
||||
public static void backup(Object systemServer, Object traceAndSlog) throws Throwable {
|
||||
SandHook.callOriginByBackup(backup, systemServer, traceAndSlog);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* This file is part of LSPosed.
|
||||
*
|
||||
* LSPosed is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LSPosed is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) 2020 EdXposed Contributors
|
||||
* Copyright (C) 2021 LSPosed Contributors
|
||||
*/
|
||||
|
||||
package io.github.lsposed.lspd.sandhook.hooker;
|
||||
|
||||
import android.app.ActivityThread;
|
||||
|
||||
import io.github.lsposed.common.KeepMembers;
|
||||
|
||||
import com.swift.sandhook.SandHook;
|
||||
import com.swift.sandhook.annotation.HookClass;
|
||||
import com.swift.sandhook.annotation.HookMethod;
|
||||
import com.swift.sandhook.annotation.HookMethodBackup;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import de.robv.android.xposed.XC_MethodHook;
|
||||
import de.robv.android.xposed.annotation.ApiSensitive;
|
||||
import de.robv.android.xposed.annotation.Level;
|
||||
|
||||
|
||||
@ApiSensitive(Level.LOW)
|
||||
// system_server initialization
|
||||
// ed: only support sdk >= 21 for now
|
||||
@HookClass(ActivityThread.class)
|
||||
public class SystemMainHooker implements KeepMembers {
|
||||
|
||||
public static String className = "android.app.ActivityThread";
|
||||
public static String methodName = "systemMain";
|
||||
public static String methodSig = "()Landroid/app/ActivityThread;";
|
||||
|
||||
public static ClassLoader systemServerCL;
|
||||
|
||||
@HookMethodBackup("systemMain")
|
||||
static Method backup;
|
||||
|
||||
@HookMethod("systemMain")
|
||||
public static ActivityThread hook() throws Throwable {
|
||||
final XC_MethodHook methodHook = new io.github.lsposed.lspd.hooker.SystemMainHooker();
|
||||
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
|
||||
param.thisObject = null;
|
||||
param.args = new Object[]{};
|
||||
methodHook.callBeforeHookedMethod(param);
|
||||
if (!param.returnEarly) {
|
||||
param.setResult(backup());
|
||||
}
|
||||
methodHook.callAfterHookedMethod(param);
|
||||
return (ActivityThread) param.getResult();
|
||||
}
|
||||
|
||||
public static ActivityThread backup() throws Throwable {
|
||||
return (ActivityThread) SandHook.callOriginByBackup(backup, null);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue