[conflict] Merge "Re-organize trout BoardConfig.mk" am: 9515bb8ddb
Original change: https://android-review.googlesource.com/c/device/google/trout/+/2323933
Change-Id: I818616220bd4d519cbe082e13b1e07557cb423f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/OWNERS b/OWNERS
index f9dd23d..3927c5e 100644
--- a/OWNERS
+++ b/OWNERS
@@ -2,5 +2,5 @@
adelva@google.com
# Automotive team
+ankitarora@google.com
egranata@google.com
-gurunagarajan@google.com
diff --git a/agl_services_build/repo_manifest.xml b/agl_services_build/repo_manifest.xml
index f69d5ef..d3c128d 100644
--- a/agl_services_build/repo_manifest.xml
+++ b/agl_services_build/repo_manifest.xml
@@ -20,7 +20,7 @@
<linkfile src="agl_services_build/cmake" dest="cmake" />
<linkfile src="agl_services_build/toolchain" dest="toolchain" />
<linkfile src="hal/audiocontrol" dest="audiocontrol" />
- <linkfile src="hal/dumpstate/1.1" dest="dumpstate_server" />
+ <linkfile src="hal/dumpstate/aidl/1.0" dest="dumpstate_server" />
<linkfile src="hal/vehicle/2.0" dest="vehicle_hal_server" />
<linkfile src="hal/common/agl/watchdog" dest="watchdog_test_server" />
</project>
diff --git a/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc b/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc
index f4cd9b6..7bf8dd5 100644
--- a/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc
+++ b/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc
@@ -49,7 +49,7 @@
device/google/trout/agl_services_build/cmake:cmake \
device/google/trout/agl_services_build/toolchain:toolchain \
device/google/trout/hal/audiocontrol:audiocontrol \
- device/google/trout/hal/dumpstate/1.1:dumpstate_server \
+ device/google/trout/hal/dumpstate/aidl/1.0:dumpstate_server \
device/google/trout/hal/vehicle/2.0:vehicle_hal_server \
device/google/trout/hal/common/agl/watchdog:watchdog_test_server \
hardware/interfaces/automotive/vehicle/2.0/default:third_party/default_native_vehicle_hal \
diff --git a/aosp_trout_arm64.mk b/aosp_trout_arm64.mk
index 30a00af..af1105a 100644
--- a/aosp_trout_arm64.mk
+++ b/aosp_trout_arm64.mk
@@ -44,9 +44,25 @@
endif
# Audio HAL
+# TODO: turn back on goldfish HAL and HFP
TARGET_USES_CUTTLEFISH_AUDIO ?= false
AUDIO_FEATURE_HFP_ENABLED ?= true
+# HWComposer choice. Setting this flag to true
+# will disable Ranchu and turn on the legacy
+# drmhwc. This is not a supported configuration and
+# should only be turned on for debugging and experimental
+# purposes. In general, omitting this line or leaving the
+# default configured (false) will do the right thing and pick
+# Ranchu from upstream Cuttlefish
+TARGET_ENABLE_DRMHWCOMPOSER ?= false
+
+# Workaround for b/246500971 - OpSy host virtio-gpu process
+# crashes while booting.
+# Setting this flag to true will disable the Android boot
+# animation which provokes the crash.
+TARGET_DISABLE_BOOT_ANIMATION ?= true
+
# Audio Control HAL
# TODO (chenhaosjtuacm, egranata): move them to kernel command line
LOCAL_AUDIOCONTROL_PROPERTIES ?= \
@@ -60,7 +76,7 @@
include device/google/trout/aosp_trout_common.mk
-DEVICE_MANIFEST_FILE += device/google/trout/manifest.xml
+DEVICE_MANIFEST_FILE += device/google/trout/trout_arm64/manifest.xml
PRODUCT_PROPERTY_OVERRIDES += \
vendor.ser.bt-uart?= \
diff --git a/aosp_trout_common.mk b/aosp_trout_common.mk
index b796b92..f3fca05 100644
--- a/aosp_trout_common.mk
+++ b/aosp_trout_common.mk
@@ -19,23 +19,13 @@
PRODUCT_PACKAGE_OVERLAYS += device/google/trout/product_files/overlay
-ifeq ($(TARGET_USES_CUTTLEFISH_AUDIO),true)
-# Cuttlefish Audio HAL with custom configuration
-ifndef LOCAL_AUDIO_PRODUCT_COPY_FILES
-LOCAL_AUDIO_PRODUCT_COPY_FILES := \
- device/google/cuttlefish/shared/config/audio_policy.conf:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy.conf \
- frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
- device/google/trout/product_files/vendor/etc/primary_audio_policy_configuration.cf.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml
-endif
-
-LOCAL_AUDIO_PROPERTIES ?=
-else
+ifeq ($(TARGET_USES_CUTTLEFISH_AUDIO),false)
# Car Emulator Audio HAL
LOCAL_AUDIO_PRODUCT_PACKAGE ?= \
audio.primary.caremu \
audio.r_submix.default \
android.hardware.audio@6.0-impl:32 \
- android.hardware.audio.effect@7.0-impl:32 \
+ android.hardware.audio.effect@6.0-impl:32 \
android.hardware.audio.service \
android.hardware.soundtrigger@2.3-impl
@@ -64,12 +54,11 @@
PRODUCT_VENDOR_PROPERTIES += ro.vendor.disable_rename_eth0=true
# Dumpstate HAL
-# TODO(b/215200137): Re-enable once converted to AIDL
-#LOCAL_DUMPSTATE_PRODUCT_PACKAGE ?= android.hardware.dumpstate@1.1-service.trout
-#LOCAL_DUMPSTATE_PROPERTIES ?= \
-# ro.vendor.dumpstate.server.cid=2 \
-# ro.vendor.dumpstate.server.port=9310 \
-# ro.vendor.helpersystem.log_loc=/data/host_logs \
+LOCAL_DUMPSTATE_PRODUCT_PACKAGE ?= android.hardware.automotive.dumpstate-service.trout
+LOCAL_DUMPSTATE_PROPERTIES ?= \
+ ro.vendor.dumpstate.server.cid=2 \
+ ro.vendor.dumpstate.server.port=9310 \
+ ro.vendor.helpersystem.log_loc=/data/host_logs \
# Vehicle HAL
LOCAL_VHAL_PRODUCT_PACKAGE ?= android.hardware.automotive.vehicle@2.0-virtualization-service
@@ -77,7 +66,10 @@
# EVS HAL
LOCAL_EVS_PROPERTIES ?= persist.automotive.evs.mode=1
LOCAL_EVS_RRO_PACKAGE_OVERLAYS ?= TroutEvsOverlay
+ENABLE_EVS_SERVICE ?= true
+ENABLE_MOCK_EVSHAL ?= false
ENABLE_EVS_SAMPLE ?= true
+ENABLE_SAMPLE_EVS_APP ?= false
ENABLE_CAREVSSERVICE_SAMPLE ?= true
ENABLE_SAMPLE_EVS_APP ?= false
@@ -97,12 +89,16 @@
${LOCAL_DUMPSTATE_PROPERTIES} \
${LOCAL_TRACING_SERVER_PROPERTIES}
+ifeq ($(TARGET_DISABLE_BOOT_ANIMATION),true)
+PRODUCT_PROPERTY_OVERRIDES += debug.sf.nobootanimation=1
+endif
+
PRODUCT_CHARACTERISTICS := nosdcard,automotive
TARGET_BOARD_INFO_FILE ?= device/google/trout/board-info.txt
# Keymaster HAL
-LOCAL_KEYMASTER_PRODUCT_PACKAGE ?= android.hardware.keymaster@4.1-service
+LOCAL_KEYMINT_PRODUCT_PACKAGE ?= android.hardware.keymaster@4.1-service
# Gatekeeper HAL
LOCAL_GATEKEEPER_PRODUCT_PACKAGE ?= android.hardware.gatekeeper@1.0-service.software
@@ -129,3 +125,5 @@
PRODUCT_PACKAGES += android.automotive.tracing-client.trout
BOARD_SEPOLICY_DIRS += device/google/trout/sepolicy/vendor/google
+
+DEVICE_MANIFEST_FILE += device/google/trout/manifest.xml
diff --git a/aosp_trout_x86.mk b/aosp_trout_x86.mk
index 93fe775..79f27ed 100644
--- a/aosp_trout_x86.mk
+++ b/aosp_trout_x86.mk
@@ -17,7 +17,7 @@
$(call inherit-product, device/google/cuttlefish/vsoc_x86/auto/aosp_cf.mk)
# Audio HAL
-TARGET_USES_CUTTLEFISH_AUDIO ?= true
+TARGET_USES_CUTTLEFISH_AUDIO ?= false
# Audio Control HAL
# TODO (chenhaosjtuacm, egranata): move them to kernel command line
@@ -27,7 +27,7 @@
include device/google/trout/aosp_trout_common.mk
-DEVICE_MANIFEST_FILE += device/google/trout/manifest_x86.xml
+DEVICE_MANIFEST_FILE += device/google/trout/trout_x86/manifest.xml
DEVICE_MATRIX_FILE += device/google/trout/compatibility_matrix.xml
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := device/google/trout/framework_compatibility_matrix.xml
diff --git a/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc b/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc
index 53dda85..5ff59e1 100644
--- a/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc
+++ b/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc
@@ -1,4 +1,4 @@
-service vendor.audiocontrol-default /vendor/bin/hw/android.hardware.automotive.audiocontrol-service.trout
+service vendor.audiocontrol-trout /vendor/bin/hw/android.hardware.automotive.audiocontrol-service.trout
class hal
user audioserver
group system
diff --git a/hal/dumpstate/aidl/1.0/dumpstate-trout.xml b/hal/dumpstate/1.1/manifest_android.hardware.dumpstate@1.1-service.trout.xml
similarity index 63%
rename from hal/dumpstate/aidl/1.0/dumpstate-trout.xml
rename to hal/dumpstate/1.1/manifest_android.hardware.dumpstate@1.1-service.trout.xml
index dd5e626..7d7c27d 100644
--- a/hal/dumpstate/aidl/1.0/dumpstate-trout.xml
+++ b/hal/dumpstate/1.1/manifest_android.hardware.dumpstate@1.1-service.trout.xml
@@ -9,8 +9,13 @@
*/
-->
<manifest version="1.0" type="device">
- <hal format="aidl">
+ <hal format="hidl">
<name>android.hardware.dumpstate</name>
- <fqname>IDumpstateDevice/default</fqname>
+ <transport>hwbinder</transport>
+ <version>1.1</version>
+ <interface>
+ <name>IDumpstateDevice</name>
+ <instance>default</instance>
+ </interface>
</hal>
</manifest>
diff --git a/hal/dumpstate/aidl/1.0/dumpstate-trout.rc b/hal/dumpstate/aidl/1.0/dumpstate-trout.rc
deleted file mode 100644
index d7aab6c..0000000
--- a/hal/dumpstate/aidl/1.0/dumpstate-trout.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.audiocontrol-default /vendor/bin/hw/android.hardware.automotive.dumpstate-service.trout
- class hal
- user system
- group system shell
diff --git a/hal/sensors/2.0/OWNERS b/hal/sensors/2.0/OWNERS
index 17b5213..7644fa1 100644
--- a/hal/sensors/2.0/OWNERS
+++ b/hal/sensors/2.0/OWNERS
@@ -1,3 +1,3 @@
-jbhayana@google.com
+ankitarora@google.com
egranata@google.com
diff --git a/hal/vehicle/2.0/DefaultVehicleHalServer.cpp b/hal/vehicle/2.0/DefaultVehicleHalServer.cpp
new file mode 100644
index 0000000..0066b8c
--- /dev/null
+++ b/hal/vehicle/2.0/DefaultVehicleHalServer.cpp
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "DefaultVehicleHalServer"
+
+#include <fstream>
+
+#include <android-base/logging.h>
+#include <utils/SystemClock.h>
+
+#include "vhal_v2_0/DefaultConfig.h"
+#include "vhal_v2_0/JsonFakeValueGenerator.h"
+#include "vhal_v2_0/LinearFakeValueGenerator.h"
+
+#include "DefaultVehicleHalServer.h"
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+
+namespace impl {
+
+void DefaultVehicleHalServer::storePropInitialValue(const ConfigDeclaration& config) {
+ VehiclePropConfig cfg = config.config;
+
+ // A global property will have only a single area
+ int32_t numAreas = isGlobalProp(cfg.prop) ? 1 : cfg.areaConfigs.size();
+
+ for (int i = 0; i < numAreas; i++) {
+ int32_t curArea = isGlobalProp(cfg.prop) ? 0 : cfg.areaConfigs[i].areaId;
+
+ // Create a separate instance for each individual zone
+ VehiclePropValue prop = {
+ .areaId = curArea,
+ .prop = cfg.prop,
+ };
+
+ if (config.initialAreaValues.empty()) {
+ prop.value = config.initialValue;
+ } else if (auto valueForAreaIt = config.initialAreaValues.find(curArea);
+ valueForAreaIt != config.initialAreaValues.end()) {
+ prop.value = valueForAreaIt->second;
+ } else {
+ LOG(WARNING) << __func__ << " failed to get default value for"
+ << " prop 0x" << std::hex << cfg.prop << " area 0x" << std::hex << curArea;
+ prop.status = VehiclePropertyStatus::UNAVAILABLE;
+ }
+
+ mServerSidePropStore.writeValue(prop, true);
+ }
+}
+
+DefaultVehicleHalServer::DefaultVehicleHalServer() {
+ for (auto& it : kVehicleProperties) {
+ VehiclePropConfig cfg = it.config;
+ mServerSidePropStore.registerProperty(cfg);
+ storePropInitialValue(it);
+ }
+}
+
+void DefaultVehicleHalServer::sendAllValuesToClient() {
+ constexpr bool update_status = true;
+ auto values = mServerSidePropStore.readAllValues();
+ for (const auto& value : values) {
+ onPropertyValueFromCar(value, update_status);
+ }
+}
+
+GeneratorHub* DefaultVehicleHalServer::getGenerator() {
+ return &mGeneratorHub;
+}
+
+VehiclePropValuePool* DefaultVehicleHalServer::getValuePool() const {
+ if (!mValuePool) {
+ LOG(WARNING) << __func__ << ": Value pool not set!";
+ }
+ return mValuePool;
+}
+
+void DefaultVehicleHalServer::setValuePool(VehiclePropValuePool* valuePool) {
+ if (!valuePool) {
+ LOG(WARNING) << __func__ << ": Setting value pool to nullptr!";
+ }
+ mValuePool = valuePool;
+}
+
+void DefaultVehicleHalServer::onFakeValueGenerated(const VehiclePropValue& value) {
+ constexpr bool updateStatus = true;
+ LOG(DEBUG) << __func__ << ": " << toString(value);
+ auto updatedPropValue = getValuePool()->obtain(value);
+ if (updatedPropValue) {
+ updatedPropValue->timestamp = value.timestamp;
+ updatedPropValue->status = VehiclePropertyStatus::AVAILABLE;
+ mServerSidePropStore.writeValue(*updatedPropValue, updateStatus);
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ }
+}
+
+std::vector<VehiclePropConfig> DefaultVehicleHalServer::onGetAllPropertyConfig() const {
+ return mServerSidePropStore.getAllConfigs();
+}
+
+StatusCode DefaultVehicleHalServer::handleGenerateFakeDataRequest(const VehiclePropValue& request) {
+ constexpr bool updateStatus = true;
+
+ LOG(INFO) << __func__;
+ const auto& v = request.value;
+ if (!v.int32Values.size()) {
+ LOG(ERROR) << __func__ << ": expected at least \"command\" field in int32Values";
+ return StatusCode::INVALID_ARG;
+ }
+
+ FakeDataCommand command = static_cast<FakeDataCommand>(v.int32Values[0]);
+
+ switch (command) {
+ case FakeDataCommand::StartLinear: {
+ LOG(INFO) << __func__ << ", FakeDataCommand::StartLinear";
+ if (v.int32Values.size() < 2) {
+ LOG(ERROR) << __func__ << ": expected property ID in int32Values";
+ return StatusCode::INVALID_ARG;
+ }
+ if (!v.int64Values.size()) {
+ LOG(ERROR) << __func__ << ": interval is not provided in int64Values";
+ return StatusCode::INVALID_ARG;
+ }
+ if (v.floatValues.size() < 3) {
+ LOG(ERROR) << __func__ << ": expected at least 3 elements in floatValues, got: "
+ << v.floatValues.size();
+ return StatusCode::INVALID_ARG;
+ }
+ int32_t cookie = v.int32Values[1];
+ getGenerator()->registerGenerator(cookie,
+ std::make_unique<LinearFakeValueGenerator>(request));
+ break;
+ }
+ case FakeDataCommand::StartJson: {
+ LOG(INFO) << __func__ << ", FakeDataCommand::StartJson";
+ if (v.stringValue.empty()) {
+ LOG(ERROR) << __func__ << ": path to JSON file is missing";
+ return StatusCode::INVALID_ARG;
+ }
+ int32_t cookie = std::hash<std::string>()(v.stringValue);
+ getGenerator()->registerGenerator(cookie,
+ std::make_unique<JsonFakeValueGenerator>(request));
+ break;
+ }
+ case FakeDataCommand::StopLinear: {
+ LOG(INFO) << __func__ << ", FakeDataCommand::StopLinear";
+ if (v.int32Values.size() < 2) {
+ LOG(ERROR) << __func__ << ": expected property ID in int32Values";
+ return StatusCode::INVALID_ARG;
+ }
+ int32_t cookie = v.int32Values[1];
+ getGenerator()->unregisterGenerator(cookie);
+ break;
+ }
+ case FakeDataCommand::StopJson: {
+ LOG(INFO) << __func__ << ", FakeDataCommand::StopJson";
+ if (v.stringValue.empty()) {
+ LOG(ERROR) << __func__ << ": path to JSON file is missing";
+ return StatusCode::INVALID_ARG;
+ }
+ int32_t cookie = std::hash<std::string>()(v.stringValue);
+ getGenerator()->unregisterGenerator(cookie);
+ break;
+ }
+ case FakeDataCommand::KeyPress: {
+ LOG(INFO) << __func__ << ", FakeDataCommand::KeyPress";
+ int32_t keyCode = request.value.int32Values[2];
+ int32_t display = request.value.int32Values[3];
+ // Send back to HAL
+ onPropertyValueFromCar(
+ *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display),
+ updateStatus);
+ onPropertyValueFromCar(
+ *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display),
+ updateStatus);
+ break;
+ }
+ default: {
+ LOG(ERROR) << __func__ << ": unexpected command: " << toInt(command);
+ return StatusCode::INVALID_ARG;
+ }
+ }
+ return StatusCode::OK;
+}
+
+DefaultVehicleHalServer::VehiclePropValuePtr DefaultVehicleHalServer::createApPowerStateReq(
+ VehicleApPowerStateReq state, int32_t param) {
+ auto req = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 2);
+ req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ);
+ req->areaId = 0;
+ req->timestamp = elapsedRealtimeNano();
+ req->status = VehiclePropertyStatus::AVAILABLE;
+ req->value.int32Values[0] = toInt(state);
+ req->value.int32Values[1] = param;
+ return req;
+}
+
+DefaultVehicleHalServer::VehiclePropValuePtr DefaultVehicleHalServer::createHwInputKeyProp(
+ VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay) {
+ auto keyEvent = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 3);
+ keyEvent->prop = toInt(VehicleProperty::HW_KEY_INPUT);
+ keyEvent->areaId = 0;
+ keyEvent->timestamp = elapsedRealtimeNano();
+ keyEvent->status = VehiclePropertyStatus::AVAILABLE;
+ keyEvent->value.int32Values[0] = toInt(action);
+ keyEvent->value.int32Values[1] = keyCode;
+ keyEvent->value.int32Values[2] = targetDisplay;
+ return keyEvent;
+}
+
+StatusCode DefaultVehicleHalServer::onSetProperty(const VehiclePropValue& value,
+ bool updateStatus) {
+ LOG(DEBUG) << "onSetProperty(" << value.prop << ")";
+
+ // Some properties need to be treated non-trivially
+ switch (value.prop) {
+ case kGenerateFakeDataControllingProperty:
+ return handleGenerateFakeDataRequest(value);
+
+ // set the value from vehicle side, used in end to end test.
+ case kSetIntPropertyFromVehicleForTest: {
+ auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::INT32, 1);
+ updatedPropValue->prop = value.value.int32Values[0];
+ updatedPropValue->value.int32Values[0] = value.value.int32Values[1];
+ updatedPropValue->timestamp = value.value.int64Values[0];
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+ case kSetFloatPropertyFromVehicleForTest: {
+ auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::FLOAT, 1);
+ updatedPropValue->prop = value.value.int32Values[0];
+ updatedPropValue->value.floatValues[0] = value.value.floatValues[0];
+ updatedPropValue->timestamp = value.value.int64Values[0];
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+ case kSetBooleanPropertyFromVehicleForTest: {
+ auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::BOOLEAN, 1);
+ updatedPropValue->prop = value.value.int32Values[1];
+ updatedPropValue->value.int32Values[0] = value.value.int32Values[0];
+ updatedPropValue->timestamp = value.value.int64Values[0];
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+
+ case AP_POWER_STATE_REPORT:
+ switch (value.value.int32Values[0]) {
+ case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT):
+ case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED):
+ case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL):
+ // CPMS is in WAIT_FOR_VHAL state, simply move to ON
+ // Send back to HAL
+ // ALWAYS update status for generated property value
+ onPropertyValueFromCar(*createApPowerStateReq(VehicleApPowerStateReq::ON, 0),
+ true /* updateStatus */);
+ break;
+ case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY):
+ case toInt(VehicleApPowerStateReport::SHUTDOWN_START):
+ // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command
+ // Send back to HAL
+ // ALWAYS update status for generated property value
+ onPropertyValueFromCar(
+ *createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0),
+ true /* updateStatus */);
+ break;
+ case toInt(VehicleApPowerStateReport::ON):
+ case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE):
+ case toInt(VehicleApPowerStateReport::SHUTDOWN_PREPARE):
+ // Do nothing
+ break;
+ default:
+ // Unknown state
+ break;
+ }
+ break;
+
+#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
+ case toInt(VehicleProperty::CLUSTER_REPORT_STATE):
+ case toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY):
+ case toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE):
+ case VENDOR_CLUSTER_SWITCH_UI:
+ case VENDOR_CLUSTER_DISPLAY_STATE: {
+ auto updatedPropValue = createVehiclePropValue(getPropType(value.prop), 0);
+ updatedPropValue->prop = value.prop & ~toInt(VehiclePropertyGroup::MASK);
+ if (isSystemProperty(value.prop)) {
+ updatedPropValue->prop |= toInt(VehiclePropertyGroup::VENDOR);
+ } else {
+ updatedPropValue->prop |= toInt(VehiclePropertyGroup::SYSTEM);
+ }
+ updatedPropValue->value = value.value;
+ updatedPropValue->timestamp = elapsedRealtimeNano();
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
+
+ default:
+ break;
+ }
+
+ // In the real vhal, the value will be sent to Car ECU.
+ // We just pretend it is done here and send back to HAL
+ auto updatedPropValue = getValuePool()->obtain(value);
+ updatedPropValue->timestamp = elapsedRealtimeNano();
+
+ mServerSidePropStore.writeValue(*updatedPropValue, updateStatus);
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+}
+
+} // namespace impl
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/hal/vehicle/2.0/DefaultVehicleHalServer.h b/hal/vehicle/2.0/DefaultVehicleHalServer.h
new file mode 100644
index 0000000..eee9a29
--- /dev/null
+++ b/hal/vehicle/2.0/DefaultVehicleHalServer.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "vhal_v2_0/VehicleObjectPool.h"
+#include "vhal_v2_0/VehiclePropertyStore.h"
+#include "vhal_v2_0/VehicleServer.h"
+
+#include "vhal_v2_0/DefaultConfig.h"
+#include "vhal_v2_0/GeneratorHub.h"
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+
+namespace impl {
+
+// This contains the server operation for VHAL running in emulator.
+class DefaultVehicleHalServer : public IVehicleServer {
+ public:
+ DefaultVehicleHalServer();
+
+ // Send all the property values to client.
+ void sendAllValuesToClient();
+
+ // Methods from IVehicleServer
+
+ std::vector<VehiclePropConfig> onGetAllPropertyConfig() const override;
+
+ StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override;
+
+ // Set the Property Value Pool used in this server
+ void setValuePool(VehiclePropValuePool* valuePool);
+
+ protected:
+ using VehiclePropValuePtr = recyclable_ptr<VehiclePropValue>;
+ GeneratorHub* getGenerator();
+
+ VehiclePropValuePool* getValuePool() const;
+
+ void onFakeValueGenerated(const VehiclePropValue& value);
+
+ StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request);
+
+ VehiclePropValuePtr createApPowerStateReq(VehicleApPowerStateReq req, int32_t param);
+
+ VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode,
+ int32_t targetDisplay);
+
+ void storePropInitialValue(const ConfigDeclaration& config);
+
+ protected:
+ GeneratorHub mGeneratorHub{
+ [this](const VehiclePropValue& value) { return onFakeValueGenerated(value); }};
+
+ VehiclePropValuePool* mValuePool{nullptr};
+ VehiclePropertyStore mServerSidePropStore;
+};
+
+} // namespace impl
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/hal/vehicle/2.0/GrpcVehicleServer.h b/hal/vehicle/2.0/GrpcVehicleServer.h
index eadcbde..a8f83e0 100644
--- a/hal/vehicle/2.0/GrpcVehicleServer.h
+++ b/hal/vehicle/2.0/GrpcVehicleServer.h
@@ -18,7 +18,19 @@
#define android_hardware_automotive_vehicle_V2_0_impl_virtialization_GrpcVehicleServer_H_
#include "Utils.h"
+
+// TODO(chenjaosjtuacm,egranata): remove this hack during AIDL migration
+// If building for Android, use the VHAL server definition coming from
+// hardware/interfaces; if building for a host environment use the older
+// hardcoded header file coming from our own source code
+// These two versions export slightly incompatible C++ interfaces but this
+// only affects building the server, whereas the communication happens over
+// the VHAL protocol which is stable across Android releases
+#if defined(ANDROID) || defined(__ANDROID__)
#include "vhal_v2_0/DefaultVehicleHalServer.h"
+#else
+#include "DefaultVehicleHalServer.h"
+#endif
namespace android {
namespace hardware {
diff --git a/hal/vehicle/2.0/agl_build/CMakeLists.txt b/hal/vehicle/2.0/agl_build/CMakeLists.txt
index 0dcaa23..585a3c4 100644
--- a/hal/vehicle/2.0/agl_build/CMakeLists.txt
+++ b/hal/vehicle/2.0/agl_build/CMakeLists.txt
@@ -45,6 +45,7 @@
# ========== vehicle_hal_grpc_server ==============
add_executable(vehicle_hal_grpc_server
+ ${trout_VHAL_SRC_ROOT}/DefaultVehicleHalServer.cpp
${trout_VHAL_SRC_ROOT}/VirtualizationGrpcServer.cpp
${trout_VHAL_SRC_ROOT}/GarageModeServerSideHandler.cpp
${trout_VHAL_SRC_ROOT}/GrpcVehicleServer.cpp
diff --git a/product_files/etc/automotive/evs/config_override.json b/product_files/etc/automotive/evs/config_override.json
index d5bf5d8..1a8c017 100644
--- a/product_files/etc/automotive/evs/config_override.json
+++ b/product_files/etc/automotive/evs/config_override.json
@@ -23,7 +23,7 @@
"cameras" : [
{
"cameraId" : "/dev/video0",
- "function" : "reverse,park",
+ "function" : "reverse",
"x" : 0.0,
"y" : 20.0,
"z" : 48,
@@ -34,7 +34,7 @@
},
{
"cameraId" : "1",
- "function" : "front,park",
+ "function" : "front",
"x" : 0.0,
"y" : 100.0,
"z" : 48,
@@ -45,7 +45,7 @@
},
{
"cameraId" : "2",
- "function" : "right,park",
+ "function" : "right",
"x" : -25.0,
"y" : 60.0,
"z" : 88,
@@ -56,7 +56,7 @@
},
{
"cameraId" : "3",
- "function" : "left, park",
+ "function" : "left",
"x" : 20.0,
"y" : 60.0,
"z" : 88,
diff --git a/product_files/overlay/frameworks/base/core/res/res/values/config.xml b/product_files/overlay/frameworks/base/core/res/res/values/config.xml
deleted file mode 100644
index e2b9046..0000000
--- a/product_files/overlay/frameworks/base/core/res/res/values/config.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (c) 2022, The Linux Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
--->
-<resources>
- <!-- This device does not support mobile data. -->
- <bool name="config_mobile_data_capable">false</bool>
-</resources>
-
diff --git a/product_files/vendor/etc/primary_audio_policy_configuration.cf.xml b/product_files/vendor/etc/primary_audio_policy_configuration.cf.xml
deleted file mode 100644
index 2b5aad5..0000000
--- a/product_files/vendor/etc/primary_audio_policy_configuration.cf.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Audio HAL override for trout using Cuttlefish Audio HAL -->
-<module name="primary" halVersion="2.0">
- <attachedDevices>
- <item>Speaker</item>
- <item>Built-In Mic</item>
- </attachedDevices>
- <defaultOutputDevice>Speaker</defaultOutputDevice>
- <mixPorts>
- <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
- <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
- samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
- </mixPort>
- <mixPort name="primary input" role="sink">
- <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
- samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
- </mixPort>
- </mixPorts>
- <devicePorts>
- <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink">
- </devicePort>
-
- <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
- </devicePort>
- </devicePorts>
- <routes>
- <route type="mix" sink="Speaker"
- sources="primary output"/>
- <route type="mix" sink="primary input"
- sources="Built-In Mic"/>
- </routes>
-</module>
diff --git a/rro_overlays/EvsOverlay/OWNERS b/rro_overlays/EvsOverlay/OWNERS
index 0ac4a2b..af0b726 100644
--- a/rro_overlays/EvsOverlay/OWNERS
+++ b/rro_overlays/EvsOverlay/OWNERS
@@ -1,3 +1,3 @@
+ankitarora@google.com
chenhaosjtuacm@google.com
egranata@google.com
-gurunagarajan@google.com
diff --git a/sepolicy/vendor/google/file_contexts b/sepolicy/vendor/google/file_contexts
index 4375e18..b405588 100644
--- a/sepolicy/vendor/google/file_contexts
+++ b/sepolicy/vendor/google/file_contexts
@@ -1,5 +1,5 @@
# Dumpstate HAL
-/vendor/bin/hw/android\.hardware\.dumpstate@1\.1-service\.trout u:object_r:hal_dumpstate_impl_exec:s0
+/vendor/bin/hw/android\.hardware\.automotive\.dumpstate-service\.trout u:object_r:hal_dumpstate_impl_exec:s0
# Virtualized Vehicle HAL (Client)
/(vendor|system/vendor)/bin/hw/android\.hardware\.automotive\.vehicle@2\.0-virtualization-service u:object_r:hal_vehicle_default_exec:s0
@@ -10,6 +10,9 @@
# Audio Control HAL
/vendor/bin/hw/android\.hardware\.automotive\.audiocontrol-service\.trout u:object_r:hal_audiocontrol_impl_exec:s0
+# virtio-gpu
+/sys/devices/platform/[0-f]{8}\.virtio_mmio/virtio[0-9]+/uevent u:object_r:sysfs_gpu_trout:s0
+
# Sensor HAL
/sys/bus/iio/devices/iio:device[0-9]+ u:object_r:sysfs_iio_devices:s0
/sys/devices/platform/system-controller/scmi_dev\.[0-9]+/iio:device[0-9]+(/.*)? u:object_r:sysfs_iio_devices:s0
diff --git a/trout_arm64/BoardConfig.mk b/trout_arm64/BoardConfig.mk
index b7be522..61dbe50 100644
--- a/trout_arm64/BoardConfig.mk
+++ b/trout_arm64/BoardConfig.mk
@@ -41,5 +41,36 @@
BOARD_BOOT_HEADER_VERSION := 3
+# Reset this variable to re-enable ramdisk.
+BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE :=
+
+# Turn off AVB so that trout can boot
+BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
+BOARD_KERNEL_CMDLINE += androidboot.verifiedbootstate=orange
+
+# Set SELinux to permissive mode for trout
+BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
+BOARD_KERNEL_CMDLINE += enforcing=0
+
+# Declare trout as a Cuttlefish HW
+BOARD_KERNEL_CMDLINE += androidboot.hardware=cutf_cvm
+BOARD_KERNEL_CMDLINE += androidboot.serialno=CUTTLEFISHCVD01
+BOARD_KERNEL_CMDLINE += androidboot.cf_devcfg=1
+
+# Set GPU properties
+BOARD_KERNEL_CMDLINE += androidboot.cpuvulkan.version=0
+BOARD_KERNEL_CMDLINE += androidboot.hardware.gralloc=minigbm
+BOARD_KERNEL_CMDLINE += androidboot.hardware.hwcomposer=ranchu
+BOARD_KERNEL_CMDLINE += androidboot.hardware.egl=mesa
+BOARD_KERNEL_CMDLINE += androidboot.hardware.hwcomposer.mode=client
+BOARD_KERNEL_CMDLINE += androidboot.hardware.hwcomposer.display_finder_mode=drm
+BOARD_KERNEL_CMDLINE += androidboot.lcd_density=160
+
+# Add WiFi configuration for VirtWifi network
+BOARD_KERNEL_CMDLINE += androidboot.wifi_mac_prefix=5554
+
+# Add default fstab settings
+BOARD_KERNEL_CMDLINE += androidboot.fstab_name=fstab androidboot.fstab_suffix=trout
+
-include device/google/cuttlefish/shared/BoardConfig.mk
-include device/google/cuttlefish/shared/virgl/BoardConfig.mk
diff --git a/manifest_x86.xml b/trout_x86/manifest.xml
similarity index 70%
rename from manifest_x86.xml
rename to trout_x86/manifest.xml
index c6fc273..b6fed2d 100644
--- a/manifest_x86.xml
+++ b/trout_x86/manifest.xml
@@ -21,4 +21,13 @@
<instance>router</instance>
</interface>
</hal>
+ <hal format="hidl">
+ <name>android.hardware.audio.effect</name>
+ <transport>hwbinder</transport>
+ <version>6.0</version>
+ <interface>
+ <name>IEffectsFactory</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
</manifest>