Refine some codes & fix logcat version

This commit is contained in:
LoveSy 2020-12-06 23:15:07 +08:00 committed by Jim Wu
parent 1e3843376f
commit 64953220de
11 changed files with 40 additions and 34 deletions

View File

@ -142,7 +142,7 @@ afterEvaluate {
from "${projectDir}/tpl/edconfig.tpl"
into templateFrameworkPath
rename "edconfig.tpl", "edconfig.jar"
expand(version: "$version", backend: "$backend")
expand(version: "$version", backend: "$backend", apiCode: "$apiCode")
}
copy {
from "${projectDir}/tpl/module.prop.tpl"
@ -150,7 +150,8 @@ afterEvaluate {
rename "module.prop.tpl", "module.prop"
expand(moduleId: "$magiskModuleId", backend: "$backendCapped",
versionName: "$version" + " ($backend)",
versionCode: "$versionCode", authorList: "$authorList")
versionCode: "$versionCode", authorList: "$authorList",
apiCode: "$apiCode")
filter(FixCrLfFilter.class, eol: FixCrLfFilter.CrLf.newInstance("lf"))
}
copy {

View File

@ -29,20 +29,20 @@ inline constexpr bool is64 = Is64();
# define LP_SELECT(lp32, lp64) (lp32)
#endif
static const auto kEntryClassName = "com.elderdrivers.riru.edxp.core.Main"_str;
static const auto kClassLinkerClassName = "com.elderdrivers.riru.edxp.art.ClassLinker";
static const auto kSandHookClassName = "com.swift.sandhook.SandHook"_str;
static const auto kSandHookNeverCallClassName = "com.swift.sandhook.ClassNeverCall"_str;
static const auto kEntryClassName = "com.elderdrivers.riru.edxp.core.Main"s;
static const auto kClassLinkerClassName = "com.elderdrivers.riru.edxp.art.ClassLinker"s;
static const auto kSandHookClassName = "com.swift.sandhook.SandHook"s;
static const auto kSandHookNeverCallClassName = "com.swift.sandhook.ClassNeverCall"s;
static const auto kLibArtName = "libart.so"_str;
static const auto kLibFwName = "libandroidfw.so"_str;
static const auto kLibSandHookName = "libsandhook.edxp.so"_str;
static const auto kLibDlName = "libdl.so"_str;
static const auto kLibSandHookNativeName = "libsandhook-native.so"_str;
static const auto kLibArtName = "libart.so"s;
static const auto kLibFwName = "libandroidfw.so"s;
static const auto kLibSandHookName = "libsandhook.edxp.so"s;
static const auto kLibDlName = "libdl.so"s;
static const auto kLibSandHookNativeName = "libsandhook-native.so"s;
static const auto kLibBasePath = std::string(
LP_SELECT("/system/lib/",
"/system/lib64/"));
static const auto kLibBasePath =
LP_SELECT("/system/lib/"s,
"/system/lib64/"s);
static const auto kLibArtLegacyPath = kLibBasePath + kLibArtName;
static const auto kLibSandHookPath = kLibBasePath + kLibSandHookName;
static const auto kLibSandHookNativePath = kLibBasePath + kLibSandHookNativeName;

View File

@ -11,6 +11,7 @@
#include "logging.h"
namespace edxp {
using namespace std::literals::string_literals;
static inline int32_t GetAndroidApiLevel() {
char prop_value[PROP_VALUE_MAX];
@ -18,10 +19,6 @@ namespace edxp {
return atoi(prop_value);
}
inline const std::string operator ""_str(const char *str, std::size_t size) {
return {str, size};
}
template<bool quite = false>
inline bool path_exists(const std::filesystem::path &path) {
try {

View File

@ -17,8 +17,8 @@ namespace edxp {
class ConfigManager {
private:
inline static const auto kPrimaryInstallerPkgName = "org.meowcat.edxposed.manager"_str;
inline static const auto kXposedPropName = "edconfig.jar"_str;
inline static const auto kPrimaryInstallerPkgName = "org.meowcat.edxposed.manager"s;
inline static const auto kXposedPropName = "edconfig.jar"s;
inline static const std::vector<std::string> kXposedInjectDexPath = {
"edxp.dex",
"eddalvikdx.dex",
@ -29,7 +29,7 @@ namespace edxp {
static void Init();
inline static ConfigManager *GetInstance() {
return instances_[current_user].get();
return instances_[current_user_].get();
}
inline auto IsInitialized() const { return initialized_; }
@ -42,7 +42,7 @@ namespace edxp {
instances_[user] = std::make_unique<ConfigManager>(user,
instance->second->IsInitialized());
}
current_user = user;
current_user_ = user;
}
inline static auto ReleaseInstances() {
@ -104,7 +104,7 @@ namespace edxp {
private:
inline static std::unordered_map<uid_t, std::unique_ptr<ConfigManager>> instances_{};
inline static uid_t current_user = 0u;
inline static uid_t current_user_ = 0u;
inline static std::filesystem::path misc_path_;
inline static std::vector<std::filesystem::path> inject_dex_paths_;
inline static const bool use_prot_storage_ = GetAndroidApiLevel() >= __ANDROID_API_N__;

View File

@ -28,7 +28,7 @@ namespace edxp {
};
void RegisterArtClassLinker(JNIEnv *env) {
REGISTER_EDXP_NATIVE_METHODS(kClassLinkerClassName);
REGISTER_EDXP_NATIVE_METHODS(kClassLinkerClassName.c_str());
}
}

View File

@ -3,7 +3,7 @@
grep_prop() {
local REGEX="s/^$1=//p"
shift
local FILES=$@
local FILES="$@"
[[ -z "$FILES" ]] && FILES='/system/build.prop'
sed -n "$REGEX" ${FILES} 2>/dev/null | head -n 1
}
@ -11,10 +11,12 @@ grep_prop() {
MODDIR=${0%/*}
RIRU_PATH="/data/adb/riru"
RIRU_PROP="/data/adb/modules/riru-core/module.prop"
TARGET="${RIRU_PATH}/modules"
[[ "$(getenforce)" == "Enforcing" ]] && ENFORCE=true || ENFORCE=false
EDXP_VERSION=$(grep_prop version "${MODDIR}/module.prop")
EDXP_APICODE=$(grep_prop api "${MODDIR}/module.prop")
ANDROID_SDK=$(getprop ro.build.version.sdk)
BUILD_DESC=$(getprop ro.build.description)
@ -28,12 +30,12 @@ DEVICE=$(getprop ro.product.device)
ANDROID=$(getprop ro.build.version.release)
BUILD=$(getprop ro.build.id)
RIRU_VERSION=$(cat "${RIRU_PATH}/version_name")
RIRU_VERCODE=$(cat "${RIRU_PATH}/version_code")
RIRU_VERSION=$(grep_prop version $RIRU_PROP)
RIRU_VERCODE=$(grep_prop versionCode $RIRU_PROP)
RIRU_APICODE=$(cat "${RIRU_PATH}/api_version")
MAGISK_VERSION=$(su -v)
MAGISK_VERCODE=$(su -V)
MAGISK_VERSION=$(magisk -v)
MAGISK_VERCODE=$(magisk -V)
#EDXP_MANAGER="org.meowcat.edxposed.manager"
#XP_INSTALLER="de.robv.android.xposed.installer"
@ -120,7 +122,7 @@ start_log_cather () {
echo "Android version: ${ANDROID}">>${LOG_FILE}
echo "Android sdk: ${ANDROID_SDK}">>${LOG_FILE}
echo "EdXposed version: ${EDXP_VERSION}">>${LOG_FILE}
echo "EdXposed api: 93.0">>${LOG_FILE}
echo "EdXposed api: ${EDXP_APICODE}">>${LOG_FILE}
echo "Riru version: ${RIRU_VERSION} (${RIRU_VERCODE})">>${LOG_FILE}
echo "Riru api: ${RIRU_APICODE}">>${LOG_FILE}
echo "Magisk: ${MAGISK_VERSION%:*} (${MAGISK_VERCODE})">>${LOG_FILE}

View File

@ -1,4 +1,4 @@
version=93.0-$version ($backend)
version=$apiCode-$version ($backend)
arch=arm64
minsdk=26
maxsdk=29

View File

@ -3,4 +3,5 @@ name=Riru - EdXposed
version=${versionName}
versionCode=${versionCode}
author=${authorList}
api=${apiCode}
description=Another enhanced implementation of Xposed Framework. Supports Android 8.0, 8.1, 9, 10 or above. Requires Riru - Core v19 or above installed. Telegram: @EdXposed

View File

@ -1,3 +1,4 @@
androidCompileSdkVersion=30
androidCompileNdkVersion=22.0.6917172
android.prefabVersion=1.1.2
android.prefabVersion=1.1.2
apiCode=93

View File

@ -18,6 +18,10 @@ android {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "int", "API_CODE", "$apiCode"
}
debug {
buildConfigField "int", "API_CODE", "$apiCode"
}
}
}

View File

@ -4,6 +4,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.Log;
import com.elderdrivers.riru.edxp.bridge.BuildConfig;
import com.elderdrivers.riru.edxp.config.EdXpConfigGlobal;
import java.lang.reflect.AccessibleObject;
@ -145,8 +146,7 @@ public final class XposedBridge {
* Returns the currently installed version of the Xposed framework.
*/
public static int getXposedVersion() {
// ed: fixed value for now
return 93;
return BuildConfig.API_CODE;
}
/**