1e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 2e5c31af7Sopenharmony_ci * drawElements Quality Program Tester Core 3e5c31af7Sopenharmony_ci * ---------------------------------------- 4e5c31af7Sopenharmony_ci * 5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 10e5c31af7Sopenharmony_ci * 11e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 17e5c31af7Sopenharmony_ci * limitations under the License. 18e5c31af7Sopenharmony_ci * 19e5c31af7Sopenharmony_ci *//*! 20e5c31af7Sopenharmony_ci * \file 21e5c31af7Sopenharmony_ci * \brief RenderActivity base class. 22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/ 23e5c31af7Sopenharmony_ci 24e5c31af7Sopenharmony_ci#include "tcuAndroidRenderActivity.hpp" 25e5c31af7Sopenharmony_ci#include "deSemaphore.hpp" 26e5c31af7Sopenharmony_ci 27e5c31af7Sopenharmony_ci#include <android/window.h> 28e5c31af7Sopenharmony_ci 29e5c31af7Sopenharmony_ci#include <string> 30e5c31af7Sopenharmony_ci#include <stdlib.h> 31e5c31af7Sopenharmony_ci 32e5c31af7Sopenharmony_ciusing std::string; 33e5c31af7Sopenharmony_ci 34e5c31af7Sopenharmony_ci#if defined(DE_DEBUG) 35e5c31af7Sopenharmony_ci# define DBG_PRINT(X) print X 36e5c31af7Sopenharmony_ci#else 37e5c31af7Sopenharmony_ci# define DBG_PRINT(X) 38e5c31af7Sopenharmony_ci#endif 39e5c31af7Sopenharmony_ci 40e5c31af7Sopenharmony_cinamespace tcu 41e5c31af7Sopenharmony_ci{ 42e5c31af7Sopenharmony_cinamespace Android 43e5c31af7Sopenharmony_ci{ 44e5c31af7Sopenharmony_ci 45e5c31af7Sopenharmony_cienum 46e5c31af7Sopenharmony_ci{ 47e5c31af7Sopenharmony_ci MESSAGE_QUEUE_SIZE = 8 //!< Length of RenderThread message queue. 48e5c31af7Sopenharmony_ci}; 49e5c31af7Sopenharmony_ci 50e5c31af7Sopenharmony_ci#if defined(DE_DEBUG) 51e5c31af7Sopenharmony_cistatic const char* getMessageTypeName (MessageType type) 52e5c31af7Sopenharmony_ci{ 53e5c31af7Sopenharmony_ci static const char* s_names[] = 54e5c31af7Sopenharmony_ci { 55e5c31af7Sopenharmony_ci "RESUME", 56e5c31af7Sopenharmony_ci "PAUSE", 57e5c31af7Sopenharmony_ci "FINISH", 58e5c31af7Sopenharmony_ci "WINDOW_CREATED", 59e5c31af7Sopenharmony_ci "WINDOW_RESIZED", 60e5c31af7Sopenharmony_ci "WINDOW_DESTROYED", 61e5c31af7Sopenharmony_ci "INPUT_QUEUE_CREATED", 62e5c31af7Sopenharmony_ci "INPUT_QUEUE_DESTROYED", 63e5c31af7Sopenharmony_ci "SYNC" 64e5c31af7Sopenharmony_ci }; 65e5c31af7Sopenharmony_ci DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == MESSAGETYPE_LAST); 66e5c31af7Sopenharmony_ci return s_names[type]; 67e5c31af7Sopenharmony_ci} 68e5c31af7Sopenharmony_ci#endif 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ci// RenderThread 71e5c31af7Sopenharmony_ci 72e5c31af7Sopenharmony_ciRenderThread::RenderThread (NativeActivity& activity) 73e5c31af7Sopenharmony_ci : m_activity (activity) 74e5c31af7Sopenharmony_ci , m_msgQueue (MESSAGE_QUEUE_SIZE) 75e5c31af7Sopenharmony_ci , m_threadRunning (false) 76e5c31af7Sopenharmony_ci , m_inputQueue (DE_NULL) 77e5c31af7Sopenharmony_ci , m_windowState (WINDOWSTATE_NOT_CREATED) 78e5c31af7Sopenharmony_ci , m_window (DE_NULL) 79e5c31af7Sopenharmony_ci , m_paused (false) 80e5c31af7Sopenharmony_ci , m_finish (false) 81e5c31af7Sopenharmony_ci , m_receivedFirstResize(false) 82e5c31af7Sopenharmony_ci{ 83e5c31af7Sopenharmony_ci} 84e5c31af7Sopenharmony_ci 85e5c31af7Sopenharmony_ciRenderThread::~RenderThread (void) 86e5c31af7Sopenharmony_ci{ 87e5c31af7Sopenharmony_ci} 88e5c31af7Sopenharmony_ci 89e5c31af7Sopenharmony_civoid RenderThread::start (void) 90e5c31af7Sopenharmony_ci{ 91e5c31af7Sopenharmony_ci m_threadRunning = true; 92e5c31af7Sopenharmony_ci Thread::start(); 93e5c31af7Sopenharmony_ci} 94e5c31af7Sopenharmony_ci 95e5c31af7Sopenharmony_civoid RenderThread::stop (void) 96e5c31af7Sopenharmony_ci{ 97e5c31af7Sopenharmony_ci // Queue finish command 98e5c31af7Sopenharmony_ci enqueue(Message(MESSAGE_FINISH)); 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ci // Wait for thread to terminate 101e5c31af7Sopenharmony_ci join(); 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_ci m_threadRunning = false; 104e5c31af7Sopenharmony_ci} 105e5c31af7Sopenharmony_ci 106e5c31af7Sopenharmony_civoid RenderThread::enqueue (const Message& message) 107e5c31af7Sopenharmony_ci{ 108e5c31af7Sopenharmony_ci // \note Thread must be running or otherwise nobody is going to drain the queue. 109e5c31af7Sopenharmony_ci DE_ASSERT(m_threadRunning); 110e5c31af7Sopenharmony_ci m_msgQueue.pushFront(message); 111e5c31af7Sopenharmony_ci} 112e5c31af7Sopenharmony_ci 113e5c31af7Sopenharmony_civoid RenderThread::pause (void) 114e5c31af7Sopenharmony_ci{ 115e5c31af7Sopenharmony_ci enqueue(Message(MESSAGE_PAUSE)); 116e5c31af7Sopenharmony_ci} 117e5c31af7Sopenharmony_ci 118e5c31af7Sopenharmony_civoid RenderThread::resume (void) 119e5c31af7Sopenharmony_ci{ 120e5c31af7Sopenharmony_ci enqueue(Message(MESSAGE_RESUME)); 121e5c31af7Sopenharmony_ci} 122e5c31af7Sopenharmony_ci 123e5c31af7Sopenharmony_civoid RenderThread::sync (void) 124e5c31af7Sopenharmony_ci{ 125e5c31af7Sopenharmony_ci de::Semaphore waitSem(0); 126e5c31af7Sopenharmony_ci enqueue(Message(MESSAGE_SYNC, &waitSem)); 127e5c31af7Sopenharmony_ci waitSem.decrement(); 128e5c31af7Sopenharmony_ci} 129e5c31af7Sopenharmony_ci 130e5c31af7Sopenharmony_civoid RenderThread::processMessage (const Message& message) 131e5c31af7Sopenharmony_ci{ 132e5c31af7Sopenharmony_ci DBG_PRINT(("RenderThread::processMessage(): message = { %s, %p }\n", getMessageTypeName(message.type), message.payload.window)); 133e5c31af7Sopenharmony_ci 134e5c31af7Sopenharmony_ci switch (message.type) 135e5c31af7Sopenharmony_ci { 136e5c31af7Sopenharmony_ci case MESSAGE_RESUME: m_paused = false; break; 137e5c31af7Sopenharmony_ci case MESSAGE_PAUSE: m_paused = true; break; 138e5c31af7Sopenharmony_ci case MESSAGE_FINISH: m_finish = true; break; 139e5c31af7Sopenharmony_ci 140e5c31af7Sopenharmony_ci // \note While Platform / WindowRegistry are currently multi-window -capable, 141e5c31af7Sopenharmony_ci // the fact that platform gives us windows too late / at unexpected times 142e5c31af7Sopenharmony_ci // forces us to do some quick checking and limit system to one window here. 143e5c31af7Sopenharmony_ci case MESSAGE_WINDOW_CREATED: 144e5c31af7Sopenharmony_ci if (m_windowState != WINDOWSTATE_NOT_CREATED && m_windowState != WINDOWSTATE_DESTROYED) 145e5c31af7Sopenharmony_ci throw InternalError("Got unexpected onNativeWindowCreated() event from system"); 146e5c31af7Sopenharmony_ci 147e5c31af7Sopenharmony_ci // The documented behavior for the callbacks is that the native activity 148e5c31af7Sopenharmony_ci // will get a call to onNativeWindowCreated(), at which point it should have 149e5c31af7Sopenharmony_ci // a surface to render to, and can then start immediately. 150e5c31af7Sopenharmony_ci // 151e5c31af7Sopenharmony_ci // The actual creation process has the framework making calls to both 152e5c31af7Sopenharmony_ci // onNativeWindowCreated() and then onNativeWindowResized(). The test 153e5c31af7Sopenharmony_ci // waits for that first resize before it considers the window ready for 154e5c31af7Sopenharmony_ci // rendering. 155e5c31af7Sopenharmony_ci // 156e5c31af7Sopenharmony_ci // However subsequent events in the framework may cause the window to be 157e5c31af7Sopenharmony_ci // recreated at a new position without a size change, which sends on 158e5c31af7Sopenharmony_ci // onNativeWindowDestroyed(), and then on onNativeWindowCreated() without 159e5c31af7Sopenharmony_ci // a follow-up onNativeWindowResized(). If this happens, the test will 160e5c31af7Sopenharmony_ci // stop rendering as it is no longer in the ready state, and a watchdog 161e5c31af7Sopenharmony_ci // thread will eventually kill the test, causing it to fail. We therefore 162e5c31af7Sopenharmony_ci // set the window state back to READY and process the window creation here 163e5c31af7Sopenharmony_ci // if we have already observed that first resize call. 164e5c31af7Sopenharmony_ci if (!m_receivedFirstResize) { 165e5c31af7Sopenharmony_ci m_windowState = WINDOWSTATE_NOT_INITIALIZED; 166e5c31af7Sopenharmony_ci } else { 167e5c31af7Sopenharmony_ci m_windowState = WINDOWSTATE_READY; 168e5c31af7Sopenharmony_ci onWindowCreated(message.payload.window); 169e5c31af7Sopenharmony_ci } 170e5c31af7Sopenharmony_ci m_window = message.payload.window; 171e5c31af7Sopenharmony_ci break; 172e5c31af7Sopenharmony_ci 173e5c31af7Sopenharmony_ci case MESSAGE_WINDOW_RESIZED: 174e5c31af7Sopenharmony_ci if (m_window != message.payload.window) 175e5c31af7Sopenharmony_ci throw InternalError("Got onNativeWindowResized() event targeting different window"); 176e5c31af7Sopenharmony_ci 177e5c31af7Sopenharmony_ci // Record that we've the first resize event, in case the window is 178e5c31af7Sopenharmony_ci // recreated later without a resize. 179e5c31af7Sopenharmony_ci m_receivedFirstResize = true; 180e5c31af7Sopenharmony_ci 181e5c31af7Sopenharmony_ci if (m_windowState == WINDOWSTATE_NOT_INITIALIZED) 182e5c31af7Sopenharmony_ci { 183e5c31af7Sopenharmony_ci // Got first resize event, window is ready for use. 184e5c31af7Sopenharmony_ci m_windowState = WINDOWSTATE_READY; 185e5c31af7Sopenharmony_ci onWindowCreated(message.payload.window); 186e5c31af7Sopenharmony_ci } 187e5c31af7Sopenharmony_ci else if (m_windowState == WINDOWSTATE_READY) 188e5c31af7Sopenharmony_ci onWindowResized(message.payload.window); 189e5c31af7Sopenharmony_ci else 190e5c31af7Sopenharmony_ci throw InternalError("Got unexpected onNativeWindowResized() event from system"); 191e5c31af7Sopenharmony_ci 192e5c31af7Sopenharmony_ci break; 193e5c31af7Sopenharmony_ci 194e5c31af7Sopenharmony_ci case MESSAGE_WINDOW_DESTROYED: 195e5c31af7Sopenharmony_ci if (m_window != message.payload.window) 196e5c31af7Sopenharmony_ci throw InternalError("Got onNativeWindowDestroyed() event targeting different window"); 197e5c31af7Sopenharmony_ci 198e5c31af7Sopenharmony_ci if (m_windowState != WINDOWSTATE_NOT_INITIALIZED && m_windowState != WINDOWSTATE_READY) 199e5c31af7Sopenharmony_ci throw InternalError("Got unexpected onNativeWindowDestroyed() event from system"); 200e5c31af7Sopenharmony_ci 201e5c31af7Sopenharmony_ci if (m_windowState == WINDOWSTATE_READY) 202e5c31af7Sopenharmony_ci onWindowDestroyed(message.payload.window); 203e5c31af7Sopenharmony_ci 204e5c31af7Sopenharmony_ci m_windowState = WINDOWSTATE_DESTROYED; 205e5c31af7Sopenharmony_ci m_window = DE_NULL; 206e5c31af7Sopenharmony_ci break; 207e5c31af7Sopenharmony_ci 208e5c31af7Sopenharmony_ci case MESSAGE_INPUT_QUEUE_CREATED: 209e5c31af7Sopenharmony_ci m_inputQueue = message.payload.inputQueue; 210e5c31af7Sopenharmony_ci break; 211e5c31af7Sopenharmony_ci 212e5c31af7Sopenharmony_ci case MESSAGE_INPUT_QUEUE_DESTROYED: 213e5c31af7Sopenharmony_ci m_inputQueue = message.payload.inputQueue; 214e5c31af7Sopenharmony_ci break; 215e5c31af7Sopenharmony_ci 216e5c31af7Sopenharmony_ci case MESSAGE_SYNC: 217e5c31af7Sopenharmony_ci message.payload.semaphore->increment(); 218e5c31af7Sopenharmony_ci break; 219e5c31af7Sopenharmony_ci 220e5c31af7Sopenharmony_ci default: 221e5c31af7Sopenharmony_ci throw std::runtime_error("Unknown message type"); 222e5c31af7Sopenharmony_ci break; 223e5c31af7Sopenharmony_ci } 224e5c31af7Sopenharmony_ci} 225e5c31af7Sopenharmony_ci 226e5c31af7Sopenharmony_civoid RenderThread::run (void) 227e5c31af7Sopenharmony_ci{ 228e5c31af7Sopenharmony_ci // Init state 229e5c31af7Sopenharmony_ci m_windowState = WINDOWSTATE_NOT_CREATED; 230e5c31af7Sopenharmony_ci m_paused = true; 231e5c31af7Sopenharmony_ci m_finish = false; 232e5c31af7Sopenharmony_ci 233e5c31af7Sopenharmony_ci try 234e5c31af7Sopenharmony_ci { 235e5c31af7Sopenharmony_ci while (!m_finish) 236e5c31af7Sopenharmony_ci { 237e5c31af7Sopenharmony_ci if (m_paused || m_windowState != WINDOWSTATE_READY) 238e5c31af7Sopenharmony_ci { 239e5c31af7Sopenharmony_ci // Block until we are not paused and window is ready. 240e5c31af7Sopenharmony_ci Message msg = m_msgQueue.popBack(); 241e5c31af7Sopenharmony_ci processMessage(msg); 242e5c31af7Sopenharmony_ci continue; 243e5c31af7Sopenharmony_ci } 244e5c31af7Sopenharmony_ci 245e5c31af7Sopenharmony_ci // Process available commands 246e5c31af7Sopenharmony_ci { 247e5c31af7Sopenharmony_ci Message msg; 248e5c31af7Sopenharmony_ci if (m_msgQueue.tryPopBack(msg)) 249e5c31af7Sopenharmony_ci { 250e5c31af7Sopenharmony_ci processMessage(msg); 251e5c31af7Sopenharmony_ci continue; 252e5c31af7Sopenharmony_ci } 253e5c31af7Sopenharmony_ci } 254e5c31af7Sopenharmony_ci 255e5c31af7Sopenharmony_ci DE_ASSERT(m_windowState == WINDOWSTATE_READY); 256e5c31af7Sopenharmony_ci 257e5c31af7Sopenharmony_ci // Process input events. 258e5c31af7Sopenharmony_ci // \todo [2013-05-08 pyry] What if system fills up the input queue before we have window ready? 259e5c31af7Sopenharmony_ci while (m_inputQueue && 260e5c31af7Sopenharmony_ci AInputQueue_hasEvents(m_inputQueue) > 0) 261e5c31af7Sopenharmony_ci { 262e5c31af7Sopenharmony_ci AInputEvent* event; 263e5c31af7Sopenharmony_ci TCU_CHECK(AInputQueue_getEvent(m_inputQueue, &event) >= 0); 264e5c31af7Sopenharmony_ci onInputEvent(event); 265e5c31af7Sopenharmony_ci AInputQueue_finishEvent(m_inputQueue, event, 1); 266e5c31af7Sopenharmony_ci } 267e5c31af7Sopenharmony_ci 268e5c31af7Sopenharmony_ci // Everything set up - safe to render. 269e5c31af7Sopenharmony_ci if (!render()) 270e5c31af7Sopenharmony_ci { 271e5c31af7Sopenharmony_ci DBG_PRINT(("RenderThread::run(): render\n")); 272e5c31af7Sopenharmony_ci break; 273e5c31af7Sopenharmony_ci } 274e5c31af7Sopenharmony_ci } 275e5c31af7Sopenharmony_ci } 276e5c31af7Sopenharmony_ci catch (const std::exception& e) 277e5c31af7Sopenharmony_ci { 278e5c31af7Sopenharmony_ci print("RenderThread: %s\n", e.what()); 279e5c31af7Sopenharmony_ci } 280e5c31af7Sopenharmony_ci 281e5c31af7Sopenharmony_ci // Tell activity to finish. 282e5c31af7Sopenharmony_ci DBG_PRINT(("RenderThread::run(): done, waiting for FINISH\n")); 283e5c31af7Sopenharmony_ci m_activity.finish(); 284e5c31af7Sopenharmony_ci 285e5c31af7Sopenharmony_ci // Thread must keep draining message queue until FINISH message is encountered. 286e5c31af7Sopenharmony_ci try 287e5c31af7Sopenharmony_ci { 288e5c31af7Sopenharmony_ci while (!m_finish) 289e5c31af7Sopenharmony_ci { 290e5c31af7Sopenharmony_ci Message msg = m_msgQueue.popBack(); 291e5c31af7Sopenharmony_ci 292e5c31af7Sopenharmony_ci // Ignore all but SYNC and FINISH messages. 293e5c31af7Sopenharmony_ci if (msg.type == MESSAGE_SYNC || msg.type == MESSAGE_FINISH) 294e5c31af7Sopenharmony_ci processMessage(msg); 295e5c31af7Sopenharmony_ci } 296e5c31af7Sopenharmony_ci } 297e5c31af7Sopenharmony_ci catch (const std::exception& e) 298e5c31af7Sopenharmony_ci { 299e5c31af7Sopenharmony_ci die("RenderThread: %s\n", e.what()); 300e5c31af7Sopenharmony_ci } 301e5c31af7Sopenharmony_ci 302e5c31af7Sopenharmony_ci DBG_PRINT(("RenderThread::run(): exiting...\n")); 303e5c31af7Sopenharmony_ci} 304e5c31af7Sopenharmony_ci 305e5c31af7Sopenharmony_ci// RenderActivity 306e5c31af7Sopenharmony_ci 307e5c31af7Sopenharmony_ciRenderActivity::RenderActivity (ANativeActivity* activity) 308e5c31af7Sopenharmony_ci : NativeActivity(activity) 309e5c31af7Sopenharmony_ci , m_thread (DE_NULL) 310e5c31af7Sopenharmony_ci{ 311e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::RenderActivity()")); 312e5c31af7Sopenharmony_ci} 313e5c31af7Sopenharmony_ci 314e5c31af7Sopenharmony_ciRenderActivity::~RenderActivity (void) 315e5c31af7Sopenharmony_ci{ 316e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::~RenderActivity()")); 317e5c31af7Sopenharmony_ci} 318e5c31af7Sopenharmony_ci 319e5c31af7Sopenharmony_civoid RenderActivity::setThread (RenderThread* thread) 320e5c31af7Sopenharmony_ci{ 321e5c31af7Sopenharmony_ci m_thread = thread; 322e5c31af7Sopenharmony_ci} 323e5c31af7Sopenharmony_ci 324e5c31af7Sopenharmony_civoid RenderActivity::onStart (void) 325e5c31af7Sopenharmony_ci{ 326e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onStart()")); 327e5c31af7Sopenharmony_ci} 328e5c31af7Sopenharmony_ci 329e5c31af7Sopenharmony_civoid RenderActivity::onResume (void) 330e5c31af7Sopenharmony_ci{ 331e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onResume()")); 332e5c31af7Sopenharmony_ci 333e5c31af7Sopenharmony_ci // Resume (or start) test execution 334e5c31af7Sopenharmony_ci m_thread->resume(); 335e5c31af7Sopenharmony_ci} 336e5c31af7Sopenharmony_ci 337e5c31af7Sopenharmony_civoid RenderActivity::onPause (void) 338e5c31af7Sopenharmony_ci{ 339e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onPause()")); 340e5c31af7Sopenharmony_ci 341e5c31af7Sopenharmony_ci // Pause test execution 342e5c31af7Sopenharmony_ci m_thread->pause(); 343e5c31af7Sopenharmony_ci} 344e5c31af7Sopenharmony_ci 345e5c31af7Sopenharmony_civoid RenderActivity::onStop (void) 346e5c31af7Sopenharmony_ci{ 347e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onStop()")); 348e5c31af7Sopenharmony_ci} 349e5c31af7Sopenharmony_ci 350e5c31af7Sopenharmony_civoid RenderActivity::onDestroy (void) 351e5c31af7Sopenharmony_ci{ 352e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onDestroy()")); 353e5c31af7Sopenharmony_ci} 354e5c31af7Sopenharmony_ci 355e5c31af7Sopenharmony_civoid RenderActivity::onNativeWindowCreated (ANativeWindow* window) 356e5c31af7Sopenharmony_ci{ 357e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onNativeWindowCreated()")); 358e5c31af7Sopenharmony_ci m_thread->enqueue(Message(MESSAGE_WINDOW_CREATED, window)); 359e5c31af7Sopenharmony_ci} 360e5c31af7Sopenharmony_ci 361e5c31af7Sopenharmony_civoid RenderActivity::onNativeWindowResized (ANativeWindow* window) 362e5c31af7Sopenharmony_ci{ 363e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onNativeWindowResized()")); 364e5c31af7Sopenharmony_ci m_thread->enqueue(Message(MESSAGE_WINDOW_RESIZED, window)); 365e5c31af7Sopenharmony_ci} 366e5c31af7Sopenharmony_ci 367e5c31af7Sopenharmony_civoid RenderActivity::onNativeWindowRedrawNeeded (ANativeWindow* window) 368e5c31af7Sopenharmony_ci{ 369e5c31af7Sopenharmony_ci DE_UNREF(window); 370e5c31af7Sopenharmony_ci} 371e5c31af7Sopenharmony_ci 372e5c31af7Sopenharmony_civoid RenderActivity::onNativeWindowDestroyed (ANativeWindow* window) 373e5c31af7Sopenharmony_ci{ 374e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onNativeWindowDestroyed()")); 375e5c31af7Sopenharmony_ci m_thread->enqueue(Message(MESSAGE_WINDOW_DESTROYED, window)); 376e5c31af7Sopenharmony_ci m_thread->sync(); // Block until thread has processed all messages. 377e5c31af7Sopenharmony_ci} 378e5c31af7Sopenharmony_ci 379e5c31af7Sopenharmony_civoid RenderActivity::onInputQueueCreated (AInputQueue* queue) 380e5c31af7Sopenharmony_ci{ 381e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onInputQueueCreated()")); 382e5c31af7Sopenharmony_ci m_thread->enqueue(Message(MESSAGE_INPUT_QUEUE_CREATED, queue)); 383e5c31af7Sopenharmony_ci} 384e5c31af7Sopenharmony_ci 385e5c31af7Sopenharmony_civoid RenderActivity::onInputQueueDestroyed (AInputQueue* queue) 386e5c31af7Sopenharmony_ci{ 387e5c31af7Sopenharmony_ci DBG_PRINT(("RenderActivity::onInputQueueDestroyed()")); 388e5c31af7Sopenharmony_ci m_thread->enqueue(Message(MESSAGE_INPUT_QUEUE_DESTROYED, queue)); 389e5c31af7Sopenharmony_ci m_thread->sync(); 390e5c31af7Sopenharmony_ci} 391e5c31af7Sopenharmony_ci 392e5c31af7Sopenharmony_ci} // Android 393e5c31af7Sopenharmony_ci} // tcu 394