diff options
author | 2017-09-05 21:45:13 +0000 | |
---|---|---|
committer | 2017-09-05 21:45:13 +0000 | |
commit | 2cdd1ce6001e642f65456f6504cbb7d11cd1469d (patch) | |
tree | fcda390559f132fd7df2d10494691587599b2c11 | |
parent | d8f298365a34d91340030ef81acc18fdf128fd01 (diff) | |
parent | d666d5b0f638a1ba06f8f8662cb5e5011659389f (diff) |
Merge "Fix ownership of objects returned by VintfObject::Get*"
-rw-r--r-- | core/jni/android_os_VintfObject.cpp | 8 | ||||
-rw-r--r-- | core/jni/android_os_VintfRuntimeInfo.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/jni/android_os_VintfObject.cpp b/core/jni/android_os_VintfObject.cpp index 7ec4b8ea0799..5ef2a9e6465c 100644 --- a/core/jni/android_os_VintfObject.cpp +++ b/core/jni/android_os_VintfObject.cpp @@ -56,7 +56,7 @@ static inline jobjectArray toJavaStringArray(JNIEnv* env, const V& v) { } 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, std::vector<std::string>* cStrings) { 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, std::set<std::string> *output) { 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) { - const HalManifest *manifest = VintfObject::GetDeviceHalManifest(); + std::shared_ptr<const HalManifest> manifest = VintfObject::GetDeviceHalManifest(); if (manifest == nullptr || manifest->type() != SchemaType::DEVICE) { LOG(WARNING) << __FUNCTION__ << "Cannot get device manifest"; return nullptr; @@ -129,7 +129,7 @@ static jstring android_os_VintfObject_getSepolicyVersion(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) { LOG(WARNING) << __FUNCTION__ << "Cannot get framework manifest"; return nullptr; diff --git a/core/jni/android_os_VintfRuntimeInfo.cpp b/core/jni/android_os_VintfRuntimeInfo.cpp index 19220cf05adb..315eac1b9414 100644 --- a/core/jni/android_os_VintfRuntimeInfo.cpp +++ b/core/jni/android_os_VintfRuntimeInfo.cpp @@ -32,7 +32,7 @@ using vintf::VintfObject; #define MAP_STRING_METHOD(javaMethod, cppString) \ 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; \ 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) { - const RuntimeInfo *info = VintfObject::GetRuntimeInfo(); + std::shared_ptr<const RuntimeInfo> info = VintfObject::GetRuntimeInfo(); if (info == nullptr) return 0; return static_cast<jlong>(info->kernelSepolicyVersion()); } |