mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Restructure project files
This commit is contained in:
parent
ecb31eed40
commit
65c18f9c09
@ -8,6 +8,7 @@ LIBRARY_PATH = ../out/$(TARGET_ARCH_ABI)/libmagisk-rs.a
|
||||
ifneq (,$(wildcard $(LOCAL_PATH)/$(LIBRARY_PATH)))
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := magisk-rs
|
||||
LOCAL_EXPORT_C_INCLUDES := src/core/include
|
||||
LOCAL_SRC_FILES := $(LIBRARY_PATH)
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
endif
|
||||
|
@ -26,19 +26,19 @@ LOCAL_SRC_FILES := \
|
||||
core/selinux.cpp \
|
||||
core/module.cpp \
|
||||
core/thread.cpp \
|
||||
core/resetprop/resetprop.cpp \
|
||||
core/core-rs.cpp \
|
||||
core/resetprop/resetprop.cpp \
|
||||
core/su/su.cpp \
|
||||
core/su/connect.cpp \
|
||||
core/su/pts.cpp \
|
||||
core/su/su_daemon.cpp \
|
||||
zygisk/entry.cpp \
|
||||
zygisk/main.cpp \
|
||||
zygisk/hook.cpp \
|
||||
zygisk/native_bridge.cpp \
|
||||
zygisk/deny/cli.cpp \
|
||||
zygisk/deny/utils.cpp \
|
||||
zygisk/deny/revert.cpp
|
||||
core/zygisk/entry.cpp \
|
||||
core/zygisk/main.cpp \
|
||||
core/zygisk/hook.cpp \
|
||||
core/zygisk/native_bridge.cpp \
|
||||
core/deny/cli.cpp \
|
||||
core/deny/utils.cpp \
|
||||
core/deny/revert.cpp
|
||||
|
||||
LOCAL_LDLIBS := -llog
|
||||
LOCAL_LDFLAGS := -Wl,--dynamic-list=src/exported_sym.txt
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <base.hpp>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <base.hpp>
|
||||
|
||||
|
@ -6,14 +6,12 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <db.hpp>
|
||||
#include <base.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Boot stage state
|
||||
|
@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "core-rs.hpp"
|
||||
#include "resetprop/resetprop.hpp"
|
||||
|
||||
extern bool RECOVERY_MODE;
|
||||
extern std::atomic<ino_t> pkg_xml_ino;
|
||||
|
||||
std::string find_preinit_device();
|
||||
void unlock_blocks();
|
||||
void reboot();
|
||||
|
||||
// Module stuffs
|
||||
void handle_modules();
|
||||
void load_modules();
|
||||
void disable_modules();
|
||||
void remove_modules();
|
||||
void exec_module_scripts(const char *stage);
|
||||
|
||||
// Scripting
|
||||
void exec_script(const char *script);
|
||||
void exec_common_scripts(const char *stage);
|
||||
void exec_module_scripts(const char *stage, const std::vector<std::string_view> &modules);
|
||||
void install_apk(const char *apk);
|
||||
void uninstall_pkg(const char *pkg);
|
||||
void clear_pkg(const char *pkg, int user_id);
|
||||
[[noreturn]] void install_module(const char *file);
|
@ -3,15 +3,13 @@
|
||||
#include <sys/un.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <db.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int SDK_INT = -1;
|
||||
|
@ -2,12 +2,10 @@
|
||||
#include <dlfcn.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <db.hpp>
|
||||
#include <socket.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
|
||||
#include "core.hpp"
|
||||
#include <db.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
#define DB_VERSION 12
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
|
||||
#include "deny.hpp"
|
@ -6,7 +6,7 @@
|
||||
#include <map>
|
||||
#include <atomic>
|
||||
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
#define ISOLATED_MAGIC "isolated"
|
||||
|
||||
@ -44,9 +44,3 @@ int disable_deny();
|
||||
int add_list(int client);
|
||||
int rm_list(int client);
|
||||
void ls_list(int client);
|
||||
|
||||
// Utility functions
|
||||
bool is_deny_target(int uid, std::string_view process);
|
||||
void revert_unmount();
|
||||
|
||||
extern std::atomic<bool> denylist_enforced;
|
@ -1,8 +1,9 @@
|
||||
#include <set>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
#include "deny.hpp"
|
||||
|
@ -6,9 +6,10 @@
|
||||
#include <dirent.h>
|
||||
#include <set>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <db.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
#include "deny.hpp"
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
#include <socket.hpp>
|
||||
#include "../core/core-rs.hpp"
|
||||
#include "socket.hpp"
|
||||
#include "../core-rs.hpp"
|
||||
|
||||
#define AID_ROOT 0
|
||||
#define AID_SHELL 2000
|
||||
@ -65,12 +65,16 @@ struct module_info {
|
||||
#endif
|
||||
};
|
||||
|
||||
extern bool RECOVERY_MODE;
|
||||
extern bool zygisk_enabled;
|
||||
extern std::vector<module_info> *module_list;
|
||||
void reset_zygisk(bool restore);
|
||||
|
||||
void reset_zygisk(bool restore);
|
||||
extern "C" const char *get_magisk_tmp();
|
||||
int connect_daemon(int req, bool create = false);
|
||||
std::string find_preinit_device();
|
||||
void unlock_blocks();
|
||||
void reboot();
|
||||
|
||||
// Poll control
|
||||
using poll_callback = void(*)(pollfd*);
|
||||
@ -88,6 +92,7 @@ void su_daemon_handler(int client, const sock_cred *cred);
|
||||
void zygisk_handler(int client, const sock_cred *cred);
|
||||
|
||||
// Package
|
||||
extern std::atomic<ino_t> pkg_xml_ino;
|
||||
void preserve_stub_apk();
|
||||
void check_pkg_refresh();
|
||||
std::vector<bool> get_app_no_list();
|
||||
@ -96,7 +101,26 @@ std::vector<bool> get_app_no_list();
|
||||
int get_manager(int user_id = 0, std::string *pkg = nullptr, bool install = false);
|
||||
void prune_su_access();
|
||||
|
||||
// Module stuffs
|
||||
void handle_modules();
|
||||
void load_modules();
|
||||
void disable_modules();
|
||||
void remove_modules();
|
||||
void exec_module_scripts(const char *stage);
|
||||
|
||||
// Scripting
|
||||
void exec_script(const char *script);
|
||||
void exec_common_scripts(const char *stage);
|
||||
void exec_module_scripts(const char *stage, const std::vector<std::string_view> &modules);
|
||||
void install_apk(const char *apk);
|
||||
void uninstall_pkg(const char *pkg);
|
||||
void clear_pkg(const char *pkg, int user_id);
|
||||
[[noreturn]] void install_module(const char *file);
|
||||
|
||||
// Denylist
|
||||
extern std::atomic_flag skip_pkg_rescan;
|
||||
void initialize_denylist();
|
||||
extern std::atomic<bool> denylist_enforced;
|
||||
int denylist_cli(int argc, char **argv);
|
||||
void initialize_denylist();
|
||||
bool is_deny_target(int uid, std::string_view process);
|
||||
void revert_unmount();
|
@ -4,9 +4,6 @@
|
||||
#include <map>
|
||||
#include <cxx.h>
|
||||
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
#include <api/_system_properties.h>
|
||||
|
||||
struct prop_cb {
|
||||
virtual void exec(const char *name, const char *value) = 0;
|
||||
};
|
@ -19,7 +19,7 @@ mod resetprop;
|
||||
#[cxx::bridge]
|
||||
pub mod ffi {
|
||||
extern "C++" {
|
||||
include!("resetprop/resetprop.hpp");
|
||||
include!("include/resetprop.hpp");
|
||||
|
||||
#[cxx_name = "prop_cb"]
|
||||
type PropCb;
|
||||
|
@ -2,13 +2,11 @@
|
||||
#include <libgen.h>
|
||||
|
||||
#include <base.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <core.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
[[noreturn]] static void usage() {
|
||||
|
@ -5,11 +5,10 @@
|
||||
#include <utility>
|
||||
|
||||
#include <base.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <core.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
#include "core.hpp"
|
||||
#include "node.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
@ -1,11 +1,9 @@
|
||||
#include <base.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <core.hpp>
|
||||
#include <db.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
#include "core.hpp"
|
||||
|
||||
using namespace std;
|
||||
using rust::Vec;
|
||||
|
||||
|
@ -4,9 +4,11 @@
|
||||
#include <map>
|
||||
|
||||
#include <base.hpp>
|
||||
#include <core.hpp>
|
||||
#include <resetprop.hpp>
|
||||
|
||||
#include "resetprop.hpp"
|
||||
#include "../core-rs.hpp"
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
#include <api/_system_properties.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -2,12 +2,10 @@
|
||||
#include <vector>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <daemon.hpp>
|
||||
|
||||
#include "core.hpp"
|
||||
#include <core.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/xattr.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
using namespace std;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <base.hpp>
|
||||
#include <selinux.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
|
||||
#include "su.hpp"
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include <db.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
#define DEFAULT_SHELL "/system/bin/sh"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <base.hpp>
|
||||
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -6,11 +6,10 @@
|
||||
#include <android/dlext.h>
|
||||
|
||||
#include <base.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
|
||||
#include "zygisk.hpp"
|
||||
#include "module.hpp"
|
||||
#include "deny/deny.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
@ -9,11 +9,10 @@
|
||||
#include <lsplt.hpp>
|
||||
|
||||
#include <base.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
|
||||
#include "zygisk.hpp"
|
||||
#include "module.hpp"
|
||||
#include "deny/deny.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
@ -2,10 +2,9 @@
|
||||
#include <android/dlext.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <socket.hpp>
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
#include <selinux.hpp>
|
||||
|
||||
#include "zygisk.hpp"
|
@ -2,9 +2,10 @@
|
||||
#include <dlfcn.h>
|
||||
#include <unwind.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
#include "zygisk.hpp"
|
||||
#include "../core/core.hpp"
|
||||
|
||||
static bool is_compatible_with(uint32_t) {
|
||||
auto name = get_prop(NBPROP);
|
@ -4,7 +4,7 @@
|
||||
#include <stdint.h>
|
||||
#include <jni.h>
|
||||
#include <vector>
|
||||
#include <daemon.hpp>
|
||||
#include <core.hpp>
|
||||
|
||||
namespace ZygiskRequest {
|
||||
enum : int {
|
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#define JAVA_PACKAGE_NAME "com.topjohnwu.magisk"
|
||||
#define ZYGISKLDR "libzygisk.so"
|
||||
#define NBPROP "ro.dalvik.vm.native.bridge"
|
||||
@ -23,7 +21,6 @@
|
||||
#define ROOTOVL INTLROOT "/rootdir"
|
||||
#define SHELLPTS INTLROOT "/pts"
|
||||
#define ROOTMNT ROOTOVL "/.mount_list"
|
||||
#define ZYGISKBIN INTLROOT "/zygisk"
|
||||
#define SELINUXMOCK INTLROOT "/selinux"
|
||||
#define MAIN_CONFIG INTLROOT "/config"
|
||||
#define MAIN_SOCKET INTLROOT "/socket"
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include <base.hpp>
|
||||
#include <flags.h>
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
|
||||
#include "init.hpp"
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
#include <sepolicy.hpp>
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <flags.h>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <sepolicy.hpp>
|
||||
#include <embed.hpp>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
#include <sys/vfs.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <magisk.hpp>
|
||||
#include <consts.hpp>
|
||||
#include <base.hpp>
|
||||
|
||||
#include "policy.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user