| 257 | } |
| 258 | |
| 259 | void GuiService::hideApp() { |
| 260 | auto lock = mutex.asScopedLock(); |
| 261 | lock.lock(); |
| 262 | |
| 263 | if (!isStarted) { |
| 264 | LOGGER.error("Failed to hide app: GUI not started"); |
| 265 | return; |
| 266 | } |
| 267 | |
| 268 | if (appToRender == nullptr) { |
| 269 | LOGGER.warn("hideApp() called but no app is currently shown"); |
| 270 | return; |
| 271 | } |
| 272 | |
| 273 | // We must lock the LVGL port, because the viewport hide callbacks |
| 274 | // might call LVGL APIs (e.g. to remove the keyboard from the screen root) |
| 275 | lvgl::lock(portMAX_DELAY); |
| 276 | appToRender->getApp()->onHide(*appToRender); |
| 277 | lvgl::unlock(); |
| 278 | appToRender = nullptr; |
| 279 | } |
| 280 | |
| 281 | std::shared_ptr<GuiService> findService() { |
| 282 | return std::static_pointer_cast<GuiService>( |