blob: 03de5c0a1cd918a3895a793d48902358afe4a91d [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/* //device/libs/android_runtime/android_util_XmlBlock.cpp
2**
3** Copyright 2006, The Android Open Source Project
4**
Elliott Hughes8451b252011-04-07 19:17:57 -07005** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008**
Elliott Hughes8451b252011-04-07 19:17:57 -07009** http://www.apache.org/licenses/LICENSE-2.0
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080010**
Elliott Hughes8451b252011-04-07 19:17:57 -070011** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080015** limitations under the License.
16*/
17
18#define LOG_TAG "XmlBlock"
19
20#include "jni.h"
Elliott Hughes8451b252011-04-07 19:17:57 -070021#include "JNIHelp.h"
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022#include <android_runtime/AndroidRuntime.h>
Mathias Agopianb13b9bd2012-02-17 18:27:36 -080023#include <androidfw/AssetManager.h>
24#include <androidfw/ResourceTypes.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025#include <utils/Log.h>
Mathias Agopianb13b9bd2012-02-17 18:27:36 -080026#include <utils/misc.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027
28#include <stdio.h>
29
30namespace android {
31
32// ----------------------------------------------------------------------------
33
Ashok Bhat896043d2014-01-17 16:02:38 +000034static jlong android_content_XmlBlock_nativeCreate(JNIEnv* env, jobject clazz,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035 jbyteArray bArray,
36 jint off, jint len)
37{
38 if (bArray == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -070039 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040 return 0;
41 }
42
43 jsize bLen = env->GetArrayLength(bArray);
44 if (off < 0 || off >= bLen || len < 0 || len > bLen || (off+len) > bLen) {
Elliott Hughes8451b252011-04-07 19:17:57 -070045 jniThrowException(env, "java/lang/IndexOutOfBoundsException", NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046 return 0;
47 }
48
49 jbyte* b = env->GetByteArrayElements(bArray, NULL);
50 ResXMLTree* osb = new ResXMLTree(b+off, len, true);
51 env->ReleaseByteArrayElements(bArray, b, 0);
52
53 if (osb == NULL || osb->getError() != NO_ERROR) {
Elliott Hughes8451b252011-04-07 19:17:57 -070054 jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 return 0;
56 }
57
Ashok Bhat896043d2014-01-17 16:02:38 +000058 return reinterpret_cast<jlong>(osb);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059}
60
Ashok Bhat896043d2014-01-17 16:02:38 +000061static jlong android_content_XmlBlock_nativeGetStringBlock(JNIEnv* env, jobject clazz,
62 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063{
Ashok Bhat896043d2014-01-17 16:02:38 +000064 ResXMLTree* osb = reinterpret_cast<ResXMLTree*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 if (osb == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -070066 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return 0;
68 }
69
Ashok Bhat896043d2014-01-17 16:02:38 +000070 return reinterpret_cast<jlong>(&osb->getStrings());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071}
72
Ashok Bhat896043d2014-01-17 16:02:38 +000073static jlong android_content_XmlBlock_nativeCreateParseState(JNIEnv* env, jobject clazz,
74 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075{
Ashok Bhat896043d2014-01-17 16:02:38 +000076 ResXMLTree* osb = reinterpret_cast<ResXMLTree*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 if (osb == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -070078 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079 return 0;
80 }
81
82 ResXMLParser* st = new ResXMLParser(*osb);
83 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -070084 jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 return 0;
86 }
87
88 st->restart();
89
Ashok Bhat896043d2014-01-17 16:02:38 +000090 return reinterpret_cast<jlong>(st);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091}
92
93static jint android_content_XmlBlock_nativeNext(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +000094 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095{
Ashok Bhat896043d2014-01-17 16:02:38 +000096 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 if (st == NULL) {
98 return ResXMLParser::END_DOCUMENT;
99 }
100
101 do {
Ashok Bhat896043d2014-01-17 16:02:38 +0000102 ResXMLParser::event_code_t code = st->next();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 switch (code) {
104 case ResXMLParser::START_TAG:
105 return 2;
106 case ResXMLParser::END_TAG:
107 return 3;
108 case ResXMLParser::TEXT:
109 return 4;
110 case ResXMLParser::START_DOCUMENT:
111 return 0;
112 case ResXMLParser::END_DOCUMENT:
113 return 1;
114 case ResXMLParser::BAD_DOCUMENT:
115 goto bad;
116 }
117 } while (true);
Elliott Hughes8451b252011-04-07 19:17:57 -0700118
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119bad:
Elliott Hughes8451b252011-04-07 19:17:57 -0700120 jniThrowException(env, "org/xmlpull/v1/XmlPullParserException",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 "Corrupt XML binary file");
122 return ResXMLParser::BAD_DOCUMENT;
123}
124
125static jint android_content_XmlBlock_nativeGetNamespace(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000126 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127{
Ashok Bhat896043d2014-01-17 16:02:38 +0000128 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 if (st == NULL) {
130 return -1;
131 }
Elliott Hughes8451b252011-04-07 19:17:57 -0700132
Ashok Bhat896043d2014-01-17 16:02:38 +0000133 return static_cast<jint>(st->getElementNamespaceID());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134}
135
136static jint android_content_XmlBlock_nativeGetName(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000137 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138{
Ashok Bhat896043d2014-01-17 16:02:38 +0000139 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800140 if (st == NULL) {
141 return -1;
142 }
143
Ashok Bhat896043d2014-01-17 16:02:38 +0000144 return static_cast<jint>(st->getElementNameID());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800145}
146
147static jint android_content_XmlBlock_nativeGetText(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000148 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149{
Ashok Bhat896043d2014-01-17 16:02:38 +0000150 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800151 if (st == NULL) {
152 return -1;
153 }
154
Ashok Bhat896043d2014-01-17 16:02:38 +0000155 return static_cast<jint>(st->getTextID());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156}
157
158static jint android_content_XmlBlock_nativeGetLineNumber(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000159 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160{
Ashok Bhat896043d2014-01-17 16:02:38 +0000161 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800162 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700163 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 return 0;
165 }
166
Ashok Bhat896043d2014-01-17 16:02:38 +0000167 return static_cast<jint>(st->getLineNumber());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168}
169
170static jint android_content_XmlBlock_nativeGetAttributeCount(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000171 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172{
Ashok Bhat896043d2014-01-17 16:02:38 +0000173 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700175 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800176 return 0;
177 }
178
Ashok Bhat896043d2014-01-17 16:02:38 +0000179 return static_cast<jint>(st->getAttributeCount());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180}
181
182static jint android_content_XmlBlock_nativeGetAttributeNamespace(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000183 jlong token, jint idx)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184{
Ashok Bhat896043d2014-01-17 16:02:38 +0000185 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800186 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700187 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800188 return 0;
189 }
Elliott Hughes8451b252011-04-07 19:17:57 -0700190
Ashok Bhat896043d2014-01-17 16:02:38 +0000191 return static_cast<jint>(st->getAttributeNamespaceID(idx));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192}
193
194static jint android_content_XmlBlock_nativeGetAttributeName(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000195 jlong token, jint idx)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196{
Ashok Bhat896043d2014-01-17 16:02:38 +0000197 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800198 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700199 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200 return 0;
201 }
202
Ashok Bhat896043d2014-01-17 16:02:38 +0000203 return static_cast<jint>(st->getAttributeNameID(idx));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800204}
205
206static jint android_content_XmlBlock_nativeGetAttributeResource(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000207 jlong token, jint idx)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208{
Ashok Bhat896043d2014-01-17 16:02:38 +0000209 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800210 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700211 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800212 return 0;
213 }
214
Ashok Bhat896043d2014-01-17 16:02:38 +0000215 return static_cast<jint>(st->getAttributeNameResID(idx));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216}
217
218static jint android_content_XmlBlock_nativeGetAttributeDataType(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000219 jlong token, jint idx)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800220{
Ashok Bhat896043d2014-01-17 16:02:38 +0000221 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700223 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800224 return 0;
225 }
226
Ashok Bhat896043d2014-01-17 16:02:38 +0000227 return static_cast<jint>(st->getAttributeDataType(idx));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800228}
229
230static jint android_content_XmlBlock_nativeGetAttributeData(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000231 jlong token, jint idx)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800232{
Ashok Bhat896043d2014-01-17 16:02:38 +0000233 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700235 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800236 return 0;
237 }
238
Ashok Bhat896043d2014-01-17 16:02:38 +0000239 return static_cast<jint>(st->getAttributeData(idx));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800240}
241
242static jint android_content_XmlBlock_nativeGetAttributeStringValue(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000243 jlong token, jint idx)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244{
Ashok Bhat896043d2014-01-17 16:02:38 +0000245 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700247 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 return 0;
249 }
250
Ashok Bhat896043d2014-01-17 16:02:38 +0000251 return static_cast<jint>(st->getAttributeValueStringID(idx));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800252}
253
254static jint android_content_XmlBlock_nativeGetAttributeIndex(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000255 jlong token,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800256 jstring ns, jstring name)
257{
Ashok Bhat896043d2014-01-17 16:02:38 +0000258 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800259 if (st == NULL || name == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700260 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800261 return 0;
262 }
263
264 const char16_t* ns16 = NULL;
265 jsize nsLen = 0;
266 if (ns) {
267 ns16 = env->GetStringChars(ns, NULL);
268 nsLen = env->GetStringLength(ns);
269 }
Elliott Hughes8451b252011-04-07 19:17:57 -0700270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 const char16_t* name16 = env->GetStringChars(name, NULL);
272 jsize nameLen = env->GetStringLength(name);
273
Ashok Bhat896043d2014-01-17 16:02:38 +0000274 jint idx = static_cast<jint>(st->indexOfAttribute(ns16, nsLen, name16, nameLen));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275
276 if (ns) {
277 env->ReleaseStringChars(ns, ns16);
278 }
279 env->ReleaseStringChars(name, name16);
280
281 return idx;
282}
283
284static jint android_content_XmlBlock_nativeGetIdAttribute(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000285 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800286{
Ashok Bhat896043d2014-01-17 16:02:38 +0000287 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700289 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800290 return 0;
291 }
292
293 ssize_t idx = st->indexOfID();
Ashok Bhat896043d2014-01-17 16:02:38 +0000294 return idx >= 0 ? static_cast<jint>(st->getAttributeValueStringID(idx)) : -1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295}
296
297static jint android_content_XmlBlock_nativeGetClassAttribute(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000298 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299{
Ashok Bhat896043d2014-01-17 16:02:38 +0000300 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700302 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303 return 0;
304 }
Elliott Hughes8451b252011-04-07 19:17:57 -0700305
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 ssize_t idx = st->indexOfClass();
Ashok Bhat896043d2014-01-17 16:02:38 +0000307 return idx >= 0 ? static_cast<jint>(st->getAttributeValueStringID(idx)) : -1;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308}
309
310static jint android_content_XmlBlock_nativeGetStyleAttribute(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000311 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800312{
Ashok Bhat896043d2014-01-17 16:02:38 +0000313 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800314 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700315 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800316 return 0;
317 }
318
319 ssize_t idx = st->indexOfStyle();
320 if (idx < 0) {
321 return 0;
322 }
323
324 Res_value value;
325 if (st->getAttributeValue(idx, &value) < 0) {
326 return 0;
327 }
328
Elliott Hughes8451b252011-04-07 19:17:57 -0700329 return value.dataType == value.TYPE_REFERENCE
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800330 || value.dataType == value.TYPE_ATTRIBUTE
331 ? value.data : 0;
332}
333
334static void android_content_XmlBlock_nativeDestroyParseState(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000335 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336{
Ashok Bhat896043d2014-01-17 16:02:38 +0000337 ResXMLParser* st = reinterpret_cast<ResXMLParser*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 if (st == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700339 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 return;
341 }
342
343 delete st;
344}
345
346static void android_content_XmlBlock_nativeDestroy(JNIEnv* env, jobject clazz,
Ashok Bhat896043d2014-01-17 16:02:38 +0000347 jlong token)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348{
Ashok Bhat896043d2014-01-17 16:02:38 +0000349 ResXMLTree* osb = reinterpret_cast<ResXMLTree*>(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 if (osb == NULL) {
Elliott Hughes8451b252011-04-07 19:17:57 -0700351 jniThrowNullPointerException(env, NULL);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 return;
353 }
354
355 delete osb;
356}
357
358// ----------------------------------------------------------------------------
359
360/*
361 * JNI registration.
362 */
363static JNINativeMethod gXmlBlockMethods[] = {
364 /* name, signature, funcPtr */
Ashok Bhat896043d2014-01-17 16:02:38 +0000365 { "nativeCreate", "([BII)J",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 (void*) android_content_XmlBlock_nativeCreate },
Ashok Bhat896043d2014-01-17 16:02:38 +0000367 { "nativeGetStringBlock", "(J)J",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800368 (void*) android_content_XmlBlock_nativeGetStringBlock },
Ashok Bhat896043d2014-01-17 16:02:38 +0000369 { "nativeCreateParseState", "(J)J",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 (void*) android_content_XmlBlock_nativeCreateParseState },
Ashok Bhat896043d2014-01-17 16:02:38 +0000371 { "nativeNext", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 (void*) android_content_XmlBlock_nativeNext },
Ashok Bhat896043d2014-01-17 16:02:38 +0000373 { "nativeGetNamespace", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 (void*) android_content_XmlBlock_nativeGetNamespace },
Ashok Bhat896043d2014-01-17 16:02:38 +0000375 { "nativeGetName", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 (void*) android_content_XmlBlock_nativeGetName },
Ashok Bhat896043d2014-01-17 16:02:38 +0000377 { "nativeGetText", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 (void*) android_content_XmlBlock_nativeGetText },
Ashok Bhat896043d2014-01-17 16:02:38 +0000379 { "nativeGetLineNumber", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 (void*) android_content_XmlBlock_nativeGetLineNumber },
Ashok Bhat896043d2014-01-17 16:02:38 +0000381 { "nativeGetAttributeCount", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 (void*) android_content_XmlBlock_nativeGetAttributeCount },
Ashok Bhat896043d2014-01-17 16:02:38 +0000383 { "nativeGetAttributeNamespace","(JI)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 (void*) android_content_XmlBlock_nativeGetAttributeNamespace },
Ashok Bhat896043d2014-01-17 16:02:38 +0000385 { "nativeGetAttributeName", "(JI)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 (void*) android_content_XmlBlock_nativeGetAttributeName },
Ashok Bhat896043d2014-01-17 16:02:38 +0000387 { "nativeGetAttributeResource", "(JI)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800388 (void*) android_content_XmlBlock_nativeGetAttributeResource },
Ashok Bhat896043d2014-01-17 16:02:38 +0000389 { "nativeGetAttributeDataType", "(JI)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 (void*) android_content_XmlBlock_nativeGetAttributeDataType },
Ashok Bhat896043d2014-01-17 16:02:38 +0000391 { "nativeGetAttributeData", "(JI)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800392 (void*) android_content_XmlBlock_nativeGetAttributeData },
Ashok Bhat896043d2014-01-17 16:02:38 +0000393 { "nativeGetAttributeStringValue", "(JI)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 (void*) android_content_XmlBlock_nativeGetAttributeStringValue },
Ashok Bhat896043d2014-01-17 16:02:38 +0000395 { "nativeGetAttributeIndex", "(JLjava/lang/String;Ljava/lang/String;)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 (void*) android_content_XmlBlock_nativeGetAttributeIndex },
Ashok Bhat896043d2014-01-17 16:02:38 +0000397 { "nativeGetIdAttribute", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 (void*) android_content_XmlBlock_nativeGetIdAttribute },
Ashok Bhat896043d2014-01-17 16:02:38 +0000399 { "nativeGetClassAttribute", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 (void*) android_content_XmlBlock_nativeGetClassAttribute },
Ashok Bhat896043d2014-01-17 16:02:38 +0000401 { "nativeGetStyleAttribute", "(J)I",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 (void*) android_content_XmlBlock_nativeGetStyleAttribute },
Ashok Bhat896043d2014-01-17 16:02:38 +0000403 { "nativeDestroyParseState", "(J)V",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 (void*) android_content_XmlBlock_nativeDestroyParseState },
Ashok Bhat896043d2014-01-17 16:02:38 +0000405 { "nativeDestroy", "(J)V",
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 (void*) android_content_XmlBlock_nativeDestroy },
407};
408
409int register_android_content_XmlBlock(JNIEnv* env)
410{
411 return AndroidRuntime::registerNativeMethods(env,
412 "android/content/res/XmlBlock", gXmlBlockMethods, NELEM(gXmlBlockMethods));
413}
414
415}; // namespace android