mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-04 18:57:39 +00:00
Add new boot service: boot-complete
This commit is contained in:
parent
bdff9769be
commit
d3858b81e2
@ -872,15 +872,13 @@ core_only:
|
|||||||
|
|
||||||
// All boot stage done, cleanup
|
// All boot stage done, cleanup
|
||||||
vec_deep_destroy(&module_list);
|
vec_deep_destroy(&module_list);
|
||||||
|
}
|
||||||
// Wait for boot complete, and clear boot count
|
|
||||||
while (1) {
|
void boot_complete(int client) {
|
||||||
char *prop = getprop("sys.boot_completed");
|
LOGI("** boot_complete triggered\n");
|
||||||
if (prop != NULL && strcmp(prop, "1") == 0) {
|
// ack
|
||||||
free(prop);
|
write_int(client, 0);
|
||||||
unlink(BOOTCOUNT);
|
close(client);
|
||||||
break;
|
|
||||||
}
|
unlink(BOOTCOUNT);
|
||||||
sleep(2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ static void *request_handler(void *args) {
|
|||||||
case LS_HIDELIST:
|
case LS_HIDELIST:
|
||||||
case POST_FS_DATA:
|
case POST_FS_DATA:
|
||||||
case LATE_START:
|
case LATE_START:
|
||||||
|
case BOOT_COMPLETE:
|
||||||
if (credential.uid != 0) {
|
if (credential.uid != 0) {
|
||||||
write_int(client, ROOT_REQUIRED);
|
write_int(client, ROOT_REQUIRED);
|
||||||
close(client);
|
close(client);
|
||||||
@ -82,6 +83,9 @@ static void *request_handler(void *args) {
|
|||||||
case LATE_START:
|
case LATE_START:
|
||||||
late_start(client);
|
late_start(client);
|
||||||
break;
|
break;
|
||||||
|
case BOOT_COMPLETE:
|
||||||
|
boot_complete(client);
|
||||||
|
break;
|
||||||
case HANDSHAKE:
|
case HANDSHAKE:
|
||||||
/* Do NOT close the client, make it hold */
|
/* Do NOT close the client, make it hold */
|
||||||
break;
|
break;
|
||||||
|
@ -50,7 +50,7 @@ static void usage() {
|
|||||||
" --clone-attr SRC DEST clone permission, owner, and selinux context\n"
|
" --clone-attr SRC DEST clone permission, owner, and selinux context\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Supported init triggers:\n"
|
"Supported init triggers:\n"
|
||||||
" startup, post-fs-data, service\n"
|
" startup, post-fs-data, service, boot-complete\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Supported applets:\n");
|
"Supported applets:\n");
|
||||||
|
|
||||||
@ -111,6 +111,10 @@ int magisk_main(int argc, char *argv[]) {
|
|||||||
int fd = connect_daemon();
|
int fd = connect_daemon();
|
||||||
write_int(fd, LATE_START);
|
write_int(fd, LATE_START);
|
||||||
return read_int(fd);
|
return read_int(fd);
|
||||||
|
} else if (strcmp(argv[1], "--boot-complete") == 0) {
|
||||||
|
int fd = connect_daemon();
|
||||||
|
write_int(fd, BOOT_COMPLETE);
|
||||||
|
return read_int(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applets
|
// Applets
|
||||||
|
@ -19,6 +19,7 @@ enum {
|
|||||||
CHECK_VERSION_CODE,
|
CHECK_VERSION_CODE,
|
||||||
POST_FS_DATA,
|
POST_FS_DATA,
|
||||||
LATE_START,
|
LATE_START,
|
||||||
|
BOOT_COMPLETE,
|
||||||
LAUNCH_MAGISKHIDE,
|
LAUNCH_MAGISKHIDE,
|
||||||
STOP_MAGISKHIDE,
|
STOP_MAGISKHIDE,
|
||||||
ADD_HIDELIST,
|
ADD_HIDELIST,
|
||||||
@ -73,6 +74,7 @@ void write_string(int fd, const char* val);
|
|||||||
void startup();
|
void startup();
|
||||||
void post_fs_data(int client);
|
void post_fs_data(int client);
|
||||||
void late_start(int client);
|
void late_start(int client);
|
||||||
|
void boot_complete(int client);
|
||||||
|
|
||||||
/**************
|
/**************
|
||||||
* MagiskHide *
|
* MagiskHide *
|
||||||
|
@ -6,31 +6,41 @@ const char magiskrc[] =
|
|||||||
// Triggers
|
// Triggers
|
||||||
|
|
||||||
"on post-fs-data\n"
|
"on post-fs-data\n"
|
||||||
" start logd\n"
|
" start logd\n"
|
||||||
" load_persist_props\n"
|
" load_persist_props\n"
|
||||||
" rm "UNBLOCKFILE"\n"
|
" rm "UNBLOCKFILE"\n"
|
||||||
" start magisk_startup\n"
|
" start magisk_startup\n"
|
||||||
" wait "UNBLOCKFILE" 10\n"
|
" wait "UNBLOCKFILE" 10\n"
|
||||||
" rm "UNBLOCKFILE"\n"
|
" rm "UNBLOCKFILE"\n"
|
||||||
|
"\n"
|
||||||
|
|
||||||
|
"on property:sys.boot_completed=1\n"
|
||||||
|
" start magisk_bc\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
|
|
||||||
"service magisk_daemon /sbin/magisk --daemon\n"
|
"service magisk_daemon /sbin/magisk --daemon\n"
|
||||||
" user root\n"
|
" user root\n"
|
||||||
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
||||||
" oneshot\n"
|
" oneshot\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
"service magisk_startup /sbin/magisk --startup\n"
|
"service magisk_startup /sbin/magisk --startup\n"
|
||||||
" user root\n"
|
" user root\n"
|
||||||
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
||||||
" oneshot\n"
|
" oneshot\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
"service magisk_service /sbin/magisk --service\n"
|
"service magisk_service /sbin/magisk --service\n"
|
||||||
" class late_start\n"
|
" class late_start\n"
|
||||||
" user root\n"
|
" user root\n"
|
||||||
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
||||||
" oneshot\n"
|
" oneshot\n"
|
||||||
|
"\n"
|
||||||
|
|
||||||
|
"service magisk_bc /sbin/magisk --boot-complete\n"
|
||||||
|
" user root\n"
|
||||||
|
" seclabel u:r:"SEPOL_PROC_DOMAIN":s0\n"
|
||||||
|
" oneshot\n"
|
||||||
;
|
;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user