Don't launch wmediumd if it isn't necessary
Bug: 202426731
Bug: 202511422
Test: m && launch_cvd and then check if wmediumd isn't running
Change-Id: I6b78186cab5de9c1eb74929a3b3fee597637d7b6
diff --git a/host/commands/run_cvd/Android.bp b/host/commands/run_cvd/Android.bp
index 87ff40d..2f6eb0b 100644
--- a/host/commands/run_cvd/Android.bp
+++ b/host/commands/run_cvd/Android.bp
@@ -49,5 +49,6 @@
defaults: [
"cuttlefish_host",
"cuttlefish_libicuuc",
+ "cvd_cc_defaults",
],
}
diff --git a/host/commands/run_cvd/launch.cc b/host/commands/run_cvd/launch.cc
index c24499c..1734350 100644
--- a/host/commands/run_cvd/launch.cc
+++ b/host/commands/run_cvd/launch.cc
@@ -642,7 +642,13 @@
// Feature
std::string Name() const override { return "WmediumdServer"; }
- bool Enabled() const override { return instance_.start_wmediumd(); }
+ bool Enabled() const override {
+#ifndef ENFORCE_MAC80211_HWSIM
+ return false;
+#else
+ return instance_.start_wmediumd();
+#endif
+ }
private:
std::unordered_set<Feature*> Dependencies() const override { return {}; }
@@ -749,7 +755,7 @@
// Feature
std::string Name() const override { return "OpenWrt"; }
bool Enabled() const override {
-#ifdef ENFORCE_MAC80211_HWSIM
+#ifndef ENFORCE_MAC80211_HWSIM
return false;
#else
return instance_.start_ap();
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index d171acc..d7e3dd4 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -123,10 +123,12 @@
crosvm_cmd.Cmd().AddParameter("--vhost-net");
}
+#ifdef ENFORCE_MAC80211_HWSIM
if (!config.vhost_user_mac80211_hwsim().empty()) {
crosvm_cmd.Cmd().AddParameter("--vhost-user-mac80211-hwsim=",
config.vhost_user_mac80211_hwsim());
}
+#endif
if (config.protected_vm()) {
crosvm_cmd.Cmd().AddParameter("--protected-vm");