• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   DeviceType device_type;
34   bool bootconfig_supported = false;
35   bool hctr2_supported = false;
36   std::string android_version_number;
37   bool gfxstream_supported = false;
38   bool gfxstream_gl_program_binary_link_status_supported = false;
39   bool vhost_user_vsock = false;
40   bool supports_bgra_framebuffers = false;
41   bool prefer_drm_virgl_when_supported = false;
42   bool mouse_supported = false;
43   std::string ti50_emulator;
44   std::optional<std::string> custom_keyboard_config;
45   std::optional<std::string> domkey_mapping_config;
46   int output_audio_streams_count = 1;
47 };
48 
49 Result<std::vector<GuestConfig>> GetGuestConfigAndSetDefaults();
50 // Must be called after ParseCommandLineFlags.
51 Result<CuttlefishConfig> InitializeCuttlefishConfiguration(
52     const std::string& root_dir,
53     const std::vector<GuestConfig>& guest_configs,
54     fruit::Injector<>& injector, const FetcherConfig& fetcher_config);
55 
56 std::string GetConfigFilePath(const CuttlefishConfig& config);
57 std::string GetSeccompPolicyDir();
58 
59 } // namespace cuttlefish
60