From f1295cb7d68b903b2e840dd0853bf025a7aabad8 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 26 Jan 2021 02:16:11 -0800 Subject: [PATCH] Fix root on Android 7.0 and lower --- native/jni/core/restorecon.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/native/jni/core/restorecon.cpp b/native/jni/core/restorecon.cpp index 001ae1674..a819e55b0 100644 --- a/native/jni/core/restorecon.cpp +++ b/native/jni/core/restorecon.cpp @@ -96,6 +96,8 @@ void restore_tmpcon() { for (dirent *entry; (entry = xreaddir(dir.get()));) setfilecon_at(dfd, entry->d_name, SYSTEM_CON); - string magisk = MAGISKTMP + "/magisk"; - setfilecon(magisk.data(), EXEC_CON); + if (SDK_INT >= 26) { + string magisk = MAGISKTMP + "/magisk"; + setfilecon(magisk.data(), EXEC_CON); + } }