blob: aa2bc3f67419033ca643222a6476db0d90af705b [file] [log] [blame]
Chet Haasedd78cca2010-10-22 18:59:26 -07001/*
2 * Copyright (C) 2010 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
17#define LOG_TAG "OpenGLRenderer"
18
Romain Guyc15008e2010-11-10 11:59:15 -080019#include <utils/Log.h>
Chet Haase9c1e23b2011-03-24 10:51:31 -070020#include <utils/String8.h>
Romain Guyc15008e2010-11-10 11:59:15 -080021
Chet Haasedd78cca2010-10-22 18:59:26 -070022#include "Caches.h"
Romain Guybb0acdf2012-03-05 13:44:35 -080023#include "DisplayListRenderer.h"
Romain Guye190aa62010-11-10 19:01:29 -080024#include "Properties.h"
Romain Guy09b7c912011-02-02 20:28:09 -080025#include "LayerRenderer.h"
Chet Haasedd78cca2010-10-22 18:59:26 -070026
27namespace android {
28
29#ifdef USE_OPENGL_RENDERER
30using namespace uirenderer;
31ANDROID_SINGLETON_STATIC_INSTANCE(Caches);
32#endif
33
34namespace uirenderer {
35
36///////////////////////////////////////////////////////////////////////////////
Romain Guybdf76092011-07-18 15:00:43 -070037// Macros
38///////////////////////////////////////////////////////////////////////////////
39
40#if DEBUG_CACHE_FLUSH
Steve Block5baa3a62011-12-20 16:23:08 +000041 #define FLUSH_LOGD(...) ALOGD(__VA_ARGS__)
Romain Guybdf76092011-07-18 15:00:43 -070042#else
43 #define FLUSH_LOGD(...)
44#endif
45
46///////////////////////////////////////////////////////////////////////////////
Chet Haasedd78cca2010-10-22 18:59:26 -070047// Constructors/destructor
48///////////////////////////////////////////////////////////////////////////////
49
Romain Guy8ff6b9e2011-11-09 20:10:18 -080050Caches::Caches(): Singleton<Caches>(), mInitialized(false) {
Romain Guy8ff6b9e2011-11-09 20:10:18 -080051 init();
Romain Guyb1d0a4e2012-07-13 18:25:35 -070052 initFont();
Romain Guydfa10462012-05-12 16:18:58 -070053 initExtensions();
54 initConstraints();
Romain Guye190aa62010-11-10 19:01:29 -080055
56 mDebugLevel = readDebugLevel();
Steve Block5baa3a62011-12-20 16:23:08 +000057 ALOGD("Enabling debug mode %d", mDebugLevel);
Romain Guy7230a742011-01-10 22:26:16 -080058
59#if RENDER_LAYERS_AS_REGIONS
Romain Guy02ccac62011-06-24 13:20:23 -070060 INIT_LOGD("Layers will be composited as regions");
Romain Guy7230a742011-01-10 22:26:16 -080061#endif
Chet Haasedd78cca2010-10-22 18:59:26 -070062}
63
Romain Guy8ff6b9e2011-11-09 20:10:18 -080064void Caches::init() {
65 if (mInitialized) return;
66
67 glGenBuffers(1, &meshBuffer);
68 glBindBuffer(GL_ARRAY_BUFFER, meshBuffer);
69 glBufferData(GL_ARRAY_BUFFER, sizeof(gMeshVertices), gMeshVertices, GL_STATIC_DRAW);
70
71 mCurrentBuffer = meshBuffer;
Romain Guy15bc6432011-12-13 13:11:32 -080072 mCurrentIndicesBuffer = 0;
Romain Guyf3a910b42011-12-12 20:35:21 -080073 mCurrentPositionPointer = this;
74 mCurrentTexCoordsPointer = this;
75
Romain Guy15bc6432011-12-13 13:11:32 -080076 mTexCoordsArrayEnabled = false;
77
Romain Guyb1d0a4e2012-07-13 18:25:35 -070078 glDisable(GL_SCISSOR_TEST);
Romain Guy586cae32012-07-13 15:28:31 -070079 scissorEnabled = false;
Romain Guy8f85e802011-12-14 19:23:32 -080080 mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
81
Romain Guya1d3c912011-12-13 14:55:06 -080082 glActiveTexture(gTextureUnits[0]);
83 mTextureUnit = 0;
84
Romain Guy8ff6b9e2011-11-09 20:10:18 -080085 mRegionMesh = NULL;
86
87 blend = false;
88 lastSrcMode = GL_ZERO;
89 lastDstMode = GL_ZERO;
90 currentProgram = NULL;
91
92 mInitialized = true;
93}
94
Romain Guyb1d0a4e2012-07-13 18:25:35 -070095void Caches::initFont() {
96 fontRenderer = GammaFontRenderer::createRenderer();
97}
98
Romain Guydfa10462012-05-12 16:18:58 -070099void Caches::initExtensions() {
100 if (extensions.hasDebugMarker()) {
101 eventMark = glInsertEventMarkerEXT;
102 startMark = glPushGroupMarkerEXT;
103 endMark = glPopGroupMarkerEXT;
104 } else {
105 eventMark = eventMarkNull;
106 startMark = startMarkNull;
107 endMark = endMarkNull;
108 }
109
110 if (extensions.hasDebugLabel()) {
111 setLabel = glLabelObjectEXT;
112 getLabel = glGetObjectLabelEXT;
113 } else {
114 setLabel = setLabelNull;
115 getLabel = getLabelNull;
116 }
117}
118
119void Caches::initConstraints() {
120 GLint maxTextureUnits;
121 glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
122 if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
123 ALOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
124 }
125
126 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
127}
128
Romain Guy8ff6b9e2011-11-09 20:10:18 -0800129void Caches::terminate() {
130 if (!mInitialized) return;
131
132 glDeleteBuffers(1, &meshBuffer);
133 mCurrentBuffer = 0;
134
135 glDeleteBuffers(1, &mRegionMeshIndices);
Romain Guy5b3b3522010-10-27 18:57:51 -0700136 delete[] mRegionMesh;
Romain Guy8ff6b9e2011-11-09 20:10:18 -0800137 mRegionMesh = NULL;
138
139 fboCache.clear();
140
141 programCache.clear();
142 currentProgram = NULL;
143
144 mInitialized = false;
Romain Guy5b3b3522010-10-27 18:57:51 -0700145}
146
147///////////////////////////////////////////////////////////////////////////////
Romain Guyc15008e2010-11-10 11:59:15 -0800148// Debug
149///////////////////////////////////////////////////////////////////////////////
150
151void Caches::dumpMemoryUsage() {
Chet Haase9c1e23b2011-03-24 10:51:31 -0700152 String8 stringLog;
153 dumpMemoryUsage(stringLog);
Steve Block5baa3a62011-12-20 16:23:08 +0000154 ALOGD("%s", stringLog.string());
Chet Haase9c1e23b2011-03-24 10:51:31 -0700155}
156
157void Caches::dumpMemoryUsage(String8 &log) {
158 log.appendFormat("Current memory usage / total memory usage (bytes):\n");
159 log.appendFormat(" TextureCache %8d / %8d\n",
160 textureCache.getSize(), textureCache.getMaxSize());
161 log.appendFormat(" LayerCache %8d / %8d\n",
162 layerCache.getSize(), layerCache.getMaxSize());
163 log.appendFormat(" GradientCache %8d / %8d\n",
164 gradientCache.getSize(), gradientCache.getMaxSize());
165 log.appendFormat(" PathCache %8d / %8d\n",
166 pathCache.getSize(), pathCache.getMaxSize());
167 log.appendFormat(" CircleShapeCache %8d / %8d\n",
Romain Guy01d58e42011-01-19 21:54:02 -0800168 circleShapeCache.getSize(), circleShapeCache.getMaxSize());
Chet Haase9c1e23b2011-03-24 10:51:31 -0700169 log.appendFormat(" OvalShapeCache %8d / %8d\n",
Romain Guy2fc941e2011-02-03 15:06:05 -0800170 ovalShapeCache.getSize(), ovalShapeCache.getMaxSize());
Chet Haase9c1e23b2011-03-24 10:51:31 -0700171 log.appendFormat(" RoundRectShapeCache %8d / %8d\n",
Romain Guy01d58e42011-01-19 21:54:02 -0800172 roundRectShapeCache.getSize(), roundRectShapeCache.getMaxSize());
Chet Haase9c1e23b2011-03-24 10:51:31 -0700173 log.appendFormat(" RectShapeCache %8d / %8d\n",
Romain Guy2fc941e2011-02-03 15:06:05 -0800174 rectShapeCache.getSize(), rectShapeCache.getMaxSize());
Chet Haase9c1e23b2011-03-24 10:51:31 -0700175 log.appendFormat(" ArcShapeCache %8d / %8d\n",
Romain Guy2fc941e2011-02-03 15:06:05 -0800176 arcShapeCache.getSize(), arcShapeCache.getMaxSize());
Chet Haase9c1e23b2011-03-24 10:51:31 -0700177 log.appendFormat(" TextDropShadowCache %8d / %8d\n", dropShadowCache.getSize(),
Romain Guyc15008e2010-11-10 11:59:15 -0800178 dropShadowCache.getMaxSize());
Romain Guyb1d0a4e2012-07-13 18:25:35 -0700179 for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
180 const uint32_t size = fontRenderer->getFontRendererSize(i);
Chet Haase9c1e23b2011-03-24 10:51:31 -0700181 log.appendFormat(" FontRenderer %d %8d / %8d\n", i, size, size);
Romain Guyc15008e2010-11-10 11:59:15 -0800182 }
Romain Guyd2ba50a2011-05-27 10:21:07 -0700183 log.appendFormat("Other:\n");
Chet Haase9c1e23b2011-03-24 10:51:31 -0700184 log.appendFormat(" FboCache %8d / %8d\n",
185 fboCache.getSize(), fboCache.getMaxSize());
186 log.appendFormat(" PatchCache %8d / %8d\n",
187 patchCache.getSize(), patchCache.getMaxSize());
Romain Guyc15008e2010-11-10 11:59:15 -0800188
189 uint32_t total = 0;
190 total += textureCache.getSize();
191 total += layerCache.getSize();
192 total += gradientCache.getSize();
193 total += pathCache.getSize();
194 total += dropShadowCache.getSize();
Romain Guy2fc941e2011-02-03 15:06:05 -0800195 total += roundRectShapeCache.getSize();
196 total += circleShapeCache.getSize();
197 total += ovalShapeCache.getSize();
198 total += rectShapeCache.getSize();
199 total += arcShapeCache.getSize();
Romain Guyb1d0a4e2012-07-13 18:25:35 -0700200 for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
201 total += fontRenderer->getFontRendererSize(i);
Romain Guyc15008e2010-11-10 11:59:15 -0800202 }
203
Chet Haase9c1e23b2011-03-24 10:51:31 -0700204 log.appendFormat("Total memory usage:\n");
205 log.appendFormat(" %d bytes, %.2f MB\n", total, total / 1024.0f / 1024.0f);
Romain Guyc15008e2010-11-10 11:59:15 -0800206}
207
208///////////////////////////////////////////////////////////////////////////////
Romain Guyfe48f652010-11-11 15:36:56 -0800209// Memory management
210///////////////////////////////////////////////////////////////////////////////
211
212void Caches::clearGarbage() {
213 textureCache.clearGarbage();
Romain Guyfe48f652010-11-11 15:36:56 -0800214 pathCache.clearGarbage();
Romain Guy57066eb2011-01-12 12:53:32 -0800215
216 Mutex::Autolock _l(mGarbageLock);
217
Romain Guyada830f2011-01-13 12:13:20 -0800218 size_t count = mLayerGarbage.size();
Romain Guy57066eb2011-01-12 12:53:32 -0800219 for (size_t i = 0; i < count; i++) {
Romain Guyada830f2011-01-13 12:13:20 -0800220 Layer* layer = mLayerGarbage.itemAt(i);
Romain Guy09b7c912011-02-02 20:28:09 -0800221 LayerRenderer::destroyLayer(layer);
Romain Guy57066eb2011-01-12 12:53:32 -0800222 }
Romain Guyada830f2011-01-13 12:13:20 -0800223 mLayerGarbage.clear();
Romain Guybb0acdf2012-03-05 13:44:35 -0800224
225 count = mDisplayListGarbage.size();
226 for (size_t i = 0; i < count; i++) {
227 DisplayList* displayList = mDisplayListGarbage.itemAt(i);
228 delete displayList;
229 }
230 mDisplayListGarbage.clear();
Romain Guy57066eb2011-01-12 12:53:32 -0800231}
232
Romain Guyada830f2011-01-13 12:13:20 -0800233void Caches::deleteLayerDeferred(Layer* layer) {
Romain Guy57066eb2011-01-12 12:53:32 -0800234 Mutex::Autolock _l(mGarbageLock);
Romain Guyada830f2011-01-13 12:13:20 -0800235 mLayerGarbage.push(layer);
Romain Guyfe48f652010-11-11 15:36:56 -0800236}
237
Romain Guybb0acdf2012-03-05 13:44:35 -0800238void Caches::deleteDisplayListDeferred(DisplayList* displayList) {
239 Mutex::Autolock _l(mGarbageLock);
240 mDisplayListGarbage.push(displayList);
241}
242
Romain Guybdf76092011-07-18 15:00:43 -0700243void Caches::flush(FlushMode mode) {
244 FLUSH_LOGD("Flushing caches (mode %d)", mode);
245
246 clearGarbage();
247
248 switch (mode) {
249 case kFlushMode_Full:
250 textureCache.clear();
251 patchCache.clear();
252 dropShadowCache.clear();
253 gradientCache.clear();
Romain Guyb1d0a4e2012-07-13 18:25:35 -0700254 fontRenderer->clear();
Romain Guy211efea2012-07-31 21:16:07 -0700255 dither.clear();
Romain Guybdf76092011-07-18 15:00:43 -0700256 // fall through
257 case kFlushMode_Moderate:
Romain Guyb1d0a4e2012-07-13 18:25:35 -0700258 fontRenderer->flush();
Romain Guyeca0ca22011-11-04 15:12:29 -0700259 textureCache.flush();
Romain Guybdf76092011-07-18 15:00:43 -0700260 pathCache.clear();
261 roundRectShapeCache.clear();
262 circleShapeCache.clear();
263 ovalShapeCache.clear();
264 rectShapeCache.clear();
265 arcShapeCache.clear();
Romain Guy6d7475d2011-07-27 16:28:21 -0700266 // fall through
267 case kFlushMode_Layers:
268 layerCache.clear();
Romain Guybdf76092011-07-18 15:00:43 -0700269 break;
270 }
271}
272
Romain Guyfe48f652010-11-11 15:36:56 -0800273///////////////////////////////////////////////////////////////////////////////
Romain Guy5b3b3522010-10-27 18:57:51 -0700274// VBO
275///////////////////////////////////////////////////////////////////////////////
276
Romain Guyf3a910b42011-12-12 20:35:21 -0800277bool Caches::bindMeshBuffer() {
278 return bindMeshBuffer(meshBuffer);
Chet Haasedd78cca2010-10-22 18:59:26 -0700279}
280
Romain Guyf3a910b42011-12-12 20:35:21 -0800281bool Caches::bindMeshBuffer(const GLuint buffer) {
Romain Guy9bca4792010-10-25 18:42:25 -0700282 if (mCurrentBuffer != buffer) {
Chet Haasedd78cca2010-10-22 18:59:26 -0700283 glBindBuffer(GL_ARRAY_BUFFER, buffer);
Romain Guy9bca4792010-10-25 18:42:25 -0700284 mCurrentBuffer = buffer;
Romain Guyf3a910b42011-12-12 20:35:21 -0800285 return true;
Chet Haasedd78cca2010-10-22 18:59:26 -0700286 }
Romain Guyf3a910b42011-12-12 20:35:21 -0800287 return false;
Chet Haasedd78cca2010-10-22 18:59:26 -0700288}
289
Romain Guyf3a910b42011-12-12 20:35:21 -0800290bool Caches::unbindMeshBuffer() {
Romain Guy9bca4792010-10-25 18:42:25 -0700291 if (mCurrentBuffer) {
Chet Haasedd78cca2010-10-22 18:59:26 -0700292 glBindBuffer(GL_ARRAY_BUFFER, 0);
Romain Guy9bca4792010-10-25 18:42:25 -0700293 mCurrentBuffer = 0;
Romain Guyf3a910b42011-12-12 20:35:21 -0800294 return true;
Chet Haasedd78cca2010-10-22 18:59:26 -0700295 }
Romain Guyf3a910b42011-12-12 20:35:21 -0800296 return false;
297}
298
Romain Guy15bc6432011-12-13 13:11:32 -0800299bool Caches::bindIndicesBuffer(const GLuint buffer) {
300 if (mCurrentIndicesBuffer != buffer) {
301 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
302 mCurrentIndicesBuffer = buffer;
303 return true;
304 }
305 return false;
306}
307
308bool Caches::unbindIndicesBuffer() {
309 if (mCurrentIndicesBuffer) {
310 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
311 mCurrentIndicesBuffer = 0;
312 return true;
313 }
314 return false;
315}
316
Romain Guyf3a910b42011-12-12 20:35:21 -0800317void Caches::bindPositionVertexPointer(bool force, GLuint slot, GLvoid* vertices, GLsizei stride) {
318 if (force || vertices != mCurrentPositionPointer) {
319 glVertexAttribPointer(slot, 2, GL_FLOAT, GL_FALSE, stride, vertices);
320 mCurrentPositionPointer = vertices;
321 }
322}
323
324void Caches::bindTexCoordsVertexPointer(bool force, GLuint slot, GLvoid* vertices) {
325 if (force || vertices != mCurrentTexCoordsPointer) {
326 glVertexAttribPointer(slot, 2, GL_FLOAT, GL_FALSE, gMeshStride, vertices);
327 mCurrentTexCoordsPointer = vertices;
328 }
329}
330
331void Caches::resetVertexPointers() {
332 mCurrentPositionPointer = this;
333 mCurrentTexCoordsPointer = this;
334}
335
336void Caches::resetTexCoordsVertexPointer() {
337 mCurrentTexCoordsPointer = this;
Chet Haasedd78cca2010-10-22 18:59:26 -0700338}
339
Romain Guy15bc6432011-12-13 13:11:32 -0800340void Caches::enableTexCoordsVertexArray() {
341 if (!mTexCoordsArrayEnabled) {
342 glEnableVertexAttribArray(Program::kBindingTexCoords);
Romain Guyec31f832011-12-13 18:39:19 -0800343 mCurrentTexCoordsPointer = this;
Romain Guy15bc6432011-12-13 13:11:32 -0800344 mTexCoordsArrayEnabled = true;
345 }
346}
347
348void Caches::disbaleTexCoordsVertexArray() {
349 if (mTexCoordsArrayEnabled) {
350 glDisableVertexAttribArray(Program::kBindingTexCoords);
351 mTexCoordsArrayEnabled = false;
352 }
353}
354
Romain Guya1d3c912011-12-13 14:55:06 -0800355void Caches::activeTexture(GLuint textureUnit) {
356 if (mTextureUnit != textureUnit) {
357 glActiveTexture(gTextureUnits[textureUnit]);
358 mTextureUnit = textureUnit;
359 }
360}
361
Romain Guy8a4ac612012-07-17 17:32:48 -0700362bool Caches::setScissor(GLint x, GLint y, GLint width, GLint height) {
Romain Guy586cae32012-07-13 15:28:31 -0700363 if (scissorEnabled && (x != mScissorX || y != mScissorY ||
364 width != mScissorWidth || height != mScissorHeight)) {
365
Romain Guy8f85e802011-12-14 19:23:32 -0800366 glScissor(x, y, width, height);
367
368 mScissorX = x;
369 mScissorY = y;
370 mScissorWidth = width;
371 mScissorHeight = height;
Romain Guy8a4ac612012-07-17 17:32:48 -0700372
373 return true;
Romain Guy8f85e802011-12-14 19:23:32 -0800374 }
Romain Guy8a4ac612012-07-17 17:32:48 -0700375 return false;
Romain Guy8f85e802011-12-14 19:23:32 -0800376}
377
Romain Guy8a4ac612012-07-17 17:32:48 -0700378bool Caches::enableScissor() {
Romain Guy586cae32012-07-13 15:28:31 -0700379 if (!scissorEnabled) {
380 glEnable(GL_SCISSOR_TEST);
381 scissorEnabled = true;
Romain Guy8a4ac612012-07-17 17:32:48 -0700382 return true;
Romain Guy586cae32012-07-13 15:28:31 -0700383 }
Romain Guy8a4ac612012-07-17 17:32:48 -0700384 return false;
Romain Guy586cae32012-07-13 15:28:31 -0700385}
386
Romain Guy8a4ac612012-07-17 17:32:48 -0700387bool Caches::disableScissor() {
Romain Guy586cae32012-07-13 15:28:31 -0700388 if (scissorEnabled) {
389 glDisable(GL_SCISSOR_TEST);
390 scissorEnabled = false;
Romain Guy8a4ac612012-07-17 17:32:48 -0700391 return true;
Romain Guy586cae32012-07-13 15:28:31 -0700392 }
Romain Guy8a4ac612012-07-17 17:32:48 -0700393 return false;
Romain Guy586cae32012-07-13 15:28:31 -0700394}
395
396void Caches::setScissorEnabled(bool enabled) {
397 if (scissorEnabled != enabled) {
398 if (enabled) glEnable(GL_SCISSOR_TEST);
399 else glDisable(GL_SCISSOR_TEST);
400 scissorEnabled = enabled;
401 }
402}
403
Romain Guy82bc7a72012-01-03 14:13:39 -0800404void Caches::resetScissor() {
405 mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
406}
407
Romain Guy5b3b3522010-10-27 18:57:51 -0700408TextureVertex* Caches::getRegionMesh() {
409 // Create the mesh, 2 triangles and 4 vertices per rectangle in the region
410 if (!mRegionMesh) {
411 mRegionMesh = new TextureVertex[REGION_MESH_QUAD_COUNT * 4];
412
413 uint16_t* regionIndices = new uint16_t[REGION_MESH_QUAD_COUNT * 6];
414 for (int i = 0; i < REGION_MESH_QUAD_COUNT; i++) {
415 uint16_t quad = i * 4;
416 int index = i * 6;
417 regionIndices[index ] = quad; // top-left
418 regionIndices[index + 1] = quad + 1; // top-right
419 regionIndices[index + 2] = quad + 2; // bottom-left
420 regionIndices[index + 3] = quad + 2; // bottom-left
421 regionIndices[index + 4] = quad + 1; // top-right
422 regionIndices[index + 5] = quad + 3; // bottom-right
423 }
424
425 glGenBuffers(1, &mRegionMeshIndices);
Romain Guy15bc6432011-12-13 13:11:32 -0800426 bindIndicesBuffer(mRegionMeshIndices);
Romain Guy5b3b3522010-10-27 18:57:51 -0700427 glBufferData(GL_ELEMENT_ARRAY_BUFFER, REGION_MESH_QUAD_COUNT * 6 * sizeof(uint16_t),
428 regionIndices, GL_STATIC_DRAW);
429
430 delete[] regionIndices;
431 } else {
Romain Guy15bc6432011-12-13 13:11:32 -0800432 bindIndicesBuffer(mRegionMeshIndices);
Romain Guy5b3b3522010-10-27 18:57:51 -0700433 }
434
435 return mRegionMesh;
436}
437
Chet Haasedd78cca2010-10-22 18:59:26 -0700438}; // namespace uirenderer
439}; // namespace android