Avoid hardcode package name

This commit is contained in:
vvb2060 2022-08-24 00:56:04 +08:00 committed by John Wu
parent f8395a7dc6
commit 77d8445bfd

View File

@ -154,7 +154,7 @@ constexpr char install_script[] = R"EOF(
APK=%s
log -t Magisk "pm_install: $APK"
log -t Magisk "pm_install: $(pm install -g -r $APK 2>&1)"
appops set com.topjohnwu.magisk REQUEST_INSTALL_PACKAGES allow
appops set %s REQUEST_INSTALL_PACKAGES allow
rm -f $APK
)EOF";
@ -164,7 +164,7 @@ void install_apk(const char *apk) {
.fork = fork_no_orphan
};
char cmds[sizeof(install_script) + 4096];
snprintf(cmds, sizeof(cmds), install_script, apk);
snprintf(cmds, sizeof(cmds), install_script, apk, JAVA_PACKAGE_NAME);
exec_command_sync(exec, "/system/bin/sh", "-c", cmds);
}