Fallback to getprop to get SDK_INT

Close #2274, close #2279
This commit is contained in:
topjohnwu 2020-02-03 12:58:59 +08:00
parent 0586760347
commit ebdd6ec40c

View File

@ -138,6 +138,14 @@ static void main_daemon() {
}
return true;
});
if (SDK_INT < 0) {
// In case some devices do not store this info in build.prop, fallback to getprop
auto sdk = getprop("ro.build.version.sdk");
if (!sdk.empty()) {
LOGI("* Device API level: %s\n", sdk.data());
SDK_INT = parse_int(sdk);
}
}
// Load config status
parse_prop_file(MAGISKTMP "/config", [](auto key, auto val) -> bool {