aboutsummaryrefslogtreecommitdiff
path: root/xbmc/addons/AddonManager.h
blob: 10668125c042d99797033f954575c539f2ef5fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "threads/CriticalSection.h"
#include "utils/EventStream.h"

#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <string>
#include <vector>

namespace ADDON
{
enum class AddonDisabledReason;
enum class AddonOriginType;
enum class AddonType;
enum class AddonUpdateRule;
enum class AllowCheckForUpdates : bool;

class CAddonDatabase;
class CAddonUpdateRules;
class CAddonVersion;
class IAddonMgrCallback;

class CAddonInfo;
using AddonInfoPtr = std::shared_ptr<CAddonInfo>;
using ADDON_INFO_LIST = std::map<std::string, AddonInfoPtr>;

class IAddon;
using AddonPtr = std::shared_ptr<IAddon>;
using VECADDONS = std::vector<AddonPtr>;

struct AddonEvent;
struct AddonWithUpdate;
struct DependencyInfo;
struct RepositoryDirInfo;

using AddonInstanceId = uint32_t;

enum class AddonCheckType : bool
{
  OUTDATED_ADDONS,
  AVAILABLE_UPDATES,
};

enum class OnlyEnabled : bool
{
  CHOICE_YES = true,
  CHOICE_NO = false,
};

enum class OnlyEnabledRootAddon : bool
{
  CHOICE_YES = true,
  CHOICE_NO = false,
};

enum class CheckIncompatible : bool
{
  CHOICE_YES = true,
  CHOICE_NO = false,
};

/**
  * Class - CAddonMgr
  * Holds references to all addons, enabled or
  * otherwise. Services the generic callbacks available
  * to all addon variants.
  */
class CAddonMgr
{
public:
  bool ReInit()
  {
    DeInit();
    return Init();
  }
  bool Init();
  void DeInit();

  CAddonMgr();
  CAddonMgr(const CAddonMgr&) = delete;
  virtual ~CAddonMgr();

  CEventStream<AddonEvent>& Events() { return m_events; }
  CEventStream<AddonEvent>& UnloadEvents() { return m_unloadEvents; }

  IAddonMgrCallback* GetCallbackForType(AddonType type);
  bool RegisterAddonMgrCallback(AddonType type, IAddonMgrCallback* cb);
  void UnregisterAddonMgrCallback(AddonType type);

  /*! \brief Retrieve a specific addon (of a specific type)
     \param id the id of the addon to retrieve.
     \param addon[out] the retrieved addon pointer - only use if the function returns true.
     \param type type of addon to retrieve - defaults to any type.
     \param onlyEnabled whether we only want enabled addons - set to false to allow both enabled and disabled addons - defaults to true.
     \return true if an addon matching the id of the given type is available and is enabled (if onlyEnabled is true).
     */
  bool GetAddon(const std::string& id,
                AddonPtr& addon,
                AddonType type,
                OnlyEnabled onlyEnabled) const;

  /*! \brief Retrieve a specific addon (of no specific type)
     \param id the id of the addon to retrieve.
     \param addon[out] the retrieved addon pointer - only use if the function returns true.
     \param onlyEnabled whether we only want enabled addons - set to false to allow both enabled and disabled addons - defaults to true.
     \return true if an addon matching the id of any type is available and is enabled (if onlyEnabled is true).
     */
  bool GetAddon(const std::string& id, AddonPtr& addon, OnlyEnabled onlyEnabled) const;

  bool HasType(const std::string& id, AddonType type);

  bool HasAddons(AddonType type);

  bool HasInstalledAddons(AddonType type);

  /*! Returns all installed, enabled and incompatible (and disabled) add-ons. */
  bool GetAddonsForUpdate(VECADDONS& addons) const;

  /*! Returns all installed, enabled add-ons. */
  bool GetAddons(VECADDONS& addons) const;

  /*! Returns enabled add-ons with given type. */
  bool GetAddons(VECADDONS& addons, AddonType type);

  /*! Returns all installed, including disabled. */
  bool GetInstalledAddons(VECADDONS& addons);

  /*! Returns installed add-ons, including disabled, with given type. */
  bool GetInstalledAddons(VECADDONS& addons, AddonType type);

  bool GetDisabledAddons(VECADDONS& addons);

  bool GetDisabledAddons(VECADDONS& addons, AddonType type);

  /*! Get all installable addons */
  bool GetInstallableAddons(VECADDONS& addons);

  bool GetInstallableAddons(VECADDONS& addons, AddonType type);

  /*! \brief Get the installable addon depending on install rules
     *         or fall back to highest version.
     * \note This function gets called in different contexts. If it's
     *       called for checking possible updates for already installed addons
     *       our update restriction rules apply.
     *       If it's called to (for example) populate an addon-select-dialog
     *       the addon is not installed yet, and we have to fall back to the
     *       highest version.
     * \param addonId addon to check for update or installation
     * \param addon[out] the retrieved addon pointer - only use if the function returns true.
     * \return true if an addon matching the id is available.
     */
  bool FindInstallableById(const std::string& addonId, AddonPtr& addon);

  void AddToUpdateableAddons(AddonPtr& pAddon);
  void RemoveFromUpdateableAddons(AddonPtr& pAddon);
  bool ReloadSettings(const std::string& addonId, AddonInstanceId instanceId);

  /*! Get addons with available updates */
  std::vector<std::shared_ptr<IAddon>> GetAvailableUpdates() const;

  /*! Get addons that are outdated */
  std::vector<std::shared_ptr<IAddon>> GetOutdatedAddons() const;

  /*! Returns true if there is any addon with available updates, otherwise false */
  bool HasAvailableUpdates();

  /*!
     * \brief Checks if the passed in addon is an orphaned dependency
     * \param addon the add-on/dependency to check
     * \param allAddons vector of all installed add-ons
     * \return true or false
     */
  bool IsOrphaned(const std::shared_ptr<IAddon>& addon,
                  const std::vector<std::shared_ptr<IAddon>>& allAddons) const;

  /*! \brief Checks for new / updated add-ons
     \return True if everything went ok, false otherwise
     */
  bool FindAddons();

  /*! \brief Checks whether given addon with given origin/version is installed
     * \param addonId addon to check
     * \param origin origin to check
     * \param addonVersion version to check
     * \return True if installed, false otherwise
     */
  bool FindAddon(const std::string& addonId,
                 const std::string& origin,
                 const CAddonVersion& addonVersion);

  /*!
     * @brief Fills the the provided vector with the list of incompatible
     * enabled addons and returns if there's any.
     *
     * @param[out] incompatible List of incompatible addons
     * @return true if there are incompatible addons
     */
  bool GetIncompatibleEnabledAddonInfos(std::vector<AddonInfoPtr>& incompatible) const;

  /*!
     * Migrate all the addons (updates all addons that have an update pending and disables those
     * that got incompatible)
     *
     * @return list of all addons (infos) that were modified.
     */
  std::vector<AddonInfoPtr> MigrateAddons();

  /*!
     * @brief Try to disable addons in the given list.
     *
     * @param[in] incompatible List of incompatible addon infos
     * @return list of all addon Infos that were disabled
     */
  std::vector<AddonInfoPtr> DisableIncompatibleAddons(
      const std::vector<AddonInfoPtr>& incompatible);

  /*!
     * Install available addon updates, if any.
     * @param wait If kodi should wait for all updates to download and install before returning
     */
  void CheckAndInstallAddonUpdates(bool wait) const;

  /*!
     * @note: should only be called by AddonInstaller
     *
     * Unload addon from the system. Returns true if it was unloaded, otherwise false.
     */
  bool UnloadAddon(const std::string& addonId);

  /*!
     * @note: should only be called by AddonInstaller
     *
     * Returns true if the addon was successfully loaded and enabled; otherwise false.
     */
  bool LoadAddon(const std::string& addonId,
                 const std::string& origin,
                 const CAddonVersion& addonVersion);

  /*! @note: should only be called by AddonInstaller
     *
     * Hook for clearing internal state after uninstall.
     */
  void OnPostUnInstall(const std::string& id);

  /*! \brief Disable an addon. Returns true on success, false on failure. */
  bool DisableAddon(const std::string& ID, AddonDisabledReason disabledReason);

  /*! \brief Updates reason for a disabled addon. Returns true on success, false on failure. */
  bool UpdateDisabledReason(const std::string& id, AddonDisabledReason newDisabledReason);

  /*! \brief Enable an addon. Returns true on success, false on failure. */
  bool EnableAddon(const std::string& ID);

  /* \brief Check whether an addon has been disabled via DisableAddon.
     In case the disabled cache does not know about the current state the database routine will be used.
     \param ID id of the addon
     \sa DisableAddon
     */
  bool IsAddonDisabled(const std::string& ID) const;

  /*!
     * @brief Check whether an addon has been disabled via DisableAddon except for a particular
     * reason In case the disabled cache does not know about the current state the database routine
     * will be used.
     * @param[in] ID id of the addon
     * @param[in] disabledReason the reason that will be an exception to being disabled
     * @return true if the addon was disabled except for the specified reason
     * @sa DisableAddon
     */
  bool IsAddonDisabledExcept(const std::string& ID, AddonDisabledReason disabledReason) const;

  /* \brief Checks whether an addon can be disabled via DisableAddon.
     \param ID id of the addon
     \sa DisableAddon
     */
  bool CanAddonBeDisabled(const std::string& ID);

  bool CanAddonBeEnabled(const std::string& id);

  /* \brief Checks whether an addon is installed.
     \param ID id of the addon
    */
  bool IsAddonInstalled(const std::string& ID);

  /* \brief Checks whether an addon is installed from a
     *        particular origin repo
     * \note if checked for an origin defined as official (i.e. repository.xbmc.org)
     *       this function will return true even if the addon is a shipped system add-on
     * \param ID id of the addon
     * \param origin origin repository id
     */
  bool IsAddonInstalled(const std::string& ID, const std::string& origin) const;

  /* \brief Checks whether an addon is installed from a
     *        particular origin repo and version
     * \note if checked for an origin defined as official (i.e. repository.xbmc.org)
     *       this function will return true even if the addon is a shipped system add-on
     * \param ID id of the addon
     * \param origin origin repository id
     * \param version the version of the addon
     */
  bool IsAddonInstalled(const std::string& ID,
                        const std::string& origin,
                        const CAddonVersion& version);

  /* \brief Checks whether an addon can be installed. Broken addons can't be installed.
    \param addon addon to be checked
    */
  bool CanAddonBeInstalled(const AddonPtr& addon);

  bool CanUninstall(const AddonPtr& addon);

  /*!
     * @brief Checks whether an addon is a bundled addon
     *
     * @param[in] id id of the addon
     * @return true if addon is bundled addon, false otherwise.
     */
  bool IsBundledAddon(const std::string& id);

  /*!
     * @brief Checks whether an addon is a system addon
     *
     * @param[in] id id of the addon
     * @return true if addon is system addon, false otherwise.
     */
  bool IsSystemAddon(const std::string& id);

  /*!
     * @brief Checks whether an addon is a required system addon
     *
     * @param[in] id id of the addon
     * @return true if addon is a required system addon, false otherwise.
     */
  bool IsRequiredSystemAddon(const std::string& id);

  /*!
     * @brief Checks whether an addon is an optional system addon
     *
     * @param[in] id id of the addon
     * @return true if addon is an optional system addon, false otherwise.
     */
  bool IsOptionalSystemAddon(const std::string& id);

  /*!
     * @brief Addon update rules.
     *
     * member functions for handling and querying add-on update rules
     *
     * @warning This should be never used from other places outside of addon
     * system directory.
     *
     */
  /*@{{{*/

  /* \brief Add a single update rule to the list for an addon
     * \sa CAddonUpdateRules::AddUpdateRuleToList()
     */
  bool AddUpdateRuleToList(const std::string& id, AddonUpdateRule updateRule);

  /* \brief Remove all rules from update rules list for an addon
     * \sa CAddonUpdateRules::RemoveAllUpdateRulesFromList()
     */
  bool RemoveAllUpdateRulesFromList(const std::string& id);

  /* \brief Remove a specific rule from update rules list for an addon
     * \sa CAddonUpdateRules::RemoveUpdateRuleFromList()
     */
  bool RemoveUpdateRuleFromList(const std::string& id, AddonUpdateRule updateRule);

  /* \brief Check if an addon version is auto-updateable
     * \param id addon id to be checked
     * \return true is addon is auto-updateable, false otherwise
     * \sa CAddonUpdateRules::IsAutoUpdateable()
     */
  bool IsAutoUpdateable(const std::string& id) const;

  /*@}}}*/

  /* \brief Launches event AddonEvent::AutoUpdateStateChanged
     * \param id addon id to pass through
     * \sa CGUIDialogAddonInfo::OnToggleAutoUpdates()
     */
  void PublishEventAutoUpdateStateChanged(const std::string& id);
  void UpdateLastUsed(const std::string& id);

  /*!
     * \brief Launches event @ref AddonEvent::InstanceAdded
     *
     * This is called when a new instance is added in add-on settings.
     *
     * \param[in] addonId Add-on id to pass through
     * \param[in] instanceId Identifier of the add-on instance
     */
  void PublishInstanceAdded(const std::string& addonId, AddonInstanceId instanceId);

  /*!
     * \brief Launches event @ref AddonEvent::InstanceRemoved
     *
     * This is called when an instance is removed in add-on settings.
     *
     * \param[in] addonId Add-on id to pass through
     * \param[in] instanceId Identifier of the add-on instance
     */
  void PublishInstanceRemoved(const std::string& addonId, AddonInstanceId instanceId);

  /*! \brief Load the addon in the given path
     This loads the addon using c-pluff which parses the addon descriptor file.
     \param path folder that contains the addon.
     \param addon [out] returned addon.
     \return true if addon is set, false otherwise.
     */
  bool LoadAddonDescription(const std::string& path, AddonPtr& addon);

  bool ServicesHasStarted() const;

  /*!
     * @brief Check if given addon is compatible with Kodi.
     *
     * @param[in] addon Addon to check
     * @return true if compatible, false if not
     */
  bool IsCompatible(const std::shared_ptr<const IAddon>& addon) const;

  /*!
     * @brief Check given addon information is compatible with Kodi.
     *
     * @param[in] addonInfo Addon information to check
     * @return true if compatible, false if not
     */
  bool IsCompatible(const AddonInfoPtr& addonInfo) const;

  /*! \brief Recursively get dependencies for an add-on
     *  \param id the id of the root addon
     *  \param onlyEnabledRootAddon whether look for enabled root add-ons only
     */
  std::vector<DependencyInfo> GetDepsRecursive(const std::string& id,
                                               OnlyEnabledRootAddon onlyEnabledRootAddon);

  /*!
     * @brief Get a list of add-on's with info's for the on system available
     * ones.
     *
     * @param[out] addonInfos list where finded addon information becomes stored
     * @param[in] onlyEnabled If true are only enabled ones given back,
     *                        if false all on system available. Default is true.
     * @param[in] type The requested type, with "ADDON_UNKNOWN" are all add-on
     *                 types given back who match the case with value before.
     *                 If a type id becomes added are only add-ons returned who
     *                 match them. Default is for all types.
     * @return true if the list contains entries
     */
  bool GetAddonInfos(std::vector<AddonInfoPtr>& addonInfos, bool onlyEnabled, AddonType type) const;

  /*!
     * @brief Get a list of add-on's with info's for the on system available
     * ones.
     *
     * @param[in] onlyEnabled If true are only enabled ones given back,
     *                        if false all on system available. Default is true.
     * @param[in] types List about requested types.
     * @return List where finded addon information becomes returned.
     *
     * @note @ref ADDON_UNKNOWN should not used for here!
     */
  std::vector<AddonInfoPtr> GetAddonInfos(bool onlyEnabled,
                                          const std::vector<AddonType>& types) const;

  /*!
     * @brief Get a list of disabled add-on's with info's
     *
     * @param[out] addonInfos list where finded addon information becomes stored
     * @param[in] type        The requested type, with "ADDON_UNKNOWN"
     *                        are all add-on types given back who match the case
     *                        with value before.
     *                        If a type id becomes added are only add-ons
     *                        returned who match them. Default is for all types.
     * @return true if the list contains entries
     */
  bool GetDisabledAddonInfos(std::vector<AddonInfoPtr>& addonInfos, AddonType type) const;

  /*!
     * @brief Get a list of disabled add-on's with info's for the on system
     * available ones with a specific disabled reason.
     *
     * @param[out] addonInfos list where finded addon information becomes stored
     * @param[in] type        The requested type, with "ADDON_UNKNOWN"
     *                        are all add-on types given back who match the case
     *                        with value before.
     *                        If a type id becomes added are only add-ons
     *                        returned who match them. Default is for all types.
     * @param[in] disabledReason To get all disabled addons use the value
     *                           "AddonDiasbledReason::NONE". If any other value
     *                           is supplied only addons with that reason will be
     *                           returned.
     * @return true if the list contains entries
     */
  bool GetDisabledAddonInfos(std::vector<AddonInfoPtr>& addonInfos,
                             AddonType type,
                             AddonDisabledReason disabledReason) const;

  const AddonInfoPtr GetAddonInfo(const std::string& id, AddonType type) const;

  /*!
     * @brief Get the path where temporary add-on files are stored
     *
     * @return the base path used for temporary addon paths
     *
     * @warning the folder and its contents are deleted when Kodi is closed
     */
  const std::string& GetTempAddonBasePath() { return m_tempAddonBasePath; }

  AddonOriginType GetAddonOriginType(const AddonPtr& addon) const;

  /*!
     * \brief Check whether an addon has been disabled with a special reason.
     * \param ID id of the addon
     * \param disabledReason reason we want to check for (NONE, USER, INCOMPATIBLE, PERMANENT_FAILURE)
     * \return true or false
     */
  bool IsAddonDisabledWithReason(const std::string& ID, AddonDisabledReason disabledReason) const;

  /*!
     * @brief Addon update and install management.
     *
     * Parts inside here are used for changes about addon system.
     *
     * @warning This should be never used from other places outside of addon
     * system directory.
     */
  /*@{{{*/

  /*!
     * @brief Update addon origin data.
     *
     * This becomes called from @ref CAddonInstallJob to set the source repo and
     * if update, to set also the date.
     *
     * @note This must be called after the addon manager has inserted a new addon
     * with @ref FindAddons() into database.
     *
     * @param[in] addonId Identifier of addon
     * @param[in] repoAddonId Identifier of related repository addon
     * @param[in] isUpdate If call becomes done on already installed addon and
     *                     update only.
     * @return True if successfully done, otherwise false
     *
     * Currently listed call sources:
     * - @ref CAddonInstallJob::DoWork
     */
  bool SetAddonOrigin(const std::string& addonId, const std::string& repoAddonId, bool isUpdate);

  /*!
     * @brief Parse a repository XML file for addons and load their descriptors.
     *
     * A repository XML is essentially a concatenated list of addon descriptors.
     *
     * @param[in] repo The repository info.
     * @param[in] xml The XML document from repository.
     * @param[out] addons returned list of addons.
     * @return true if the repository XML file is parsed, false otherwise.
     *
     * Currently listed call sources:
     * - @ref CRepository::FetchIndex
     */
  bool AddonsFromRepoXML(const RepositoryDirInfo& repo,
                         const std::string& xml,
                         std::vector<AddonInfoPtr>& addons);

  /*@}}}*/

  /*!
     * \brief Retrieves list of outdated addons as well as their related
     *        available updates and stores them into map.
     * \return map of outdated addons with their update
     */
  std::map<std::string, AddonWithUpdate> GetAddonsWithAvailableUpdate() const;

  /*!
     * \brief Retrieves list of compatible addon versions of all origins
     * \param[in] addonId addon to look up
     * \return vector containing compatible addon versions
     */
  std::vector<std::shared_ptr<IAddon>> GetCompatibleVersions(const std::string& addonId) const;

  /*!
     * \brief Return number of available updates formatted as string
     *        this can be used as a lightweight method of retrieving the number of updates
     *        rather than using the expensive GetAvailableUpdates call
     * \return number of available updates
     */
  const std::string& GetLastAvailableUpdatesCountAsString() const;

  /*!
     * \brief returns a vector with all found orphaned dependencies.
     * \return the vector
     */
  std::vector<std::shared_ptr<IAddon>> GetOrphanedDependencies() const;

private:
  CAddonMgr& operator=(CAddonMgr const&) = delete;

  VECADDONS m_updateableAddons;

  /*!
     * \brief returns a vector with either available updates or outdated addons.
     *        usually called by its wrappers GetAvailableUpdates() or
     *        GetOutdatedAddons()
     * \param[in] true to return outdated addons, false to return available updates
     * \return vector filled with either available updates or outdated addons
     */
  std::vector<std::shared_ptr<IAddon>> GetAvailableUpdatesOrOutdatedAddons(
      AddonCheckType addonCheckType) const;

  bool GetAddonsInternal(AddonType type,
                         VECADDONS& addons,
                         OnlyEnabled onlyEnabled,
                         CheckIncompatible checkIncompatible) const;

  bool EnableSingle(const std::string& id);

  void FindAddons(ADDON_INFO_LIST& addonmap, const std::string& path);

  /*!
     * @brief Fills the the provided vector with the list of incompatible
     * addons and returns if there's any.
     *
     * @param[out] incompatible List of incompatible addons
     * @param[in] whether or not to include incompatible addons that are disabled
     * @return true if there are incompatible addons
     */
  bool GetIncompatibleAddonInfos(std::vector<AddonInfoPtr>& incompatible,
                                 bool includeDisabled) const;

  /*!
     * Get the list of of available updates
     * \param[in,out] updates the vector of addons to be filled with addons that need to be updated (not blacklisted)
     * \return if there are any addons needing updates
     */
  bool GetAddonUpdateCandidates(VECADDONS& updates) const;

  /*!\brief Sort a list of addons for installation, i.e., defines the order of installation depending
     * of each addon dependencies.
     * \param[in,out] updates the vector of addons to sort
     */
  void SortByDependencies(VECADDONS& updates) const;

  /*!
     * Install the list of addon updates via AddonInstaller
     * \param[in,out] updates the vector of addons to install (will be sorted)
     * \param wait if the process should wait for all addons to install
     * \param allowCheckForUpdates indicates if content update checks are allowed
     *        after installation of a repository addon from the list
     */
  void InstallAddonUpdates(VECADDONS& updates,
                           bool wait,
                           AllowCheckForUpdates allowCheckForUpdates) const;

  // This guards the addon installation process to make sure
  // addon updates are not installed concurrently
  // while the migration is running. Addon updates can be triggered
  // as a result of a repository update event.
  // (migration will install any available update anyway)
  mutable std::mutex m_installAddonsMutex;

  std::map<std::string, AddonDisabledReason> m_disabled;
  static std::map<AddonType, IAddonMgrCallback*> m_managers;
  mutable CCriticalSection m_critSection;
  std::unique_ptr<CAddonDatabase> m_database;
  std::unique_ptr<CAddonUpdateRules> m_updateRules;
  CEventSource<AddonEvent> m_events;
  CBlockingEventSource<AddonEvent> m_unloadEvents;
  std::set<std::string> m_systemAddons;
  std::set<std::string> m_optionalSystemAddons;
  ADDON_INFO_LIST m_installedAddons;

  // Temporary path given to add-ons, whose content is deleted when Kodi is stopped
  const std::string m_tempAddonBasePath = "special://temp/addons";

  /*!
     * latest count of available updates
     */
  mutable std::string m_lastAvailableUpdatesCountAsString;
  mutable std::mutex m_lastAvailableUpdatesCountMutex;
};

}; /* namespace ADDON */