Skip to content

Commit

Permalink
Remove remaining cross-fork API compatibility hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
osm0sis committed Dec 21, 2023
1 parent dc10cae commit 89348bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
20 changes: 2 additions & 18 deletions app/src/main/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,32 +178,16 @@ class PlayIntegrityFix : public zygisk::ModuleBase {
void readJson() {
LOGD("JSON contains %d keys!", static_cast<int>(json.size()));

// Verbose logging if VERBOSE_LOGS with level number is last entry
if (json.contains("VERBOSE_LOGS")) {
if (!json["VERBOSE_LOGS"].is_null() && json["VERBOSE_LOGS"].is_string()) {
if (!json["VERBOSE_LOGS"].is_null() && json["VERBOSE_LOGS"].is_string() && json["VERBOSE_LOGS"] != "") {
VERBOSE_LOGS = stoi(json["VERBOSE_LOGS"].get<std::string>());
if (VERBOSE_LOGS > 0) LOGD("Verbose logging (level %d) enabled!", VERBOSE_LOGS);
} else {
LOGD("Error parsing VERBOSE_LOGS!");
}
}

// Backwards compatibility for chiteroman's alternate API naming
if (json.contains("FIRST_API_LEVEL")) {
if (!json["FIRST_API_LEVEL"].is_null() && json["FIRST_API_LEVEL"].is_string()) {
if (json["FIRST_API_LEVEL"] == "") {
LOGD("FIRST_API_LEVEL is empty, skipping...");
json.erase("FIRST_API_LEVEL");
} else {
LOGD("Using deprecated 'FIRST_API_LEVEL' field for '*.first_api_level' direct property spoofing...");
if (VERBOSE_LOGS > 0) LOGD("Adding '*.first_api_level' to properties list");
jsonProps["*.first_api_level"] = json["FIRST_API_LEVEL"].get<std::string>();
}
} else {
LOGD("Error parsing FIRST_API_LEVEL!");
json.erase("FIRST_API_LEVEL");
}
}

std::vector<std::string> eraseKeys;
for (auto &jsonList: json.items()) {
if (VERBOSE_LOGS > 1) LOGD("Parsing %s...", jsonList.key().c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ static void spoofDevice() {
// Verbose logging if VERBOSE_LOGS with level number is last entry
if (key.equals("VERBOSE_LOGS")) {
verboseLogs = Integer.parseInt(map.get("VERBOSE_LOGS"));
// Backwards compatibility for chiteroman's alternate API naming
} else if (key.equals("FIRST_API_LEVEL")) {
setField("DEVICE_INITIAL_SDK_INT", map.get("FIRST_API_LEVEL"));
} else {
setField(key, map.get(key));
}
Expand Down

0 comments on commit 89348bb

Please sign in to comment.