Ndk build (#753)
* Update dependencies * Use prefab dobby * NDK build * Add ccache * Fix library copy * rm CMakeLists.txt
This commit is contained in:
parent
2b593be1d5
commit
74f93dbd7a
|
|
@ -8,3 +8,5 @@
|
||||||
# Denote all files that are truly binary and should not be modified.
|
# Denote all files that are truly binary and should not be modified.
|
||||||
*.so binary
|
*.so binary
|
||||||
*.dex binary
|
*.dex binary
|
||||||
|
*.jar binary
|
||||||
|
*.png binary
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ jobs:
|
||||||
key: gradle-builds-core-${{ github.sha }}
|
key: gradle-builds-core-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
gradle-builds
|
gradle-builds
|
||||||
- name: Cache Cmake
|
- name: Cache Ccache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.ccache
|
path: ~/.ccache
|
||||||
|
|
@ -64,6 +64,8 @@ jobs:
|
||||||
ccache -o max_size=2G
|
ccache -o max_size=2G
|
||||||
ccache -o hash_dir=false
|
ccache -o hash_dir=false
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
|
env:
|
||||||
|
NDK_CCACHE: ccache
|
||||||
run: |
|
run: |
|
||||||
[ $(du -s ~/.gradle/wrapper | awk '{ print $1 }') -gt 250000 ] && rm -rf ~/.gradle/wrapper/* || true
|
[ $(du -s ~/.gradle/wrapper | awk '{ print $1 }') -gt 250000 ] && rm -rf ~/.gradle/wrapper/* || true
|
||||||
find ~/.gradle/caches -exec touch -d "2 days ago" {} + || true
|
find ~/.gradle/caches -exec touch -d "2 days ago" {} + || true
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,3 @@
|
||||||
[submodule "core/src/main/cpp/external/DexBuilder"]
|
[submodule "core/src/main/cpp/external/DexBuilder"]
|
||||||
path = core/src/main/cpp/external/DexBuilder
|
path = core/src/main/cpp/external/DexBuilder
|
||||||
url = https://github.com/LSPosed/DexBuilder.git
|
url = https://github.com/LSPosed/DexBuilder.git
|
||||||
[submodule "core/src/main/cpp/external/Dobby"]
|
|
||||||
path = core/src/main/cpp/external/Dobby
|
|
||||||
url = https://github.com/LSPosed/Dobby.git
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ plugins {
|
||||||
id("org.gradle.idea")
|
id("org.gradle.idea")
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("androidx.navigation.safeargs")
|
id("androidx.navigation.safeargs")
|
||||||
kotlin("android")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// workaround for AS.
|
// workaround for AS.
|
||||||
|
|
@ -210,7 +209,7 @@ dependencies {
|
||||||
implementation("androidx.fragment:fragment:1.3.4")
|
implementation("androidx.fragment:fragment:1.3.4")
|
||||||
implementation("androidx.navigation:navigation-fragment:$navVersion")
|
implementation("androidx.navigation:navigation-fragment:$navVersion")
|
||||||
implementation("androidx.navigation:navigation-ui:$navVersion")
|
implementation("androidx.navigation:navigation-ui:$navVersion")
|
||||||
implementation("androidx.recyclerview:recyclerview:1.2.0")
|
implementation("androidx.recyclerview:recyclerview:1.2.1")
|
||||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||||
implementation("com.caverock:androidsvg-aar:1.4")
|
implementation("com.caverock:androidsvg-aar:1.4")
|
||||||
implementation("com.github.bumptech.glide:glide:$glideVersion")
|
implementation("com.github.bumptech.glide:glide:$glideVersion")
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ buildscript {
|
||||||
classpath("com.android.tools.build:gradle:7.0.0-beta04")
|
classpath("com.android.tools.build:gradle:7.0.0-beta04")
|
||||||
classpath("org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r")
|
classpath("org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r")
|
||||||
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5")
|
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5")
|
||||||
classpath(kotlin("gradle-plugin", version = "1.4.32"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
/release
|
/release
|
||||||
*.iml
|
*.iml
|
||||||
/.cxx
|
/.cxx
|
||||||
|
src/main/cpp/main/src/config.cpp
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
* Copyright (C) 2021 LSPosed Contributors
|
* Copyright (C) 2021 LSPosed Contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.android.build.api.variant.impl.ApplicationVariantImpl
|
|
||||||
import com.android.build.api.component.analytics.AnalyticsEnabledApplicationVariant
|
import com.android.build.api.component.analytics.AnalyticsEnabledApplicationVariant
|
||||||
|
import com.android.build.api.variant.impl.ApplicationVariantImpl
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import com.android.ide.common.signing.KeystoreHelper
|
import com.android.ide.common.signing.KeystoreHelper
|
||||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||||
|
|
@ -29,7 +29,6 @@ import java.security.MessageDigest
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
kotlin("android")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val moduleName = "LSPosed"
|
val moduleName = "LSPosed"
|
||||||
|
|
@ -59,6 +58,7 @@ val verName: String by rootProject.extra
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("dev.rikka.ndk:riru:${moduleMinRiruVersionName}")
|
implementation("dev.rikka.ndk:riru:${moduleMinRiruVersionName}")
|
||||||
implementation("dev.rikka.ndk.thirdparty:cxx:1.1.0")
|
implementation("dev.rikka.ndk.thirdparty:cxx:1.1.0")
|
||||||
|
implementation("io.github.vvb2060.ndk:dobby:1.0")
|
||||||
implementation("com.android.tools.build:apksig:7.0.0-beta03")
|
implementation("com.android.tools.build:apksig:7.0.0-beta03")
|
||||||
implementation("org.apache.commons:commons-lang3:3.12.0")
|
implementation("org.apache.commons:commons-lang3:3.12.0")
|
||||||
implementation("de.upb.cs.swt:axml:2.1.1")
|
implementation("de.upb.cs.swt:axml:2.1.1")
|
||||||
|
|
@ -87,29 +87,9 @@ android {
|
||||||
multiDexEnabled = false
|
multiDexEnabled = false
|
||||||
|
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
ndkBuild {
|
||||||
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
|
arguments += "RIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion"
|
||||||
val flags = arrayOf(
|
arguments += "MODULE_NAME=$riruModuleId"
|
||||||
"-ffixed-x18",
|
|
||||||
"-Qunused-arguments",
|
|
||||||
"-fno-rtti", "-fno-exceptions",
|
|
||||||
"-fno-stack-protector",
|
|
||||||
"-fomit-frame-pointer",
|
|
||||||
"-Wno-builtin-macro-redefined",
|
|
||||||
"-Wl,--exclude-libs,ALL",
|
|
||||||
"-D__FILE__=__FILE_NAME__",
|
|
||||||
"-DRIRU_MODULE",
|
|
||||||
"-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion",
|
|
||||||
"""-DMODULE_NAME=\"$riruModuleId\"""",
|
|
||||||
)
|
|
||||||
cppFlags("-std=c++20", *flags)
|
|
||||||
cFlags("-std=c18", *flags)
|
|
||||||
arguments(
|
|
||||||
"-DANDROID_STL=none",
|
|
||||||
"-DVERSION_CODE=$verCode",
|
|
||||||
"-DVERSION_NAME=$verName",
|
|
||||||
)
|
|
||||||
targets("lspd")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,56 +103,14 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
|
||||||
externalNativeBuild {
|
|
||||||
cmake {
|
|
||||||
arguments.addAll(
|
|
||||||
arrayOf(
|
|
||||||
"-DCMAKE_CXX_FLAGS_DEBUG=-Og",
|
|
||||||
"-DCMAKE_C_FLAGS_DEBUG=-Og"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
proguardFiles("proguard-rules.pro")
|
proguardFiles("proguard-rules.pro")
|
||||||
|
|
||||||
externalNativeBuild {
|
|
||||||
cmake {
|
|
||||||
val flags = arrayOf(
|
|
||||||
"-fvisibility=hidden",
|
|
||||||
"-fvisibility-inlines-hidden",
|
|
||||||
"-Wno-unused-value",
|
|
||||||
"-ffunction-sections",
|
|
||||||
"-fdata-sections",
|
|
||||||
"-Wl,--gc-sections",
|
|
||||||
"-Wl,--strip-all",
|
|
||||||
"-fno-unwind-tables",
|
|
||||||
"-fno-asynchronous-unwind-tables"
|
|
||||||
)
|
|
||||||
cppFlags.addAll(flags)
|
|
||||||
cFlags.addAll(flags)
|
|
||||||
val configFlags = arrayOf(
|
|
||||||
"-Oz",
|
|
||||||
"-DNDEBUG"
|
|
||||||
).joinToString(" ")
|
|
||||||
arguments.addAll(
|
|
||||||
arrayOf(
|
|
||||||
"-DCMAKE_CXX_FLAGS_RELEASE=$configFlags",
|
|
||||||
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$configFlags",
|
|
||||||
"-DCMAKE_C_FLAGS_RELEASE=$configFlags",
|
|
||||||
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=$configFlags"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
ndkBuild {
|
||||||
path("src/main/cpp/CMakeLists.txt")
|
path("src/main/cpp/Android.mk")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,8 +216,7 @@ androidComponents.onVariants { v ->
|
||||||
rename(".*\\.apk", "manager.apk")
|
rename(".*\\.apk", "manager.apk")
|
||||||
}
|
}
|
||||||
into("lib") {
|
into("lib") {
|
||||||
from("${buildDir}/intermediates/cmake/$variantLowered/obj")
|
from("${buildDir}/intermediates/stripped_native_libs/$variantLowered/out/lib")
|
||||||
exclude("**/*.txt")
|
|
||||||
}
|
}
|
||||||
val dexOutPath = if (variantLowered == "release")
|
val dexOutPath = if (variantLowered == "release")
|
||||||
"$buildDir/intermediates/dex/$variantLowered/minify${variantCapped}WithR8" else
|
"$buildDir/intermediates/dex/$variantLowered/minify${variantCapped}WithR8" else
|
||||||
|
|
@ -342,3 +279,13 @@ androidComponents.onVariants { v ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val generateVersion = task("generateVersion", Copy::class) {
|
||||||
|
inputs.property("VERSION_CODE", verCode)
|
||||||
|
inputs.property("VERSION_NAME", verName)
|
||||||
|
from("${projectDir}/src/main/cpp/main/template")
|
||||||
|
include("config.cpp")
|
||||||
|
expand("VERSION_CODE" to verCode, "VERSION_NAME" to verName)
|
||||||
|
into("${projectDir}/src/main/cpp/main/src")
|
||||||
|
}
|
||||||
|
tasks.getByName("preBuild").dependsOn(generateVersion)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
include src/main/cpp/external/DexBuilder/Android.mk
|
||||||
|
include src/main/cpp/external/yahfa/Android.mk
|
||||||
|
include src/main/cpp/main/Android.mk
|
||||||
|
|
||||||
|
$(call import-module,prefab/cxx)
|
||||||
|
$(call import-module,prefab/riru)
|
||||||
|
$(call import-module,prefab/dobby)
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
APP_CFLAGS := -Wall -Wextra
|
||||||
|
APP_CFLAGS += -fno-stack-protector -fomit-frame-pointer
|
||||||
|
APP_CFLAGS += -Wno-builtin-macro-redefined -D__FILE__=__FILE_NAME__
|
||||||
|
APP_CPPFLAGS := -std=c++20
|
||||||
|
APP_CONLYFLAGS := -std=c18
|
||||||
|
APP_LDFLAGS := -Wl,--exclude-libs,ALL
|
||||||
|
APP_STL := none
|
||||||
|
|
||||||
|
ifneq ($(NDK_DEBUG),1)
|
||||||
|
APP_CFLAGS += -Oz -Wno-unused -Wno-unused-parameter -Werror
|
||||||
|
APP_CFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
|
APP_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
APP_LDFLAGS += -Wl,--gc-sections -Wl,--strip-all
|
||||||
|
endif
|
||||||
|
|
@ -1,35 +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
|
|
||||||
##
|
|
||||||
|
|
||||||
project(libcxx)
|
|
||||||
cmake_minimum_required(VERSION 3.4.1)
|
|
||||||
|
|
||||||
find_program(CCACHE ccache)
|
|
||||||
|
|
||||||
if (CCACHE)
|
|
||||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
|
|
||||||
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
find_package(cxx REQUIRED CONFIG)
|
|
||||||
link_libraries(cxx::cxx)
|
|
||||||
|
|
||||||
add_subdirectory(main)
|
|
||||||
add_subdirectory(external)
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.4.1)
|
|
||||||
|
|
||||||
add_subdirectory(yahfa)
|
|
||||||
|
|
||||||
add_subdirectory(DexBuilder)
|
|
||||||
target_include_directories(dex_builder PUBLIC DexBuilder)
|
|
||||||
|
|
||||||
macro(SET_OPTION option value)
|
|
||||||
set(${option} ${value} CACHE INTERNAL "" FORCE)
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
SET_OPTION(DOBBY_GENERATE_SHARED OFF)
|
|
||||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
SET_OPTION(DOBBY_DEBUG OFF)
|
|
||||||
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
add_subdirectory(Dobby)
|
|
||||||
target_include_directories(dobby PUBLIC Dobby/include)
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 41b9171852840cb421d8be22ef73d9467db02799
|
Subproject commit 9141e5aed87360fa6926ad05a8ac1511fc6bcbe6
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 2da2c218b0ae824b3a0e5ef1474223636f7f32a9
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := yahfa
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||||
|
LOCAL_SRC_FILES := src/HookMain.cpp src/trampoline.c
|
||||||
|
LOCAL_EXPORT_LDLIBS := -llog
|
||||||
|
LOCAL_STATIC_LIBRARIES := libcxx
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
define walk
|
||||||
|
$(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e)))
|
||||||
|
endef
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := lspd
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/src
|
||||||
|
FILE_LIST := $(filter %.cpp, $(call walk, $(LOCAL_PATH)/src))
|
||||||
|
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
|
||||||
|
LOCAL_STATIC_LIBRARIES := cxx yahfa riru dobby dex_builder
|
||||||
|
LOCAL_CFLAGS := -DRIRU_MODULE -DRIRU_MODULE_API_VERSION=${RIRU_MODULE_API_VERSION}
|
||||||
|
LOCAL_CFLAGS += -DMODULE_NAME=${MODULE_NAME}
|
||||||
|
LOCAL_LDLIBS := -llog
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
@ -1,36 +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
|
|
||||||
##
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.4.1)
|
|
||||||
|
|
||||||
configure_file(template/config.cpp src/config.cpp)
|
|
||||||
|
|
||||||
aux_source_directory(src SRC_LIST)
|
|
||||||
aux_source_directory(src/jni SRC_JNI_LIST)
|
|
||||||
include_directories(include src)
|
|
||||||
|
|
||||||
add_library(lspd SHARED ${SRC_LIST} ${SRC_JNI_LIST} ${CMAKE_CURRENT_BINARY_DIR}/src/config.cpp)
|
|
||||||
|
|
||||||
find_package(riru REQUIRED CONFIG)
|
|
||||||
find_library(log-lib log)
|
|
||||||
target_link_libraries(lspd yahfa riru::riru android dobby dex_builder ${log-lib})
|
|
||||||
|
|
||||||
add_custom_command(TARGET lspd POST_BUILD
|
|
||||||
COMMAND ${CMAKE_STRIP} --remove-section=.comment -g "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/liblspd.so")
|
|
||||||
|
|
@ -170,7 +170,7 @@ ElfW(Addr) ElfImg::LinearLookup(std::string_view name) const {
|
||||||
if (symtabs_.empty()) {
|
if (symtabs_.empty()) {
|
||||||
symtabs_.reserve(symtab_count);
|
symtabs_.reserve(symtab_count);
|
||||||
if (symtab_start != nullptr && symstr_offset_for_symtab != 0) {
|
if (symtab_start != nullptr && symstr_offset_for_symtab != 0) {
|
||||||
for (int i = 0; i < symtab_count; i++) {
|
for (ElfW(Off) i = 0; i < symtab_count; i++) {
|
||||||
unsigned int st_type = ELF_ST_TYPE(symtab_start[i].st_info);
|
unsigned int st_type = ELF_ST_TYPE(symtab_start[i].st_info);
|
||||||
const char *st_name = offsetOf<const char *>(header, symstr_offset_for_symtab +
|
const char *st_name = offsetOf<const char *>(header, symstr_offset_for_symtab +
|
||||||
symtab_start[i].st_name);
|
symtab_start[i].st_name);
|
||||||
|
|
@ -260,4 +260,3 @@ bool ElfImg::findModuleBase() {
|
||||||
base = reinterpret_cast<void *>(load_addr);
|
base = reinterpret_cast<void *>(load_addr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ namespace lspd {
|
||||||
env, class_clazz, "accessFlags", "I");
|
env, class_clazz, "accessFlags", "I");
|
||||||
jint access_flags = env->GetIntField(target_class, java_lang_Class_accessFlags);
|
jint access_flags = env->GetIntField(target_class, java_lang_Class_accessFlags);
|
||||||
env->SetIntField(target_class, java_lang_Class_accessFlags, access_flags & ~kAccFinal);
|
env->SetIntField(target_class, java_lang_Class_accessFlags, access_flags & ~kAccFinal);
|
||||||
for (auto i = 0u; i < env->GetArrayLength(constructors); ++i) {
|
for (auto i = 0; i < env->GetArrayLength(constructors); ++i) {
|
||||||
auto constructor = env->GetObjectArrayElement(constructors, i);
|
auto constructor = env->GetObjectArrayElement(constructors, i);
|
||||||
void *method = yahfa::getArtMethod(env, constructor);
|
void *method = yahfa::getArtMethod(env, constructor);
|
||||||
uint32_t flags = yahfa::getAccessFlags(method);
|
uint32_t flags = yahfa::getAccessFlags(method);
|
||||||
|
|
|
||||||
|
|
@ -115,11 +115,13 @@ namespace lspd {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define str(s) #s
|
||||||
|
|
||||||
RIRU_EXPORT RiruVersionedModuleInfo *init(Riru *riru) {
|
RIRU_EXPORT RiruVersionedModuleInfo *init(Riru *riru) {
|
||||||
LOGD("using riru %d", riru->riruApiVersion);
|
LOGD("using riru %d", riru->riruApiVersion);
|
||||||
LOGD("module path: %s", riru->magiskModulePath);
|
LOGD("module path: %s", riru->magiskModulePath);
|
||||||
lspd::magiskPath = riru->magiskModulePath;
|
lspd::magiskPath = riru->magiskModulePath;
|
||||||
if (!lspd::isDebug && lspd::magiskPath.find(MODULE_NAME) == std::string::npos) {
|
if (!lspd::isDebug && lspd::magiskPath.find(str(MODULE_NAME)) == std::string::npos) {
|
||||||
LOGE("who am i");
|
LOGE("who am i");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
kotlin("android")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val androidTargetSdkVersion: Int by rootProject.extra
|
val androidTargetSdkVersion: Int by rootProject.extra
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue