From f4f69971d0d688726be0d56feee77eb5ede38ecb Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 16 Apr 2021 19:29:35 -0700 Subject: [PATCH] VintfObject: use toXml. Test: builds & boots Test: run CTS device info collect Bug: 179270601 Depends-On: I6c90991c5b9c95801e0b92fb166de7d68bd949c2 Change-Id: I4fc55d06c4d5959a989669bf41e21982f67db207 --- core/jni/android_os_VintfObject.cpp | 31 ++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/core/jni/android_os_VintfObject.cpp b/core/jni/android_os_VintfObject.cpp index 25ffbabd6199a..4bd33a9cbd3bc 100644 --- a/core/jni/android_os_VintfObject.cpp +++ b/core/jni/android_os_VintfObject.cpp @@ -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 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 -static void tryAddSchema(const std::shared_ptr& object, const XmlConverter& converter, - const std::string& description, - std::vector* cStrings) { +template +static void tryAddSchema(const std::shared_ptr& object, const std::string& description, + std::vector* 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 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); }