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
fc1844b4
Commit
fc1844b4
authored
May 19, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update policy for handling /data/adb
parent
99ef2062
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
bootstages.cpp
native/jni/core/bootstages.cpp
+24
-26
No files found.
native/jni/core/bootstages.cpp
View file @
fc1844b4
...
...
@@ -20,7 +20,6 @@
using
namespace
std
;
static
bool
pfs_done
=
false
;
static
bool
no_secure_dir
=
false
;
static
bool
safe_mode
=
false
;
/*********
...
...
@@ -225,11 +224,6 @@ static void collect_logs(bool reset) {
* Entry points *
****************/
[[
noreturn
]]
static
void
exit_post_fs_data
()
{
close
(
xopen
(
UNBLOCKFILE
,
O_RDONLY
|
O_CREAT
,
0
));
pthread_exit
(
nullptr
);
}
void
post_fs_data
(
int
client
)
{
// ack
write_int
(
client
,
0
);
...
...
@@ -239,7 +233,7 @@ void post_fs_data(int client) {
xmount
(
nullptr
,
"/"
,
nullptr
,
MS_REMOUNT
|
MS_RDONLY
,
nullptr
);
if
(
!
check_data
())
exit_post_fs_data
()
;
goto
unblock_init
;
collect_logs
(
true
);
...
...
@@ -249,17 +243,21 @@ void post_fs_data(int client) {
unlock_blocks
();
if
(
access
(
SECURE_DIR
,
F_OK
)
!=
0
)
{
/* If the folder is not automatically created by the system,
* do NOT proceed further. Manual creation of the folder
* will cause bootloops on FBE devices. */
LOGE
(
SECURE_DIR
" is not present, abort..."
);
no_secure_dir
=
true
;
exit_post_fs_data
();
if
(
SDK_INT
<
24
)
{
// There is no FBE pre 7.0, we can directly create the folder without issues
xmkdir
(
SECURE_DIR
,
0700
);
}
else
{
/* If the folder is not automatically created by Android,
* do NOT proceed further. Manual creation of the folder
* will cause bootloops on FBE devices. */
LOGE
(
SECURE_DIR
" is not present, abort...
\n
"
);
goto
unblock_init
;
}
}
if
(
!
magisk_env
())
{
LOGE
(
"* Magisk environment setup incomplete, abort
\n
"
);
exit_post_fs_data
()
;
goto
unblock_init
;
}
if
(
getprop
(
"persist.sys.safemode"
,
true
)
==
"1"
)
{
...
...
@@ -273,10 +271,12 @@ void post_fs_data(int client) {
handle_modules
();
}
// We still
want to
do magic mount because root itself might need it
// We still do magic mount because root itself might need it
magic_mount
();
pfs_done
=
true
;
exit_post_fs_data
();
unblock_init:
close
(
xopen
(
UNBLOCKFILE
,
O_RDONLY
|
O_CREAT
,
0
));
}
void
late_start
(
int
client
)
{
...
...
@@ -287,14 +287,6 @@ void late_start(int client) {
collect_logs
(
false
);
if
(
no_secure_dir
)
{
// It's safe to create the folder at this point if the system didn't create it
if
(
access
(
SECURE_DIR
,
F_OK
)
!=
0
)
xmkdir
(
SECURE_DIR
,
0700
);
// And reboot to make proper setup possible
reboot
();
}
if
(
!
pfs_done
||
safe_mode
)
return
;
...
...
@@ -310,10 +302,16 @@ void boot_complete(int client) {
collect_logs
(
false
);
if
(
!
pfs_done
||
safe_mode
)
if
(
safe_mode
)
return
;
auto_start_magiskhide
();
/* It's safe to create the folder at this point if the system didn't create it
* Magisk Manager should finish up the remaining environment setup */
if
(
access
(
SECURE_DIR
,
F_OK
)
!=
0
)
xmkdir
(
SECURE_DIR
,
0700
);
if
(
pfs_done
)
auto_start_magiskhide
();
if
(
access
(
MANAGERAPK
,
F_OK
)
==
0
)
{
// Install Magisk Manager if exists
...
...
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