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

Migrate EdXposed Manager app #90

Closed
wants to merge 8 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
import external.com.android.dx.Local;
import external.com.android.dx.TypeId;

import static de.robv.android.xposed.XposedInit.INSTALLER_DATA_BASE_DIR;

public class DexMakerUtils {

private static final boolean IN_MEMORY_DEX_ELIGIBLE = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
private static final String COMPAT_LIST_PATH = "/data/misc/riru/modules/edxposed/compatlist/";
private static final String COMPAT_LIST_PATH = INSTALLER_DATA_BASE_DIR + "/conf/compatlist/";

public static boolean shouldUseInMemoryHook() {
if (!IN_MEMORY_DEX_ELIGIBLE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class XposedInit {
public static boolean startsSystemServer = false;
private static final String startClassName = ""; // ed: no support for tool process anymore

public static final String INSTALLER_PACKAGE_NAME = "com.solohsu.android.edxp.manager";
public static final String INSTALLER_PACKAGE_NAME = "org.meowcat.edxposed.manager";
public static final String INSTALLER_LEGACY_PACKAGE_NAME = "de.robv.android.xposed.installer";
@SuppressLint("SdCardPath")
public static final String INSTALLER_DATA_BASE_DIR = Build.VERSION.SDK_INT >= 24
Expand Down
31 changes: 17 additions & 14 deletions Core/jni/main/inject/config_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@
#include <vector>
#include <string>
#include <include/logging.h>
#include <include/android_build.h>
#include "config_manager.h"

#define BLACK_LIST_PATH "/data/misc/riru/modules/edxposed/blacklist/"
#define WHITE_LIST_PATH "/data/misc/riru/modules/edxposed/whitelist/"
#define USE_WHITE_LIST "/data/misc/riru/modules/edxposed/usewhitelist"
#define GLOBAL_MODE "/data/misc/riru/modules/edxposed/forceglobal"
#define DYNAMIC_MODULES "/data/misc/riru/modules/edxposed/dynamicmodules"

static char package_name[256];
static bool global_mode = false;
static bool dynamic_modules = false;
static bool inited = false;
static bool use_prot_storage = GetAndroidApiLevel() >= ANDROID_N;
static std::string config_path = use_prot_storage ? "/data/user_de/0/org.meowcat.edxposed.manager/conf/"
: "/data/user/0/org.meowcat.edxposed.manager/conf/";
static std::string blacklist_path = config_path + "blacklist/";
static std::string whitelist_path = config_path + "whitelist/";
static std::string use_whitelist_path = config_path + "usewhitelist";
static std::string forceglobal_path = config_path + "forceglobal";
static std::string dynamicmodules_path = config_path + "dynamicmodules";

void initOnce() {
if (!inited) {
global_mode = access(GLOBAL_MODE, F_OK) == 0;
dynamic_modules = access(DYNAMIC_MODULES, F_OK) == 0;
global_mode = access(forceglobal_path.c_str(), F_OK) == 0;
dynamic_modules = access(dynamicmodules_path.c_str(), F_OK) == 0;
inited = true;
}
}
Expand All @@ -51,22 +54,22 @@ int is_app_need_hook(JNIEnv *env, jstring appDataDir) {
}
}
env->ReleaseStringUTFChars(appDataDir, app_data_dir);
if (strcmp(package_name, "com.solohsu.android.edxp.manager") == 0) {
if (strcmp(package_name, "org.meowcat.edxposed.manager") == 0) {
// always hook installer app
return 1;
}
bool use_white_list = access(USE_WHITE_LIST, F_OK) == 0;
bool white_list_exists = access(WHITE_LIST_PATH, F_OK) == 0;
bool black_list_exists = access(BLACK_LIST_PATH, F_OK) == 0;
bool use_white_list = access(use_whitelist_path.c_str(), F_OK) == 0;
bool white_list_exists = access(whitelist_path.c_str(), F_OK) == 0;
bool black_list_exists = access(blacklist_path.c_str(), F_OK) == 0;
if (use_white_list && white_list_exists) {
char path[PATH_MAX];
snprintf(path, PATH_MAX, WHITE_LIST_PATH "%s", package_name);
snprintf(path, PATH_MAX, "%s%s", whitelist_path.c_str(), package_name);
int res = access(path, F_OK) == 0;
LOGD("use whitelist, res=%d", res);
return res;
} else if (!use_white_list && black_list_exists) {
char path[PATH_MAX];
snprintf(path, PATH_MAX, BLACK_LIST_PATH "%s", package_name);
snprintf(path, PATH_MAX, "%s%s", blacklist_path.c_str(), package_name);
int res = access(path, F_OK) != 0;
LOGD("use blacklist, res=%d", res);
return res;
Expand Down
4 changes: 2 additions & 2 deletions Core/template_override/module.prop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id=riru_edxposed
name=Riru - Ed Xposed
version=v0.2.9.8_beta1
versionCode=2981
version=v0.2.9.9
versionCode=2990
author=givein2u & MlgmXyysd
description=Magisk version of Xposed. Require Riru - Core installed.
minMagisk=17000
4 changes: 2 additions & 2 deletions Core/template_override/riru_module.prop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Ed Xposed
version=v0.2.9.8_beta1
versionCode=2981
version=v0.2.9.9
versionCode=2990
author=givein2u & MlgmXyysd
description=Magisk version of Xposed. Require Riru - Core installed.
2 changes: 1 addition & 1 deletion Core/template_override/system/framework/edconfig.dex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=90.0-0.2.9.8 (by Elder Driver)
version=0.2.9.9
arch=arm64
minsdk=23
maxsdk=28
Expand Down