Merge "Fix ownership of objects returned by VintfObject::Get*"
This commit is contained in:
@@ -56,7 +56,7 @@ static inline jobjectArray toJavaStringArray(JNIEnv* env, const V& v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void tryAddSchema(const T* object, const XmlConverter<T>& converter,
|
static void tryAddSchema(const std::shared_ptr<const T>& object, const XmlConverter<T>& converter,
|
||||||
const std::string& description,
|
const std::string& description,
|
||||||
std::vector<std::string>* cStrings) {
|
std::vector<std::string>* cStrings) {
|
||||||
if (object == nullptr) {
|
if (object == nullptr) {
|
||||||
@@ -66,7 +66,7 @@ static void tryAddSchema(const T* object, const XmlConverter<T>& converter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tryAddHalNamesAndVersions(const HalManifest *manifest,
|
static void tryAddHalNamesAndVersions(const std::shared_ptr<const HalManifest>& manifest,
|
||||||
const std::string& description,
|
const std::string& description,
|
||||||
std::set<std::string> *output) {
|
std::set<std::string> *output) {
|
||||||
if (manifest == nullptr) {
|
if (manifest == nullptr) {
|
||||||
@@ -119,7 +119,7 @@ static jobjectArray android_os_VintfObject_getHalNamesAndVersions(JNIEnv* env, j
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jstring android_os_VintfObject_getSepolicyVersion(JNIEnv* env, jclass) {
|
static jstring android_os_VintfObject_getSepolicyVersion(JNIEnv* env, jclass) {
|
||||||
const HalManifest *manifest = VintfObject::GetDeviceHalManifest();
|
std::shared_ptr<const HalManifest> manifest = VintfObject::GetDeviceHalManifest();
|
||||||
if (manifest == nullptr || manifest->type() != SchemaType::DEVICE) {
|
if (manifest == nullptr || manifest->type() != SchemaType::DEVICE) {
|
||||||
LOG(WARNING) << __FUNCTION__ << "Cannot get device manifest";
|
LOG(WARNING) << __FUNCTION__ << "Cannot get device manifest";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -129,7 +129,7 @@ static jstring android_os_VintfObject_getSepolicyVersion(JNIEnv* env, jclass) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jobject android_os_VintfObject_getVndkSnapshots(JNIEnv* env, jclass) {
|
static jobject android_os_VintfObject_getVndkSnapshots(JNIEnv* env, jclass) {
|
||||||
const HalManifest *manifest = VintfObject::GetFrameworkHalManifest();
|
std::shared_ptr<const HalManifest> manifest = VintfObject::GetFrameworkHalManifest();
|
||||||
if (manifest == nullptr || manifest->type() != SchemaType::FRAMEWORK) {
|
if (manifest == nullptr || manifest->type() != SchemaType::FRAMEWORK) {
|
||||||
LOG(WARNING) << __FUNCTION__ << "Cannot get framework manifest";
|
LOG(WARNING) << __FUNCTION__ << "Cannot get framework manifest";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ using vintf::VintfObject;
|
|||||||
#define MAP_STRING_METHOD(javaMethod, cppString) \
|
#define MAP_STRING_METHOD(javaMethod, cppString) \
|
||||||
static jstring android_os_VintfRuntimeInfo_##javaMethod(JNIEnv* env, jclass clazz) \
|
static jstring android_os_VintfRuntimeInfo_##javaMethod(JNIEnv* env, jclass clazz) \
|
||||||
{ \
|
{ \
|
||||||
const RuntimeInfo *info = VintfObject::GetRuntimeInfo(); \
|
std::shared_ptr<const RuntimeInfo> info = VintfObject::GetRuntimeInfo(); \
|
||||||
if (info == nullptr) return nullptr; \
|
if (info == nullptr) return nullptr; \
|
||||||
return env->NewStringUTF((cppString).c_str()); \
|
return env->NewStringUTF((cppString).c_str()); \
|
||||||
} \
|
} \
|
||||||
@@ -50,7 +50,7 @@ MAP_STRING_METHOD(getBootVbmetaAvbVersion, vintf::to_string(info->bootVbmetaAvbV
|
|||||||
|
|
||||||
static jlong android_os_VintfRuntimeInfo_getKernelSepolicyVersion(JNIEnv *env, jclass clazz)
|
static jlong android_os_VintfRuntimeInfo_getKernelSepolicyVersion(JNIEnv *env, jclass clazz)
|
||||||
{
|
{
|
||||||
const RuntimeInfo *info = VintfObject::GetRuntimeInfo();
|
std::shared_ptr<const RuntimeInfo> info = VintfObject::GetRuntimeInfo();
|
||||||
if (info == nullptr) return 0;
|
if (info == nullptr) return 0;
|
||||||
return static_cast<jlong>(info->kernelSepolicyVersion());
|
return static_cast<jlong>(info->kernelSepolicyVersion());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user