Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
4497e0aa
Commit
4497e0aa
authored
May 18, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't expose module_list
parent
c3e045e3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
25 deletions
+21
-25
bootstages.cpp
native/jni/core/bootstages.cpp
+3
-11
module.cpp
native/jni/core/module.cpp
+6
-5
scripting.cpp
native/jni/core/scripting.cpp
+4
-2
daemon.hpp
native/jni/include/daemon.hpp
+8
-7
No files found.
native/jni/core/bootstages.cpp
View file @
4497e0aa
...
...
@@ -268,8 +268,7 @@ void post_fs_data(int client) {
foreach_modules
(
"disable"
);
stop_magiskhide
();
}
else
{
LOGI
(
"* Running post-fs-data.d scripts
\n
"
);
exec_common_script
(
"post-fs-data"
);
exec_common_scripts
(
"post-fs-data"
);
auto_start_magiskhide
();
handle_modules
();
}
...
...
@@ -299,15 +298,8 @@ void late_start(int client) {
if
(
!
pfs_done
||
safe_mode
)
return
;
LOGI
(
"* Running service.d scripts
\n
"
);
exec_common_script
(
"service"
);
LOGI
(
"* Running module service scripts
\n
"
);
exec_module_script
(
"service"
,
module_list
);
// All boot stage done, cleanup
module_list
.
clear
();
module_list
.
shrink_to_fit
();
exec_common_scripts
(
"service"
);
exec_module_scripts
(
"service"
);
}
void
boot_complete
(
int
client
)
{
...
...
native/jni/core/module.cpp
View file @
4497e0aa
...
...
@@ -25,7 +25,7 @@ using namespace std;
#define TYPE_CUSTOM (1 << 5)
/* custom node type overrides all */
#define TYPE_DIR (TYPE_INTER|TYPE_SKEL|TYPE_ROOT)
vector
<
string
>
module_list
;
static
vector
<
string
>
module_list
;
class
node_entry
;
class
dir_node
;
...
...
@@ -671,10 +671,7 @@ static void collect_modules() {
void
handle_modules
()
{
prepare_modules
();
collect_modules
();
// Execute module scripts
LOGI
(
"* Running module post-fs-data scripts
\n
"
);
exec_module_script
(
"post-fs-data"
,
module_list
);
exec_module_scripts
(
"post-fs-data"
);
// Recollect modules (module scripts could remove itself)
module_list
.
clear
();
...
...
@@ -699,3 +696,7 @@ void foreach_modules(const char *name) {
}
}
}
void
exec_module_scripts
(
const
char
*
stage
)
{
exec_module_scripts
(
stage
,
module_list
);
}
native/jni/core/scripting.cpp
View file @
4497e0aa
...
...
@@ -24,7 +24,8 @@ void exec_script(const char *script) {
exec_command_sync
(
exec
,
BBEXEC_CMD
,
script
);
}
void
exec_common_script
(
const
char
*
stage
)
{
void
exec_common_scripts
(
const
char
*
stage
)
{
LOGI
(
"* Running %s.d scripts
\n
"
,
stage
);
char
path
[
4096
];
char
*
name
=
path
+
sprintf
(
path
,
SECURE_DIR
"/%s.d"
,
stage
);
auto
dir
=
xopen_dir
(
path
);
...
...
@@ -53,7 +54,8 @@ void exec_common_script(const char *stage) {
}
}
void
exec_module_script
(
const
char
*
stage
,
const
vector
<
string
>
&
module_list
)
{
void
exec_module_scripts
(
const
char
*
stage
,
const
vector
<
string
>
&
module_list
)
{
LOGI
(
"* Running module %s scripts
\n
"
,
stage
);
char
path
[
4096
];
bool
pfs
=
stage
==
"post-fs-data"
sv
;
for
(
auto
&
m
:
module_list
)
{
...
...
native/jni/include/daemon.hpp
View file @
4497e0aa
...
...
@@ -42,22 +42,23 @@ extern bool RECOVERY_MODE;
extern
int
DAEMON_STATE
;
#define APP_DATA_DIR (SDK_INT >= 24 ? "/data/user_de" : "/data/user")
extern
std
::
vector
<
std
::
string
>
module_list
;
// Daemon handlers
void
post_fs_data
(
int
client
);
void
late_start
(
int
client
);
void
boot_complete
(
int
client
);
void
magiskhide_handler
(
int
client
);
void
su_daemon_handler
(
int
client
,
struct
ucred
*
credential
);
void
foreach_modules
(
const
char
*
name
);
void
su_daemon_handler
(
int
client
,
ucred
*
credential
);
// Misc
int
connect_daemon
(
bool
create
=
false
);
void
unlock_blocks
();
void
reboot
();
// Module stuffs
void
handle_modules
();
void
magic_mount
();
void
reboot
();
void
foreach_modules
(
const
char
*
name
);
void
exec_module_scripts
(
const
char
*
stage
);
// MagiskHide
void
auto_start_magiskhide
();
...
...
@@ -65,6 +66,6 @@ int stop_magiskhide();
// Scripting
void
exec_script
(
const
char
*
script
);
void
exec_common_script
(
const
char
*
stage
);
void
exec_module_script
(
const
char
*
stage
,
const
std
::
vector
<
std
::
string
>
&
module_list
);
void
exec_common_script
s
(
const
char
*
stage
);
void
exec_module_script
s
(
const
char
*
stage
,
const
std
::
vector
<
std
::
string
>
&
module_list
);
void
install_apk
(
const
char
*
apk
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment