Merge "Move registration of AssetManager.mObject to zygote." into pi-dev
am: 85ec63532f Change-Id: I5f8035cb13d51a038b81ddc779e2881f683eb200
This commit is contained in:
commit
5652b43cca
@ -75,9 +75,8 @@ static struct assetfiledescriptor_offsets_t {
|
||||
jfieldID mLength;
|
||||
} gAssetFileDescriptorOffsets;
|
||||
|
||||
static struct assetmanager_offsets_t {
|
||||
jfieldID mObject;
|
||||
} gAssetManagerOffsets;
|
||||
// This is also used by asset_manager.cpp.
|
||||
assetmanager_offsets_t gAssetManagerOffsets;
|
||||
|
||||
static struct {
|
||||
jfieldID native_ptr;
|
||||
|
@ -27,6 +27,11 @@ namespace android {
|
||||
extern AAssetManager* NdkAssetManagerForJavaObject(JNIEnv* env, jobject jassetmanager);
|
||||
extern Guarded<AssetManager2>* AssetManagerForJavaObject(JNIEnv* env, jobject jassetmanager);
|
||||
extern Guarded<AssetManager2>* AssetManagerForNdkAssetManager(AAssetManager* assetmanager);
|
||||
struct assetmanager_offsets_t
|
||||
{
|
||||
jfieldID mObject;
|
||||
};
|
||||
extern assetmanager_offsets_t gAssetManagerOffsets;
|
||||
|
||||
} // namespace android
|
||||
|
||||
|
@ -55,33 +55,11 @@ struct AAsset {
|
||||
|
||||
// -------------------- Public native C API --------------------
|
||||
|
||||
/**
|
||||
* Supporting information
|
||||
*/
|
||||
|
||||
static struct assetmanager_offsets_t
|
||||
{
|
||||
jfieldID mObject;
|
||||
} gAssetManagerOffsets;
|
||||
|
||||
static volatile bool gJNIConfigured = false;
|
||||
static Mutex gMutex;
|
||||
|
||||
/**
|
||||
* Asset Manager functionality
|
||||
*/
|
||||
AAssetManager* AAssetManager_fromJava(JNIEnv* env, jobject assetManager)
|
||||
{
|
||||
{
|
||||
Mutex::Autolock _l(gMutex);
|
||||
|
||||
if (gJNIConfigured == false) {
|
||||
jclass amClass = env->FindClass("android/content/res/AssetManager");
|
||||
gAssetManagerOffsets.mObject = env->GetFieldID(amClass, "mObject", "J");
|
||||
gJNIConfigured = true;
|
||||
}
|
||||
}
|
||||
|
||||
return (AAssetManager*) env->GetLongField(assetManager, gAssetManagerOffsets.mObject);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user