Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine some codes & fix logcat version #713

Merged
merged 1 commit into from
Dec 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions edxp-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,16 @@ 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"
into templateRootPath
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 {
Expand Down
28 changes: 14 additions & 14 deletions edxp-core/src/main/cpp/main/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 kLibBasePath = std::string(
LP_SELECT("/system/lib/",
"/system/lib64/"));
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"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 =
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;
Expand Down
5 changes: 1 addition & 4 deletions edxp-core/src/main/cpp/main/include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
#include "logging.h"

namespace edxp {
using namespace std::literals::string_literals;

static inline int32_t GetAndroidApiLevel() {
char prop_value[PROP_VALUE_MAX];
__system_property_get("ro.build.version.sdk", prop_value);
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 {
Expand Down
10 changes: 5 additions & 5 deletions edxp-core/src/main/cpp/main/src/config_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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_; }
Expand All @@ -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() {
Expand Down Expand Up @@ -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__;
Expand Down
2 changes: 1 addition & 1 deletion edxp-core/src/main/cpp/main/src/jni/art_class_linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace edxp {
};

void RegisterArtClassLinker(JNIEnv *env) {
REGISTER_EDXP_NATIVE_METHODS(kClassLinkerClassName);
REGISTER_EDXP_NATIVE_METHODS(kClassLinkerClassName.c_str());
}

}
14 changes: 8 additions & 6 deletions edxp-core/template_override/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
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
}

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)
Expand All @@ -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"
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion edxp-core/tpl/edconfig.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=93.0-$version ($backend)
version=$apiCode-$version ($backend)
arch=arm64
minsdk=26
maxsdk=29
Expand Down
1 change: 1 addition & 0 deletions edxp-core/tpl/module.prop.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
androidCompileSdkVersion=30
androidCompileNdkVersion=22.0.6917172
android.prefabVersion=1.1.2
android.prefabVersion=1.1.2
apiCode=93
4 changes: 4 additions & 0 deletions xposed-bridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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;
Expand Down Expand Up @@ -145,8 +146,7 @@ public static void initXResources() {
* Returns the currently installed version of the Xposed framework.
*/
public static int getXposedVersion() {
// ed: fixed value for now
return 93;
return BuildConfig.API_CODE;
}

/**
Expand Down