blob: a075092d3e5b968899ecff2cb1b5f2cee4b059a4 [file] [log] [blame]
Xiaochu Liu8ba486f2018-11-06 11:14:10 -08001//
2// Copyright (C) 2018 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#ifndef UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_
18#define UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_
19
Jae Hoon Kim50f26732020-05-14 10:46:15 -070020#include <memory>
Xiaochu Liu8ba486f2018-11-06 11:14:10 -080021#include <string>
22#include <vector>
23
Kokoa Matsuda1783eb32024-10-16 13:49:17 +090024#include <android-base/macros.h>
Xiaochu Liu8ba486f2018-11-06 11:14:10 -080025
26namespace chromeos_update_engine {
27
28// The abstract dlcservice interface defines the interaction with the
29// platform's dlcservice.
30class DlcServiceInterface {
31 public:
32 virtual ~DlcServiceInterface() = default;
33
Amin Hassani2b68e6b2020-04-17 10:49:12 -070034 // Returns true and a list of installed DLC ids in |dlc_ids|.
Xiaochu Liu8ba486f2018-11-06 11:14:10 -080035 // On failure it returns false.
Amin Hassani2b68e6b2020-04-17 10:49:12 -070036 virtual bool GetDlcsToUpdate(std::vector<std::string>* dlc_ids) = 0;
Xiaochu Liu8ba486f2018-11-06 11:14:10 -080037
Jae Hoon Kim7fdfbf12020-04-10 18:15:50 -070038 // Returns true if dlcservice successfully handled the install completion
39 // method call, otherwise false.
Amin Hassani2b68e6b2020-04-17 10:49:12 -070040 virtual bool InstallCompleted(const std::vector<std::string>& dlc_ids) = 0;
Jae Hoon Kim7fdfbf12020-04-10 18:15:50 -070041
42 // Returns true if dlcservice successfully handled the update completion
43 // method call, otherwise false.
Amin Hassani2b68e6b2020-04-17 10:49:12 -070044 virtual bool UpdateCompleted(const std::vector<std::string>& dlc_ids) = 0;
Jae Hoon Kim7fdfbf12020-04-10 18:15:50 -070045
Xiaochu Liu8ba486f2018-11-06 11:14:10 -080046 protected:
47 DlcServiceInterface() = default;
48
49 private:
50 DISALLOW_COPY_AND_ASSIGN(DlcServiceInterface);
51};
52
Jae Hoon Kim50f26732020-05-14 10:46:15 -070053// This factory function creates a new DlcServiceInterface instance for the
54// current platform.
55std::unique_ptr<DlcServiceInterface> CreateDlcService();
56
Xiaochu Liu8ba486f2018-11-06 11:14:10 -080057} // namespace chromeos_update_engine
58
59#endif // UPDATE_ENGINE_COMMON_DLCSERVICE_INTERFACE_H_