Update core
This commit is contained in:
parent
074dce99a8
commit
9129b42226
|
|
@ -57,7 +57,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
lint {
|
lint {
|
||||||
isAbortOnError = false
|
abortOnError = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,6 +89,7 @@ androidComponents.onVariants { variant ->
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation(project(":daemon-service"))
|
||||||
implementation(project(":lspcore"))
|
implementation(project(":lspcore"))
|
||||||
implementation(project(":hiddenapi-bridge"))
|
implementation(project(":hiddenapi-bridge"))
|
||||||
compileOnly(project(":hiddenapi-stubs"))
|
compileOnly(project(":hiddenapi-stubs"))
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.lsposed.lspatch.loader;
|
||||||
import static android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE;
|
import static android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE;
|
||||||
import static org.lsposed.lspatch.share.Constants.CONFIG_ASSET_PATH;
|
import static org.lsposed.lspatch.share.Constants.CONFIG_ASSET_PATH;
|
||||||
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APK_ASSET_PATH;
|
import static org.lsposed.lspatch.share.Constants.ORIGINAL_APK_ASSET_PATH;
|
||||||
import static org.lsposed.lspd.service.ConfigFileManager.loadModule;
|
|
||||||
|
|
||||||
import android.app.ActivityThread;
|
import android.app.ActivityThread;
|
||||||
import android.app.LoadedApk;
|
import android.app.LoadedApk;
|
||||||
|
|
@ -25,6 +24,7 @@ import android.util.Log;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import org.lsposed.lspatch.loader.util.FileUtils;
|
import org.lsposed.lspatch.loader.util.FileUtils;
|
||||||
|
import org.lsposed.lspatch.loader.util.ModuleLoader;
|
||||||
import org.lsposed.lspatch.loader.util.XLog;
|
import org.lsposed.lspatch.loader.util.XLog;
|
||||||
import org.lsposed.lspatch.share.Constants;
|
import org.lsposed.lspatch.share.Constants;
|
||||||
import org.lsposed.lspatch.share.PatchConfig;
|
import org.lsposed.lspatch.share.PatchConfig;
|
||||||
|
|
@ -267,7 +267,7 @@ public class LSPApplication extends ApplicationServiceClient {
|
||||||
var module = new Module();
|
var module = new Module();
|
||||||
module.apkPath = cacheApkPath;
|
module.apkPath = cacheApkPath;
|
||||||
module.packageName = packageName;
|
module.packageName = packageName;
|
||||||
module.file = loadModule(cacheApkPath);
|
module.file = ModuleLoader.loadModule(cacheApkPath);
|
||||||
modules.add(module);
|
modules.add(module);
|
||||||
}
|
}
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
package org.lsposed.lspatch.loader.util;
|
||||||
|
|
||||||
|
import android.os.SharedMemory;
|
||||||
|
import android.system.ErrnoException;
|
||||||
|
import android.system.OsConstants;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.lsposed.lspd.models.PreLoadedApk;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.channels.Channels;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
public class ModuleLoader {
|
||||||
|
private static final String TAG = "LSPatch";
|
||||||
|
|
||||||
|
private static void readDexes(ZipFile apkFile, List<SharedMemory> preLoadedDexes) {
|
||||||
|
int secondary = 2;
|
||||||
|
for (var dexFile = apkFile.getEntry("classes.dex"); dexFile != null;
|
||||||
|
dexFile = apkFile.getEntry("classes" + secondary + ".dex"), secondary++) {
|
||||||
|
try (var in = apkFile.getInputStream(dexFile)) {
|
||||||
|
var memory = SharedMemory.create(null, in.available());
|
||||||
|
var byteBuffer = memory.mapReadWrite();
|
||||||
|
Channels.newChannel(in).read(byteBuffer);
|
||||||
|
SharedMemory.unmap(byteBuffer);
|
||||||
|
memory.setProtect(OsConstants.PROT_READ);
|
||||||
|
preLoadedDexes.add(memory);
|
||||||
|
} catch (IOException | ErrnoException e) {
|
||||||
|
Log.w(TAG, "Can not load " + dexFile + " in " + apkFile, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void readName(ZipFile apkFile, String initName, List<String> names) {
|
||||||
|
var initEntry = apkFile.getEntry(initName);
|
||||||
|
if (initEntry == null) return;
|
||||||
|
try (var in = apkFile.getInputStream(initEntry)) {
|
||||||
|
var reader = new BufferedReader(new InputStreamReader(in));
|
||||||
|
String name;
|
||||||
|
while ((name = reader.readLine()) != null) {
|
||||||
|
name = name.trim();
|
||||||
|
if (name.isEmpty() || name.startsWith("#")) continue;
|
||||||
|
names.add(name);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Can not open " + initEntry, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PreLoadedApk loadModule(String path) {
|
||||||
|
if (path == null) return null;
|
||||||
|
var file = new PreLoadedApk();
|
||||||
|
var preLoadedDexes = new ArrayList<SharedMemory>();
|
||||||
|
var moduleClassNames = new ArrayList<String>(1);
|
||||||
|
var moduleLibraryNames = new ArrayList<String>(1);
|
||||||
|
try (var apkFile = new ZipFile(path)) {
|
||||||
|
readDexes(apkFile, preLoadedDexes);
|
||||||
|
readName(apkFile, "assets/xposed_init", moduleClassNames);
|
||||||
|
readName(apkFile, "assets/native_init", moduleLibraryNames);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Can not open " + path, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (preLoadedDexes.isEmpty()) return null;
|
||||||
|
if (moduleClassNames.isEmpty()) return null;
|
||||||
|
file.preLoadedDexes = preLoadedDexes;
|
||||||
|
file.moduleClassNames = moduleClassNames;
|
||||||
|
file.moduleLibraryNames = moduleLibraryNames;
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,12 +5,10 @@ buildscript {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
val agpVersion by extra("7.0.3")
|
val agpVersion by extra("7.1.1")
|
||||||
val navVersion by extra("2.5.0-alpha01")
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("com.android.tools.build:gradle:$agpVersion")
|
classpath("com.android.tools.build:gradle:$agpVersion")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
|
||||||
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$navVersion")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
core
2
core
|
|
@ -1 +1 @@
|
||||||
Subproject commit a06ba931a533198cd906825d436280db8247c869
|
Subproject commit 216a6f00435b4ab00f5fadc80c1c3b1e7ac9b20c
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#Tue Aug 24 21:50:17 CST 2021
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,5 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":lspcore"))
|
api(project(":daemon-service"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":patch"))
|
implementation(project(":patch"))
|
||||||
compileOnly(project(":lspcore"))
|
|
||||||
implementation(project(":imanager"))
|
implementation(project(":imanager"))
|
||||||
|
|
||||||
implementation("androidx.core:core-ktx:1.7.0")
|
implementation("androidx.core:core-ktx:1.7.0")
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
rootProject.name = "LSPatch"
|
rootProject.name = "LSPatch"
|
||||||
|
|
||||||
|
include(":daemon-service")
|
||||||
include(":hiddenapi-bridge")
|
include(":hiddenapi-bridge")
|
||||||
include(":hiddenapi-stubs")
|
include(":hiddenapi-stubs")
|
||||||
include(":interface")
|
include(":interface")
|
||||||
include(":lspapp")
|
|
||||||
include(":lspcore")
|
include(":lspcore")
|
||||||
include(":manager-service")
|
include(":manager-service")
|
||||||
|
|
||||||
|
project(":daemon-service").projectDir = file("core/daemon-service")
|
||||||
project(":hiddenapi-bridge").projectDir = file("core/hiddenapi-bridge")
|
project(":hiddenapi-bridge").projectDir = file("core/hiddenapi-bridge")
|
||||||
project(":hiddenapi-stubs").projectDir = file("core/hiddenapi-stubs")
|
project(":hiddenapi-stubs").projectDir = file("core/hiddenapi-stubs")
|
||||||
project(":interface").projectDir = file("core/service/interface")
|
project(":interface").projectDir = file("core/service/interface")
|
||||||
project(":lspapp").projectDir = file("core/app")
|
|
||||||
project(":lspcore").projectDir = file("core/core")
|
project(":lspcore").projectDir = file("core/core")
|
||||||
project(":manager-service").projectDir = file("core/manager-service")
|
project(":manager-service").projectDir = file("core/manager-service")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue