Process the next main command.
| 336 | |
| 337 | // Process the next main command. |
| 338 | static void HandleCmd(android_app *appState, int32_t cmd) { |
| 339 | switch (cmd) { |
| 340 | case APP_CMD_DESTROY: |
| 341 | /** |
| 342 | * Command from main thread: the app's activity is being destroyed, |
| 343 | * and waiting for the app thread to clean up and exit before proceeding. |
| 344 | */ |
| 345 | if (appInitialized) { |
| 346 | app.OnApplicationTerminate(); |
| 347 | } |
| 348 | break; |
| 349 | case APP_CMD_PAUSE: |
| 350 | /** |
| 351 | * Command from main thread: the app's activity has been paused. |
| 352 | */ |
| 353 | suspended = true; |
| 354 | if (appInitialized) { |
| 355 | app.OnApplicationPause(true); |
| 356 | } |
| 357 | break; |
| 358 | case APP_CMD_RESUME: |
| 359 | /** |
| 360 | * Command from main thread: the app's activity has been resumed. |
| 361 | */ |
| 362 | if (appInitialized) { |
| 363 | app.OnApplicationPause(false); |
| 364 | } |
| 365 | suspended = false; |
| 366 | break; |
| 367 | case APP_CMD_INIT_WINDOW: |
| 368 | /** |
| 369 | * Command from main thread: a new ANativeWindow is ready for use. Upon |
| 370 | * receiving this command, android_app->window will contain the new window |
| 371 | * surface. |
| 372 | */ |
| 373 | if (appState->window) { |
| 374 | surfaceCreated = true; |
| 375 | InitDisplay(appState->window); |
| 376 | } |
| 377 | break; |
| 378 | case APP_CMD_TERM_WINDOW: |
| 379 | /** |
| 380 | * Command from main thread: the existing ANativeWindow needs to be |
| 381 | * terminated. Upon receiving this command, android_app->window still |
| 382 | * contains the existing window; after calling android_app_exec_cmd |
| 383 | * it will be set to NULL. |
| 384 | */ |
| 385 | if (surfaceCreated) { |
| 386 | BE1::rhi.DeactivateSurface(app.mainRenderContext->GetContextHandle()); |
| 387 | surfaceCreated = false; |
| 388 | } |
| 389 | break; |
| 390 | case APP_CMD_LOST_FOCUS: |
| 391 | /** |
| 392 | * Command from main thread: the app's activity window has lost |
| 393 | * input focus. |
| 394 | */ |
| 395 | SuspendSensors(); |
nothing calls this directly
no test coverage detected