AddSignatureToApiList(signature, membership);
size_t pos = signature.find("->"); if (pos != std::string::npos) { // Add the class name.
AddSignatureToApiList(signature.substr(0, pos), membership);
pos = signature.find('('); if (pos != std::string::npos) { // Add the class->method name (so stripping the signature).
AddSignatureToApiList(signature.substr(0, pos), membership);
}
pos = signature.find(':'); if (pos != std::string::npos) { // Add the class->field name (so stripping the type).
AddSignatureToApiList(signature.substr(0, pos), membership);
}
}
}
CHECK(!errors) << "Errors encountered while parsing file " << filename;
if (flagged_apis_file != nullptr) {
std::ifstream flagged_in(flagged_apis_file); if (flagged_in.fail()) {
LOG(WARNING) << "Could not open flagged apis file: " << flagged_apis_file; return;
}
for (std::string str; std::getline(flagged_in, str);) { // the input string is formatted as "signature,flag"
std::vector<std::string> values = android::base::Split(str, ","); if (values.size() < 2) {
LOG(WARNING) << "Invalid line in flagged apis file: " << str; continue;
}
// Remove the last semicolon if exist. // We are using the prefix matching with the flagged apis to match with // inner classes.
std::string& key = values[0]; if (!key.empty() && key.back() == ';') {
key.pop_back();
}
flagged_apis_.emplace(std::move(key), std::move(values[1]));
}
}
}
void HiddenApi::AddSignatureToApiList(const std::string& signature, hiddenapi::ApiList membership) { auto it = api_list_.find(signature); if (it == api_list_.end()) { // Does not exist yet. Add it to list.
api_list_.emplace(signature, membership);
} elseif (membership.GetMaxAllowedSdkVersion() < it->second.GetMaxAllowedSdkVersion()) { // Already exist but `membership` is more restrictive.
it->second = membership;
} else { // Already exists and `membership` is equally or less restrictive.
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.