Process the next main command.
| 187 | |
| 188 | // Process the next main command. |
| 189 | static void HandleCmd(android_app *appState, int32_t cmd) { |
| 190 | switch (cmd) { |
| 191 | case APP_CMD_DESTROY: |
| 192 | /** |
| 193 | * Command from main thread: the app's activity is being destroyed, |
| 194 | * and waiting for the app thread to clean up and exit before proceeding. |
| 195 | */ |
| 196 | break; |
| 197 | case APP_CMD_PAUSE: |
| 198 | /** |
| 199 | * Command from main thread: the app's activity has been paused. |
| 200 | */ |
| 201 | suspended = true; |
| 202 | break; |
| 203 | case APP_CMD_RESUME: |
| 204 | /** |
| 205 | * Command from main thread: the app's activity has been resumed. |
| 206 | */ |
| 207 | suspended = false; |
| 208 | break; |
| 209 | case APP_CMD_INIT_WINDOW: |
| 210 | /** |
| 211 | * Command from main thread: a new ANativeWindow is ready for use. Upon |
| 212 | * receiving this command, android_app->window will contain the new window |
| 213 | * surface. |
| 214 | */ |
| 215 | if (appState->window) { |
| 216 | surfaceCreated = true; |
| 217 | InitDisplay(appState->window); |
| 218 | } |
| 219 | break; |
| 220 | case APP_CMD_TERM_WINDOW: |
| 221 | /** |
| 222 | * Command from main thread: the existing ANativeWindow needs to be |
| 223 | * terminated. Upon receiving this command, android_app->window still |
| 224 | * contains the existing window; after calling android_app_exec_cmd |
| 225 | * it will be set to NULL. |
| 226 | */ |
| 227 | if (surfaceCreated) { |
| 228 | BE1::rhi.DeactivateSurface(mainContext); |
| 229 | surfaceCreated = false; |
| 230 | } |
| 231 | break; |
| 232 | case APP_CMD_LOST_FOCUS: |
| 233 | /** |
| 234 | * Command from main thread: the app's activity window has lost |
| 235 | * input focus. |
| 236 | */ |
| 237 | SuspendSensors(); |
| 238 | hasFocus = false; |
| 239 | break; |
| 240 | case APP_CMD_GAINED_FOCUS: |
| 241 | /** |
| 242 | * Command from main thread: the app's activity window has gained |
| 243 | * input focus. |
| 244 | */ |
| 245 | ResumeSensors(); |
| 246 | hasFocus = true; |
nothing calls this directly
no test coverage detected