blob: 7ca9e401293697920b5b05c10e1a09b9afba329d [file] [log] [blame]
Mathias Agopian518ec112011-05-13 16:21:08 -07001/*
2 ** Copyright 2007, The Android Open Source Project
3 **
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
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
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.
15 */
16
Jesse Hallb29e5e82012-04-04 16:53:42 -070017#define __STDC_LIMIT_MACROS 1
18
Mathias Agopian4b9511c2011-11-13 23:52:47 -080019#include <string.h>
20
Jamie Gennisaca51c02011-11-03 17:42:43 -070021#include "egl_cache.h"
Mathias Agopian518ec112011-05-13 16:21:08 -070022#include "egl_display.h"
23#include "egl_object.h"
24#include "egl_tls.h"
25#include "egl_impl.h"
26#include "Loader.h"
Mathias Agopian7db993a2012-03-25 00:49:46 -070027#include <cutils/properties.h>
Mathias Agopian518ec112011-05-13 16:21:08 -070028
29// ----------------------------------------------------------------------------
30namespace android {
31// ----------------------------------------------------------------------------
32
Mathias Agopian4b9511c2011-11-13 23:52:47 -080033static char const * const sVendorString = "Android";
34static char const * const sVersionString = "1.4 Android META-EGL";
Mathias Agopiancc2b1562012-05-21 14:01:37 -070035static char const * const sClientApiString = "OpenGL_ES";
Mathias Agopian4b9511c2011-11-13 23:52:47 -080036
37// this is the list of EGL extensions that are exposed to applications
38// some of them are mandatory because used by the ANDROID system.
39//
40// mandatory extensions are required per the CDD and not explicitly
41// checked during EGL initialization. the system *assumes* these extensions
42// are present. the system may not function properly if some mandatory
43// extensions are missing.
44//
45// NOTE: sExtensionString MUST be have a single space as the last character.
46//
47static char const * const sExtensionString =
48 "EGL_KHR_image " // mandatory
49 "EGL_KHR_image_base " // mandatory
50 "EGL_KHR_image_pixmap "
51 "EGL_KHR_gl_texture_2D_image "
52 "EGL_KHR_gl_texture_cubemap_image "
53 "EGL_KHR_gl_renderbuffer_image "
54 "EGL_KHR_fence_sync "
Jamie Gennis09b11432012-09-20 15:47:44 -070055 "EGL_EXT_create_context_robustness "
Mathias Agopian4b9511c2011-11-13 23:52:47 -080056 "EGL_NV_system_time "
57 "EGL_ANDROID_image_native_buffer " // mandatory
58 ;
59
60// extensions not exposed to applications but used by the ANDROID system
61// "EGL_ANDROID_recordable " // mandatory
Jamie Gennis3ff48e52012-09-24 13:34:18 -070062// "EGL_ANDROID_framebuffer_target " // mandatory for HWC 1.1
Mathias Agopian4b9511c2011-11-13 23:52:47 -080063// "EGL_ANDROID_blob_cache " // strongly recommended
Jamie Gennis331841b2012-09-06 14:52:00 -070064// "EGL_ANDROID_native_fence_sync " // strongly recommended
Jesse Hall25838592012-04-05 15:53:28 -070065// "EGL_IMG_hibernate_process " // optional
Mathias Agopian4b9511c2011-11-13 23:52:47 -080066
Mathias Agopian518ec112011-05-13 16:21:08 -070067extern void initEglTraceLevel();
Siva Velusamyb13c78f2012-03-09 14:51:28 -080068extern void initEglDebugLevel();
Mathias Agopian518ec112011-05-13 16:21:08 -070069extern void setGLHooksThreadSpecific(gl_hooks_t const *value);
70
Mathias Agopian518ec112011-05-13 16:21:08 -070071// ----------------------------------------------------------------------------
72
73egl_display_t egl_display_t::sDisplay[NUM_DISPLAYS];
74
75egl_display_t::egl_display_t() :
Jesse Halla0fef1c2012-04-17 12:02:26 -070076 magic('_dpy'), finishOnSwap(false), traceGpuCompletion(false), refs(0) {
Mathias Agopian518ec112011-05-13 16:21:08 -070077}
78
79egl_display_t::~egl_display_t() {
80 magic = 0;
Jamie Gennis76601082011-11-06 14:14:33 -080081 egl_cache_t::get()->terminate();
Mathias Agopian518ec112011-05-13 16:21:08 -070082}
83
84egl_display_t* egl_display_t::get(EGLDisplay dpy) {
85 uintptr_t index = uintptr_t(dpy)-1U;
86 return (index >= NUM_DISPLAYS) ? NULL : &sDisplay[index];
87}
88
89void egl_display_t::addObject(egl_object_t* object) {
90 Mutex::Autolock _l(lock);
91 objects.add(object);
92}
93
Mathias Agopian5b287a62011-05-16 18:58:55 -070094void egl_display_t::removeObject(egl_object_t* object) {
95 Mutex::Autolock _l(lock);
96 objects.remove(object);
97}
98
Mathias Agopianf0480de2011-11-13 20:50:07 -080099bool egl_display_t::getObject(egl_object_t* object) const {
Mathias Agopian518ec112011-05-13 16:21:08 -0700100 Mutex::Autolock _l(lock);
101 if (objects.indexOf(object) >= 0) {
Mathias Agopianf0480de2011-11-13 20:50:07 -0800102 if (object->getDisplay() == this) {
103 object->incRef();
104 return true;
105 }
Mathias Agopian518ec112011-05-13 16:21:08 -0700106 }
107 return false;
108}
109
Mathias Agopian518ec112011-05-13 16:21:08 -0700110EGLDisplay egl_display_t::getFromNativeDisplay(EGLNativeDisplayType disp) {
111 if (uintptr_t(disp) >= NUM_DISPLAYS)
112 return NULL;
113
114 return sDisplay[uintptr_t(disp)].getDisplay(disp);
115}
116
117EGLDisplay egl_display_t::getDisplay(EGLNativeDisplayType display) {
118
119 Mutex::Autolock _l(lock);
120
121 // get our driver loader
122 Loader& loader(Loader::getInstance());
123
Mathias Agopianada798b2012-02-13 17:09:30 -0800124 egl_connection_t* const cnx = &gEGLImpl;
125 if (cnx->dso && disp.dpy == EGL_NO_DISPLAY) {
126 EGLDisplay dpy = cnx->egl.eglGetDisplay(display);
127 disp.dpy = dpy;
128 if (dpy == EGL_NO_DISPLAY) {
129 loader.close(cnx->dso);
130 cnx->dso = NULL;
Mathias Agopian518ec112011-05-13 16:21:08 -0700131 }
132 }
133
134 return EGLDisplay(uintptr_t(display) + 1U);
135}
136
137EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) {
138
139 Mutex::Autolock _l(lock);
140
141 if (refs > 0) {
142 if (major != NULL)
143 *major = VERSION_MAJOR;
144 if (minor != NULL)
145 *minor = VERSION_MINOR;
146 refs++;
147 return EGL_TRUE;
148 }
149
150#if EGL_TRACE
151
152 // Called both at early_init time and at this time. (Early_init is pre-zygote, so
153 // the information from that call may be stale.)
154 initEglTraceLevel();
Siva Velusamyb13c78f2012-03-09 14:51:28 -0800155 initEglDebugLevel();
Mathias Agopian518ec112011-05-13 16:21:08 -0700156
157#endif
158
159 setGLHooksThreadSpecific(&gHooksNoContext);
160
161 // initialize each EGL and
162 // build our own extension string first, based on the extension we know
163 // and the extension supported by our client implementation
Mathias Agopianada798b2012-02-13 17:09:30 -0800164
165 egl_connection_t* const cnx = &gEGLImpl;
166 cnx->major = -1;
167 cnx->minor = -1;
168 if (cnx->dso) {
Mathias Agopian518ec112011-05-13 16:21:08 -0700169
170#if defined(ADRENO130)
171#warning "Adreno-130 eglInitialize() workaround"
172 /*
173 * The ADRENO 130 driver returns a different EGLDisplay each time
174 * eglGetDisplay() is called, but also makes the EGLDisplay invalid
175 * after eglTerminate() has been called, so that eglInitialize()
176 * cannot be called again. Therefore, we need to make sure to call
177 * eglGetDisplay() before calling eglInitialize();
178 */
179 if (i == IMPL_HARDWARE) {
Mathias Agopianada798b2012-02-13 17:09:30 -0800180 disp[i].dpy = cnx->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
Mathias Agopian518ec112011-05-13 16:21:08 -0700181 }
182#endif
183
Mathias Agopianada798b2012-02-13 17:09:30 -0800184 EGLDisplay idpy = disp.dpy;
Mathias Agopian518ec112011-05-13 16:21:08 -0700185 if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) {
Mathias Agopianada798b2012-02-13 17:09:30 -0800186 //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p",
187 // idpy, cnx->major, cnx->minor, cnx);
Mathias Agopian518ec112011-05-13 16:21:08 -0700188
189 // display is now initialized
Mathias Agopianada798b2012-02-13 17:09:30 -0800190 disp.state = egl_display_t::INITIALIZED;
Mathias Agopian518ec112011-05-13 16:21:08 -0700191
192 // get the query-strings for this display for each implementation
Mathias Agopianada798b2012-02-13 17:09:30 -0800193 disp.queryString.vendor = cnx->egl.eglQueryString(idpy,
Mathias Agopian518ec112011-05-13 16:21:08 -0700194 EGL_VENDOR);
Mathias Agopianada798b2012-02-13 17:09:30 -0800195 disp.queryString.version = cnx->egl.eglQueryString(idpy,
Mathias Agopian518ec112011-05-13 16:21:08 -0700196 EGL_VERSION);
Mathias Agopianada798b2012-02-13 17:09:30 -0800197 disp.queryString.extensions = cnx->egl.eglQueryString(idpy,
Mathias Agopian518ec112011-05-13 16:21:08 -0700198 EGL_EXTENSIONS);
Mathias Agopianada798b2012-02-13 17:09:30 -0800199 disp.queryString.clientApi = cnx->egl.eglQueryString(idpy,
Mathias Agopian518ec112011-05-13 16:21:08 -0700200 EGL_CLIENT_APIS);
201
202 } else {
Mathias Agopianada798b2012-02-13 17:09:30 -0800203 ALOGW("eglInitialize(%p) failed (%s)", idpy,
Mathias Agopian518ec112011-05-13 16:21:08 -0700204 egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
205 }
206 }
207
Mathias Agopian4b9511c2011-11-13 23:52:47 -0800208 // the query strings are per-display
209 mVendorString.setTo(sVendorString);
210 mVersionString.setTo(sVersionString);
211 mClientApiString.setTo(sClientApiString);
212
Mathias Agopian7773c432012-02-13 20:06:08 -0800213 // we only add extensions that exist in the implementation
Mathias Agopian4b9511c2011-11-13 23:52:47 -0800214 char const* start = sExtensionString;
215 char const* end;
216 do {
217 // find the space separating this extension for the next one
218 end = strchr(start, ' ');
219 if (end) {
220 // length of the extension string
221 const size_t len = end - start;
Mathias Agopianf3ae82d2011-11-16 16:49:25 -0800222 if (len) {
223 // NOTE: we could avoid the copy if we had strnstr.
224 const String8 ext(start, len);
Mathias Agopianada798b2012-02-13 17:09:30 -0800225 // now look for this extension
226 if (disp.queryString.extensions) {
227 // if we find it, add this extension string to our list
228 // (and don't forget the space)
229 const char* match = strstr(disp.queryString.extensions, ext.string());
230 if (match && (match[len] == ' ' || match[len] == 0)) {
231 mExtensionString.append(start, len+1);
Mathias Agopianf3ae82d2011-11-16 16:49:25 -0800232 }
Mathias Agopian4b9511c2011-11-13 23:52:47 -0800233 }
234 }
235 // process the next extension string, and skip the space.
236 start = end + 1;
237 }
238 } while (end);
239
Jamie Gennisaca51c02011-11-03 17:42:43 -0700240 egl_cache_t::get()->initialize(this);
241
Mathias Agopian7db993a2012-03-25 00:49:46 -0700242 char value[PROPERTY_VALUE_MAX];
243 property_get("debug.egl.finish", value, "0");
244 if (atoi(value)) {
245 finishOnSwap = true;
246 }
247
Jamie Gennis28ef8d72012-04-05 20:34:54 -0700248 property_get("debug.egl.traceGpuCompletion", value, "0");
249 if (atoi(value)) {
250 traceGpuCompletion = true;
251 }
252
Mathias Agopian7773c432012-02-13 20:06:08 -0800253 refs++;
254 if (major != NULL)
255 *major = VERSION_MAJOR;
256 if (minor != NULL)
257 *minor = VERSION_MINOR;
Jesse Halla0fef1c2012-04-17 12:02:26 -0700258
259 mHibernation.setDisplayValid(true);
260
Mathias Agopian7773c432012-02-13 20:06:08 -0800261 return EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700262}
263
264EGLBoolean egl_display_t::terminate() {
265
266 Mutex::Autolock _l(lock);
267
268 if (refs == 0) {
Mathias Agopianfe981272012-06-13 15:21:21 -0700269 /*
270 * From the EGL spec (3.2):
271 * "Termination of a display that has already been terminated,
272 * (...), is allowed, but the only effect of such a call is
273 * to return EGL_TRUE (...)
274 */
275 return EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700276 }
277
278 // this is specific to Android, display termination is ref-counted.
279 if (refs > 1) {
280 refs--;
281 return EGL_TRUE;
282 }
283
284 EGLBoolean res = EGL_FALSE;
Mathias Agopianada798b2012-02-13 17:09:30 -0800285 egl_connection_t* const cnx = &gEGLImpl;
286 if (cnx->dso && disp.state == egl_display_t::INITIALIZED) {
287 if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) {
288 ALOGW("eglTerminate(%p) failed (%s)", disp.dpy,
289 egl_tls_t::egl_strerror(cnx->egl.eglGetError()));
Mathias Agopian518ec112011-05-13 16:21:08 -0700290 }
Mathias Agopianada798b2012-02-13 17:09:30 -0800291 // REVISIT: it's unclear what to do if eglTerminate() fails
Mathias Agopianada798b2012-02-13 17:09:30 -0800292 disp.state = egl_display_t::TERMINATED;
Mathias Agopianada798b2012-02-13 17:09:30 -0800293 res = EGL_TRUE;
Mathias Agopian518ec112011-05-13 16:21:08 -0700294 }
295
Jesse Halla0fef1c2012-04-17 12:02:26 -0700296 mHibernation.setDisplayValid(false);
297
Jamie Gennisa08cf6e2012-09-16 14:02:20 -0700298 // Reset the extension string since it will be regenerated if we get
299 // reinitialized.
300 mExtensionString.setTo("");
301
Mathias Agopian5b287a62011-05-16 18:58:55 -0700302 // Mark all objects remaining in the list as terminated, unless
303 // there are no reference to them, it which case, we're free to
304 // delete them.
305 size_t count = objects.size();
Steve Block32397c12012-01-05 23:22:43 +0000306 ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count);
Mathias Agopian5b287a62011-05-16 18:58:55 -0700307 for (size_t i=0 ; i<count ; i++) {
308 egl_object_t* o = objects.itemAt(i);
309 o->destroy();
310 }
311
312 // this marks all object handles are "terminated"
313 objects.clear();
Mathias Agopian518ec112011-05-13 16:21:08 -0700314
315 refs--;
Mathias Agopian518ec112011-05-13 16:21:08 -0700316 return res;
317}
318
Mathias Agopianfb87e542012-01-30 18:20:52 -0800319void egl_display_t::loseCurrent(egl_context_t * cur_c)
320{
321 if (cur_c) {
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800322 egl_display_t* display = cur_c->getDisplay();
323 if (display) {
324 display->loseCurrentImpl(cur_c);
325 }
326 }
327}
Mathias Agopianfb87e542012-01-30 18:20:52 -0800328
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800329void egl_display_t::loseCurrentImpl(egl_context_t * cur_c)
330{
331 // by construction, these are either 0 or valid (possibly terminated)
332 // it should be impossible for these to be invalid
333 ContextRef _cur_c(cur_c);
334 SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
335 SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800336
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800337 { // scope for the lock
338 Mutex::Autolock _l(lock);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800339 cur_c->onLooseCurrent();
340
Mathias Agopianfb87e542012-01-30 18:20:52 -0800341 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800342
343 // This cannot be called with the lock held because it might end-up
344 // calling back into EGL (in particular when a surface is destroyed
345 // it calls ANativeWindow::disconnect
346 _cur_c.release();
347 _cur_r.release();
348 _cur_d.release();
Mathias Agopianfb87e542012-01-30 18:20:52 -0800349}
350
351EGLBoolean egl_display_t::makeCurrent(egl_context_t* c, egl_context_t* cur_c,
352 EGLSurface draw, EGLSurface read, EGLContext ctx,
353 EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx)
354{
Mathias Agopianfb87e542012-01-30 18:20:52 -0800355 EGLBoolean result;
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800356
357 // by construction, these are either 0 or valid (possibly terminated)
358 // it should be impossible for these to be invalid
359 ContextRef _cur_c(cur_c);
360 SurfaceRef _cur_r(cur_c ? get_surface(cur_c->read) : NULL);
361 SurfaceRef _cur_d(cur_c ? get_surface(cur_c->draw) : NULL);
362
363 { // scope for the lock
364 Mutex::Autolock _l(lock);
Mathias Agopianfb87e542012-01-30 18:20:52 -0800365 if (c) {
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800366 result = c->cnx->egl.eglMakeCurrent(
Mathias Agopianada798b2012-02-13 17:09:30 -0800367 disp.dpy, impl_draw, impl_read, impl_ctx);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800368 if (result == EGL_TRUE) {
369 c->onMakeCurrent(draw, read);
Jesse Hall25838592012-04-05 15:53:28 -0700370 if (!cur_c) {
Jesse Halla0fef1c2012-04-17 12:02:26 -0700371 mHibernation.incWakeCount(HibernationMachine::STRONG);
Jesse Hall25838592012-04-05 15:53:28 -0700372 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800373 }
374 } else {
375 result = cur_c->cnx->egl.eglMakeCurrent(
Mathias Agopianada798b2012-02-13 17:09:30 -0800376 disp.dpy, impl_draw, impl_read, impl_ctx);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800377 if (result == EGL_TRUE) {
378 cur_c->onLooseCurrent();
Jesse Halla0fef1c2012-04-17 12:02:26 -0700379 mHibernation.decWakeCount(HibernationMachine::STRONG);
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800380 }
Mathias Agopianfb87e542012-01-30 18:20:52 -0800381 }
382 }
Mathias Agopiana4b2c042012-02-03 15:24:51 -0800383
384 if (result == EGL_TRUE) {
385 // This cannot be called with the lock held because it might end-up
386 // calling back into EGL (in particular when a surface is destroyed
387 // it calls ANativeWindow::disconnect
388 _cur_c.release();
389 _cur_r.release();
390 _cur_d.release();
391 }
392
Mathias Agopianfb87e542012-01-30 18:20:52 -0800393 return result;
394}
Mathias Agopian518ec112011-05-13 16:21:08 -0700395
Jesse Halla0fef1c2012-04-17 12:02:26 -0700396// ----------------------------------------------------------------------------
397
398bool egl_display_t::HibernationMachine::incWakeCount(WakeRefStrength strength) {
399 Mutex::Autolock _l(mLock);
Jesse Hallb29e5e82012-04-04 16:53:42 -0700400 ALOGE_IF(mWakeCount < 0 || mWakeCount == INT32_MAX,
401 "Invalid WakeCount (%d) on enter\n", mWakeCount);
Jesse Halla0fef1c2012-04-17 12:02:26 -0700402
Jesse Hallb29e5e82012-04-04 16:53:42 -0700403 mWakeCount++;
Jesse Halla0fef1c2012-04-17 12:02:26 -0700404 if (strength == STRONG)
405 mAttemptHibernation = false;
406
Jesse Hall25838592012-04-05 15:53:28 -0700407 if (CC_UNLIKELY(mHibernating)) {
408 ALOGV("Awakening\n");
409 egl_connection_t* const cnx = &gEGLImpl;
Jesse Halla0fef1c2012-04-17 12:02:26 -0700410
411 // These conditions should be guaranteed before entering hibernation;
412 // we don't want to get into a state where we can't wake up.
413 ALOGD_IF(!mDpyValid || !cnx->egl.eglAwakenProcessIMG,
414 "Invalid hibernation state, unable to awaken\n");
415
Jesse Hall25838592012-04-05 15:53:28 -0700416 if (!cnx->egl.eglAwakenProcessIMG()) {
417 ALOGE("Failed to awaken EGL implementation\n");
418 return false;
419 }
420 mHibernating = false;
421 }
Jesse Hallb29e5e82012-04-04 16:53:42 -0700422 return true;
423}
424
Jesse Halla0fef1c2012-04-17 12:02:26 -0700425void egl_display_t::HibernationMachine::decWakeCount(WakeRefStrength strength) {
426 Mutex::Autolock _l(mLock);
Jesse Hallb29e5e82012-04-04 16:53:42 -0700427 ALOGE_IF(mWakeCount <= 0, "Invalid WakeCount (%d) on leave\n", mWakeCount);
Jesse Halla0fef1c2012-04-17 12:02:26 -0700428
429 mWakeCount--;
430 if (strength == STRONG)
431 mAttemptHibernation = true;
432
433 if (mWakeCount == 0 && CC_UNLIKELY(mAttemptHibernation)) {
Jesse Hall25838592012-04-05 15:53:28 -0700434 egl_connection_t* const cnx = &gEGLImpl;
435 mAttemptHibernation = false;
Jesse Hall201f3b22012-05-04 14:52:40 -0700436 if (mAllowHibernation && mDpyValid &&
Jesse Halla0fef1c2012-04-17 12:02:26 -0700437 cnx->egl.eglHibernateProcessIMG &&
438 cnx->egl.eglAwakenProcessIMG) {
Jesse Hall25838592012-04-05 15:53:28 -0700439 ALOGV("Hibernating\n");
440 if (!cnx->egl.eglHibernateProcessIMG()) {
441 ALOGE("Failed to hibernate EGL implementation\n");
442 return;
443 }
444 mHibernating = true;
445 }
446 }
447}
448
Jesse Halla0fef1c2012-04-17 12:02:26 -0700449void egl_display_t::HibernationMachine::setDisplayValid(bool valid) {
450 Mutex::Autolock _l(mLock);
451 mDpyValid = valid;
Jesse Hallb29e5e82012-04-04 16:53:42 -0700452}
453
Mathias Agopian518ec112011-05-13 16:21:08 -0700454// ----------------------------------------------------------------------------
455}; // namespace android
456// ----------------------------------------------------------------------------