Android 12 (#814)

This commit is contained in:
vvb2060 2021-07-15 11:46:33 +08:00 committed by GitHub
parent 521786f6af
commit 1937365b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 35 deletions

View File

@ -11,7 +11,7 @@ A Riru module trying to provide an ART hooking framework (initially for Android
## Supported Versions
Android 8.1 ~ 12 Beta 2
Android 8.1 ~ 12 Beta 3
## Install

View File

@ -45,7 +45,7 @@ idea {
val androidTargetSdkVersion: Int by rootProject.extra
val androidMinSdkVersion: Int by rootProject.extra
val androidBuildToolsVersion: String by rootProject.extra
val androidCompileSdkVersion: String by rootProject.extra
val androidCompileSdkVersion: Int by rootProject.extra
val androidCompileNdkVersion: String by rootProject.extra
val androidSourceCompatibility: JavaVersion by rootProject.extra
val androidTargetCompatibility: JavaVersion by rootProject.extra
@ -59,7 +59,7 @@ val androidKeyAlias: String? by rootProject
val androidKeyPassword: String? by rootProject
android {
compileSdkPreview = androidCompileSdkVersion
compileSdk = androidCompileSdkVersion
ndkVersion = androidCompileNdkVersion
buildToolsVersion = androidBuildToolsVersion

View File

@ -38,23 +38,15 @@ val commitCount = Git(repo).log().add(refId).call().count()
val defaultManagerPackageName by extra("org.lsposed.manager")
val verCode by extra(commitCount + 4200)
val verName by extra("v1.4.7")
val androidTargetSdkVersion by extra(30)
val androidTargetSdkVersion by extra(31)
val androidMinSdkVersion by extra(27)
val androidBuildToolsVersion by extra("30.0.3")
val androidCompileSdkVersion by extra("android-S")
val androidBuildToolsVersion by extra("31.0.0")
val androidCompileSdkVersion by extra(31)
val androidCompileNdkVersion by extra("22.1.7171670")
val androidSourceCompatibility by extra(JavaVersion.VERSION_11)
val androidTargetCompatibility by extra(JavaVersion.VERSION_11)
val apiCode by extra(93)
allprojects {
repositories {
google()
mavenCentral()
maven("https://jcenter.bintray.com")
}
}
tasks.register("Delete", Delete::class) {
delete(rootProject.buildDir)
}

View File

@ -21,10 +21,10 @@ import com.android.build.api.component.analytics.AnalyticsEnabledApplicationVari
import com.android.build.api.variant.impl.ApplicationVariantImpl
import com.android.build.gradle.BaseExtension
import com.android.ide.common.signing.KeystoreHelper
import org.apache.commons.codec.binary.Hex
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.daemon.common.toHexString
import java.io.PrintStream
import java.security.MessageDigest
@ -48,7 +48,7 @@ val apiCode: Int by rootProject.extra
val androidTargetSdkVersion: Int by rootProject.extra
val androidMinSdkVersion: Int by rootProject.extra
val androidBuildToolsVersion: String by rootProject.extra
val androidCompileSdkVersion: String by rootProject.extra
val androidCompileSdkVersion: Int by rootProject.extra
val androidCompileNdkVersion: String by rootProject.extra
val androidSourceCompatibility: JavaVersion by rootProject.extra
val androidTargetCompatibility: JavaVersion by rootProject.extra
@ -71,7 +71,7 @@ dependencies {
}
android {
compileSdkPreview = androidCompileSdkVersion
compileSdk = androidCompileSdkVersion
ndkVersion = androidCompileNdkVersion
buildToolsVersion = androidBuildToolsVersion
@ -215,7 +215,7 @@ androidComponents.onVariants { v ->
file.forEachBlock(4096) { bytes, size ->
md.update(bytes, 0, size)
}
file(file.path + ".sha256").writeText(md.digest().toHexString())
file(file.path + ".sha256").writeText(Hex.encodeHexString(md.digest()))
}
}
}

View File

@ -3,4 +3,4 @@ name=Riru - LSPosed
version=${versionName} (${versionCode})
versionCode=${versionCode}
author=${authorList}
description=Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 12 Beta 2. Requires Riru ${minRiruVersionName} or above installed.
description=Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 12 Beta 3. Requires Riru ${minRiruVersionName} or above installed.

View File

@ -46,7 +46,7 @@ import android.util.Log;
import org.lsposed.lspd.nativebridge.NativeAPI;
import org.lsposed.lspd.nativebridge.ResourcesHook;
import org.lsposed.lspd.util.InMemoryDelegateLastClassLoader;
import org.lsposed.lspd.util.LspModuleClassLoader;
import java.io.BufferedReader;
import java.io.File;
@ -60,7 +60,6 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import dalvik.system.DelegateLastClassLoader;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
import de.robv.android.xposed.callbacks.XC_InitZygote;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
@ -374,7 +373,7 @@ public final class XposedInit {
librarySearchPath.append(apk).append("!/lib/").append(abi).append(File.pathSeparator);
}
ClassLoader initLoader = XposedInit.class.getClassLoader();
ClassLoader mcl = InMemoryDelegateLastClassLoader.loadApk(new File(apk), librarySearchPath.toString(), initLoader);
ClassLoader mcl = LspModuleClassLoader.loadApk(new File(apk), librarySearchPath.toString(), initLoader);
try {
if (mcl.loadClass(XposedBridge.class.getName()).getClassLoader() != initLoader) {

View File

@ -28,7 +28,7 @@ import java.util.zip.ZipFile;
import hidden.ByteBufferDexClassLoader;
@SuppressWarnings("ConstantConditions")
public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoader {
public final class LspModuleClassLoader extends ByteBufferDexClassLoader {
private static final String zipSeparator = "!/";
private final String apk;
private final List<File> nativeLibraryDirs = new ArrayList<>();
@ -42,7 +42,7 @@ public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoa
return result;
}
private InMemoryDelegateLastClassLoader(ByteBuffer[] dexBuffers,
private LspModuleClassLoader(ByteBuffer[] dexBuffers,
ClassLoader parent,
String apk) {
super(dexBuffers, parent);
@ -50,7 +50,7 @@ public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoa
}
@RequiresApi(Build.VERSION_CODES.Q)
private InMemoryDelegateLastClassLoader(ByteBuffer[] dexBuffers,
private LspModuleClassLoader(ByteBuffer[] dexBuffers,
String librarySearchPath,
ClassLoader parent,
String apk) {
@ -175,7 +175,7 @@ public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoa
super.toString() + "]";
}
public static InMemoryDelegateLastClassLoader loadApk(File apk,
public static LspModuleClassLoader loadApk(File apk,
String librarySearchPath,
ClassLoader parent) {
var byteBuffers = new ArrayList<ByteBuffer>();
@ -198,10 +198,10 @@ public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoa
}
var dexBuffers = new ByteBuffer[byteBuffers.size()];
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return new InMemoryDelegateLastClassLoader(byteBuffers.toArray(dexBuffers),
return new LspModuleClassLoader(byteBuffers.toArray(dexBuffers),
librarySearchPath, parent, apk.getAbsolutePath());
} else {
var cl = new InMemoryDelegateLastClassLoader(byteBuffers.toArray(dexBuffers),
var cl = new LspModuleClassLoader(byteBuffers.toArray(dexBuffers),
parent, apk.getAbsolutePath());
cl.initNativeLibraryDirs(librarySearchPath);
return cl;

View File

@ -1,3 +1,12 @@
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jcenter.bintray.com")
}
}
rootProject.name = "LSPosed"
include(
":core",