1 /* 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 #pragma once 17 18 #include <fruit/fruit.h> 19 #include <set> 20 21 #include "host/libs/config/command_source.h" 22 #include "host/libs/config/config_flag.h" 23 #include "host/libs/config/config_fragment.h" 24 #include "host/libs/config/cuttlefish_config.h" 25 #include "host/libs/config/feature.h" 26 #include "host/libs/config/kernel_log_pipe_provider.h" 27 28 namespace cuttlefish { 29 30 enum class AdbMode { 31 VsockTunnel, 32 VsockHalfTunnel, 33 NativeVsock, 34 Unknown, 35 }; 36 37 AdbMode StringToAdbMode(const std::string& mode); 38 std::string AdbModeToString(AdbMode mode); 39 40 class AdbConfig { 41 public: 42 virtual ~AdbConfig() = default; 43 virtual const std::set<AdbMode>& Modes() const = 0; 44 virtual bool SetModes(const std::set<AdbMode>&) = 0; 45 virtual bool SetModes(std::set<AdbMode>&&) = 0; 46 47 virtual bool RunConnector() const = 0; 48 virtual bool SetRunConnector(bool) = 0; 49 }; 50 51 class AdbConfigFragment : public ConfigFragment {}; 52 class AdbConfigFlag : public FlagFeature {}; 53 54 fruit::Component<AdbConfig> AdbConfigComponent(); 55 fruit::Component<fruit::Required<AdbConfig, ConfigFlag>, AdbConfigFlag> 56 AdbConfigFlagComponent(); 57 fruit::Component<fruit::Required<AdbConfig>, AdbConfigFragment> 58 AdbConfigFragmentComponent(); 59 fruit::Component<fruit::Required<KernelLogPipeProvider, const AdbConfig, 60 const CuttlefishConfig, 61 const CuttlefishConfig::InstanceSpecific>> 62 LaunchAdbComponent(); 63 64 } // namespace cuttlefish 65