• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_SYSTEM_ABILITY_MANAGER_COLLECT_PLUGIN_INTERFACE_H
17 #define OHOS_SYSTEM_ABILITY_MANAGER_COLLECT_PLUGIN_INTERFACE_H
18 
19 #include <list>
20 
21 #include "errors.h"
22 #include "ireport.h"
23 #include "refbase.h"
24 #include "sa_profiles.h"
25 #include "system_ability_ondemand_reason.h"
26 
27 namespace OHOS {
28 class ICollectPlugin : public virtual RefBase {
29 public:
30     explicit ICollectPlugin(const sptr<IReport>& report);
31     virtual ~ICollectPlugin() = default;
32 
33     virtual int32_t OnStart() = 0;
34     virtual int32_t OnStop() = 0;
Init(const std::list<SaProfile> & saProfiles)35     virtual void Init(const std::list<SaProfile>& saProfiles) {};
CheckCondition(const OnDemandCondition & condition)36     virtual bool CheckCondition(const OnDemandCondition& condition) { return false; };
GetOnDemandReasonExtraData(int64_t extraDataId,OnDemandReasonExtraData & extraData)37     virtual bool GetOnDemandReasonExtraData(int64_t extraDataId, OnDemandReasonExtraData& extraData) { return false; };
AddCollectEvent(const OnDemandEvent & event)38     virtual int32_t AddCollectEvent(const OnDemandEvent& event) { return ERR_OK; };
39     void ReportEvent(const OnDemandEvent& event);
40     void PostDelayTask(std::function<void()> callback, int32_t delayTime);
41 private:
42     sptr<IReport> report_;
43 };
44 } // namespace OHOS
45 #endif // OHOS_SYSTEM_ABILITY_MANAGER_COLLECT_PLUGIN_INTERFACE_H