MCPcopy Create free account
hub / github.com/android/ndk-samples / HandleCmd

Method HandleCmd

teapots/image-decoder/src/main/cpp/TeapotNativeActivity.cpp:255–291  ·  view source on GitHub ↗

* Process the next main command. */

Source from the content-addressed store, hash-verified

253 * Process the next main command.
254 */
255void Engine::HandleCmd(struct android_app* app, int32_t cmd) {
256 Engine* eng = (Engine*)app->userData;
257 switch (cmd) {
258 case APP_CMD_SAVE_STATE:
259 break;
260 case APP_CMD_INIT_WINDOW:
261 // The window is being shown, get it ready.
262 if (app->window != NULL) {
263 eng->InitDisplay(app);
264 eng->has_focus_ = true;
265 eng->DrawFrame();
266 }
267 break;
268 case APP_CMD_TERM_WINDOW:
269 // The window is being hidden or closed, clean it up.
270 eng->TermDisplay();
271 eng->has_focus_ = false;
272 break;
273 case APP_CMD_STOP:
274 break;
275 case APP_CMD_GAINED_FOCUS:
276 eng->ResumeSensors();
277 // Start animation
278 eng->has_focus_ = true;
279 break;
280 case APP_CMD_LOST_FOCUS:
281 eng->SuspendSensors();
282 // Also stop animating.
283 eng->has_focus_ = false;
284 eng->DrawFrame();
285 break;
286 case APP_CMD_LOW_MEMORY:
287 // Free up GL resources
288 eng->TrimMemory();
289 break;
290 }
291}
292
293//-------------------------------------------------------------------------
294// Sensor handlers

Callers

nothing calls this directly

Calls 6

InitDisplayMethod · 0.45
DrawFrameMethod · 0.45
TermDisplayMethod · 0.45
ResumeSensorsMethod · 0.45
SuspendSensorsMethod · 0.45
TrimMemoryMethod · 0.45

Tested by

no test coverage detected