• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #pragma once
18 
19 #include "FileSystem.h"
20 
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 namespace android {
26 namespace vintf {
27 
28 // APEX VINTF interface
29 class ApexInterface {
30    public:
31     virtual ~ApexInterface() = default;
32     // Check if there is an update for the given type of APEX files in the system
33     virtual bool HasUpdate(FileSystem* fileSystem) const = 0;
34     // Get device VINTF directories
35     virtual status_t DeviceVintfDirs(FileSystem* fileSystem, std::vector<std::string>* out,
36                                      std::string* error) = 0;
37 };
38 
39 namespace details {
40 
41 // Provide default implementation for ApexInterface
42 class Apex : public ApexInterface {
43    public:
44     Apex() = default;
45     bool HasUpdate(FileSystem* fileSystem) const override;
46     status_t DeviceVintfDirs(FileSystem* fileSystem, std::vector<std::string>* out,
47                              std::string* error) override;
48 
49    private:
50     std::optional<int64_t> mtime_;
51 };
52 
53 }  // namespace details
54 }  // namespace vintf
55 }  // namespace android
56