1 /*
2  * Copyright (c) 2023 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 #ifndef SYS_INSTALLER_MODULE_UPDATE_SERVICE_H
16 #define SYS_INSTALLER_MODULE_UPDATE_SERVICE_H
17 
18 #include "module_update_stub.h"
19 #include "system_ability.h"
20 
21 namespace OHOS {
22 namespace SysInstaller {
23 class ModuleUpdateService : public SystemAbility, public ModuleUpdateStub {
24     DECLARE_SYSTEM_ABILITY(ModuleUpdateService);
25 
26 public:
27     ModuleUpdateService(int32_t systemAbilityId, bool runOnCreate = false);
28     ~ModuleUpdateService() override;
29 
30     int32_t InstallModulePackage(const std::string &pkgPath) override;
31     int32_t UninstallModulePackage(const std::string &hmpName) override;
32     int32_t GetModulePackageInfo(const std::string &hmpName,
33         std::list<ModulePackageInfo> &modulePackageInfos) override;
34     int32_t ExitModuleUpdate() override;
35 
36     std::vector<HmpVersionInfo> GetHmpVersionInfo() override;
37     int32_t StartUpdateHmpPackage(const std::string &path,
38         const sptr<ISysInstallerCallback> &updateCallback) override;
39     std::vector<HmpUpdateInfo> GetHmpUpdateResult() override;
40 
41 #ifndef UPDATER_UT
42 protected:
43 #endif
44     void OnStart(const SystemAbilityOnDemandReason &startReason) override;
45     void OnStop(const SystemAbilityOnDemandReason &stopReason) override;
46 };
47 } // namespace SysInstaller
48 } // namespace OHOS
49 #endif // SYS_INSTALLER_MODULE_UPDATE_SERVICE_H
50