From bde1df21adf264d3398b9f3274f353faa6399008 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 9 Feb 2018 11:12:22 -0800 Subject: Revert "Replace AssetManager with AssetManager2 implementation" This reverts commit 1187590da38457809dd368d4901c9c47ac5a6958. Bug: 73134570 Change-Id: I59b4d714e447478ea124f086356f127f42251fb7 --- rs/jni/android_renderscript_RenderScript.cpp | 30 ++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'rs') diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index 52d0e08e4e7f..b32be736533b 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -24,9 +24,8 @@ #include #include -#include #include -#include +#include #include #include @@ -1665,22 +1664,18 @@ nFileA3DCreateFromAssetStream(JNIEnv *_env, jobject _this, jlong con, jlong nati static jlong nFileA3DCreateFromAsset(JNIEnv *_env, jobject _this, jlong con, jobject _assetMgr, jstring _path) { - Guarded* mgr = AssetManagerForJavaObject(_env, _assetMgr); + AssetManager* mgr = assetManagerForJavaObject(_env, _assetMgr); if (mgr == nullptr) { return 0; } AutoJavaStringToUTF8 str(_env, _path); - std::unique_ptr asset; - { - ScopedLock locked_mgr(*mgr); - asset = locked_mgr->Open(str.c_str(), Asset::ACCESS_BUFFER); - if (asset == nullptr) { - return 0; - } + Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER); + if (asset == nullptr) { + return 0; } - jlong id = (jlong)(uintptr_t)rsaFileA3DCreateFromAsset((RsContext)con, asset.release()); + jlong id = (jlong)(uintptr_t)rsaFileA3DCreateFromAsset((RsContext)con, asset); return id; } @@ -1757,25 +1752,22 @@ static jlong nFontCreateFromAsset(JNIEnv *_env, jobject _this, jlong con, jobject _assetMgr, jstring _path, jfloat fontSize, jint dpi) { - Guarded* mgr = AssetManagerForJavaObject(_env, _assetMgr); + AssetManager* mgr = assetManagerForJavaObject(_env, _assetMgr); if (mgr == nullptr) { return 0; } AutoJavaStringToUTF8 str(_env, _path); - std::unique_ptr asset; - { - ScopedLock locked_mgr(*mgr); - asset = locked_mgr->Open(str.c_str(), Asset::ACCESS_BUFFER); - if (asset == nullptr) { - return 0; - } + Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER); + if (asset == nullptr) { + return 0; } jlong id = (jlong)(uintptr_t)rsFontCreateFromMemory((RsContext)con, str.c_str(), str.length(), fontSize, dpi, asset->getBuffer(false), asset->getLength()); + delete asset; return id; } -- cgit v1.2.3