| 44 | } |
| 45 | |
| 46 | void LoaderService::onStartAppMessage(const std::string& id, app::LaunchId launchId, std::shared_ptr<const Bundle> parameters) { |
| 47 | LOGGER.info("Start by id {}", id); |
| 48 | |
| 49 | auto app_manifest = app::findAppManifestById(id); |
| 50 | if (app_manifest == nullptr) { |
| 51 | LOGGER.error("App not found: {}", id); |
| 52 | return; |
| 53 | } |
| 54 | |
| 55 | auto lock = mutex.asScopedLock(); |
| 56 | if (!lock.lock(LOADER_TIMEOUT)) { |
| 57 | LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED); |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | auto previous_app = !appStack.empty() ? appStack[appStack.size() - 1]: nullptr; |
| 62 | auto new_app = std::make_shared<app::AppInstance>(app_manifest, launchId, parameters); |
| 63 | |
| 64 | new_app->mutableFlags().hideStatusbar = (app_manifest->appFlags & app::AppManifest::Flags::HideStatusBar); |
| 65 | |
| 66 | // We might have to hide the previous app first |
| 67 | if (previous_app != nullptr) { |
| 68 | transitionAppToState(previous_app, app::State::Hiding); |
| 69 | } |
| 70 | |
| 71 | appStack.push_back(new_app); |
| 72 | transitionAppToState(new_app, app::State::Created); |
| 73 | transitionAppToState(new_app, app::State::Showing); |
| 74 | } |
| 75 | |
| 76 | void LoaderService::onStopTopAppMessage(const std::string& id) { |
| 77 | auto lock = mutex.asScopedLock(); |
nothing calls this directly
no test coverage detected