2 ** Copyright 2006, The Android Open Source Project
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
8 ** http://www.apache.org/licenses/LICENSE-2.0
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
17 #define LOG_TAG "Log_println"
19 #include <utils/Log.h>
20 #include <utils/String8.h>
24 #include "utils/misc.h"
25 #include "android_runtime/AndroidRuntime.h"
26 #include "ScopedStringChars.h"
27 #include "TimeUtils.h"
28 #include <nativehelper/JNIHelp.h>
29 #include <cutils/tztime.h>
33 static jfieldID g_allDayField = 0;
34 static jfieldID g_secField = 0;
35 static jfieldID g_minField = 0;
36 static jfieldID g_hourField = 0;
37 static jfieldID g_mdayField = 0;
38 static jfieldID g_monField = 0;
39 static jfieldID g_yearField = 0;
40 static jfieldID g_wdayField = 0;
41 static jfieldID g_ydayField = 0;
42 static jfieldID g_isdstField = 0;
43 static jfieldID g_gmtoffField = 0;
44 static jfieldID g_timezoneField = 0;
46 static jfieldID g_shortMonthsField = 0;
47 static jfieldID g_longMonthsField = 0;
48 static jfieldID g_longStandaloneMonthsField = 0;
49 static jfieldID g_shortWeekdaysField = 0;
50 static jfieldID g_longWeekdaysField = 0;
51 static jfieldID g_timeOnlyFormatField = 0;
52 static jfieldID g_dateOnlyFormatField = 0;
53 static jfieldID g_dateTimeFormatField = 0;
54 static jfieldID g_amField = 0;
55 static jfieldID g_pmField = 0;
56 static jfieldID g_dateCommandField = 0;
57 static jfieldID g_localeField = 0;
59 static jclass g_timeClass = NULL;
61 static inline bool java2time(JNIEnv* env, Time* t, jobject o)
63 t->t.tm_sec = env->GetIntField(o, g_secField);
64 t->t.tm_min = env->GetIntField(o, g_minField);
65 t->t.tm_hour = env->GetIntField(o, g_hourField);
66 t->t.tm_mday = env->GetIntField(o, g_mdayField);
67 t->t.tm_mon = env->GetIntField(o, g_monField);
68 t->t.tm_year = (env->GetIntField(o, g_yearField))-1900;
69 t->t.tm_wday = env->GetIntField(o, g_wdayField);
70 t->t.tm_yday = env->GetIntField(o, g_ydayField);
71 t->t.tm_isdst = env->GetIntField(o, g_isdstField);
72 t->t.tm_gmtoff = env->GetLongField(o, g_gmtoffField);
73 bool allDay = env->GetBooleanField(o, g_allDayField);
75 ((t->t.tm_sec !=0) || (t->t.tm_min != 0) || (t->t.tm_hour != 0))) {
76 jniThrowException(env, "java/lang/IllegalArgumentException",
77 "allDay is true but sec, min, hour are not 0.");
83 static inline void time2java(JNIEnv* env, jobject o, const Time &t)
85 env->SetIntField(o, g_secField, t.t.tm_sec);
86 env->SetIntField(o, g_minField, t.t.tm_min);
87 env->SetIntField(o, g_hourField, t.t.tm_hour);
88 env->SetIntField(o, g_mdayField, t.t.tm_mday);
89 env->SetIntField(o, g_monField, t.t.tm_mon);
90 env->SetIntField(o, g_yearField, t.t.tm_year+1900);
91 env->SetIntField(o, g_wdayField, t.t.tm_wday);
92 env->SetIntField(o, g_ydayField, t.t.tm_yday);
93 env->SetIntField(o, g_isdstField, t.t.tm_isdst);
94 env->SetLongField(o, g_gmtoffField, t.t.tm_gmtoff);
97 #define ACQUIRE_TIMEZONE(This, t) \
98 jstring timezoneString_##This \
99 = (jstring) env->GetObjectField(This, g_timezoneField); \
100 t.timezone = env->GetStringUTFChars(timezoneString_##This, NULL);
102 #define RELEASE_TIMEZONE(This, t) \
103 env->ReleaseStringUTFChars(timezoneString_##This, t.timezone);
106 // ============================================================================
108 static jlong android_text_format_Time_normalize(JNIEnv* env, jobject This,
112 if (!java2time(env, &t, This)) return 0L;
113 ACQUIRE_TIMEZONE(This, t)
115 int64_t result = t.toMillis(ignoreDst != 0);
117 time2java(env, This, t);
118 RELEASE_TIMEZONE(This, t)
123 static void android_text_format_Time_switchTimezone(JNIEnv* env, jobject This,
124 jstring timezoneObject)
127 if (!java2time(env, &t, This)) return;
128 ACQUIRE_TIMEZONE(This, t)
130 const char* timezone = env->GetStringUTFChars(timezoneObject, NULL);
132 t.switchTimezone(timezone);
134 time2java(env, This, t);
135 env->ReleaseStringUTFChars(timezoneObject, timezone);
136 RELEASE_TIMEZONE(This, t)
138 // we do this here because there's no point in reallocating the string
139 env->SetObjectField(This, g_timezoneField, timezoneObject);
142 static jint android_text_format_Time_compare(JNIEnv* env, jobject clazz,
143 jobject aObject, jobject bObject)
147 if (!java2time(env, &a, aObject)) return 0;
148 ACQUIRE_TIMEZONE(aObject, a)
150 if (!java2time(env, &b, bObject)) return 0;
151 ACQUIRE_TIMEZONE(bObject, b)
153 int result = Time::compare(a, b);
155 RELEASE_TIMEZONE(aObject, a)
156 RELEASE_TIMEZONE(bObject, b)
161 static jstring android_text_format_Time_format2445(JNIEnv* env, jobject This)
164 if (!java2time(env, &t, This)) return env->NewStringUTF("");
165 bool allDay = env->GetBooleanField(This, g_allDayField);
168 ACQUIRE_TIMEZONE(This, t)
169 bool inUtc = strcmp("UTC", t.timezone) == 0;
171 t.format2445(buf, true);
172 RELEASE_TIMEZONE(This, t)
174 // The letter 'Z' is appended to the end so allow for one
175 // more character in the buffer.
176 return env->NewString((jchar*)buf, 16);
178 return env->NewString((jchar*)buf, 15);
182 t.format2445(buf, false);
183 return env->NewString((jchar*)buf, 8);
187 static jstring android_text_format_Time_format(JNIEnv* env, jobject This,
188 jstring formatObject)
190 // We only teardown and setup our 'locale' struct and other state
191 // when the Java-side locale changed. This is safe to do here
192 // without locking because we're always called from Java code
193 // synchronized on the class instance.
194 static jobject js_locale_previous = NULL;
195 static struct strftime_locale locale;
196 static jstring js_mon[12], js_month[12], js_wday[7], js_weekday[7];
197 static jstring js_standalone_month[12];
198 static jstring js_X_fmt, js_x_fmt, js_c_fmt, js_am, js_pm, js_date_fmt;
201 if (!java2time(env, &t, This)) return env->NewStringUTF("");
203 jclass timeClass = g_timeClass;
204 jobject js_locale = (jobject) env->GetStaticObjectField(timeClass, g_localeField);
205 if (js_locale_previous != js_locale) {
206 if (js_locale_previous != NULL) {
208 for (int i = 0; i < 12; i++) {
209 env->ReleaseStringUTFChars(js_mon[i], locale.mon[i]);
210 env->ReleaseStringUTFChars(js_month[i], locale.month[i]);
211 env->ReleaseStringUTFChars(js_standalone_month[i], locale.standalone_month[i]);
212 env->DeleteGlobalRef(js_mon[i]);
213 env->DeleteGlobalRef(js_month[i]);
214 env->DeleteGlobalRef(js_standalone_month[i]);
217 for (int i = 0; i < 7; i++) {
218 env->ReleaseStringUTFChars(js_wday[i], locale.wday[i]);
219 env->ReleaseStringUTFChars(js_weekday[i], locale.weekday[i]);
220 env->DeleteGlobalRef(js_wday[i]);
221 env->DeleteGlobalRef(js_weekday[i]);
224 env->ReleaseStringUTFChars(js_X_fmt, locale.X_fmt);
225 env->ReleaseStringUTFChars(js_x_fmt, locale.x_fmt);
226 env->ReleaseStringUTFChars(js_c_fmt, locale.c_fmt);
227 env->ReleaseStringUTFChars(js_am, locale.am);
228 env->ReleaseStringUTFChars(js_pm, locale.pm);
229 env->ReleaseStringUTFChars(js_date_fmt, locale.date_fmt);
230 env->DeleteGlobalRef(js_X_fmt);
231 env->DeleteGlobalRef(js_x_fmt);
232 env->DeleteGlobalRef(js_c_fmt);
233 env->DeleteGlobalRef(js_am);
234 env->DeleteGlobalRef(js_pm);
235 env->DeleteGlobalRef(js_date_fmt);
237 js_locale_previous = js_locale;
240 ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_shortMonthsField);
241 for (int i = 0; i < 12; i++) {
242 // Calendar.JANUARY == 0.
243 js_mon[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i));
244 locale.mon[i] = env->GetStringUTFChars(js_mon[i], NULL);
247 ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_longMonthsField);
248 for (int i = 0; i < 12; i++) {
249 // Calendar.JANUARY == 0.
250 js_month[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i));
251 locale.month[i] = env->GetStringUTFChars(js_month[i], NULL);
254 ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_longStandaloneMonthsField);
255 for (int i = 0; i < 12; i++) {
256 // Calendar.JANUARY == 0.
257 js_standalone_month[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i));
258 locale.standalone_month[i] = env->GetStringUTFChars(js_standalone_month[i], NULL);
261 ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_shortWeekdaysField);
262 for (int i = 0; i < 7; i++) {
263 // Calendar.SUNDAY == 1, and there's an empty string in element 0.
264 js_wday[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i + 1));
265 locale.wday[i] = env->GetStringUTFChars(js_wday[i], NULL);
268 ja = (jobjectArray) env->GetStaticObjectField(timeClass, g_longWeekdaysField);
269 for (int i = 0; i < 7; i++) {
270 // Calendar.SUNDAY == 1, and there's an empty string in element 0.
271 js_weekday[i] = (jstring) env->NewGlobalRef(env->GetObjectArrayElement(ja, i + 1));
272 locale.weekday[i] = env->GetStringUTFChars(js_weekday[i], NULL);
275 js_X_fmt = (jstring) env->NewGlobalRef(env->GetStaticObjectField(
276 timeClass, g_timeOnlyFormatField));
277 locale.X_fmt = env->GetStringUTFChars(js_X_fmt, NULL);
279 js_x_fmt = (jstring) env->NewGlobalRef(env->GetStaticObjectField(
280 timeClass, g_dateOnlyFormatField));
281 locale.x_fmt = env->GetStringUTFChars(js_x_fmt, NULL);
283 js_c_fmt = (jstring) env->NewGlobalRef(env->GetStaticObjectField(
284 timeClass, g_dateTimeFormatField));
285 locale.c_fmt = env->GetStringUTFChars(js_c_fmt, NULL);
287 js_am = (jstring) env->NewGlobalRef(env->GetStaticObjectField(
288 timeClass, g_amField));
289 locale.am = env->GetStringUTFChars(js_am, NULL);
291 js_pm = (jstring) env->NewGlobalRef(env->GetStaticObjectField(
292 timeClass, g_pmField));
293 locale.pm = env->GetStringUTFChars(js_pm, NULL);
295 js_date_fmt = (jstring) env->NewGlobalRef(env->GetStaticObjectField(
296 timeClass, g_dateCommandField));
297 locale.date_fmt = env->GetStringUTFChars(js_date_fmt, NULL);
300 ACQUIRE_TIMEZONE(This, t)
302 const char* format = env->GetStringUTFChars(formatObject, NULL);
304 String8 r = t.format(format, &locale);
306 env->ReleaseStringUTFChars(formatObject, format);
307 RELEASE_TIMEZONE(This, t)
309 return env->NewStringUTF(r.string());
313 static jstring android_text_format_Time_toString(JNIEnv* env, jobject This)
316 if (!java2time(env, &t, This)) return env->NewStringUTF("");
317 ACQUIRE_TIMEZONE(This, t)
319 String8 r = t.toString();
321 RELEASE_TIMEZONE(This, t)
323 return env->NewStringUTF(r.string());
326 static void android_text_format_Time_setToNow(JNIEnv* env, jobject This)
328 env->SetBooleanField(This, g_allDayField, JNI_FALSE);
330 ACQUIRE_TIMEZONE(This, t)
334 time2java(env, This, t);
335 RELEASE_TIMEZONE(This, t)
338 static jlong android_text_format_Time_toMillis(JNIEnv* env, jobject This,
342 if (!java2time(env, &t, This)) return 0L;
343 ACQUIRE_TIMEZONE(This, t)
345 int64_t result = t.toMillis(ignoreDst != 0);
347 RELEASE_TIMEZONE(This, t)
352 static void android_text_format_Time_set(JNIEnv* env, jobject This, jlong millis)
354 env->SetBooleanField(This, g_allDayField, JNI_FALSE);
356 ACQUIRE_TIMEZONE(This, t)
360 time2java(env, This, t);
361 RELEASE_TIMEZONE(This, t)
365 // ============================================================================
366 // Just do this here because it's not worth recreating the strings
368 static int get_char(JNIEnv* env, const ScopedStringChars& s, int spos, int mul,
372 if (c >= '0' && c <= '9') {
373 return (c - '0') * mul;
376 jniThrowExceptionFmt(env, "android/util/TimeFormatException",
377 "Parse error at pos=%d", spos);
384 static bool check_char(JNIEnv* env, const ScopedStringChars& s, int spos, jchar expected)
388 jniThrowExceptionFmt(env, "android/util/TimeFormatException",
389 "Unexpected character 0x%02x at pos=%d. Expected %c.",
397 static jboolean android_text_format_Time_parse(JNIEnv* env, jobject This, jstring strObj)
399 jsize len = env->GetStringLength(strObj);
401 jniThrowException(env, "android/util/TimeFormatException",
402 "String too short -- expected at least 8 characters.");
406 jboolean inUtc = false;
408 ScopedStringChars s(env, strObj);
413 n = get_char(env, s, 0, 1000, &thrown);
414 n += get_char(env, s, 1, 100, &thrown);
415 n += get_char(env, s, 2, 10, &thrown);
416 n += get_char(env, s, 3, 1, &thrown);
417 if (thrown) return false;
418 env->SetIntField(This, g_yearField, n);
421 n = get_char(env, s, 4, 10, &thrown);
422 n += get_char(env, s, 5, 1, &thrown);
424 if (thrown) return false;
425 env->SetIntField(This, g_monField, n);
428 n = get_char(env, s, 6, 10, &thrown);
429 n += get_char(env, s, 7, 1, &thrown);
430 if (thrown) return false;
431 env->SetIntField(This, g_mdayField, n);
435 if (!check_char(env, s, 8, 'T')) return false;
436 env->SetBooleanField(This, g_allDayField, JNI_FALSE);
439 n = get_char(env, s, 9, 10, &thrown);
440 n += get_char(env, s, 10, 1, &thrown);
441 if (thrown) return false;
442 env->SetIntField(This, g_hourField, n);
445 n = get_char(env, s, 11, 10, &thrown);
446 n += get_char(env, s, 12, 1, &thrown);
447 if (thrown) return false;
448 env->SetIntField(This, g_minField, n);
451 n = get_char(env, s, 13, 10, &thrown);
452 n += get_char(env, s, 14, 1, &thrown);
453 if (thrown) return false;
454 env->SetIntField(This, g_secField, n);
458 if (!check_char(env, s, 15, 'Z')) return false;
462 env->SetBooleanField(This, g_allDayField, JNI_TRUE);
463 env->SetIntField(This, g_hourField, 0);
464 env->SetIntField(This, g_minField, 0);
465 env->SetIntField(This, g_secField, 0);
468 env->SetIntField(This, g_wdayField, 0);
469 env->SetIntField(This, g_ydayField, 0);
470 env->SetIntField(This, g_isdstField, -1);
471 env->SetLongField(This, g_gmtoffField, 0);
476 static jboolean android_text_format_Time_parse3339(JNIEnv* env,
480 jsize len = env->GetStringLength(strObj);
482 jniThrowException(env, "android/util/TimeFormatException",
483 "String too short --- expected at least 10 characters.");
487 jboolean inUtc = false;
489 ScopedStringChars s(env, strObj);
494 n = get_char(env, s, 0, 1000, &thrown);
495 n += get_char(env, s, 1, 100, &thrown);
496 n += get_char(env, s, 2, 10, &thrown);
497 n += get_char(env, s, 3, 1, &thrown);
498 if (thrown) return false;
499 env->SetIntField(This, g_yearField, n);
502 if (!check_char(env, s, 4, '-')) return false;
505 n = get_char(env, s, 5, 10, &thrown);
506 n += get_char(env, s, 6, 1, &thrown);
508 if (thrown) return false;
509 env->SetIntField(This, g_monField, n);
512 if (!check_char(env, s, 7, '-')) return false;
515 n = get_char(env, s, 8, 10, &thrown);
516 n += get_char(env, s, 9, 1, &thrown);
517 if (thrown) return false;
518 env->SetIntField(This, g_mdayField, n);
522 if (!check_char(env, s, 10, 'T')) return false;
524 env->SetBooleanField(This, g_allDayField, JNI_FALSE);
526 n = get_char(env, s, 11, 10, &thrown);
527 n += get_char(env, s, 12, 1, &thrown);
528 if (thrown) return false;
530 // env->SetIntField(This, g_hourField, n);
533 if (!check_char(env, s, 13, ':')) return false;
536 n = get_char(env, s, 14, 10, &thrown);
537 n += get_char(env, s, 15, 1, &thrown);
538 if (thrown) return false;
540 // env->SetIntField(This, g_minField, n);
543 if (!check_char(env, s, 16, ':')) return false;
546 n = get_char(env, s, 17, 10, &thrown);
547 n += get_char(env, s, 18, 1, &thrown);
548 if (thrown) return false;
549 env->SetIntField(This, g_secField, n);
551 // skip the '.XYZ' -- we don't care about subsecond precision.
553 if (tz_index < len && s[tz_index] == '.') {
556 } while (tz_index < len
557 && s[tz_index] >= '0'
558 && s[tz_index] <= '9');
562 if (len > tz_index) {
563 char c = s[tz_index];
565 // NOTE: the offset is meant to be subtracted to get from local time
566 // to UTC. we therefore use 1 for '-' and -1 for '+'.
579 jniThrowExceptionFmt(env, "android/util/TimeFormatException",
580 "Unexpected character 0x%02x at position %d. Expected + or -",
587 if (len < tz_index + 6) {
588 jniThrowExceptionFmt(env, "android/util/TimeFormatException",
589 "Unexpected length; should be %d characters",
595 n = get_char(env, s, tz_index + 1, 10, &thrown);
596 n += get_char(env, s, tz_index + 2, 1, &thrown);
597 if (thrown) return false;
602 if (!check_char(env, s, tz_index + 3, ':')) return false;
605 n = get_char(env, s, tz_index + 4, 10, &thrown);
606 n += get_char(env, s, tz_index + 5, 1, &thrown);
607 if (thrown) return false;
612 env->SetIntField(This, g_hourField, hour);
613 env->SetIntField(This, g_minField, minute);
616 // we need to normalize after applying the hour and minute offsets
617 android_text_format_Time_normalize(env, This, false /* use isdst */);
618 // The timezone is set to UTC in the calling Java code.
621 env->SetBooleanField(This, g_allDayField, JNI_TRUE);
622 env->SetIntField(This, g_hourField, 0);
623 env->SetIntField(This, g_minField, 0);
624 env->SetIntField(This, g_secField, 0);
627 env->SetIntField(This, g_wdayField, 0);
628 env->SetIntField(This, g_ydayField, 0);
629 env->SetIntField(This, g_isdstField, -1);
630 env->SetLongField(This, g_gmtoffField, 0);
635 // ============================================================================
639 static JNINativeMethod gMethods[] = {
640 /* name, signature, funcPtr */
641 { "normalize", "(Z)J", (void*)android_text_format_Time_normalize },
642 { "switchTimezone", "(Ljava/lang/String;)V", (void*)android_text_format_Time_switchTimezone },
643 { "nativeCompare", "(Landroid/text/format/Time;Landroid/text/format/Time;)I", (void*)android_text_format_Time_compare },
644 { "format1", "(Ljava/lang/String;)Ljava/lang/String;", (void*)android_text_format_Time_format },
645 { "format2445", "()Ljava/lang/String;", (void*)android_text_format_Time_format2445 },
646 { "toString", "()Ljava/lang/String;", (void*)android_text_format_Time_toString },
647 { "nativeParse", "(Ljava/lang/String;)Z", (void*)android_text_format_Time_parse },
648 { "nativeParse3339", "(Ljava/lang/String;)Z", (void*)android_text_format_Time_parse3339 },
649 { "setToNow", "()V", (void*)android_text_format_Time_setToNow },
650 { "toMillis", "(Z)J", (void*)android_text_format_Time_toMillis },
651 { "set", "(J)V", (void*)android_text_format_Time_set }
654 int register_android_text_format_Time(JNIEnv* env)
656 jclass timeClass = env->FindClass("android/text/format/Time");
658 g_timeClass = (jclass) env->NewGlobalRef(timeClass);
660 g_allDayField = env->GetFieldID(timeClass, "allDay", "Z");
661 g_secField = env->GetFieldID(timeClass, "second", "I");
662 g_minField = env->GetFieldID(timeClass, "minute", "I");
663 g_hourField = env->GetFieldID(timeClass, "hour", "I");
664 g_mdayField = env->GetFieldID(timeClass, "monthDay", "I");
665 g_monField = env->GetFieldID(timeClass, "month", "I");
666 g_yearField = env->GetFieldID(timeClass, "year", "I");
667 g_wdayField = env->GetFieldID(timeClass, "weekDay", "I");
668 g_ydayField = env->GetFieldID(timeClass, "yearDay", "I");
669 g_isdstField = env->GetFieldID(timeClass, "isDst", "I");
670 g_gmtoffField = env->GetFieldID(timeClass, "gmtoff", "J");
671 g_timezoneField = env->GetFieldID(timeClass, "timezone", "Ljava/lang/String;");
673 g_shortMonthsField = env->GetStaticFieldID(timeClass, "sShortMonths", "[Ljava/lang/String;");
674 g_longMonthsField = env->GetStaticFieldID(timeClass, "sLongMonths", "[Ljava/lang/String;");
675 g_longStandaloneMonthsField = env->GetStaticFieldID(timeClass, "sLongStandaloneMonths", "[Ljava/lang/String;");
676 g_shortWeekdaysField = env->GetStaticFieldID(timeClass, "sShortWeekdays", "[Ljava/lang/String;");
677 g_longWeekdaysField = env->GetStaticFieldID(timeClass, "sLongWeekdays", "[Ljava/lang/String;");
678 g_timeOnlyFormatField = env->GetStaticFieldID(timeClass, "sTimeOnlyFormat", "Ljava/lang/String;");
679 g_dateOnlyFormatField = env->GetStaticFieldID(timeClass, "sDateOnlyFormat", "Ljava/lang/String;");
680 g_dateTimeFormatField = env->GetStaticFieldID(timeClass, "sDateTimeFormat", "Ljava/lang/String;");
681 g_amField = env->GetStaticFieldID(timeClass, "sAm", "Ljava/lang/String;");
682 g_pmField = env->GetStaticFieldID(timeClass, "sPm", "Ljava/lang/String;");
683 g_dateCommandField = env->GetStaticFieldID(timeClass, "sDateCommand", "Ljava/lang/String;");
684 g_localeField = env->GetStaticFieldID(timeClass, "sLocale", "Ljava/util/Locale;");
686 return AndroidRuntime::registerNativeMethods(env, "android/text/format/Time", gMethods, NELEM(gMethods));
689 }; // namespace android