mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-13 13:47:44 +02:00
Add new boot service: boot-complete
This commit is contained in:
@ -872,15 +872,13 @@ core_only:
|
||||
|
||||
// All boot stage done, cleanup
|
||||
vec_deep_destroy(&module_list);
|
||||
|
||||
// Wait for boot complete, and clear boot count
|
||||
while (1) {
|
||||
char *prop = getprop("sys.boot_completed");
|
||||
if (prop != NULL && strcmp(prop, "1") == 0) {
|
||||
free(prop);
|
||||
unlink(BOOTCOUNT);
|
||||
break;
|
||||
}
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
|
||||
void boot_complete(int client) {
|
||||
LOGI("** boot_complete triggered\n");
|
||||
// ack
|
||||
write_int(client, 0);
|
||||
close(client);
|
||||
|
||||
unlink(BOOTCOUNT);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ static void *request_handler(void *args) {
|
||||
case LS_HIDELIST:
|
||||
case POST_FS_DATA:
|
||||
case LATE_START:
|
||||
case BOOT_COMPLETE:
|
||||
if (credential.uid != 0) {
|
||||
write_int(client, ROOT_REQUIRED);
|
||||
close(client);
|
||||
@ -82,6 +83,9 @@ static void *request_handler(void *args) {
|
||||
case LATE_START:
|
||||
late_start(client);
|
||||
break;
|
||||
case BOOT_COMPLETE:
|
||||
boot_complete(client);
|
||||
break;
|
||||
case HANDSHAKE:
|
||||
/* Do NOT close the client, make it hold */
|
||||
break;
|
||||
|
@ -50,7 +50,7 @@ static void usage() {
|
||||
" --clone-attr SRC DEST clone permission, owner, and selinux context\n"
|
||||
"\n"
|
||||
"Supported init triggers:\n"
|
||||
" startup, post-fs-data, service\n"
|
||||
" startup, post-fs-data, service, boot-complete\n"
|
||||
"\n"
|
||||
"Supported applets:\n");
|
||||
|
||||
@ -111,6 +111,10 @@ int magisk_main(int argc, char *argv[]) {
|
||||
int fd = connect_daemon();
|
||||
write_int(fd, LATE_START);
|
||||
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
|
||||
|
Reference in New Issue
Block a user