1 /*
2  * Copyright (C) 2019 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 #pragma once
17 
18 #include <fruit/fruit.h>
19 #include <cstdint>
20 #include <optional>
21 #include <string>
22 #include <vector>
23 
24 #include "common/libs/utils/environment.h"
25 #include "common/libs/utils/result.h"
26 #include "host/libs/config/cuttlefish_config.h"
27 #include "host/libs/config/fetcher_config.h"
28 
29 namespace cuttlefish {
30 
31 struct GuestConfig {
32   Arch target_arch;
33   bool bootconfig_supported = false;
34   bool hctr2_supported = false;
35   std::string android_version_number;
36   bool gfxstream_supported = false;
37   bool vhost_user_vsock = false;
38   bool supports_bgra_framebuffers = false;
39 };
40 
41 Result<std::vector<GuestConfig>> GetGuestConfigAndSetDefaults();
42 // Must be called after ParseCommandLineFlags.
43 Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
44     const std::string& root_dir,
45     const std::vector<GuestConfig>& guest_configs,
46     fruit::Injector<>& injector, const FetcherConfig& fetcher_config);
47 
48 std::string GetConfigFilePath(const CuttlefishConfig& config);
49 std::string GetCuttlefishEnvPath();
50 std::string GetSeccompPolicyDir();
51 
52 } // namespace cuttlefish
53