diff --git a/native/jni/core/applets.cpp b/native/jni/core/applets.cpp index 4d6d8a888..e32b69745 100644 --- a/native/jni/core/applets.cpp +++ b/native/jni/core/applets.cpp @@ -4,8 +4,8 @@ #include #include -#include "magisk.h" -#include "selinux.h" +#include +#include static int (*applet_main[]) (int, char *[]) = { magisk_main, su_client_main, resetprop_main, magiskhide_main, imgtool_main, nullptr }; diff --git a/native/jni/core/daemon.cpp b/native/jni/core/daemon.cpp index d994f40e1..0012bb3b5 100644 --- a/native/jni/core/daemon.cpp +++ b/native/jni/core/daemon.cpp @@ -14,13 +14,13 @@ #include #include -#include "magisk.h" -#include "utils.h" -#include "daemon.h" -#include "selinux.h" -#include "db.h" -#include "resetprop.h" -#include "flags.h" +#include +#include +#include +#include +#include +#include +#include int SDK_INT = -1; struct stat SERVER_STAT; diff --git a/native/jni/core/db.cpp b/native/jni/core/db.cpp index e1f552548..8926fe9f5 100644 --- a/native/jni/core/db.cpp +++ b/native/jni/core/db.cpp @@ -5,9 +5,9 @@ #include #include -#include "magisk.h" -#include "db.h" -#include "daemon.h" +#include +#include +#include #define DB_VERSION 7 diff --git a/native/jni/core/img.cpp b/native/jni/core/img.cpp index 8379cc4f7..803d298fa 100644 --- a/native/jni/core/img.cpp +++ b/native/jni/core/img.cpp @@ -14,10 +14,10 @@ #include #include -#include "magisk.h" -#include "utils.h" -#include "img.h" -#include "flags.h" +#include +#include +#include +#include #define round_size(a) ((((a) / 32) + 2) * 32) #define SOURCE_TMP "/dev/.img_src" diff --git a/native/jni/core/init.cpp b/native/jni/core/init.cpp index f7f2f491c..b26fc30ae 100644 --- a/native/jni/core/init.cpp +++ b/native/jni/core/init.cpp @@ -37,16 +37,15 @@ #include #include +#include +#include +#include +#include +#include #include "binaries.h" #include "binaries_arch.h" - #include "magiskrc.h" -#include "magisk.h" -#include "magiskpolicy.h" -#include "selinux.h" -#include "utils.h" -#include "flags.h" #define DEFAULT_DT_DIR "/proc/device-tree/firmware/android" diff --git a/native/jni/include/magiskrc.h b/native/jni/core/magiskrc.h similarity index 94% rename from native/jni/include/magiskrc.h rename to native/jni/core/magiskrc.h index a1234f1cf..d820f0fc8 100644 --- a/native/jni/include/magiskrc.h +++ b/native/jni/core/magiskrc.h @@ -1,5 +1,5 @@ -#include "magisk.h" -#include "magiskpolicy.h" +#include +#include static const char magiskrc[] = diff --git a/native/jni/core/socket.cpp b/native/jni/core/socket.cpp index d201dc4ce..a875b551b 100644 --- a/native/jni/core/socket.cpp +++ b/native/jni/core/socket.cpp @@ -6,10 +6,10 @@ #include #include -#include "daemon.h" -#include "logging.h" -#include "utils.h" -#include "magisk.h" +#include +#include +#include +#include #define ABS_SOCKET_LEN(sun) (sizeof(sa_family_t) + strlen(sun->sun_path + 1) + 1) diff --git a/native/jni/include/daemon.h b/native/jni/include/daemon.h index 9ba09f4fe..b8595fc90 100644 --- a/native/jni/include/daemon.h +++ b/native/jni/include/daemon.h @@ -4,7 +4,6 @@ #ifndef _DAEMON_H_ #define _DAEMON_H_ -#include #include #include #include diff --git a/native/jni/include/magisk.h b/native/jni/include/magisk.h index 503d9e0b9..48fcb45d7 100644 --- a/native/jni/include/magisk.h +++ b/native/jni/include/magisk.h @@ -27,7 +27,6 @@ #define SIMPLEMOUNT SECURE_DIR "/magisk_simple" #define BOOTCOUNT SECURE_DIR "/.boot_count" #define MANAGERAPK DATABIN "/magisk.apk" -#define MAGISKRC "/init.magisk.rc" // selinux consts #define SELINUX_PATH "/sys/fs/selinux" @@ -38,8 +37,6 @@ #define SEPOL_PROC_DOMAIN "magisk" #define SEPOL_FILE_DOMAIN "magisk_file" -#define MAGISKHIDE_PROP "persist.magisk.hide" - extern char *argv0; /* For changing process name */ extern int SDK_INT; diff --git a/native/jni/magiskboot/bootimg.cpp b/native/jni/magiskboot/bootimg.cpp index 5866a4462..8e5cfe605 100644 --- a/native/jni/magiskboot/bootimg.cpp +++ b/native/jni/magiskboot/bootimg.cpp @@ -6,11 +6,11 @@ #include #include +#include +#include #include "bootimg.h" #include "magiskboot.h" -#include "utils.h" -#include "logging.h" static void dump(void *buf, size_t size, const char *filename) { if (size == 0) diff --git a/native/jni/magiskboot/compress.cpp b/native/jni/magiskboot/compress.cpp index af8c8b310..92ea85c5d 100644 --- a/native/jni/magiskboot/compress.cpp +++ b/native/jni/magiskboot/compress.cpp @@ -10,10 +10,10 @@ #include #include #include +#include +#include #include "magiskboot.h" -#include "logging.h" -#include "utils.h" #define CHUNK 0x40000 diff --git a/native/jni/magiskboot/cpio.cpp b/native/jni/magiskboot/cpio.cpp index d839848e9..481e69336 100644 --- a/native/jni/magiskboot/cpio.cpp +++ b/native/jni/magiskboot/cpio.cpp @@ -4,9 +4,10 @@ #include #include +#include +#include + #include "cpio.h" -#include "utils.h" -#include "logging.h" using namespace std; diff --git a/native/jni/magiskboot/dtb.cpp b/native/jni/magiskboot/dtb.cpp index d7245895d..c59f50ea2 100644 --- a/native/jni/magiskboot/dtb.cpp +++ b/native/jni/magiskboot/dtb.cpp @@ -3,9 +3,9 @@ extern "C" { #include } +#include #include "magiskboot.h" -#include "utils.h" static void print_props(const void *fdt, int node, int depth) { int prop; diff --git a/native/jni/magiskboot/hexpatch.cpp b/native/jni/magiskboot/hexpatch.cpp index f4f5a6a88..aea7187f3 100644 --- a/native/jni/magiskboot/hexpatch.cpp +++ b/native/jni/magiskboot/hexpatch.cpp @@ -3,8 +3,9 @@ #include #include +#include + #include "magiskboot.h" -#include "utils.h" static void hex2byte(uint8_t *hex, uint8_t *str) { char high, low; diff --git a/native/jni/magiskboot/main.cpp b/native/jni/magiskboot/main.cpp index 762b65aac..dbe67ee5e 100644 --- a/native/jni/magiskboot/main.cpp +++ b/native/jni/magiskboot/main.cpp @@ -5,11 +5,11 @@ #include #include +#include +#include +#include #include "magiskboot.h" -#include "logging.h" -#include "utils.h" -#include "flags.h" /******************** Patch Boot Image diff --git a/native/jni/magiskboot/pattern.cpp b/native/jni/magiskboot/pattern.cpp index 743d916cb..de51ce735 100644 --- a/native/jni/magiskboot/pattern.cpp +++ b/native/jni/magiskboot/pattern.cpp @@ -1,8 +1,9 @@ #include #include +#include + #include "magiskboot.h" -#include "utils.h" static int check_verity_pattern(const char *s) { int skip = 0; diff --git a/native/jni/magiskboot/ramdisk.cpp b/native/jni/magiskboot/ramdisk.cpp index c6ab0c91f..8c50034fd 100644 --- a/native/jni/magiskboot/ramdisk.cpp +++ b/native/jni/magiskboot/ramdisk.cpp @@ -2,9 +2,10 @@ #include #include +#include + #include "magiskboot.h" #include "cpio.h" -#include "utils.h" using namespace std; diff --git a/native/jni/magiskhide/magiskhide.cpp b/native/jni/magiskhide/magiskhide.cpp index 0c01b508a..63e8988de 100644 --- a/native/jni/magiskhide/magiskhide.cpp +++ b/native/jni/magiskhide/magiskhide.cpp @@ -7,10 +7,11 @@ #include #include -#include "magisk.h" +#include +#include +#include + #include "magiskhide.h" -#include "daemon.h" -#include "flags.h" bool hide_enabled = false; diff --git a/native/jni/magiskpolicy/magiskpolicy.cpp b/native/jni/magiskpolicy/magiskpolicy.cpp index f799a4459..dcb1a5176 100644 --- a/native/jni/magiskpolicy/magiskpolicy.cpp +++ b/native/jni/magiskpolicy/magiskpolicy.cpp @@ -8,11 +8,12 @@ #include #include +#include +#include +#include + #include "sepolicy.h" #include "magiskpolicy.h" -#include "magisk.h" -#include "utils.h" -#include "flags.h" using namespace std; diff --git a/native/jni/magiskpolicy/rules.cpp b/native/jni/magiskpolicy/rules.cpp index 0677e6e5f..622a5e7af 100644 --- a/native/jni/magiskpolicy/rules.cpp +++ b/native/jni/magiskpolicy/rules.cpp @@ -1,4 +1,5 @@ -#include "magisk.h" +#include + #include "magiskpolicy.h" #include "sepolicy.h" diff --git a/native/jni/magiskpolicy/sepolicy.c b/native/jni/magiskpolicy/sepolicy.c index 92a9b0625..3b3007d6a 100644 --- a/native/jni/magiskpolicy/sepolicy.c +++ b/native/jni/magiskpolicy/sepolicy.c @@ -19,10 +19,11 @@ #include #include -#include "utils.h" +#include +#include + #include "magiskpolicy.h" #include "sepolicy.h" -#include "logging.h" policydb_t *policydb = NULL; extern int policydb_index_decls(sepol_handle_t * handle, policydb_t * p); diff --git a/native/jni/resetprop/persist_properties.cpp b/native/jni/resetprop/persist_properties.cpp index e53221b7a..948934ca8 100644 --- a/native/jni/resetprop/persist_properties.cpp +++ b/native/jni/resetprop/persist_properties.cpp @@ -4,15 +4,14 @@ #include #include #include - #include #include #include #include +#include #include "_resetprop.h" -#include "utils.h" using namespace std; diff --git a/native/jni/resetprop/resetprop.cpp b/native/jni/resetprop/resetprop.cpp index 37ab10fa3..cf5e44fda 100644 --- a/native/jni/resetprop/resetprop.cpp +++ b/native/jni/resetprop/resetprop.cpp @@ -9,15 +9,15 @@ #include #include +#include +#include +#include +#include + #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include "private/_system_properties.h" #include "private/system_properties.h" - -#include "magisk.h" -#include "resetprop.h" #include "_resetprop.h" -#include "utils.h" -#include "flags.h" using namespace std; diff --git a/native/jni/su/connect.cpp b/native/jni/su/connect.cpp index 7175d99ff..856d89e28 100644 --- a/native/jni/su/connect.cpp +++ b/native/jni/su/connect.cpp @@ -12,9 +12,10 @@ #include #include -#include "magisk.h" -#include "daemon.h" -#include "utils.h" +#include +#include +#include + #include "su.h" #define BROADCAST_BOOT_COMPLETED \ diff --git a/native/jni/su/pts.cpp b/native/jni/su/pts.cpp index 69ebe36ea..2b8243b35 100644 --- a/native/jni/su/pts.cpp +++ b/native/jni/su/pts.cpp @@ -17,7 +17,8 @@ #include #include -#include "magisk.h" +#include + #include "pts.h" /** diff --git a/native/jni/su/su.cpp b/native/jni/su/su.cpp index 5b38dc27f..2505957db 100644 --- a/native/jni/su/su.cpp +++ b/native/jni/su/su.cpp @@ -21,12 +21,13 @@ #include #include -#include "magisk.h" -#include "daemon.h" -#include "utils.h" +#include +#include +#include +#include + #include "su.h" #include "pts.h" -#include "flags.h" int quit_signals[] = { SIGALRM, SIGABRT, SIGHUP, SIGPIPE, SIGQUIT, SIGTERM, SIGINT, 0 }; diff --git a/native/jni/su/su_daemon.cpp b/native/jni/su/su_daemon.cpp index cde625b36..5bed94029 100644 --- a/native/jni/su/su_daemon.cpp +++ b/native/jni/su/su_daemon.cpp @@ -11,12 +11,13 @@ #include #include -#include "magisk.h" -#include "daemon.h" -#include "utils.h" +#include +#include +#include +#include + #include "su.h" #include "pts.h" -#include "selinux.h" #define LOCK_CACHE() pthread_mutex_lock(&cache_lock) #define UNLOCK_CACHE() pthread_mutex_unlock(&cache_lock) diff --git a/native/jni/utils/file.cpp b/native/jni/utils/file.cpp index adce24a38..cb4a9857e 100644 --- a/native/jni/utils/file.cpp +++ b/native/jni/utils/file.cpp @@ -11,9 +11,9 @@ #include #include -#include "magisk.h" -#include "utils.h" -#include "selinux.h" +#include +#include +#include using namespace std; diff --git a/native/jni/utils/logging.cpp b/native/jni/utils/logging.cpp index 93bac9fec..7b3a2c14d 100644 --- a/native/jni/utils/logging.cpp +++ b/native/jni/utils/logging.cpp @@ -2,8 +2,8 @@ #include #include -#include "logging.h" -#include "flags.h" +#include +#include int nop_log(const char *fmt, va_list ap) { return 0; diff --git a/native/jni/utils/misc.cpp b/native/jni/utils/misc.cpp index e947bb91e..1c9217c89 100644 --- a/native/jni/utils/misc.cpp +++ b/native/jni/utils/misc.cpp @@ -13,8 +13,8 @@ #include #include -#include "logging.h" -#include "utils.h" +#include +#include using namespace std; diff --git a/native/jni/utils/selinux.cpp b/native/jni/utils/selinux.cpp index fb32404f9..9a38473b5 100644 --- a/native/jni/utils/selinux.cpp +++ b/native/jni/utils/selinux.cpp @@ -5,9 +5,9 @@ #include #include -#include "magisk.h" -#include "utils.h" -#include "selinux.h" +#include +#include +#include #define UNLABEL_CON "u:object_r:unlabeled:s0" #define SYSTEM_CON "u:object_r:system_file:s0" diff --git a/native/jni/utils/xwrap.cpp b/native/jni/utils/xwrap.cpp index cc854db89..83e2ad984 100644 --- a/native/jni/utils/xwrap.cpp +++ b/native/jni/utils/xwrap.cpp @@ -22,8 +22,8 @@ #include #include -#include "logging.h" -#include "utils.h" +#include +#include FILE *xfopen(const char *pathname, const char *mode) { FILE *fp = fopen(pathname, mode);