Merge "VintfObject: use toXml." am: e8456d8ded am: c3a768efaf am: 4d601b8a2e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1678425

Change-Id: I60f9090bf4c9f0014b56feb1a14aa96b6ec7a84e
This commit is contained in:
Yifan Hong
2021-04-21 19:32:30 +00:00
committed by Automerger Merge Worker

View File

@@ -40,12 +40,10 @@ namespace android {
using vintf::HalManifest;
using vintf::Level;
using vintf::SchemaType;
using vintf::VintfObject;
using vintf::XmlConverter;
using vintf::Vndk;
using vintf::gHalManifestConverter;
using vintf::gCompatibilityMatrixConverter;
using vintf::to_string;
using vintf::toXml;
using vintf::VintfObject;
using vintf::Vndk;
template<typename V>
static inline jobjectArray toJavaStringArray(JNIEnv* env, const V& v) {
@@ -58,14 +56,13 @@ static inline jobjectArray toJavaStringArray(JNIEnv* env, const V& v) {
return ret;
}
template<typename T>
static void tryAddSchema(const std::shared_ptr<const T>& object, const XmlConverter<T>& converter,
const std::string& description,
std::vector<std::string>* cStrings) {
template <typename T>
static void tryAddSchema(const std::shared_ptr<const T>& object, const std::string& description,
std::vector<std::string>* cStrings) {
if (object == nullptr) {
LOG(WARNING) << __FUNCTION__ << "Cannot get " << description;
} else {
cStrings->push_back(converter(*object));
cStrings->push_back(toXml(*object));
}
}
@@ -84,14 +81,12 @@ static jobjectArray android_os_VintfObject_report(JNIEnv* env, jclass)
{
std::vector<std::string> cStrings;
tryAddSchema(VintfObject::GetDeviceHalManifest(), gHalManifestConverter,
"device manifest", &cStrings);
tryAddSchema(VintfObject::GetFrameworkHalManifest(), gHalManifestConverter,
"framework manifest", &cStrings);
tryAddSchema(VintfObject::GetDeviceCompatibilityMatrix(), gCompatibilityMatrixConverter,
"device compatibility matrix", &cStrings);
tryAddSchema(VintfObject::GetFrameworkCompatibilityMatrix(), gCompatibilityMatrixConverter,
"framework compatibility matrix", &cStrings);
tryAddSchema(VintfObject::GetDeviceHalManifest(), "device manifest", &cStrings);
tryAddSchema(VintfObject::GetFrameworkHalManifest(), "framework manifest", &cStrings);
tryAddSchema(VintfObject::GetDeviceCompatibilityMatrix(), "device compatibility matrix",
&cStrings);
tryAddSchema(VintfObject::GetFrameworkCompatibilityMatrix(), "framework compatibility matrix",
&cStrings);
return toJavaStringArray(env, cStrings);
}