From 2533a4fc4a07e8a58ca1c4d3b50314549a16844e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 8 Apr 2018 03:22:22 +0800 Subject: [PATCH] Fix APK installation on Android P --- native/jni/core/bootstages.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/native/jni/core/bootstages.c b/native/jni/core/bootstages.c index 329272972..0ce221802 100644 --- a/native/jni/core/bootstages.c +++ b/native/jni/core/bootstages.c @@ -124,15 +124,6 @@ static void bb_setenv(struct vector *v) { vec_push_back(v, NULL); } -static void pm_setenv(struct vector *v) { - for (int i = 0; environ[i]; ++i) { - if (strncmp(environ[i], "CLASSPATH=", 10) != 0) - vec_push_back(v, strdup(environ[i])); - } - vec_push_back(v, strdup("CLASSPATH=/system/framework/pm.jar")); - vec_push_back(v, NULL); -} - /*********** * Scripts * ***********/ @@ -651,11 +642,10 @@ core_only: setfilecon("/data/magisk.apk", "u:object_r:su_file:s0"); while (1) { sleep(5); + LOGD("apk_install: attempting to install APK"); int apk_res = -1, pid; - pid = exec_command(1, &apk_res, pm_setenv, - "app_process", - "/system/bin", "com.android.commands.pm.Pm", - "install", "-r", "/data/magisk.apk", NULL); + pid = exec_command(1, &apk_res, NULL, + "/system/bin/pm", "install", "-r", "/data/magisk.apk", NULL); if (pid != -1) { int err = 0; while (fdgets(buf, PATH_MAX, apk_res) > 0) {