| 209 | } |
| 210 | |
| 211 | void |
| 212 | FrameworkPrivate::Start(uint32_t) |
| 213 | { |
| 214 | std::vector<long> bundlesToStart; |
| 215 | { |
| 216 | auto l = Lock(); |
| 217 | US_UNUSED(l); |
| 218 | coreCtx->SetFrameworkStoppedState(false); |
| 219 | |
| 220 | switch (state.load()) |
| 221 | { |
| 222 | case Bundle::STATE_INSTALLED: |
| 223 | case Bundle::STATE_RESOLVED: |
| 224 | DoInit(); |
| 225 | [[fallthrough]]; |
| 226 | case Bundle::STATE_STARTING: |
| 227 | operation = BundlePrivate::OP_ACTIVATING; |
| 228 | break; |
| 229 | case Bundle::STATE_ACTIVE: |
| 230 | return; |
| 231 | default: |
| 232 | std::stringstream ss; |
| 233 | ss << state; |
| 234 | |
| 235 | throw std::runtime_error("INTERNAL ERROR, Illegal state, " + ss.str()); |
| 236 | } |
| 237 | bundlesToStart = coreCtx->storage->GetStartOnLaunchBundles(); |
| 238 | } |
| 239 | |
| 240 | // Start bundles according to their autostart setting. |
| 241 | for (auto i : bundlesToStart) |
| 242 | { |
| 243 | auto b = coreCtx->bundleRegistry.GetBundle(i); |
| 244 | try |
| 245 | { |
| 246 | int32_t const autostartSetting = b->barchive->GetAutostartSetting(); |
| 247 | // Launch must not change the autostart setting of a bundle |
| 248 | int option = Bundle::START_TRANSIENT; |
| 249 | if (Bundle::START_ACTIVATION_POLICY == autostartSetting) |
| 250 | { |
| 251 | // Transient start according to the bundles activation policy. |
| 252 | option |= Bundle::START_ACTIVATION_POLICY; |
| 253 | } |
| 254 | b->Start(option); |
| 255 | } |
| 256 | catch (...) |
| 257 | { |
| 258 | coreCtx->listeners.SendFrameworkEvent(FrameworkEvent(FrameworkEvent::Type::FRAMEWORK_ERROR, |
| 259 | MakeBundle(b->shared_from_this()), |
| 260 | std::string(), |
| 261 | std::current_exception())); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | { |
| 266 | auto l = Lock(); |
| 267 | US_UNUSED(l); |
| 268 |
nothing calls this directly
no test coverage detected