You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
replace our implementation of applyStyle with a native function that calls into libandroidfw
also change a few things to work with latest libandroidfw, since we are now using it's helper functions that need to agree on e.g STYLE_NUM_ENTRIES with the Java code.
This commit is contained in:
@@ -349,6 +349,38 @@ JNIEXPORT jboolean JNICALL Java_android_content_res_AssetManager_resolveAttrs(JN
|
||||
return ret;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_android_content_res_AssetManager_retrieveAttributes(JNIEnv *env, jobject this,
|
||||
jlong parser_ptr,
|
||||
jintArray java_attrs, jint attrs_len,
|
||||
long out_values, long out_indices)
|
||||
{
|
||||
struct AssetManager *asset_manager = _PTR(_GET_LONG_FIELD(this, "mObject"));
|
||||
struct ResXMLParser *parser = (struct ResXMLParser *)_PTR(parser_ptr);
|
||||
|
||||
jint *attrs = (*env)->GetIntArrayElements(env, java_attrs, 0);
|
||||
|
||||
return RetrieveAttributes(asset_manager, parser, (uint32_t *)attrs, attrs_len, (uint32_t *)_PTR(out_values), (uint32_t *)_PTR(out_indices));
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, java_attrs, attrs, JNI_ABORT);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_content_res_AssetManager_applyStyle(JNIEnv *env, jclass this,
|
||||
jlong theme_ptr, jlong parser_ptr,
|
||||
jint def_style_attr, jint def_style_res,
|
||||
jintArray java_attrs, jint attrs_len,
|
||||
long out_values, long out_indices)
|
||||
{
|
||||
struct Theme *theme = _PTR(theme_ptr);
|
||||
struct ResXMLParser *parser = (struct ResXMLParser *)_PTR(parser_ptr);
|
||||
|
||||
jint *attrs = (*env)->GetIntArrayElements(env, java_attrs, 0);
|
||||
|
||||
ApplyStyle(theme, parser, def_style_attr, def_style_res, (uint32_t *)attrs, attrs_len, (uint32_t *)_PTR(out_values), (uint32_t *)_PTR(out_indices));
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, java_attrs, attrs, JNI_ABORT);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_getArraySize(JNIEnv *env, jobject this, jint ident)
|
||||
{
|
||||
struct AssetManager *asset_manager = _PTR(_GET_LONG_FIELD(this, "mObject"));
|
||||
|
||||
@@ -20,7 +20,7 @@ extern "C" {
|
||||
#undef android_content_res_AssetManager_DEBUG_REFS
|
||||
#define android_content_res_AssetManager_DEBUG_REFS 0L
|
||||
#undef android_content_res_AssetManager_STYLE_NUM_ENTRIES
|
||||
#define android_content_res_AssetManager_STYLE_NUM_ENTRIES 6L
|
||||
#define android_content_res_AssetManager_STYLE_NUM_ENTRIES 7L
|
||||
#undef android_content_res_AssetManager_STYLE_TYPE
|
||||
#define android_content_res_AssetManager_STYLE_TYPE 0L
|
||||
#undef android_content_res_AssetManager_STYLE_DATA
|
||||
@@ -33,6 +33,8 @@ extern "C" {
|
||||
#define android_content_res_AssetManager_STYLE_CHANGING_CONFIGURATIONS 4L
|
||||
#undef android_content_res_AssetManager_STYLE_DENSITY
|
||||
#define android_content_res_AssetManager_STYLE_DENSITY 5L
|
||||
#undef android_content_res_AssetManager_STYLE_SOURCE_RESOURCE_ID
|
||||
#define android_content_res_AssetManager_STYLE_SOURCE_RESOURCE_ID 6L
|
||||
/*
|
||||
* Class: android_content_res_AssetManager
|
||||
* Method: getPooledString
|
||||
@@ -209,6 +211,14 @@ JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_loadResourceValue
|
||||
JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_loadResourceBagValue
|
||||
(JNIEnv *, jobject, jint, jint, jobject, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_content_res_AssetManager
|
||||
* Method: applyStyle
|
||||
* Signature: (JJII[IIJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_content_res_AssetManager_applyStyle
|
||||
(JNIEnv *, jclass, jlong, jlong, jint, jint, jintArray, jint, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_content_res_AssetManager
|
||||
* Method: resolveAttrs
|
||||
@@ -217,6 +227,14 @@ JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_loadResourceBagValu
|
||||
JNIEXPORT jboolean JNICALL Java_android_content_res_AssetManager_resolveAttrs
|
||||
(JNIEnv *, jclass, jlong, jint, jint, jintArray, jintArray, jintArray, jintArray);
|
||||
|
||||
/*
|
||||
* Class: android_content_res_AssetManager
|
||||
* Method: retrieveAttributes
|
||||
* Signature: (J[IIJJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_content_res_AssetManager_retrieveAttributes
|
||||
(JNIEnv *, jobject, jlong, jintArray, jint, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_content_res_AssetManager
|
||||
* Method: getArraySize
|
||||
|
||||
Reference in New Issue
Block a user