mirror of
https://github.com/topjohnwu/libsu.git
synced 2024-11-23 03:59:43 +00:00
Update AGP
This commit is contained in:
parent
d4d755a984
commit
697db8d8ce
@ -1,4 +1,5 @@
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import com.android.build.gradle.LibraryExtension
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.net.URL
|
||||
|
||||
@ -15,7 +16,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:7.4.2")
|
||||
classpath("com.android.tools.build:gradle:8.0.1")
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
@ -78,6 +79,9 @@ publishing {
|
||||
fun Project.android(configuration: BaseExtension.() -> Unit) =
|
||||
extensions.getByName<BaseExtension>("android").configuration()
|
||||
|
||||
fun Project.androidLibrary(configuration: LibraryExtension.() -> Unit) =
|
||||
extensions.getByName<LibraryExtension>("android").configuration()
|
||||
|
||||
subprojects {
|
||||
buildscript {
|
||||
repositories {
|
||||
@ -96,7 +100,7 @@ subprojects {
|
||||
afterEvaluate {
|
||||
android {
|
||||
compileSdkVersion(33)
|
||||
buildToolsVersion = "33.0.1"
|
||||
buildToolsVersion = "33.0.2"
|
||||
|
||||
defaultConfig {
|
||||
if (minSdkVersion == null)
|
||||
@ -113,8 +117,8 @@ subprojects {
|
||||
if (plugins.hasPlugin("com.android.library")) {
|
||||
apply(plugin = "maven-publish")
|
||||
|
||||
android {
|
||||
buildFeatures.apply {
|
||||
androidLibrary {
|
||||
buildFeatures {
|
||||
buildConfig = false
|
||||
}
|
||||
|
||||
@ -126,19 +130,20 @@ subprojects {
|
||||
classpath += configurations.getByName("javadocDeps")
|
||||
}
|
||||
|
||||
val sourcesJar = tasks.register("sourcesJar", Jar::class) {
|
||||
archiveClassifier.set("sources")
|
||||
from(sources)
|
||||
publishing {
|
||||
singleVariant("release") {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
register<MavenPublication>("maven") {
|
||||
from(components["release"])
|
||||
groupId = "com.github.topjohnwu"
|
||||
artifactId = project.name
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,9 @@ android {
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
viewBinding = true
|
||||
aidl = true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -1,2 +1,2 @@
|
||||
jdk:
|
||||
- openjdk11
|
||||
- openjdk17
|
||||
|
@ -9,6 +9,9 @@ android {
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
}
|
||||
buildFeatures {
|
||||
aidl = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import com.android.tools.r8.R8
|
||||
import java.io.PrintStream
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import com.android.tools.r8.R8
|
||||
import java.util.stream.Collectors
|
||||
|
||||
plugins {
|
||||
@ -12,6 +12,9 @@ group="com.github.topjohnwu.libsu"
|
||||
|
||||
android {
|
||||
namespace = "com.topjohnwu.superuser.ipc"
|
||||
buildFeatures {
|
||||
aidl = true
|
||||
}
|
||||
}
|
||||
|
||||
android.libraryVariants.all {
|
||||
|
Binary file not shown.
@ -181,10 +181,12 @@ class RootServerMain extends ContextWrapper implements Callable<Object[]> {
|
||||
int userId = uid / 100000; // UserHandler.getUserId
|
||||
int flags = Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY;
|
||||
try {
|
||||
UserHandle userHandle = (UserHandle) UserHandle.class.getDeclaredMethod("of", int.class).invoke(null, userId);
|
||||
Method createPackageContextAsUser = systemContext.getClass().getDeclaredMethod("createPackageContextAsUser",
|
||||
String.class, int.class, UserHandle.class);
|
||||
context = (Context) createPackageContextAsUser.invoke(systemContext, name.getPackageName(), flags, userHandle);
|
||||
UserHandle userHandle = (UserHandle) UserHandle.class
|
||||
.getDeclaredMethod("of", int.class).invoke(null, userId);
|
||||
context = (Context) systemContext.getClass()
|
||||
.getDeclaredMethod("createPackageContextAsUser",
|
||||
String.class, int.class, UserHandle.class)
|
||||
.invoke(systemContext, name.getPackageName(), flags, userHandle);
|
||||
} catch (Throwable e) {
|
||||
Log.w("IPC", "Failed to create package context as user: " + userId, e);
|
||||
context = systemContext.createPackageContext(name.getPackageName(), flags);
|
||||
|
Loading…
Reference in New Issue
Block a user