diff --git a/base/cvd/cuttlefish/common/libs/utils/device_type.cpp b/base/cvd/cuttlefish/common/libs/utils/device_type.cpp index 098306fe8c6..5564d4515d2 100644 --- a/base/cvd/cuttlefish/common/libs/utils/device_type.cpp +++ b/base/cvd/cuttlefish/common/libs/utils/device_type.cpp @@ -38,6 +38,8 @@ DeviceType ParseDeviceType(std::string_view type_name) { return DeviceType::Minidroid; } else if (type_name == "go") { return DeviceType::Go; + } else if (type_name == "desktop") { + return DeviceType::Desktop; } else { return DeviceType::Unknown; } @@ -61,6 +63,8 @@ std::string_view DeviceTypeToStringView(DeviceType device_type) { return "minidroid"; case DeviceType::Go: return "go"; + case DeviceType::Desktop: + return "desktop"; } } diff --git a/base/cvd/cuttlefish/common/libs/utils/device_type.h b/base/cvd/cuttlefish/common/libs/utils/device_type.h index 26a6a2b06da..296a465113f 100644 --- a/base/cvd/cuttlefish/common/libs/utils/device_type.h +++ b/base/cvd/cuttlefish/common/libs/utils/device_type.h @@ -29,6 +29,7 @@ enum class DeviceType { Tv, Minidroid, Go, + Desktop, }; // Parse device type android-info.txt config field. diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc b/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc index 808d709ec34..8f9abdd79e1 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/guest_config.cc @@ -81,7 +81,8 @@ Result ParseGuestConfigTextProto(const std::string& guest_config_path, {config::DeviceType::Foldable, DeviceType::Foldable}, {config::DeviceType::Tv, DeviceType::Tv}, {config::DeviceType::Minidroid, DeviceType::Minidroid}, - {config::DeviceType::Go, DeviceType::Go}}; + {config::DeviceType::Go, DeviceType::Go}, + {config::DeviceType::Desktop, DeviceType::Desktop}}; config::GuestConfigFile proto_config; diff --git a/base/cvd/cuttlefish/host/commands/assemble_cvd/proto/guest_config.proto b/base/cvd/cuttlefish/host/commands/assemble_cvd/proto/guest_config.proto index 647ec67dbe4..2f778206090 100644 --- a/base/cvd/cuttlefish/host/commands/assemble_cvd/proto/guest_config.proto +++ b/base/cvd/cuttlefish/host/commands/assemble_cvd/proto/guest_config.proto @@ -147,6 +147,7 @@ enum DeviceType { Tv = 5; Minidroid = 6; Go = 7; + Desktop = 8; } // The presence of this field in the proto indicates the lights HAL is enabled. diff --git a/base/cvd/cuttlefish/host/commands/sensors_simulator/sensors_hal_proxy.cpp b/base/cvd/cuttlefish/host/commands/sensors_simulator/sensors_hal_proxy.cpp index 4a04b0f56d2..f155d9ae037 100644 --- a/base/cvd/cuttlefish/host/commands/sensors_simulator/sensors_hal_proxy.cpp +++ b/base/cvd/cuttlefish/host/commands/sensors_simulator/sensors_hal_proxy.cpp @@ -121,6 +121,31 @@ Result UpdateSensorsHal(const std::string& sensors_data, return {}; } +SensorsMask HostEnabledSensors(DeviceType device_type) { + switch (device_type) { + case DeviceType::Foldable: + return (1 << kAccelerationId) | (1 << kGyroscopeId) | (1 << kMagneticId) | + (1 << kTemperatureId) | (1 << kProximityId) | (1 << kLightId) | + (1 << kPressureId) | (1 << kHumidityId) | (1 << kHingeAngle0Id); + case DeviceType::Auto: + return (1 << kAccelerationId) | (1 << kGyroscopeId) | + (1 << kUncalibGyroscopeId) | (1 << kUncalibAccelerationId); + case DeviceType::Wear: + return (1 << kAccelerationId) | (1 << kGyroscopeId) | (1 << kMagneticId) | + (1 << kTemperatureId) | (1 << kProximityId) | (1 << kLightId) | + (1 << kPressureId) | (1 << kHumidityId) | + (1 << kSensorHandleLowLatencyOffBodyDetect); + case DeviceType::Desktop: + return (1 << kAccelerationId) | (1 << kGyroscopeId) | (1 << kMagneticId) | + (1 << kTemperatureId) | (1 << kProximityId) | (1 << kLightId) | + (1 << kPressureId) | (1 << kHumidityId) | (1 << kHingeAngle0Id); + default: + return (1 << kAccelerationId) | (1 << kGyroscopeId) | (1 << kMagneticId) | + (1 << kTemperatureId) | (1 << kProximityId) | (1 << kLightId) | + (1 << kPressureId) | (1 << kHumidityId); + } +} + } // namespace SensorsHalProxy::SensorsHalProxy(SharedFD control_from_guest_fd, @@ -135,32 +160,7 @@ SensorsHalProxy::SensorsHalProxy(SharedFD control_from_guest_fd, data_channel_(std::move(data_from_guest_fd), std::move(data_to_guest_fd)), kernel_events_fd_(std::move(kernel_events_fd)), sensors_simulator_(sensors_simulator) { - SensorsMask host_enabled_sensors; - switch (device_type) { - case DeviceType::Foldable: - host_enabled_sensors = - (1 << kAccelerationId) | (1 << kGyroscopeId) | (1 << kMagneticId) | - (1 << kTemperatureId) | (1 << kProximityId) | (1 << kLightId) | - (1 << kPressureId) | (1 << kHumidityId) | (1 << kHingeAngle0Id); - break; - case DeviceType::Auto: - host_enabled_sensors = (1 << kAccelerationId) | (1 << kGyroscopeId) | - (1 << kUncalibGyroscopeId) | - (1 << kUncalibAccelerationId); - break; - case DeviceType::Wear: - host_enabled_sensors = (1 << kAccelerationId) | (1 << kGyroscopeId) | - (1 << kMagneticId) | (1 << kTemperatureId) | - (1 << kProximityId) | (1 << kLightId) | - (1 << kPressureId) | (1 << kHumidityId) | - (1 << kSensorHandleLowLatencyOffBodyDetect); - break; - default: - host_enabled_sensors = (1 << kAccelerationId) | (1 << kGyroscopeId) | - (1 << kMagneticId) | (1 << kTemperatureId) | - (1 << kProximityId) | (1 << kLightId) | - (1 << kPressureId) | (1 << kHumidityId); - } + const SensorsMask host_enabled_sensors = HostEnabledSensors(device_type); req_responder_thread_ = std::thread([this, host_enabled_sensors] { while (running_) {