From 10cc332c67527a6d07eb3f90ca27086bc7ee998c Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 29 Feb 2024 18:51:32 +0000 Subject: [PATCH 001/161] Fixed defined versions for new Android V vehicle properties Bug: 327635895 Test: presubmit Change-Id: I12b532a0a7eca6e398d779578af01252c1470bf1 --- .../aidl/generated_lib/cpp/VersionForVehicleProperty.h | 8 ++++---- .../hardware/automotive/vehicle/VehicleProperty.aidl | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h index 1c1035ddb3..0e80bd85b2 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h @@ -84,7 +84,7 @@ std::unordered_map VersionForVehicleProperty = { {VehicleProperty::TRACTION_CONTROL_ACTIVE, 2}, {VehicleProperty::EV_STOPPING_MODE, 2}, {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, 3}, - {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, 2}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, 3}, {VehicleProperty::HVAC_FAN_SPEED, 2}, {VehicleProperty::HVAC_FAN_DIRECTION, 2}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, 2}, @@ -172,8 +172,8 @@ std::unordered_map VersionForVehicleProperty = { {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, 2}, {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, 2}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, 2}, - {VehicleProperty::SEAT_AIRBAG_ENABLED, 3}, - {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, 2}, + {VehicleProperty::SEAT_AIRBAG_ENABLED, 2}, + {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, 3}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, 2}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, 2}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, 2}, @@ -293,7 +293,7 @@ std::unordered_map VersionForVehicleProperty = { {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, 3}, {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, 3}, {VehicleProperty::DRIVER_DISTRACTION_STATE, 3}, - {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, 2}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, 3}, {VehicleProperty::DRIVER_DISTRACTION_WARNING, 3}, {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, 3}, {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, 3}, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6f5c0c1aaf..376f7f7758 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -772,7 +772,7 @@ enum VehicleProperty { * @access VehiclePropertyAccess.READ * @data_enum ElectronicStabilityControlState * @data_enum ErrorState - * @version 2 + * @version 3 */ ELECTRONIC_STABILITY_CONTROL_STATE = 0x040F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, @@ -2909,7 +2909,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ - * @version 3 + * @version 2 */ SEAT_AIRBAG_ENABLED = 0x0B9E + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, @@ -2932,7 +2932,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @data_enum VehicleAirbagLocation - * @version 2 + * @version 3 */ SEAT_AIRBAGS_DEPLOYED = 0x0BA5 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, @@ -5868,7 +5868,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ - * @version 2 + * @version 3 */ DRIVER_DISTRACTION_WARNING_ENABLED = 0x101F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, From 6e37b45fd125dba48d1525058dd740abb94dfafb Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Mon, 5 Feb 2024 12:00:23 -0800 Subject: [PATCH 002/161] Add an explicit TWT register events call Bug: 297481123 Test: m Change-Id: Ib1644e391df30fa4b846b7e37d3aed6b15a85e67 --- wifi/aidl/default/wifi_legacy_hal.cpp | 14 +- wifi/aidl/default/wifi_legacy_hal.h | 19 +- wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + wifi/aidl/default/wifi_sta_iface.cpp | 279 +++++++++++--------- wifi/aidl/default/wifi_sta_iface.h | 2 + 5 files changed, 172 insertions(+), 143 deletions(-) diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 55d6f59314..cf86120032 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1867,9 +1867,8 @@ std::pair WifiLegacyHal::twtGetCapabilities( return {capabs, status}; } -wifi_error WifiLegacyHal::twtSessionSetup( - const std::string& ifaceName, uint32_t cmdId, const wifi_twt_request& request, - const on_twt_failure& on_twt_failure_user_callback, +wifi_error WifiLegacyHal::twtRegisterEvents( + const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback, const on_twt_session_create& on_twt_session_create_user_callback, const on_twt_session_update& on_twt_session_update_user_callback, const on_twt_session_teardown& on_twt_session_teardown_user_callback, @@ -1921,13 +1920,18 @@ wifi_error WifiLegacyHal::twtSessionSetup( on_twt_session_resume_user_callback(id, session_id); }; - return global_func_table_.wifi_twt_session_setup( - cmdId, getIfaceHandle(ifaceName), request, + return global_func_table_.wifi_twt_register_events( + getIfaceHandle(ifaceName), {onAsyncTwtError, onAsyncTwtSessionCreate, onAsyncTwtSessionUpdate, onAsyncTwtSessionTeardown, onAsyncTwtSessionStats, onAsyncTwtSessionSuspend, onAsyncTwtSessionResume}); } +wifi_error WifiLegacyHal::twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, + const wifi_twt_request& request) { + return global_func_table_.wifi_twt_session_setup(cmdId, getIfaceHandle(ifaceName), request); +} + wifi_error WifiLegacyHal::twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, const wifi_twt_request& request) { return global_func_table_.wifi_twt_session_update(cmdId, getIfaceHandle(ifaceName), sessionId, diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 121d1b5ed8..3fd567bc45 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -780,15 +780,16 @@ class WifiLegacyHal { // TWT functions std::pair twtGetCapabilities(const std::string& ifaceName); + wifi_error twtRegisterEvents( + const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback, + const on_twt_session_create& on_twt_session_create_user_callback, + const on_twt_session_update& on_twt_session_update_user_callback, + const on_twt_session_teardown& on_twt_session_teardown_user_callback, + const on_twt_session_stats& on_twt_session_stats_user_callback, + const on_twt_session_suspend& on_twt_session_suspend_user_callback, + const on_twt_session_resume& on_twt_session_resume_user_callback); wifi_error twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, - const wifi_twt_request& request, - const on_twt_failure& on_twt_failure_user_callback, - const on_twt_session_create& on_twt_session_create_user_callback, - const on_twt_session_update& on_twt_session_update_user_callback, - const on_twt_session_teardown& on_twt_session_teardown_user_callback, - const on_twt_session_stats& on_twt_session_stats_user_callback, - const on_twt_session_suspend& on_twt_session_suspend_user_callback, - const on_twt_session_resume& on_twt_session_resume_user_callback); + const wifi_twt_request& request); wifi_error twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, const wifi_twt_request& request); wifi_error twtSessionSuspend(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); @@ -797,7 +798,7 @@ class WifiLegacyHal { wifi_error twtSessionGetStats(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); // Note: Following TWT functions are deprecated - // Deprecated + // Deprecated by twtRegisterEvegnts wifi_error twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& handler); // Deprecated by twtGetCapabilities diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 3e4afd0427..6e137608da 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -182,6 +182,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_get_rtt_capabilities_v3); populateStubFor(&hal_fn->wifi_rtt_range_request_v3); populateStubFor(&hal_fn->wifi_twt_get_capabilities); + populateStubFor(&hal_fn->wifi_twt_register_events); populateStubFor(&hal_fn->wifi_twt_session_setup); populateStubFor(&hal_fn->wifi_twt_session_update); populateStubFor(&hal_fn->wifi_twt_session_suspend); diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index aee183d429..85e373cde0 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -31,7 +31,11 @@ using aidl_return_util::validateAndCall; WifiStaIface::WifiStaIface(const std::string& ifname, const std::weak_ptr legacy_hal, const std::weak_ptr iface_util) - : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { + : ifname_(ifname), + legacy_hal_(legacy_hal), + iface_util_(iface_util), + is_valid_(true), + is_twt_registered_(false) { // Turn on DFS channel usage for STA iface. legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); if (legacy_status != legacy_hal::WIFI_SUCCESS) { @@ -266,11 +270,150 @@ std::pair WifiStaIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } +ndk::ScopedAStatus WifiStaIface::registerTwtEventCallbackInternal() { + std::weak_ptr weak_ptr_this = weak_ptr_this_; + + // onTwtFailure callback + const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_error_code error_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = + aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtFailure callback"; + } + } + }; + // onTwtSessionCreate callback + const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; + } + } + }; + // onTwtSessionUpdate callback + const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; + } + } + }; + // onTwtSessionTeardown callback + const auto& on_twt_session_teardown = + [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, + legacy_hal::wifi_twt_teardown_reason_code reason_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = + aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; + } + } + }; + // onTwtSessionStats callback + const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id, + legacy_hal::wifi_twt_session_stats stats) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSessionStats aidl_session_stats; + if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { + LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; + return; + } + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; + } + } + }; + // onTwtSessionSuspend callback + const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; + } + } + }; + // onTwtSessionResume callback + const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionResume(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtRegisterEvents( + ifname_, on_twt_failure, on_twt_session_create, on_twt_session_update, + on_twt_session_teardown, on_twt_session_stats, on_twt_session_suspend, + on_twt_session_resume); + + if (legacy_status == legacy_hal::WIFI_ERROR_NOT_SUPPORTED) { + LOG(INFO) << "twtRegisterEvents is not supported" << legacy_status; + } else if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "twtRegisterEvents failed - %d" << legacy_status; + } + return createWifiStatusFromLegacyError(legacy_status); +} + ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( const std::shared_ptr& callback) { if (!event_cb_handler_.addCallback(callback)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } + is_twt_registered_ = registerTwtEventCallbackInternal().isOk(); return ndk::ScopedAStatus::ok(); } @@ -617,138 +760,16 @@ std::pair WifiStaIface::twtGetCapabilitiesI ndk::ScopedAStatus WifiStaIface::twtSessionSetupInternal(int32_t cmdId, const TwtRequest& aidlTwtRequest) { + if (!is_twt_registered_) { + LOG(INFO) << "twtSessionSetup is not supported as twtRegisterEvents failed"; + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); + } legacy_hal::wifi_twt_request legacyHalTwtRequest; if (!aidl_struct_util::convertAidlTwtRequestToLegacy(aidlTwtRequest, &legacyHalTwtRequest)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } - std::weak_ptr weak_ptr_this = weak_ptr_this_; - - // onTwtFailure callback - const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_error_code error_code) { - const auto shared_ptr_this = weak_ptr_this.lock(); - IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = - aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtFailure callback"; - } - } - }; - // onTwtSessionCreate callback - const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_session twt_session) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSession aidl_twt_session; - if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { - LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; - return; - } - - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; - } - } - }; - // onTwtSessionUpdate callback - const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_session twt_session) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSession aidl_twt_session; - if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { - LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; - return; - } - - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; - } - } - }; - // onTwtSessionTeardown callback - const auto& on_twt_session_teardown = - [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, - legacy_hal::wifi_twt_teardown_reason_code reason_code) { - const auto shared_ptr_this = weak_ptr_this.lock(); - IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = - aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; - } - } - }; - // onTwtSessionStats callback - const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id, - legacy_hal::wifi_twt_session_stats stats) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSessionStats aidl_session_stats; - if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { - LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; - return; - } - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; - } - } - }; - // onTwtSessionSuspend callback - const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; - } - } - }; - // onTwtSessionResume callback - const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionResume(id, session_id).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; - } - } - }; - - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtSessionSetup( - ifname_, cmdId, legacyHalTwtRequest, on_twt_failure, on_twt_session_create, - on_twt_session_update, on_twt_session_teardown, on_twt_session_stats, - on_twt_session_suspend, on_twt_session_resume); + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionSetup(ifname_, cmdId, legacyHalTwtRequest); return createWifiStatusFromLegacyError(legacy_status); } diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index eb8f745475..5713928448 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -103,6 +103,7 @@ class WifiStaIface : public BnWifiStaIface { private: // Corresponding worker functions for the AIDL methods. std::pair getNameInternal(); + ndk::ScopedAStatus registerTwtEventCallbackInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& callback); std::pair getFeatureSetInternal(); @@ -157,6 +158,7 @@ class WifiStaIface : public BnWifiStaIface { std::weak_ptr weak_ptr_this_; bool is_valid_; aidl_callback_util::AidlCallbackHandler event_cb_handler_; + bool is_twt_registered_; DISALLOW_COPY_AND_ASSIGN(WifiStaIface); }; From f12db3a9090acf82b88c0d167488a31f2b664cc2 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Sun, 3 Mar 2024 21:37:54 +0000 Subject: [PATCH 003/161] Revert^2 "Change HVAC_MAX_DEFROST_ON to front and back row area IDs" This reverts commit 0a36f19c736822382f9bfe7048d0c3a2b8e653d1. Reason for revert: Submitting with test fixed Change-Id: I4b53ad65516abab2cf5317e3b991adfedcb18146 --- .../2.0/default/impl/vhal_v2_0/DefaultConfig.h | 3 ++- .../2.0/default/impl/vhal_v2_0/PropertyUtils.h | 3 +++ .../JsonConfigLoader/src/JsonConfigLoader.cpp | 2 ++ .../default_config/config/DefaultProperties.json | 13 ++----------- .../aidl/impl/utils/common/include/PropertyUtils.h | 2 ++ 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index 4846bfb00a..f021f7b31d 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -449,7 +449,8 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_FRONT_ROW}, + VehicleAreaConfig{.areaId = HVAC_REAR_ROW}}}, .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON), diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h index f58e09a67d..e866f70337 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h @@ -50,6 +50,9 @@ constexpr int ALL_WHEELS = VehicleAreaWheel::LEFT_REAR | VehicleAreaWheel::RIGHT_REAR); constexpr int SEAT_1_LEFT = (int)(VehicleAreaSeat::ROW_1_LEFT); constexpr int SEAT_1_RIGHT = (int)(VehicleAreaSeat::ROW_1_RIGHT); +constexpr int HVAC_FRONT_ROW = (int)(VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT); +constexpr int HVAC_REAR_ROW = (int)(VehicleAreaSeat::ROW_2_LEFT | VehicleAreaSeat::ROW_2_CENTER | + VehicleAreaSeat::ROW_2_RIGHT); constexpr int HVAC_LEFT = (int)(VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_2_LEFT | VehicleAreaSeat::ROW_2_CENTER); constexpr int HVAC_RIGHT = (int)(VehicleAreaSeat::ROW_1_RIGHT | VehicleAreaSeat::ROW_2_RIGHT); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index ea1437ecb1..57af04c2d2 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -104,6 +104,8 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"HVAC_ALL", HVAC_ALL}, {"HVAC_LEFT", HVAC_LEFT}, {"HVAC_RIGHT", HVAC_RIGHT}, + {"HVAC_FRONT_ROW", HVAC_FRONT_ROW}, + {"HVAC_REAR_ROW", HVAC_REAR_ROW}, {"WINDOW_1_LEFT", WINDOW_1_LEFT}, {"WINDOW_1_RIGHT", WINDOW_1_RIGHT}, {"WINDOW_2_LEFT", WINDOW_2_LEFT}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0a859af695..2d1e9ab7fe 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2033,19 +2033,10 @@ }, "areas": [ { - "areaId": "Constants::SEAT_1_LEFT" + "areaId": "Constants::HVAC_FRONT_ROW" }, { - "areaId": "Constants::SEAT_1_RIGHT" - }, - { - "areaId": "Constants::SEAT_2_LEFT" - }, - { - "areaId": "Constants::SEAT_2_RIGHT" - }, - { - "areaId": "Constants::SEAT_2_CENTER" + "areaId": "Constants::HVAC_REAR_ROW" } ] }, diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index 78b61f714e..f2327e1942 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -97,6 +97,8 @@ constexpr int ALL_WHEELS = constexpr int HVAC_LEFT = SEAT_1_LEFT | SEAT_2_LEFT | SEAT_2_CENTER; constexpr int HVAC_RIGHT = SEAT_1_RIGHT | SEAT_2_RIGHT; constexpr int HVAC_ALL = HVAC_LEFT | HVAC_RIGHT; +constexpr int HVAC_FRONT_ROW = SEAT_1_LEFT | SEAT_1_RIGHT; +constexpr int HVAC_REAR_ROW = SEAT_2_LEFT | SEAT_2_CENTER | SEAT_2_RIGHT; } // namespace vehicle } // namespace automotive From e390c1c975a2de61a0f4a766f8812e4dcf020c31 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 4 Mar 2024 15:44:49 -0800 Subject: [PATCH 004/161] Remove unnecssary checks in VehiclePropertyStore. We use propId and areaId as key to get the current value, so there is not need to check them against the value to update. Test: Presubmit Bug: 307977317 Change-Id: I5e8b3f676c02b4130769615f78a25b3a32b5b6ee --- .../aidl/impl/utils/common/src/VehiclePropertyStore.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp index 6a2a695254..97efdf6927 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp @@ -153,10 +153,9 @@ VhalResult VehiclePropertyStore::writeValue(VehiclePropValuePool::Recyclab propValue->status = oldStatus; } + // areaId and propId must be the same between valueToUpdate and propValue. valueUpdated = (valueToUpdate->value != propValue->value || - valueToUpdate->status != propValue->status || - valueToUpdate->prop != propValue->prop || - valueToUpdate->areaId != propValue->areaId); + valueToUpdate->status != propValue->status); } else if (!updateStatus) { propValue->status = VehiclePropertyStatus::AVAILABLE; } From 81a14293f4f26bf3af740cc1682c1111d7e1e29d Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 26 Feb 2024 13:24:15 -0800 Subject: [PATCH 005/161] audio: Set correct priority for the SPATIALIZER stream thread To align with the framework, the thread serving SPATIALIZER stream I/O must use SCHED_FIFO and realtime priority. The latter can be set via `audio.spatializer.priority` property. Bug: 321233946 Test: adb shell ps -Tl -p Change-Id: I80107c9aa7d86cbfc2f79c2ad05959fc9f7913f7 --- audio/aidl/default/Stream.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index 807348fad7..697ff0d0f0 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -652,16 +653,34 @@ ndk::ScopedAStatus StreamCommonImpl::initInstance( isBitPositionFlagSet(flags.template get(), AudioInputFlags::FAST)) || (flags.getTag() == AudioIoFlags::Tag::output && - isBitPositionFlagSet(flags.template get(), - AudioOutputFlags::FAST))) { + (isBitPositionFlagSet(flags.template get(), + AudioOutputFlags::FAST) || + isBitPositionFlagSet(flags.template get(), + AudioOutputFlags::SPATIALIZER)))) { // FAST workers should be run with a SCHED_FIFO scheduler, however the host process // might be lacking the capability to request it, thus a failure to set is not an error. pid_t workerTid = mWorker->getTid(); if (workerTid > 0) { - struct sched_param param; - param.sched_priority = 3; // Must match SchedulingPolicyService.PRIORITY_MAX (Java). + constexpr int32_t kRTPriorityMin = 1; // SchedulingPolicyService.PRIORITY_MIN (Java). + constexpr int32_t kRTPriorityMax = 3; // SchedulingPolicyService.PRIORITY_MAX (Java). + int priorityBoost = kRTPriorityMax; + if (flags.getTag() == AudioIoFlags::Tag::output && + isBitPositionFlagSet(flags.template get(), + AudioOutputFlags::SPATIALIZER)) { + const int32_t sptPrio = + property_get_int32("audio.spatializer.priority", kRTPriorityMin); + if (sptPrio >= kRTPriorityMin && sptPrio <= kRTPriorityMax) { + priorityBoost = sptPrio; + } else { + LOG(WARNING) << __func__ << ": invalid spatializer priority: " << sptPrio; + return ndk::ScopedAStatus::ok(); + } + } + struct sched_param param = { + .sched_priority = priorityBoost, + }; if (sched_setscheduler(workerTid, SCHED_FIFO | SCHED_RESET_ON_FORK, ¶m) != 0) { - PLOG(WARNING) << __func__ << ": failed to set FIFO scheduler for a fast thread"; + PLOG(WARNING) << __func__ << ": failed to set FIFO scheduler and priority"; } } else { LOG(WARNING) << __func__ << ": invalid worker tid: " << workerTid; From f2f9ae08c2ee4e396bbe4b8c7e955bad725ce545 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 4 Mar 2024 16:17:20 -0800 Subject: [PATCH 006/161] audio: Align HAL buffer size logic with the framework When the framework uses mixers, it rounds up the buffer size to the frame count which is a multiple of 16. In the HIDL implementation, this adjustment was done after the framework thread was already created, and FMQ was created on the first transfer, using adjusted size. In the AIDL implementation, the FMQ is created together with the stream, using the size suggested by the HAL. Bug: 321233946 Test: verify audio playback over S/W A2DP Change-Id: I35a5479bfc87a290aff09d51415381948857a146 --- audio/aidl/default/bluetooth/StreamBluetooth.cpp | 10 ++-------- audio/aidl/default/include/core-impl/Module.h | 6 ++---- audio/aidl/default/include/core-impl/StreamBluetooth.h | 1 - 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/audio/aidl/default/bluetooth/StreamBluetooth.cpp b/audio/aidl/default/bluetooth/StreamBluetooth.cpp index 77e48df26e..f22b7a97d6 100644 --- a/audio/aidl/default/bluetooth/StreamBluetooth.cpp +++ b/audio/aidl/default/bluetooth/StreamBluetooth.cpp @@ -16,16 +16,13 @@ #include -#define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_StreamBluetooth" #include #include #include -#include #include "core-impl/StreamBluetooth.h" -using aidl::android::hardware::audio::common::frameCountFromDurationUs; using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::hardware::audio::core::VendorParameter; @@ -67,8 +64,6 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat : (mIsInput ? kBluetoothDefaultInputBufferMs : kBluetoothDefaultOutputBufferMs) * 1000), - mPreferredFrameCount( - frameCountFromDurationUs(mPreferredDataIntervalUs, pcmConfig.sampleRateHz)), mBtDeviceProxy(btDeviceProxy) {} ::android::status_t StreamBluetooth::init() { @@ -77,6 +72,7 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat // This is a normal situation in VTS tests. LOG(INFO) << __func__ << ": no BT HAL proxy, stream is non-functional"; } + LOG(INFO) << __func__ << ": preferred data interval (us): " << mPreferredDataIntervalUs; return ::android::OK; } @@ -108,12 +104,10 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat LOG(ERROR) << __func__ << ": state= " << mBtDeviceProxy->getState() << " failed to start"; return -EIO; } - const size_t fc = std::min(frameCount, mPreferredFrameCount); - const size_t bytesToTransfer = fc * mFrameSizeBytes; + const size_t bytesToTransfer = frameCount * mFrameSizeBytes; const size_t bytesTransferred = mIsInput ? mBtDeviceProxy->readData(buffer, bytesToTransfer) : mBtDeviceProxy->writeData(buffer, bytesToTransfer); *actualFrameCount = bytesTransferred / mFrameSizeBytes; - ATRACE_INT("BTdropped", bytesToTransfer - bytesTransferred); PresentationPosition presentation_position; if (!mBtDeviceProxy->getPresentationPosition(presentation_position)) { presentation_position.remoteDeviceAudioDelayNanos = diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index ce71d70903..8abf9ef1fe 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -211,10 +211,8 @@ class Module : public BnModule { const int32_t rawSizeFrames = aidl::android::hardware::audio::common::frameCountFromDurationMs(latencyMs, sampleRateHz); - if (latencyMs >= 5) return rawSizeFrames; - int32_t powerOf2 = 1; - while (powerOf2 < rawSizeFrames) powerOf2 <<= 1; - return powerOf2; + // Round up to nearest 16 frames since in the framework this is the size of a mixer burst. + return (rawSizeFrames + 15) & ~15; } ndk::ScopedAStatus bluetoothParametersUpdated(); diff --git a/audio/aidl/default/include/core-impl/StreamBluetooth.h b/audio/aidl/default/include/core-impl/StreamBluetooth.h index 35c3183560..7f4239cfb4 100644 --- a/audio/aidl/default/include/core-impl/StreamBluetooth.h +++ b/audio/aidl/default/include/core-impl/StreamBluetooth.h @@ -63,7 +63,6 @@ class StreamBluetooth : public StreamCommonImpl { const std::weak_ptr mBluetoothA2dp; const std::weak_ptr mBluetoothLe; const size_t mPreferredDataIntervalUs; - const size_t mPreferredFrameCount; mutable std::mutex mLock; // The lock is also used to serialize calls to the proxy. std::shared_ptr<::android::bluetooth::audio::aidl::BluetoothAudioPortAidl> mBtDeviceProxy From 1897df2794e954a63b22ff28d77ba4d5e55847a9 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 26 Feb 2024 13:24:15 -0800 Subject: [PATCH 007/161] audio: Set correct priority for the SPATIALIZER stream thread To align with the framework, the thread serving SPATIALIZER stream I/O must use SCHED_FIFO and realtime priority. The latter can be set via `audio.spatializer.priority` property. Bug: 321233946 Test: adb shell ps -Tl -p (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:81a14293f4f26bf3af740cc1682c1111d7e1e29d) Merged-In: I80107c9aa7d86cbfc2f79c2ad05959fc9f7913f7 Change-Id: I80107c9aa7d86cbfc2f79c2ad05959fc9f7913f7 --- audio/aidl/default/Stream.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index 807348fad7..697ff0d0f0 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -652,16 +653,34 @@ ndk::ScopedAStatus StreamCommonImpl::initInstance( isBitPositionFlagSet(flags.template get(), AudioInputFlags::FAST)) || (flags.getTag() == AudioIoFlags::Tag::output && - isBitPositionFlagSet(flags.template get(), - AudioOutputFlags::FAST))) { + (isBitPositionFlagSet(flags.template get(), + AudioOutputFlags::FAST) || + isBitPositionFlagSet(flags.template get(), + AudioOutputFlags::SPATIALIZER)))) { // FAST workers should be run with a SCHED_FIFO scheduler, however the host process // might be lacking the capability to request it, thus a failure to set is not an error. pid_t workerTid = mWorker->getTid(); if (workerTid > 0) { - struct sched_param param; - param.sched_priority = 3; // Must match SchedulingPolicyService.PRIORITY_MAX (Java). + constexpr int32_t kRTPriorityMin = 1; // SchedulingPolicyService.PRIORITY_MIN (Java). + constexpr int32_t kRTPriorityMax = 3; // SchedulingPolicyService.PRIORITY_MAX (Java). + int priorityBoost = kRTPriorityMax; + if (flags.getTag() == AudioIoFlags::Tag::output && + isBitPositionFlagSet(flags.template get(), + AudioOutputFlags::SPATIALIZER)) { + const int32_t sptPrio = + property_get_int32("audio.spatializer.priority", kRTPriorityMin); + if (sptPrio >= kRTPriorityMin && sptPrio <= kRTPriorityMax) { + priorityBoost = sptPrio; + } else { + LOG(WARNING) << __func__ << ": invalid spatializer priority: " << sptPrio; + return ndk::ScopedAStatus::ok(); + } + } + struct sched_param param = { + .sched_priority = priorityBoost, + }; if (sched_setscheduler(workerTid, SCHED_FIFO | SCHED_RESET_ON_FORK, ¶m) != 0) { - PLOG(WARNING) << __func__ << ": failed to set FIFO scheduler for a fast thread"; + PLOG(WARNING) << __func__ << ": failed to set FIFO scheduler and priority"; } } else { LOG(WARNING) << __func__ << ": invalid worker tid: " << workerTid; From e1e2d9ad5a5499d8e151fd28d909693b3b0cbb44 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 4 Mar 2024 16:17:20 -0800 Subject: [PATCH 008/161] audio: Align HAL buffer size logic with the framework When the framework uses mixers, it rounds up the buffer size to the frame count which is a multiple of 16. In the HIDL implementation, this adjustment was done after the framework thread was already created, and FMQ was created on the first transfer, using adjusted size. In the AIDL implementation, the FMQ is created together with the stream, using the size suggested by the HAL. Bug: 321233946 Test: verify audio playback over S/W A2DP (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f2f9ae08c2ee4e396bbe4b8c7e955bad725ce545) Merged-In: I35a5479bfc87a290aff09d51415381948857a146 Change-Id: I35a5479bfc87a290aff09d51415381948857a146 --- audio/aidl/default/bluetooth/StreamBluetooth.cpp | 10 ++-------- audio/aidl/default/include/core-impl/Module.h | 6 ++---- audio/aidl/default/include/core-impl/StreamBluetooth.h | 1 - 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/audio/aidl/default/bluetooth/StreamBluetooth.cpp b/audio/aidl/default/bluetooth/StreamBluetooth.cpp index 77e48df26e..f22b7a97d6 100644 --- a/audio/aidl/default/bluetooth/StreamBluetooth.cpp +++ b/audio/aidl/default/bluetooth/StreamBluetooth.cpp @@ -16,16 +16,13 @@ #include -#define ATRACE_TAG ATRACE_TAG_AUDIO #define LOG_TAG "AHAL_StreamBluetooth" #include #include #include -#include #include "core-impl/StreamBluetooth.h" -using aidl::android::hardware::audio::common::frameCountFromDurationUs; using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::hardware::audio::core::VendorParameter; @@ -67,8 +64,6 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat : (mIsInput ? kBluetoothDefaultInputBufferMs : kBluetoothDefaultOutputBufferMs) * 1000), - mPreferredFrameCount( - frameCountFromDurationUs(mPreferredDataIntervalUs, pcmConfig.sampleRateHz)), mBtDeviceProxy(btDeviceProxy) {} ::android::status_t StreamBluetooth::init() { @@ -77,6 +72,7 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat // This is a normal situation in VTS tests. LOG(INFO) << __func__ << ": no BT HAL proxy, stream is non-functional"; } + LOG(INFO) << __func__ << ": preferred data interval (us): " << mPreferredDataIntervalUs; return ::android::OK; } @@ -108,12 +104,10 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat LOG(ERROR) << __func__ << ": state= " << mBtDeviceProxy->getState() << " failed to start"; return -EIO; } - const size_t fc = std::min(frameCount, mPreferredFrameCount); - const size_t bytesToTransfer = fc * mFrameSizeBytes; + const size_t bytesToTransfer = frameCount * mFrameSizeBytes; const size_t bytesTransferred = mIsInput ? mBtDeviceProxy->readData(buffer, bytesToTransfer) : mBtDeviceProxy->writeData(buffer, bytesToTransfer); *actualFrameCount = bytesTransferred / mFrameSizeBytes; - ATRACE_INT("BTdropped", bytesToTransfer - bytesTransferred); PresentationPosition presentation_position; if (!mBtDeviceProxy->getPresentationPosition(presentation_position)) { presentation_position.remoteDeviceAudioDelayNanos = diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index ce71d70903..8abf9ef1fe 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -211,10 +211,8 @@ class Module : public BnModule { const int32_t rawSizeFrames = aidl::android::hardware::audio::common::frameCountFromDurationMs(latencyMs, sampleRateHz); - if (latencyMs >= 5) return rawSizeFrames; - int32_t powerOf2 = 1; - while (powerOf2 < rawSizeFrames) powerOf2 <<= 1; - return powerOf2; + // Round up to nearest 16 frames since in the framework this is the size of a mixer burst. + return (rawSizeFrames + 15) & ~15; } ndk::ScopedAStatus bluetoothParametersUpdated(); diff --git a/audio/aidl/default/include/core-impl/StreamBluetooth.h b/audio/aidl/default/include/core-impl/StreamBluetooth.h index 35c3183560..7f4239cfb4 100644 --- a/audio/aidl/default/include/core-impl/StreamBluetooth.h +++ b/audio/aidl/default/include/core-impl/StreamBluetooth.h @@ -63,7 +63,6 @@ class StreamBluetooth : public StreamCommonImpl { const std::weak_ptr mBluetoothA2dp; const std::weak_ptr mBluetoothLe; const size_t mPreferredDataIntervalUs; - const size_t mPreferredFrameCount; mutable std::mutex mLock; // The lock is also used to serialize calls to the proxy. std::shared_ptr<::android::bluetooth::audio::aidl::BluetoothAudioPortAidl> mBtDeviceProxy From 1b6c03d742a2e9da1d0fa860b6f76365ade62247 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 5 Mar 2024 16:48:08 -0800 Subject: [PATCH 009/161] Check secondary ids in bcradio HAL utils isValid methods Check whether secondary ids in isValid and isValidV2 methods in AIDL broadcast radio utils lib. Bug: 328312711 Test: atest broadcastradio_utils_aidl_test Change-Id: Ie693de565c3819d1599b6ff40c95ecfd83483722 --- broadcastradio/common/utilsaidl/src/Utils.cpp | 7 ++++++- broadcastradio/common/utilsaidl/src/UtilsV2.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/broadcastradio/common/utilsaidl/src/Utils.cpp b/broadcastradio/common/utilsaidl/src/Utils.cpp index ddc5b8db59..4ab04d2a52 100644 --- a/broadcastradio/common/utilsaidl/src/Utils.cpp +++ b/broadcastradio/common/utilsaidl/src/Utils.cpp @@ -296,7 +296,12 @@ bool isValid(const ProgramSelector& sel) { sel.primaryId.type > IdentifierType::VENDOR_END)) { return false; } - return isValid(sel.primaryId); + for (auto it = begin(sel); it != end(sel); it++) { + if (!isValid(*it)) { + return false; + } + } + return true; } ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { diff --git a/broadcastradio/common/utilsaidl/src/UtilsV2.cpp b/broadcastradio/common/utilsaidl/src/UtilsV2.cpp index 6c75759f07..7077be92f3 100644 --- a/broadcastradio/common/utilsaidl/src/UtilsV2.cpp +++ b/broadcastradio/common/utilsaidl/src/UtilsV2.cpp @@ -135,7 +135,12 @@ bool isValidV2(const ProgramSelector& sel) { sel.primaryId.type > IdentifierType::VENDOR_END)) { return false; } - return isValidV2(sel.primaryId); + for (auto it = begin(sel); it != end(sel); it++) { + if (!isValidV2(*it)) { + return false; + } + } + return true; } bool isValidMetadataV2(const Metadata& metadata) { From 1735123db2554d7debf581ad073cacca0df8d92e Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 5 Mar 2024 17:42:20 -0800 Subject: [PATCH 010/161] audio: Fix glitching of remote submix Align behavior with the HIDL implementation. This helps to prevent glitches in the scenarios that use remote submix for sending audio externally: Auto and Cast. Bug: 322247032 Bug: 327220024 Test: Repro steps in b/327220024#comment14 Change-Id: If2e4ebd7145375a268ee5f0e4ab656bb3748b2fe --- audio/aidl/default/include/core-impl/Module.h | 7 ++++++- audio/aidl/default/r_submix/StreamRemoteSubmix.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 8abf9ef1fe..d6e89053d9 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -212,7 +212,12 @@ class Module : public BnModule { aidl::android::hardware::audio::common::frameCountFromDurationMs(latencyMs, sampleRateHz); // Round up to nearest 16 frames since in the framework this is the size of a mixer burst. - return (rawSizeFrames + 15) & ~15; + const int32_t multipleOf16 = (rawSizeFrames + 15) & ~15; + if (multipleOf16 <= 512) return multipleOf16; + // Larger buffers should use powers of 2. + int32_t powerOf2 = 1; + while (powerOf2 < multipleOf16) powerOf2 <<= 1; + return powerOf2; } ndk::ScopedAStatus bluetoothParametersUpdated(); diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp index fa4135d3e5..2376ed9371 100644 --- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp +++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp @@ -136,10 +136,12 @@ void StreamRemoteSubmix::shutdown() { mCurrentRoute->exitStandby(mIsInput); RETURN_STATUS_IF_ERROR(mIsInput ? inRead(buffer, frameCount, actualFrameCount) : outWrite(buffer, frameCount, actualFrameCount)); + mFramesSinceStart += *actualFrameCount; + if (!mIsInput) return ::android::OK; + // Only input streams need to block, for output this is implemented by MonoPipe. const long bufferDurationUs = (*actualFrameCount) * MICROS_PER_SECOND / mContext.getSampleRate(); const auto totalDurationUs = (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND; - mFramesSinceStart += *actualFrameCount; const long totalOffsetUs = mFramesSinceStart * MICROS_PER_SECOND / mContext.getSampleRate() - totalDurationUs; LOG(VERBOSE) << __func__ << ": totalOffsetUs " << totalOffsetUs; @@ -275,8 +277,9 @@ size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() { char* buff = (char*)buffer; size_t actuallyRead = 0; long remainingFrames = frameCount; - const int64_t deadlineTimeNs = ::android::uptimeNanos() + - getDelayInUsForFrameCount(frameCount) * NANOS_PER_MICROSECOND; + const int64_t deadlineTimeNs = + ::android::uptimeNanos() + + getDelayInUsForFrameCount(frameCount) * NANOS_PER_MICROSECOND / 2; while (remainingFrames > 0) { ssize_t framesRead = source->read(buff, remainingFrames); LOG(VERBOSE) << __func__ << ": frames read " << framesRead; From 130b254840aed7376ca1aeca27f8bc637fb978cc Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 5 Mar 2024 17:42:20 -0800 Subject: [PATCH 011/161] audio: Fix glitching of remote submix Align behavior with the HIDL implementation. This helps to prevent glitches in the scenarios that use remote submix for sending audio externally: Auto and Cast. Bug: 322247032 Bug: 327220024 Test: Repro steps in b/327220024#comment14 Change-Id: If2e4ebd7145375a268ee5f0e4ab656bb3748b2fe Merged-In: If2e4ebd7145375a268ee5f0e4ab656bb3748b2fe (cherry picked from commit 1735123db2554d7debf581ad073cacca0df8d92e) --- audio/aidl/default/include/core-impl/Module.h | 7 ++++++- audio/aidl/default/r_submix/StreamRemoteSubmix.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 8abf9ef1fe..d6e89053d9 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -212,7 +212,12 @@ class Module : public BnModule { aidl::android::hardware::audio::common::frameCountFromDurationMs(latencyMs, sampleRateHz); // Round up to nearest 16 frames since in the framework this is the size of a mixer burst. - return (rawSizeFrames + 15) & ~15; + const int32_t multipleOf16 = (rawSizeFrames + 15) & ~15; + if (multipleOf16 <= 512) return multipleOf16; + // Larger buffers should use powers of 2. + int32_t powerOf2 = 1; + while (powerOf2 < multipleOf16) powerOf2 <<= 1; + return powerOf2; } ndk::ScopedAStatus bluetoothParametersUpdated(); diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp index fa4135d3e5..2376ed9371 100644 --- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp +++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp @@ -136,10 +136,12 @@ void StreamRemoteSubmix::shutdown() { mCurrentRoute->exitStandby(mIsInput); RETURN_STATUS_IF_ERROR(mIsInput ? inRead(buffer, frameCount, actualFrameCount) : outWrite(buffer, frameCount, actualFrameCount)); + mFramesSinceStart += *actualFrameCount; + if (!mIsInput) return ::android::OK; + // Only input streams need to block, for output this is implemented by MonoPipe. const long bufferDurationUs = (*actualFrameCount) * MICROS_PER_SECOND / mContext.getSampleRate(); const auto totalDurationUs = (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND; - mFramesSinceStart += *actualFrameCount; const long totalOffsetUs = mFramesSinceStart * MICROS_PER_SECOND / mContext.getSampleRate() - totalDurationUs; LOG(VERBOSE) << __func__ << ": totalOffsetUs " << totalOffsetUs; @@ -275,8 +277,9 @@ size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() { char* buff = (char*)buffer; size_t actuallyRead = 0; long remainingFrames = frameCount; - const int64_t deadlineTimeNs = ::android::uptimeNanos() + - getDelayInUsForFrameCount(frameCount) * NANOS_PER_MICROSECOND; + const int64_t deadlineTimeNs = + ::android::uptimeNanos() + + getDelayInUsForFrameCount(frameCount) * NANOS_PER_MICROSECOND / 2; while (remainingFrames > 0) { ssize_t framesRead = source->read(buff, remainingFrames); LOG(VERBOSE) << __func__ << ": frames read " << framesRead; From 52a3afa7b51e98051242ec99118ce8d779851de6 Mon Sep 17 00:00:00 2001 From: yomna Date: Wed, 6 Mar 2024 18:24:23 +0000 Subject: [PATCH 012/161] Mark IMS_NULL as deprecated. Bug: b/328449089 Test: m Change-Id: I23610bd5736310ebbe6c78271343c5db48425a1a --- .../aidl/android/hardware/radio/network/SecurityAlgorithm.aidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl b/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl index 01f732738b..451eaa98d6 100644 --- a/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl +++ b/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl @@ -62,7 +62,7 @@ enum SecurityAlgorithm { // IMS and SIP layer security (See 3GPP TS 33.203) // No IPsec config SIP_NO_IPSEC_CONFIG = 66, - IMS_NULL = 67, + IMS_NULL = 67, // Deprecated. Use SIP_NO_IPSEC_CONFIG and SIP_NULL instead. // Has IPsec config SIP_NULL = 68, From af20855c7c4dc806044a62509cb3922e79113e7e Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 5 Mar 2024 12:58:50 -0800 Subject: [PATCH 013/161] Fix isValidV2 check for HD station location id Bug: 328313667 Test: atest broadcastradio_utils_aidl_test Change-Id: I570d24fee3607cf53d197fe886e6c4a5a611b932 --- .../hardware/broadcastradio/IdentifierType.aidl | 2 +- broadcastradio/common/utilsaidl/src/UtilsV2.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl index 4a95a41c94..4d2974306b 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl @@ -174,7 +174,7 @@ enum IdentifierType { * - 13 bit: Fractional bits of longitude * - 8 bit: Integer bits of longitude * - 1 bit: 0 for east and 1 for west for longitude - * - 1 bit: 0, representing latitude + * - 1 bit: 0, representing longitude * - 5 bit: pad of zeros separating longitude and latitude * - 4 bit: Bits 4:7 of altitude * - 13 bit: Fractional bits of latitude diff --git a/broadcastradio/common/utilsaidl/src/UtilsV2.cpp b/broadcastradio/common/utilsaidl/src/UtilsV2.cpp index 7077be92f3..56365c57fd 100644 --- a/broadcastradio/common/utilsaidl/src/UtilsV2.cpp +++ b/broadcastradio/common/utilsaidl/src/UtilsV2.cpp @@ -102,15 +102,16 @@ bool isValidV2(const ProgramIdentifier& id) { expect(val < 1000u, "SXM channel < 1000"); break; case IdentifierType::HD_STATION_LOCATION: { + val >>= 26; uint64_t latitudeBit = val & 0x1; - expect(latitudeBit == 1u, "Latitude comes first"); - val >>= 27; + expect(latitudeBit == 0u, "Longitude comes first"); + val >>= 1; uint64_t latitudePad = val & 0x1Fu; - expect(latitudePad == 0u, "Latitude padding"); - val >>= 5; + expect(latitudePad == 0u, "Longitude padding"); + val >>= 31; uint64_t longitudeBit = val & 0x1; - expect(longitudeBit == 1u, "Longitude comes next"); - val >>= 27; + expect(longitudeBit == 1u, "Latitude comes next"); + val >>= 1; uint64_t longitudePad = val & 0x1Fu; expect(longitudePad == 0u, "Latitude padding"); break; From f33a3c099b2d49827f5d29d856d4ea458aec52de Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 6 Mar 2024 21:12:07 +0000 Subject: [PATCH 014/161] Rename android16 kernel configs We want a placeholder for the next android16 kernel configs, but we do not yet know which version(s) will be available. So renaming them to be android-6.next. Test: m Bug: 328236210 Change-Id: I921e78059c752950e9eff66dc8512171484505f5 --- compatibility_matrices/Android.bp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp index 2b694427fb..951ca850b4 100644 --- a/compatibility_matrices/Android.bp +++ b/compatibility_matrices/Android.bp @@ -88,8 +88,7 @@ vintf_compatibility_matrix { stem: "compatibility_matrix.202504.xml", srcs: ["compatibility_matrix.202504.xml"], kernel_configs: [ - "kernel_config_w_6.1", - "kernel_config_w_6.6", + "kernel_config_w_6.next", ], } From 8d98f3bd9905efeca2962bb141849110130f85e1 Mon Sep 17 00:00:00 2001 From: Cindy Lin Date: Fri, 8 Mar 2024 06:40:56 +0000 Subject: [PATCH 015/161] Revert "Add an explicit TWT register events call" Revert submission 26139993-wifi_twt_register_events Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_main-throttled-monitored&target=adt4-trunk_staging-userdebug&lkgb=11547652&lkbb=11547886&fkbb=11547886, bug: 328706639 BUG: 328706639 Reverted changes: /q/submissionid:26139993-wifi_twt_register_events Change-Id: I35ad8f55151ca0a93368c425ee85373120ce211e --- wifi/aidl/default/wifi_legacy_hal.cpp | 14 +- wifi/aidl/default/wifi_legacy_hal.h | 19 +- wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 - wifi/aidl/default/wifi_sta_iface.cpp | 279 +++++++++----------- wifi/aidl/default/wifi_sta_iface.h | 2 - 5 files changed, 143 insertions(+), 172 deletions(-) diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index cf86120032..55d6f59314 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1867,8 +1867,9 @@ std::pair WifiLegacyHal::twtGetCapabilities( return {capabs, status}; } -wifi_error WifiLegacyHal::twtRegisterEvents( - const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback, +wifi_error WifiLegacyHal::twtSessionSetup( + const std::string& ifaceName, uint32_t cmdId, const wifi_twt_request& request, + const on_twt_failure& on_twt_failure_user_callback, const on_twt_session_create& on_twt_session_create_user_callback, const on_twt_session_update& on_twt_session_update_user_callback, const on_twt_session_teardown& on_twt_session_teardown_user_callback, @@ -1920,18 +1921,13 @@ wifi_error WifiLegacyHal::twtRegisterEvents( on_twt_session_resume_user_callback(id, session_id); }; - return global_func_table_.wifi_twt_register_events( - getIfaceHandle(ifaceName), + return global_func_table_.wifi_twt_session_setup( + cmdId, getIfaceHandle(ifaceName), request, {onAsyncTwtError, onAsyncTwtSessionCreate, onAsyncTwtSessionUpdate, onAsyncTwtSessionTeardown, onAsyncTwtSessionStats, onAsyncTwtSessionSuspend, onAsyncTwtSessionResume}); } -wifi_error WifiLegacyHal::twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, - const wifi_twt_request& request) { - return global_func_table_.wifi_twt_session_setup(cmdId, getIfaceHandle(ifaceName), request); -} - wifi_error WifiLegacyHal::twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, const wifi_twt_request& request) { return global_func_table_.wifi_twt_session_update(cmdId, getIfaceHandle(ifaceName), sessionId, diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 3fd567bc45..121d1b5ed8 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -780,16 +780,15 @@ class WifiLegacyHal { // TWT functions std::pair twtGetCapabilities(const std::string& ifaceName); - wifi_error twtRegisterEvents( - const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback, - const on_twt_session_create& on_twt_session_create_user_callback, - const on_twt_session_update& on_twt_session_update_user_callback, - const on_twt_session_teardown& on_twt_session_teardown_user_callback, - const on_twt_session_stats& on_twt_session_stats_user_callback, - const on_twt_session_suspend& on_twt_session_suspend_user_callback, - const on_twt_session_resume& on_twt_session_resume_user_callback); wifi_error twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, - const wifi_twt_request& request); + const wifi_twt_request& request, + const on_twt_failure& on_twt_failure_user_callback, + const on_twt_session_create& on_twt_session_create_user_callback, + const on_twt_session_update& on_twt_session_update_user_callback, + const on_twt_session_teardown& on_twt_session_teardown_user_callback, + const on_twt_session_stats& on_twt_session_stats_user_callback, + const on_twt_session_suspend& on_twt_session_suspend_user_callback, + const on_twt_session_resume& on_twt_session_resume_user_callback); wifi_error twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, const wifi_twt_request& request); wifi_error twtSessionSuspend(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); @@ -798,7 +797,7 @@ class WifiLegacyHal { wifi_error twtSessionGetStats(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); // Note: Following TWT functions are deprecated - // Deprecated by twtRegisterEvegnts + // Deprecated wifi_error twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& handler); // Deprecated by twtGetCapabilities diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 6e137608da..3e4afd0427 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -182,7 +182,6 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_get_rtt_capabilities_v3); populateStubFor(&hal_fn->wifi_rtt_range_request_v3); populateStubFor(&hal_fn->wifi_twt_get_capabilities); - populateStubFor(&hal_fn->wifi_twt_register_events); populateStubFor(&hal_fn->wifi_twt_session_setup); populateStubFor(&hal_fn->wifi_twt_session_update); populateStubFor(&hal_fn->wifi_twt_session_suspend); diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 85e373cde0..aee183d429 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -31,11 +31,7 @@ using aidl_return_util::validateAndCall; WifiStaIface::WifiStaIface(const std::string& ifname, const std::weak_ptr legacy_hal, const std::weak_ptr iface_util) - : ifname_(ifname), - legacy_hal_(legacy_hal), - iface_util_(iface_util), - is_valid_(true), - is_twt_registered_(false) { + : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { // Turn on DFS channel usage for STA iface. legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); if (legacy_status != legacy_hal::WIFI_SUCCESS) { @@ -270,150 +266,11 @@ std::pair WifiStaIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } -ndk::ScopedAStatus WifiStaIface::registerTwtEventCallbackInternal() { - std::weak_ptr weak_ptr_this = weak_ptr_this_; - - // onTwtFailure callback - const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_error_code error_code) { - const auto shared_ptr_this = weak_ptr_this.lock(); - IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = - aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtFailure callback"; - } - } - }; - // onTwtSessionCreate callback - const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_session twt_session) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSession aidl_twt_session; - if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { - LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; - return; - } - - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; - } - } - }; - // onTwtSessionUpdate callback - const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_session twt_session) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSession aidl_twt_session; - if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { - LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; - return; - } - - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; - } - } - }; - // onTwtSessionTeardown callback - const auto& on_twt_session_teardown = - [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, - legacy_hal::wifi_twt_teardown_reason_code reason_code) { - const auto shared_ptr_this = weak_ptr_this.lock(); - IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = - aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; - } - } - }; - // onTwtSessionStats callback - const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id, - legacy_hal::wifi_twt_session_stats stats) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSessionStats aidl_session_stats; - if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { - LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; - return; - } - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; - } - } - }; - // onTwtSessionSuspend callback - const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; - } - } - }; - // onTwtSessionResume callback - const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionResume(id, session_id).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; - } - } - }; - - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtRegisterEvents( - ifname_, on_twt_failure, on_twt_session_create, on_twt_session_update, - on_twt_session_teardown, on_twt_session_stats, on_twt_session_suspend, - on_twt_session_resume); - - if (legacy_status == legacy_hal::WIFI_ERROR_NOT_SUPPORTED) { - LOG(INFO) << "twtRegisterEvents is not supported" << legacy_status; - } else if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "twtRegisterEvents failed - %d" << legacy_status; - } - return createWifiStatusFromLegacyError(legacy_status); -} - ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( const std::shared_ptr& callback) { if (!event_cb_handler_.addCallback(callback)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - is_twt_registered_ = registerTwtEventCallbackInternal().isOk(); return ndk::ScopedAStatus::ok(); } @@ -760,16 +617,138 @@ std::pair WifiStaIface::twtGetCapabilitiesI ndk::ScopedAStatus WifiStaIface::twtSessionSetupInternal(int32_t cmdId, const TwtRequest& aidlTwtRequest) { - if (!is_twt_registered_) { - LOG(INFO) << "twtSessionSetup is not supported as twtRegisterEvents failed"; - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); - } legacy_hal::wifi_twt_request legacyHalTwtRequest; if (!aidl_struct_util::convertAidlTwtRequestToLegacy(aidlTwtRequest, &legacyHalTwtRequest)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->twtSessionSetup(ifname_, cmdId, legacyHalTwtRequest); + std::weak_ptr weak_ptr_this = weak_ptr_this_; + + // onTwtFailure callback + const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_error_code error_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = + aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtFailure callback"; + } + } + }; + // onTwtSessionCreate callback + const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; + } + } + }; + // onTwtSessionUpdate callback + const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; + } + } + }; + // onTwtSessionTeardown callback + const auto& on_twt_session_teardown = + [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, + legacy_hal::wifi_twt_teardown_reason_code reason_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = + aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; + } + } + }; + // onTwtSessionStats callback + const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id, + legacy_hal::wifi_twt_session_stats stats) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSessionStats aidl_session_stats; + if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { + LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; + return; + } + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; + } + } + }; + // onTwtSessionSuspend callback + const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; + } + } + }; + // onTwtSessionResume callback + const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionResume(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtSessionSetup( + ifname_, cmdId, legacyHalTwtRequest, on_twt_failure, on_twt_session_create, + on_twt_session_update, on_twt_session_teardown, on_twt_session_stats, + on_twt_session_suspend, on_twt_session_resume); return createWifiStatusFromLegacyError(legacy_status); } diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index 5713928448..eb8f745475 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -103,7 +103,6 @@ class WifiStaIface : public BnWifiStaIface { private: // Corresponding worker functions for the AIDL methods. std::pair getNameInternal(); - ndk::ScopedAStatus registerTwtEventCallbackInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& callback); std::pair getFeatureSetInternal(); @@ -158,7 +157,6 @@ class WifiStaIface : public BnWifiStaIface { std::weak_ptr weak_ptr_this_; bool is_valid_; aidl_callback_util::AidlCallbackHandler event_cb_handler_; - bool is_twt_registered_; DISALLOW_COPY_AND_ASSIGN(WifiStaIface); }; From fe3a8461f266283aa0f842831876058553fdd684 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 5 Mar 2024 12:58:50 -0800 Subject: [PATCH 016/161] Add isValid method test for V2 bcradio utils Refactored unit tests isValid broadcast radio utils methods to reuse testcases. Also fixed isValidV2 check for HD station location. Bug: 310708886 Test: atest broadcastradio_utils_aidl_test Change-Id: Ic168776493a5433606849d39175347a5a83b492f --- .../test/BroadcastRadioUtilsCommonTest.cpp | 421 ++++++++++++++++++ .../test/BroadcastRadioUtilsTest.cpp | 266 ----------- .../test/BroadcastRadioUtilsV2Test.cpp | 75 ---- 3 files changed, 421 insertions(+), 341 deletions(-) create mode 100644 broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsCommonTest.cpp delete mode 100644 broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsV2Test.cpp diff --git a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsCommonTest.cpp b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsCommonTest.cpp new file mode 100644 index 0000000000..b71bf03d28 --- /dev/null +++ b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsCommonTest.cpp @@ -0,0 +1,421 @@ +/* + * Copyright (C) 2024 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. + */ + +#include +#include +#include + +namespace aidl::android::hardware::broadcastradio { + +namespace { +constexpr int64_t kFmFrequencyKHz = 97900; +constexpr uint32_t kDabSid = 0x0000C221u; +constexpr int kDabEccCode = 0xE1u; +constexpr int kDabSCIdS = 0x1u; +constexpr uint64_t kDabSidExt = static_cast(kDabSid) | + (static_cast(kDabEccCode) << 32) | + (static_cast(kDabSCIdS) << 40); +constexpr uint32_t kDabEnsemble = 0xCE15u; +constexpr uint64_t kDabFrequencyKhz = 225648u; +constexpr uint64_t kHdStationId = 0xA0000001u; +constexpr uint64_t kHdSubChannel = 1u; +constexpr uint64_t kHdStationLocation = 0x44E647003665CF6u; +constexpr uint64_t kHdStationLocationInvalid = 0x4E647007665CF6u; +constexpr uint64_t kHdFrequency = 97700u; +constexpr int64_t kRdsValue = 0xBEEF; + +struct IsValidIdentifierTestCase { + std::string name; + ProgramIdentifier id; + bool valid; +}; + +std::vector getIsValidIdentifierTestCases() { + return std::vector({ + IsValidIdentifierTestCase{.name = "invalid_id_type", + .id = utils::makeIdentifier(IdentifierType::INVALID, 0), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_frequency_high", + .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 10000000u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_frequency_low", + .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 100000u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_dab_frequency", + .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 1000000u), + .valid = true}, + IsValidIdentifierTestCase{ + .name = "invalid_am_fm_frequency_high", + .id = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 10000000u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_am_fm_frequency_low", + .id = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 100u), + .valid = false}, + IsValidIdentifierTestCase{.name = "valid_am_fm_frequency", + .id = utils::makeIdentifier( + IdentifierType::AMFM_FREQUENCY_KHZ, kFmFrequencyKHz), + .valid = true}, + IsValidIdentifierTestCase{ + .name = "drmo_frequency_high", + .id = utils::makeIdentifier(IdentifierType::DRMO_FREQUENCY_KHZ, 10000000u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "drmo_frequency_low", + .id = utils::makeIdentifier(IdentifierType::DRMO_FREQUENCY_KHZ, 100u), + .valid = false}, + IsValidIdentifierTestCase{.name = "valid_drmo_frequency", + .id = utils::makeIdentifier( + IdentifierType::DRMO_FREQUENCY_KHZ, kFmFrequencyKHz), + .valid = true}, + IsValidIdentifierTestCase{.name = "invalid_rds_low", + .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x0), + .valid = false}, + IsValidIdentifierTestCase{.name = "invalid_rds_high", + .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x10000), + .valid = false}, + IsValidIdentifierTestCase{.name = "valid_rds", + .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x1000), + .valid = true}, + IsValidIdentifierTestCase{ + .name = "invalid_hd_id_zero", + .id = utils::makeSelectorHd(/* stationId= */ 0u, kHdSubChannel, kHdFrequency) + .primaryId, + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_hd_suchannel", + .id = utils::makeSelectorHd(kHdStationId, /* subChannel= */ 8u, kHdFrequency) + .primaryId, + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_hd_frequency_low", + .id = utils::makeSelectorHd(kHdStationId, kHdSubChannel, /* frequency= */ 100u) + .primaryId, + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_hd_id", + .id = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency) + .primaryId, + .valid = true}, + IsValidIdentifierTestCase{ + .name = "invalid_hd_station_name", + .id = utils::makeIdentifier(IdentifierType::HD_STATION_NAME, 0x41422D464D), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_hd_station_name", + .id = utils::makeIdentifier(IdentifierType::HD_STATION_NAME, 0x414231464D), + .valid = true}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_sid", + .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x0E100000000u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_ecc_low", + .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x0F700000221u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_ecc_high", + .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x09900000221u), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_dab_sid_ext", + .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, kDabSidExt), + .valid = true}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_ensemble_zero", + .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, 0x0), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_dab_ensemble_high", + .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, 0x10000), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_dab_ensemble", + .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, kDabEnsemble), + .valid = true}, + IsValidIdentifierTestCase{.name = "invalid_dab_scid_low", + .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0xF), + .valid = false}, + IsValidIdentifierTestCase{.name = "invalid_dab_scid_high", + .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0x1000), + .valid = false}, + IsValidIdentifierTestCase{.name = "valid_dab_scid", + .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0x100), + .valid = true}, + IsValidIdentifierTestCase{ + .name = "invalid_drmo_id_zero", + .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x0), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "invalid_drmo_id_high", + .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x1000000), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_drmo_id", + .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000), + .valid = true}, + }); +} + +std::vector getIsValidIdentifierV2TestCases() { + std::vector testcases = getIsValidIdentifierTestCases(); + std::vector testcasesNew = std::vector({ + IsValidIdentifierTestCase{ + .name = "invalid_hd_station_location_id", + .id = utils::makeIdentifier(IdentifierType::HD_STATION_LOCATION, + kHdStationLocationInvalid), + .valid = false}, + IsValidIdentifierTestCase{ + .name = "valid_hd_station_location_id", + .id = utils::makeIdentifier(IdentifierType::HD_STATION_LOCATION, + kHdStationLocation), + .valid = true}, + }); + testcases.insert(testcases.end(), testcasesNew.begin(), testcasesNew.end()); + return testcases; +} + +struct IsValidSelectorTestCase { + std::string name; + ProgramSelector sel; + bool valid; +}; + +std::vector getIsValidSelectorTestCases() { + return std::vector({ + IsValidSelectorTestCase{.name = "valid_am_fm_selector", + .sel = utils::makeSelectorAmfm(kFmFrequencyKHz), + .valid = true}, + IsValidSelectorTestCase{ + .name = "valid_hd_selector", + .sel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency), + .valid = true}, + IsValidSelectorTestCase{ + .name = "valid_dab_selector", + .sel = utils::makeSelectorDab(kDabSidExt, kDabEnsemble, kDabFrequencyKhz), + .valid = true}, + IsValidSelectorTestCase{.name = "valid_rds_selector", + .sel = ProgramSelector{.primaryId = utils::makeIdentifier( + IdentifierType::RDS_PI, 0x1000)}, + .valid = true}, + IsValidSelectorTestCase{.name = "selector_with_invalid_id", + .sel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, + /* frequency= */ 100u), + .valid = false}, + IsValidSelectorTestCase{ + .name = "selector_with_invalid_primary_id_type", + .sel = ProgramSelector{.primaryId = utils::makeIdentifier( + IdentifierType::DAB_ENSEMBLE, kDabEnsemble)}, + .valid = false}, + IsValidSelectorTestCase{ + .name = "selector_with_invalid_secondary_id", + .sel = ProgramSelector{.primaryId = utils::makeIdentifier( + IdentifierType::DAB_SID_EXT, kDabSidExt), + .secondaryIds = {utils::makeIdentifier( + IdentifierType::DAB_ENSEMBLE, 0x0)}}, + .valid = false}, + }); +} + +std::vector getIsValidSelectorV2TestCases() { + ProgramSelector validHdSel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency); + validHdSel.secondaryIds = { + utils::makeIdentifier(IdentifierType::HD_STATION_LOCATION, kHdStationLocation)}; + ProgramSelector invalidHdSel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency); + invalidHdSel.secondaryIds = { + utils::makeIdentifier(IdentifierType::HD_STATION_LOCATION, kHdStationLocationInvalid)}; + std::vector testcasesNew = std::vector( + {IsValidSelectorTestCase{.name = "hd_selector_with_valid_station_location", + .sel = validHdSel, + .valid = true}, + IsValidSelectorTestCase{.name = "hd_selector_with_invalid_station_location", + .sel = invalidHdSel, + .valid = false}}); + std::vector testcases = getIsValidSelectorTestCases(); + testcases.insert(testcases.end(), testcasesNew.begin(), testcasesNew.end()); + return testcases; +} + +struct IsValidMetadataTestCase { + std::string name; + Metadata metadata; + bool valid; +}; + +std::vector getIsValidMetadataTestCases() { + return std::vector({ + IsValidMetadataTestCase{.name = "valid_rds_pty", + .metadata = Metadata::make(1), + .valid = true}, + IsValidMetadataTestCase{.name = "negative_rds_pty", + .metadata = Metadata::make(-1), + .valid = false}, + IsValidMetadataTestCase{.name = "large_rds_pty", + .metadata = Metadata::make(256), + .valid = false}, + IsValidMetadataTestCase{.name = "valid_rbds_pty", + .metadata = Metadata::make(1), + .valid = true}, + IsValidMetadataTestCase{.name = "negative_rbds_pty", + .metadata = Metadata::make(-1), + .valid = false}, + IsValidMetadataTestCase{.name = "large_rbds_pty", + .metadata = Metadata::make(256), + .valid = false}, + IsValidMetadataTestCase{ + .name = "valid_dab_ensemble_name_short", + .metadata = Metadata::make("name"), + .valid = true}, + IsValidMetadataTestCase{ + .name = "too_long_dab_ensemble_name_short", + .metadata = Metadata::make("name_long"), + .valid = false}, + IsValidMetadataTestCase{ + .name = "valid_dab_service_name_short", + .metadata = Metadata::make("name"), + .valid = true}, + IsValidMetadataTestCase{ + .name = "too_long_dab_service_name_short", + .metadata = Metadata::make("name_long"), + .valid = false}, + IsValidMetadataTestCase{ + .name = "valid_dab_component_name_short", + .metadata = Metadata::make("name"), + .valid = true}, + IsValidMetadataTestCase{ + .name = "too_long_dab_component_name_short", + .metadata = Metadata::make("name_long"), + .valid = false}, + }); +} + +std::vector getIsValidMetadataV2TestCases() { + std::vector testcases = getIsValidMetadataTestCases(); + std::vector testcasesNew = std::vector({ + IsValidMetadataTestCase{ + .name = "valid_hd_station_name_short", + .metadata = Metadata::make("name_short"), + .valid = true}, + IsValidMetadataTestCase{ + .name = "too_long_hd_station_name_short", + .metadata = Metadata::make("name_too_long"), + .valid = false}, + IsValidMetadataTestCase{.name = "valid_hd_subchannel_available", + .metadata = Metadata::make(1), + .valid = true}, + IsValidMetadataTestCase{ + .name = "negative_subchannel_available", + .metadata = Metadata::make(-1), + .valid = false}, + IsValidMetadataTestCase{ + .name = "large_subchannel_available", + .metadata = Metadata::make(256), + .valid = false}, + }); + testcases.insert(testcases.end(), testcasesNew.begin(), testcasesNew.end()); + return testcases; +} +} // namespace + +class IsValidIdentifierTest : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(IsValidIdentifierTests, IsValidIdentifierTest, + testing::ValuesIn(getIsValidIdentifierTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(IsValidIdentifierTest, IsValid) { + IsValidIdentifierTestCase testcase = GetParam(); + + ASSERT_EQ(utils::isValid(testcase.id), testcase.valid); +} + +class IsValidIdentifierV2Test : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P( + IsValidIdentifierV2Tests, IsValidIdentifierV2Test, + testing::ValuesIn(getIsValidIdentifierV2TestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(IsValidIdentifierV2Test, IsValidV2) { + IsValidIdentifierTestCase testcase = GetParam(); + + ASSERT_EQ(utils::isValidV2(testcase.id), testcase.valid); +} + +class IsValidSelectorTest : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(IsValidSelectorTests, IsValidSelectorTest, + testing::ValuesIn(getIsValidSelectorTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(IsValidSelectorTest, IsValid) { + IsValidSelectorTestCase testcase = GetParam(); + + ASSERT_EQ(utils::isValid(testcase.sel), testcase.valid); +} + +class IsValidSelectorV2Test : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(IsValidSelectorV2Tests, IsValidSelectorV2Test, + testing::ValuesIn(getIsValidSelectorV2TestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(IsValidSelectorV2Test, IsValidV2) { + IsValidSelectorTestCase testcase = GetParam(); + + ASSERT_EQ(utils::isValidV2(testcase.sel), testcase.valid); +} + +class IsValidMetadataTest : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(IsValidMetadataTests, IsValidMetadataTest, + testing::ValuesIn(getIsValidMetadataTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(IsValidMetadataTest, IsValidMetadata) { + IsValidMetadataTestCase testParam = GetParam(); + + ASSERT_EQ(utils::isValidMetadata(testParam.metadata), testParam.valid); +} + +class IsValidMetadataV2Test : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(IsValidMetadataV2Tests, IsValidMetadataV2Test, + testing::ValuesIn(getIsValidMetadataV2TestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(IsValidMetadataV2Test, IsValidMetadataV2) { + IsValidMetadataTestCase testParam = GetParam(); + + ASSERT_EQ(utils::isValidMetadataV2(testParam.metadata), testParam.valid); +} + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp index a5c9073133..b633ff0af2 100644 --- a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp +++ b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp @@ -66,230 +66,6 @@ std::vector getBandTestCases() { .frequency = 110000, .bandResult = utils::FrequencyBand::UNKNOWN}}); } - -struct IsValidIdentifierTestCase { - std::string name; - ProgramIdentifier id; - bool valid; -}; - -std::vector getIsValidIdentifierTestCases() { - return std::vector({ - IsValidIdentifierTestCase{.name = "invalid_id_type", - .id = utils::makeIdentifier(IdentifierType::INVALID, 0), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_frequency_high", - .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 10000000u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_frequency_low", - .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 100000u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "valid_dab_frequency", - .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 1000000u), - .valid = true}, - IsValidIdentifierTestCase{ - .name = "invalid_am_fm_frequency_high", - .id = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 10000000u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_am_fm_frequency_low", - .id = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 100u), - .valid = false}, - IsValidIdentifierTestCase{.name = "valid_am_fm_frequency", - .id = utils::makeIdentifier( - IdentifierType::AMFM_FREQUENCY_KHZ, kFmFrequencyKHz), - .valid = true}, - IsValidIdentifierTestCase{ - .name = "drmo_frequency_high", - .id = utils::makeIdentifier(IdentifierType::DRMO_FREQUENCY_KHZ, 10000000u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "drmo_frequency_low", - .id = utils::makeIdentifier(IdentifierType::DRMO_FREQUENCY_KHZ, 100u), - .valid = false}, - IsValidIdentifierTestCase{.name = "valid_drmo_frequency", - .id = utils::makeIdentifier( - IdentifierType::DRMO_FREQUENCY_KHZ, kFmFrequencyKHz), - .valid = true}, - IsValidIdentifierTestCase{.name = "invalid_rds_low", - .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x0), - .valid = false}, - IsValidIdentifierTestCase{.name = "invalid_rds_high", - .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x10000), - .valid = false}, - IsValidIdentifierTestCase{.name = "valid_rds", - .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x1000), - .valid = true}, - IsValidIdentifierTestCase{ - .name = "invalid_hd_id_zero", - .id = utils::makeSelectorHd(/* stationId= */ 0u, kHdSubChannel, kHdFrequency) - .primaryId, - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_hd_suchannel", - .id = utils::makeSelectorHd(kHdStationId, /* subChannel= */ 8u, kHdFrequency) - .primaryId, - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_hd_frequency_low", - .id = utils::makeSelectorHd(kHdStationId, kHdSubChannel, /* frequency= */ 100u) - .primaryId, - .valid = false}, - IsValidIdentifierTestCase{ - .name = "valid_hd_id", - .id = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency) - .primaryId, - .valid = true}, - IsValidIdentifierTestCase{ - .name = "invalid_hd_station_name", - .id = utils::makeIdentifier(IdentifierType::HD_STATION_NAME, 0x41422D464D), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "valid_hd_station_name", - .id = utils::makeIdentifier(IdentifierType::HD_STATION_NAME, 0x414231464D), - .valid = true}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_sid", - .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x0E100000000u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_ecc_low", - .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x0F700000221u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_ecc_high", - .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x09900000221u), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "valid_dab_sid_ext", - .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, kDabSidExt), - .valid = true}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_ensemble_zero", - .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, 0x0), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_dab_ensemble_high", - .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, 0x10000), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "valid_dab_ensemble", - .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, kDabEnsemble), - .valid = true}, - IsValidIdentifierTestCase{.name = "invalid_dab_scid_low", - .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0xF), - .valid = false}, - IsValidIdentifierTestCase{.name = "invalid_dab_scid_high", - .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0x1000), - .valid = false}, - IsValidIdentifierTestCase{.name = "valid_dab_scid", - .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0x100), - .valid = true}, - IsValidIdentifierTestCase{ - .name = "invalid_drmo_id_zero", - .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x0), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "invalid_drmo_id_high", - .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x1000000), - .valid = false}, - IsValidIdentifierTestCase{ - .name = "valid_drmo_id", - .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000), - .valid = true}, - }); -} - -struct IsValidSelectorTestCase { - std::string name; - ProgramSelector sel; - bool valid; -}; - -std::vector getIsValidSelectorTestCases() { - return std::vector({ - IsValidSelectorTestCase{.name = "valid_am_fm_selector", - .sel = utils::makeSelectorAmfm(kFmFrequencyKHz), - .valid = true}, - IsValidSelectorTestCase{ - .name = "valid_hd_selector", - .sel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency), - .valid = true}, - IsValidSelectorTestCase{ - .name = "valid_dab_selector", - .sel = utils::makeSelectorDab(kDabSidExt, kDabEnsemble, kDabFrequencyKhz), - .valid = true}, - IsValidSelectorTestCase{.name = "valid_rds_selector", - .sel = ProgramSelector{.primaryId = utils::makeIdentifier( - IdentifierType::RDS_PI, 0x1000)}, - .valid = true}, - IsValidSelectorTestCase{.name = "selector_with_invalid_id", - .sel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, - /* frequency= */ 100u), - .valid = false}, - IsValidSelectorTestCase{ - .name = "selector_with_invalid_primary_id_type", - .sel = ProgramSelector{.primaryId = utils::makeIdentifier( - IdentifierType::DAB_ENSEMBLE, kDabEnsemble)}, - .valid = false}, - }); -} - -struct IsValidMetadataTestCase { - std::string name; - Metadata metadata; - bool valid; -}; - -std::vector getIsValidMetadataTestCases() { - return std::vector({ - IsValidMetadataTestCase{.name = "valid_rds_pty", - .metadata = Metadata::make(1), - .valid = true}, - IsValidMetadataTestCase{.name = "negative_rds_pty", - .metadata = Metadata::make(-1), - .valid = false}, - IsValidMetadataTestCase{.name = "large_rds_pty", - .metadata = Metadata::make(256), - .valid = false}, - IsValidMetadataTestCase{.name = "valid_rbds_pty", - .metadata = Metadata::make(1), - .valid = true}, - IsValidMetadataTestCase{.name = "negative_rbds_pty", - .metadata = Metadata::make(-1), - .valid = false}, - IsValidMetadataTestCase{.name = "large_rbds_pty", - .metadata = Metadata::make(256), - .valid = false}, - IsValidMetadataTestCase{ - .name = "valid_dab_ensemble_name_short", - .metadata = Metadata::make("name"), - .valid = true}, - IsValidMetadataTestCase{ - .name = "too_long_dab_ensemble_name_short", - .metadata = Metadata::make("name_long"), - .valid = false}, - IsValidMetadataTestCase{ - .name = "valid_dab_service_name_short", - .metadata = Metadata::make("name"), - .valid = true}, - IsValidMetadataTestCase{ - .name = "too_long_dab_service_name_short", - .metadata = Metadata::make("name_long"), - .valid = false}, - IsValidMetadataTestCase{ - .name = "valid_dab_component_name_short", - .metadata = Metadata::make("name"), - .valid = true}, - IsValidMetadataTestCase{ - .name = "too_long_dab_component_name_short", - .metadata = Metadata::make("name_long"), - .valid = false}, - }); -} } // namespace class GetBandTest : public testing::TestWithParam {}; @@ -305,48 +81,6 @@ TEST_P(GetBandTest, GetBand) { ASSERT_EQ(utils::getBand(testcase.frequency), testcase.bandResult); } -class IsValidMetadataTest : public testing::TestWithParam {}; - -INSTANTIATE_TEST_SUITE_P(IsValidMetadataTests, IsValidMetadataTest, - testing::ValuesIn(getIsValidMetadataTestCases()), - [](const testing::TestParamInfo& info) { - return info.param.name; - }); - -TEST_P(IsValidMetadataTest, IsValidMetadata) { - IsValidMetadataTestCase testParam = GetParam(); - - ASSERT_EQ(utils::isValidMetadata(testParam.metadata), testParam.valid); -} - -class IsValidIdentifierTest : public testing::TestWithParam {}; - -INSTANTIATE_TEST_SUITE_P(IsValidIdentifierTests, IsValidIdentifierTest, - testing::ValuesIn(getIsValidIdentifierTestCases()), - [](const testing::TestParamInfo& info) { - return info.param.name; - }); - -TEST_P(IsValidIdentifierTest, IsValid) { - IsValidIdentifierTestCase testcase = GetParam(); - - ASSERT_EQ(utils::isValid(testcase.id), testcase.valid); -} - -class IsValidSelectorTest : public testing::TestWithParam {}; - -INSTANTIATE_TEST_SUITE_P(IsValidSelectorTests, IsValidSelectorTest, - testing::ValuesIn(getIsValidSelectorTestCases()), - [](const testing::TestParamInfo& info) { - return info.param.name; - }); - -TEST_P(IsValidSelectorTest, IsValid) { - IsValidSelectorTestCase testcase = GetParam(); - - ASSERT_EQ(utils::isValid(testcase.sel), testcase.valid); -} - TEST(BroadcastRadioUtilsTest, IdentifierIteratorBegin) { ProgramSelector sel = { .primaryId = utils::makeIdentifier(IdentifierType::RDS_PI, kRdsValue), diff --git a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsV2Test.cpp b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsV2Test.cpp deleted file mode 100644 index cf9f9e965b..0000000000 --- a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsV2Test.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ - -#include -#include - -namespace aidl::android::hardware::broadcastradio { - -namespace { -struct IsValidMetadataV2TestCase { - std::string name; - Metadata metadata; - bool valid; -}; - -std::vector getIsValidMetadataV2TestCases() { - return std::vector({ - IsValidMetadataV2TestCase{.name = "valid_rds_pty", - .metadata = Metadata::make(1), - .valid = true}, - IsValidMetadataV2TestCase{.name = "negative_rds_pty", - .metadata = Metadata::make(-1), - .valid = false}, - IsValidMetadataV2TestCase{ - .name = "valid_hd_station_name_short", - .metadata = Metadata::make("name_short"), - .valid = true}, - IsValidMetadataV2TestCase{ - .name = "too_long_hd_station_name_short", - .metadata = Metadata::make("name_too_long"), - .valid = false}, - IsValidMetadataV2TestCase{ - .name = "valid_hd_subchannel_available", - .metadata = Metadata::make(1), - .valid = true}, - IsValidMetadataV2TestCase{ - .name = "negative_subchannel_available", - .metadata = Metadata::make(-1), - .valid = false}, - IsValidMetadataV2TestCase{ - .name = "large_subchannel_available", - .metadata = Metadata::make(256), - .valid = false}, - }); -} -} // namespace - -class IsValidMetadataV2Test : public testing::TestWithParam {}; - -INSTANTIATE_TEST_SUITE_P(IsValidMetadataV2Tests, IsValidMetadataV2Test, - testing::ValuesIn(getIsValidMetadataV2TestCases()), - [](const testing::TestParamInfo& info) { - return info.param.name; - }); - -TEST_P(IsValidMetadataV2Test, IsValidMetadataV2) { - IsValidMetadataV2TestCase testParam = GetParam(); - - ASSERT_EQ(utils::isValidMetadataV2(testParam.metadata), testParam.valid); -} - -} // namespace aidl::android::hardware::broadcastradio From f84adb0fade1dbbf5b56a3cd06e0bb27a9fc6945 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 7 Mar 2024 20:15:51 +0000 Subject: [PATCH 017/161] Effect AIDL: remove placeholder effect from default implementation Bug: 328330990 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: Icf15e349a2ad36eeefa1e3eb46428c04ae164ad1 Merged-In: Icf15e349a2ad36eeefa1e3eb46428c04ae164ad1 --- audio/aidl/default/audio_effects_config.xml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/audio/aidl/default/audio_effects_config.xml b/audio/aidl/default/audio_effects_config.xml index 827ff80a8a..e859a0e083 100644 --- a/audio/aidl/default/audio_effects_config.xml +++ b/audio/aidl/default/audio_effects_config.xml @@ -72,10 +72,7 @@ - - - - + @@ -86,16 +83,10 @@ - - - - + - - - - + From 3375df8b11c0bb9e466c1c91197c42334bd4a393 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Mon, 11 Mar 2024 17:40:08 +0000 Subject: [PATCH 018/161] Revert^2 "Add an explicit TWT register events call" Revert submission revert-26139993-wifi_twt_register_events-BHPFTTCQRF Reason for revert: Build issue (Bug: 328706639) on target adt4-trunk_staging-userdebug , project 'platform/hardware/amlogic' was due to an incorrect inclusion of wifi_hal.h. The fix (Bug: 328781057) is merged. BUG: 329101606 Test: Build on adt4-trunk_staging-userdebug Reverted changes: /q/topic:revert-26139993-wifi_twt_register_events-BHPFTTCQRF Change-Id: I6210bd14c32feafd6b45493307b604584524ff50 --- wifi/aidl/default/wifi_legacy_hal.cpp | 14 +- wifi/aidl/default/wifi_legacy_hal.h | 19 +- wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + wifi/aidl/default/wifi_sta_iface.cpp | 279 +++++++++++--------- wifi/aidl/default/wifi_sta_iface.h | 2 + 5 files changed, 172 insertions(+), 143 deletions(-) diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 55d6f59314..cf86120032 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1867,9 +1867,8 @@ std::pair WifiLegacyHal::twtGetCapabilities( return {capabs, status}; } -wifi_error WifiLegacyHal::twtSessionSetup( - const std::string& ifaceName, uint32_t cmdId, const wifi_twt_request& request, - const on_twt_failure& on_twt_failure_user_callback, +wifi_error WifiLegacyHal::twtRegisterEvents( + const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback, const on_twt_session_create& on_twt_session_create_user_callback, const on_twt_session_update& on_twt_session_update_user_callback, const on_twt_session_teardown& on_twt_session_teardown_user_callback, @@ -1921,13 +1920,18 @@ wifi_error WifiLegacyHal::twtSessionSetup( on_twt_session_resume_user_callback(id, session_id); }; - return global_func_table_.wifi_twt_session_setup( - cmdId, getIfaceHandle(ifaceName), request, + return global_func_table_.wifi_twt_register_events( + getIfaceHandle(ifaceName), {onAsyncTwtError, onAsyncTwtSessionCreate, onAsyncTwtSessionUpdate, onAsyncTwtSessionTeardown, onAsyncTwtSessionStats, onAsyncTwtSessionSuspend, onAsyncTwtSessionResume}); } +wifi_error WifiLegacyHal::twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, + const wifi_twt_request& request) { + return global_func_table_.wifi_twt_session_setup(cmdId, getIfaceHandle(ifaceName), request); +} + wifi_error WifiLegacyHal::twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, const wifi_twt_request& request) { return global_func_table_.wifi_twt_session_update(cmdId, getIfaceHandle(ifaceName), sessionId, diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 121d1b5ed8..3fd567bc45 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -780,15 +780,16 @@ class WifiLegacyHal { // TWT functions std::pair twtGetCapabilities(const std::string& ifaceName); + wifi_error twtRegisterEvents( + const std::string& ifaceName, const on_twt_failure& on_twt_failure_user_callback, + const on_twt_session_create& on_twt_session_create_user_callback, + const on_twt_session_update& on_twt_session_update_user_callback, + const on_twt_session_teardown& on_twt_session_teardown_user_callback, + const on_twt_session_stats& on_twt_session_stats_user_callback, + const on_twt_session_suspend& on_twt_session_suspend_user_callback, + const on_twt_session_resume& on_twt_session_resume_user_callback); wifi_error twtSessionSetup(const std::string& ifaceName, uint32_t cmdId, - const wifi_twt_request& request, - const on_twt_failure& on_twt_failure_user_callback, - const on_twt_session_create& on_twt_session_create_user_callback, - const on_twt_session_update& on_twt_session_update_user_callback, - const on_twt_session_teardown& on_twt_session_teardown_user_callback, - const on_twt_session_stats& on_twt_session_stats_user_callback, - const on_twt_session_suspend& on_twt_session_suspend_user_callback, - const on_twt_session_resume& on_twt_session_resume_user_callback); + const wifi_twt_request& request); wifi_error twtSessionUpdate(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId, const wifi_twt_request& request); wifi_error twtSessionSuspend(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); @@ -797,7 +798,7 @@ class WifiLegacyHal { wifi_error twtSessionGetStats(const std::string& ifaceName, uint32_t cmdId, uint32_t sessionId); // Note: Following TWT functions are deprecated - // Deprecated + // Deprecated by twtRegisterEvegnts wifi_error twtRegisterHandler(const std::string& iface_name, const TwtCallbackHandlers& handler); // Deprecated by twtGetCapabilities diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 3e4afd0427..6e137608da 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -182,6 +182,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_get_rtt_capabilities_v3); populateStubFor(&hal_fn->wifi_rtt_range_request_v3); populateStubFor(&hal_fn->wifi_twt_get_capabilities); + populateStubFor(&hal_fn->wifi_twt_register_events); populateStubFor(&hal_fn->wifi_twt_session_setup); populateStubFor(&hal_fn->wifi_twt_session_update); populateStubFor(&hal_fn->wifi_twt_session_suspend); diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index aee183d429..85e373cde0 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -31,7 +31,11 @@ using aidl_return_util::validateAndCall; WifiStaIface::WifiStaIface(const std::string& ifname, const std::weak_ptr legacy_hal, const std::weak_ptr iface_util) - : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { + : ifname_(ifname), + legacy_hal_(legacy_hal), + iface_util_(iface_util), + is_valid_(true), + is_twt_registered_(false) { // Turn on DFS channel usage for STA iface. legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); if (legacy_status != legacy_hal::WIFI_SUCCESS) { @@ -266,11 +270,150 @@ std::pair WifiStaIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } +ndk::ScopedAStatus WifiStaIface::registerTwtEventCallbackInternal() { + std::weak_ptr weak_ptr_this = weak_ptr_this_; + + // onTwtFailure callback + const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_error_code error_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = + aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtFailure callback"; + } + } + }; + // onTwtSessionCreate callback + const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; + } + } + }; + // onTwtSessionUpdate callback + const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, + legacy_hal::wifi_twt_session twt_session) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSession aidl_twt_session; + if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { + LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; + return; + } + + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; + } + } + }; + // onTwtSessionTeardown callback + const auto& on_twt_session_teardown = + [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, + legacy_hal::wifi_twt_teardown_reason_code reason_code) { + const auto shared_ptr_this = weak_ptr_this.lock(); + IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = + aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; + } + } + }; + // onTwtSessionStats callback + const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id, + legacy_hal::wifi_twt_session_stats stats) { + const auto shared_ptr_this = weak_ptr_this.lock(); + TwtSessionStats aidl_session_stats; + if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { + LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; + return; + } + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; + } + } + }; + // onTwtSessionSuspend callback + const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; + } + } + }; + // onTwtSessionResume callback + const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, + int session_id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onTwtSessionResume(id, session_id).isOk()) { + LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtRegisterEvents( + ifname_, on_twt_failure, on_twt_session_create, on_twt_session_update, + on_twt_session_teardown, on_twt_session_stats, on_twt_session_suspend, + on_twt_session_resume); + + if (legacy_status == legacy_hal::WIFI_ERROR_NOT_SUPPORTED) { + LOG(INFO) << "twtRegisterEvents is not supported" << legacy_status; + } else if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "twtRegisterEvents failed - %d" << legacy_status; + } + return createWifiStatusFromLegacyError(legacy_status); +} + ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( const std::shared_ptr& callback) { if (!event_cb_handler_.addCallback(callback)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } + is_twt_registered_ = registerTwtEventCallbackInternal().isOk(); return ndk::ScopedAStatus::ok(); } @@ -617,138 +760,16 @@ std::pair WifiStaIface::twtGetCapabilitiesI ndk::ScopedAStatus WifiStaIface::twtSessionSetupInternal(int32_t cmdId, const TwtRequest& aidlTwtRequest) { + if (!is_twt_registered_) { + LOG(INFO) << "twtSessionSetup is not supported as twtRegisterEvents failed"; + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); + } legacy_hal::wifi_twt_request legacyHalTwtRequest; if (!aidl_struct_util::convertAidlTwtRequestToLegacy(aidlTwtRequest, &legacyHalTwtRequest)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } - std::weak_ptr weak_ptr_this = weak_ptr_this_; - - // onTwtFailure callback - const auto& on_twt_failure = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_error_code error_code) { - const auto shared_ptr_this = weak_ptr_this.lock(); - IWifiStaIfaceEventCallback::TwtErrorCode aidl_error_code = - aidl_struct_util::convertLegacyHalTwtErrorCodeToAidl(error_code); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtFailure(id, aidl_error_code).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtFailure callback"; - } - } - }; - // onTwtSessionCreate callback - const auto& on_twt_session_create = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_session twt_session) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSession aidl_twt_session; - if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { - LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; - return; - } - - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionCreate(id, aidl_twt_session).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionCreate callback"; - } - } - }; - // onTwtSessionUpdate callback - const auto& on_twt_session_update = [weak_ptr_this](legacy_hal::wifi_request_id id, - legacy_hal::wifi_twt_session twt_session) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSession aidl_twt_session; - if (!aidl_struct_util::convertLegacyHalTwtSessionToAidl(twt_session, &aidl_twt_session)) { - LOG(ERROR) << "convertLegacyHalTwtSessionToAidl failed"; - return; - } - - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionUpdate(id, aidl_twt_session).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionUpdate callback"; - } - } - }; - // onTwtSessionTeardown callback - const auto& on_twt_session_teardown = - [weak_ptr_this](legacy_hal::wifi_request_id id, int session_id, - legacy_hal::wifi_twt_teardown_reason_code reason_code) { - const auto shared_ptr_this = weak_ptr_this.lock(); - IWifiStaIfaceEventCallback::TwtTeardownReasonCode aidl_reason_code = - aidl_struct_util::convertLegacyHalTwtReasonCodeToAidl(reason_code); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionTeardown(id, session_id, aidl_reason_code).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionTeardown callback"; - } - } - }; - // onTwtSessionStats callback - const auto& on_twt_session_stats = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id, - legacy_hal::wifi_twt_session_stats stats) { - const auto shared_ptr_this = weak_ptr_this.lock(); - TwtSessionStats aidl_session_stats; - if (!aidl_struct_util::convertLegacyHalTwtSessionStatsToAidl(stats, &aidl_session_stats)) { - LOG(ERROR) << "convertLegacyHalTwtSessionStatsToAidl failed"; - return; - } - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionStats(id, session_id, aidl_session_stats).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionStats callback"; - } - } - }; - // onTwtSessionSuspend callback - const auto& on_twt_session_suspend = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionSuspend(id, session_id).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionSuspend callback"; - } - } - }; - // onTwtSessionResume callback - const auto& on_twt_session_resume = [weak_ptr_this](legacy_hal::wifi_request_id id, - int session_id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onTwtSessionResume(id, session_id).isOk()) { - LOG(ERROR) << "Failed to invoke onTwtSessionResume callback"; - } - } - }; - - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->twtSessionSetup( - ifname_, cmdId, legacyHalTwtRequest, on_twt_failure, on_twt_session_create, - on_twt_session_update, on_twt_session_teardown, on_twt_session_stats, - on_twt_session_suspend, on_twt_session_resume); + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->twtSessionSetup(ifname_, cmdId, legacyHalTwtRequest); return createWifiStatusFromLegacyError(legacy_status); } diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index eb8f745475..5713928448 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -103,6 +103,7 @@ class WifiStaIface : public BnWifiStaIface { private: // Corresponding worker functions for the AIDL methods. std::pair getNameInternal(); + ndk::ScopedAStatus registerTwtEventCallbackInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& callback); std::pair getFeatureSetInternal(); @@ -157,6 +158,7 @@ class WifiStaIface : public BnWifiStaIface { std::weak_ptr weak_ptr_this_; bool is_valid_; aidl_callback_util::AidlCallbackHandler event_cb_handler_; + bool is_twt_registered_; DISALLOW_COPY_AND_ASSIGN(WifiStaIface); }; From 2f9f0b32e82d086e52f4d5768ea54b0c7eca020e Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 29 Feb 2024 22:33:09 -0800 Subject: [PATCH 019/161] Update HVAC_TEMPERATURE_SET/HVAC_TEMPERATURE_VALUE_SUGGESTION HAL docs Explain how to define the configArray and how to map fahrenheit values to celsius values. Mention standardizing the values suggested and the values defined by the configArray table. Bug: 313720524 Test: m Change-Id: I1ebd8223804a939968dfad1d8cb5a4de2d214946 --- ...ardware.automotive.vehicle-types-meta.json | 2 +- .../automotive/vehicle/VehicleProperty.aidl | 62 ++++++++++++++++--- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index c812326d2e..32788cb24a 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -277,7 +277,7 @@ "value": 358614274 }, { - "name": "HVAC, target temperature set.", + "name": "HVAC_TEMPERATURE_SET", "value": 358614275 }, { diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6f5c0c1aaf..a5ee9772a6 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -868,10 +868,18 @@ enum VehicleProperty { HVAC_TEMPERATURE_CURRENT = 0x0502 + 0x10000000 + 0x05000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:FLOAT /** - * HVAC, target temperature set. + * HVAC target temperature set in Celsius. + * + * The minFloatValue and maxFloatValue in VehicleAreaConfig must be defined. + * + * The minFloatValue indicates the minimum temperature setting in Celsius. + * The maxFloatValue indicates the maximum temperature setting in Celsius. + * + * If all the values between minFloatValue and maxFloatValue are not supported, the configArray + * can be used to list the valid temperature values that can be set. It also describes a lookup + * table to convert the temperature from Celsius to Fahrenheit and vice versa for this vehicle. + * The configArray must be defined if standard unit conversion is not supported on this vehicle. * - * The configArray is used to indicate the valid values for HVAC in Fahrenheit and Celsius. - * Android might use it in the HVAC app UI. * The configArray is set as follows: * configArray[0] = [the lower bound of the supported temperature in Celsius] * 10. * configArray[1] = [the upper bound of the supported temperature in Celsius] * 10. @@ -879,14 +887,35 @@ enum VehicleProperty { * configArray[3] = [the lower bound of the supported temperature in Fahrenheit] * 10. * configArray[4] = [the upper bound of the supported temperature in Fahrenheit] * 10. * configArray[5] = [the increment in Fahrenheit] * 10. + * + * The minFloatValue and maxFloatValue in VehicleAreaConfig must be equal to configArray[0] and + * configArray[1] respectively. + * * For example, if the vehicle supports temperature values as: * [16.0, 16.5, 17.0 ,..., 28.0] in Celsius - * [60.5, 61.5, 62.5 ,..., 85.5] in Fahrenheit. - * The configArray should be configArray = {160, 280, 5, 605, 825, 10}. + * [60.5, 61.5, 62.5 ,..., 84.5] in Fahrenheit + * The configArray should be configArray = {160, 280, 5, 605, 845, 10}. * - * If the vehicle supports HVAC_TEMPERATURE_VALUE_SUGGESTION, the application can use - * that property to get the suggested value before setting HVAC_TEMPERATURE_SET. Otherwise, - * the application may choose the value in HVAC_TEMPERATURE_SET configArray by itself. + * Ideally, the ratio of the Celsius increment to the Fahrenheit increment should be as close to + * the actual ratio of 1 degree Celsius to 1.8 degrees Fahrenheit. + * + * There must be a one to one mapping of all Celsius values to Fahrenheit values defined by the + * configArray. The configArray will be used by clients to convert this property's temperature + * from Celsius to Fahrenheit. Also, it will let clients know what Celsius value to set the + * property to achieve their desired Fahreneheit value for the system. If the ECU does not have + * a one to one mapping of all Celsius values to Fahrenheit values, then the config array should + * only define the list of Celsius and Fahrenheit values that do have a one to one mapping. + * + * For example, if the ECU supports Celsius values from 16 to 28 and Fahrenheit values from 60 + * to 85 both with an increment of 1, then one possible configArray would be {160, 280, 10, 600, + * 840, 20}. In this case, 85 would not be a supported temperature. + * + * Any value set in between a valid value should be rounded to the closest valid value. + * + * It is highly recommended that the OEM also implement the HVAC_TEMPERATURE_VALUE_SUGGESTION + * vehicle property because it provides applications a simple method for determining temperature + * values that can be set for this vehicle and for converting values between Celsius and + * Fahrenheit. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1295,7 +1324,22 @@ enum VehicleProperty { * * An application calls set(VehiclePropValue propValue) with the requested value and unit for * the value. OEMs need to return the suggested values in floatValues[2] and floatValues[3] by - * onPropertyEvent() callbacks. + * onPropertyEvent() callbacks. The suggested values must conform to the values that can be + * derived from the HVAC_TEMPERATURE_SET configArray. In other words, the suggested values and + * the table of values from the configArray should be the same. It is recommended for the OEM to + * add custom logic in their VHAL implementation in order to avoid making requests to the HVAC + * ECU. + * + * The logic can be as follows: + * For converting the temperature from celsius to fahrenheit use the following: + * // Given tempC and the configArray + * float minTempC = configArray[0] / 10.0; + * float temperatureIncrementCelsius = configArray[2] / 10.0; + * float minTempF = configArray[3] / 10.0; + * float temperatureIncrementFahrenheit = configArray[5] / 10.0; + * // Round to the closest increment + * int numIncrements = round((tempC - minTempC) / temperatureIncrementCelsius); + * tempF = temperatureIncrementFahrenheit * numIncrements + minTempF; * * For example, when a user uses the voice assistant to set HVAC temperature to 66.2 in * Fahrenheit. From 64d876d96e16185fcbd0d4f6193d556841c57684 Mon Sep 17 00:00:00 2001 From: Steve Pomeroy Date: Wed, 6 Mar 2024 16:15:35 +0000 Subject: [PATCH 020/161] Add VTS test for NFC observe mode Test: this is only a test; manual run on a device Bug: 305979303 326470047 Change-Id: Idf4953e942bb5db8c2ee72779dfdf80ed4e224b2 --- nfc/aidl/vts/functional/Android.bp | 42 ++++ nfc/aidl/vts/functional/CondVar.cpp | 129 ++++++++++ nfc/aidl/vts/functional/CondVar.h | 86 +++++++ nfc/aidl/vts/functional/SyncEvent.h | 143 +++++++++++ .../functional/VtsNfcBehaviorChangesTest.cpp | 223 ++++++++++++++++++ 5 files changed, 623 insertions(+) create mode 100644 nfc/aidl/vts/functional/CondVar.cpp create mode 100644 nfc/aidl/vts/functional/CondVar.h create mode 100644 nfc/aidl/vts/functional/SyncEvent.h create mode 100644 nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp diff --git a/nfc/aidl/vts/functional/Android.bp b/nfc/aidl/vts/functional/Android.bp index 0dab2d804f..fcaaf33ac4 100644 --- a/nfc/aidl/vts/functional/Android.bp +++ b/nfc/aidl/vts/functional/Android.bp @@ -45,3 +45,45 @@ cc_test { "vts", ], } + +cc_test { + name: "VtsNfcBehaviorChangesTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "VtsNfcBehaviorChangesTest.cpp", + "CondVar.cpp", + ], + include_dirs: [ + "system/nfc/src/gki/common", + "system/nfc/src/gki/ulinux", + "system/nfc/src/include", + "system/nfc/src/nfa/include", + "system/nfc/src/nfc/include", + "system/nfc/utils/include", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libnativehelper", + "libstatssocket", + ], + static_libs: [ + "android.hardware.nfc-V1-ndk", + "android.hardware.nfc@1.0", + "android.hardware.nfc@1.1", + "android.hardware.nfc@1.2", + "android_nfc_flags_aconfig_c_lib", + "libnfc-nci", + "libnfc-nci_flags", + "libnfcutils", + "libstatslog_nfc", + "server_configurable_flags", + ], + require_root: true, + test_suites: [ + "vts", + ], +} diff --git a/nfc/aidl/vts/functional/CondVar.cpp b/nfc/aidl/vts/functional/CondVar.cpp new file mode 100644 index 0000000000..59e5b51f2b --- /dev/null +++ b/nfc/aidl/vts/functional/CondVar.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2012 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. + */ + +/* + * Encapsulate a condition variable for thread synchronization. + */ + +#include "CondVar.h" + +#include +#include +#include +#include + +using android::base::StringPrintf; + +/******************************************************************************* +** +** Function: CondVar +** +** Description: Initialize member variables. +** +** Returns: None. +** +*******************************************************************************/ +CondVar::CondVar() { + pthread_condattr_t attr; + pthread_condattr_init(&attr); + pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); + memset(&mCondition, 0, sizeof(mCondition)); + int const res = pthread_cond_init(&mCondition, &attr); + if (res) { + LOG(ERROR) << StringPrintf("CondVar::CondVar: fail init; error=0x%X", res); + } +} + +/******************************************************************************* +** +** Function: ~CondVar +** +** Description: Cleanup all resources. +** +** Returns: None. +** +*******************************************************************************/ +CondVar::~CondVar() { + int const res = pthread_cond_destroy(&mCondition); + if (res) { + LOG(ERROR) << StringPrintf("CondVar::~CondVar: fail destroy; error=0x%X", res); + } +} + +/******************************************************************************* +** +** Function: wait +** +** Description: Block the caller and wait for a condition. +** +** Returns: None. +** +*******************************************************************************/ +void CondVar::wait(std::mutex& mutex) { + int const res = pthread_cond_wait(&mCondition, mutex.native_handle()); + if (res) { + LOG(ERROR) << StringPrintf("CondVar::wait: fail wait; error=0x%X", res); + } +} + +/******************************************************************************* +** +** Function: wait +** +** Description: Block the caller and wait for a condition. +** millisec: Timeout in milliseconds. +** +** Returns: True if wait is successful; false if timeout occurs. +** +*******************************************************************************/ +bool CondVar::wait(std::mutex& mutex, long millisec) { + bool retVal = false; + struct timespec absoluteTime; + + if (clock_gettime(CLOCK_MONOTONIC, &absoluteTime) == -1) { + LOG(ERROR) << StringPrintf("CondVar::wait: fail get time; errno=0x%X", errno); + } else { + absoluteTime.tv_sec += millisec / 1000; + long ns = absoluteTime.tv_nsec + ((millisec % 1000) * 1000000); + if (ns > 1000000000) { + absoluteTime.tv_sec++; + absoluteTime.tv_nsec = ns - 1000000000; + } else + absoluteTime.tv_nsec = ns; + } + + int waitResult = pthread_cond_timedwait(&mCondition, mutex.native_handle(), &absoluteTime); + if ((waitResult != 0) && (waitResult != ETIMEDOUT)) + LOG(ERROR) << StringPrintf("CondVar::wait: fail timed wait; error=0x%X", waitResult); + retVal = (waitResult == 0); // waited successfully + return retVal; +} + +/******************************************************************************* +** +** Function: notifyOne +** +** Description: Unblock the waiting thread. +** +** Returns: None. +** +*******************************************************************************/ +void CondVar::notifyOne() { + int const res = pthread_cond_signal(&mCondition); + if (res) { + LOG(ERROR) << StringPrintf("CondVar::notifyOne: fail signal; error=0x%X", res); + } +} diff --git a/nfc/aidl/vts/functional/CondVar.h b/nfc/aidl/vts/functional/CondVar.h new file mode 100644 index 0000000000..5e0dcf77b4 --- /dev/null +++ b/nfc/aidl/vts/functional/CondVar.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2012 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. + */ + +/* + * Encapsulate a condition variable for thread synchronization. + */ + +#pragma once +#include + +#include + +class CondVar { + public: + /******************************************************************************* + ** + ** Function: CondVar + ** + ** Description: Initialize member variables. + ** + ** Returns: None. + ** + *******************************************************************************/ + CondVar(); + + /******************************************************************************* + ** + ** Function: ~CondVar + ** + ** Description: Cleanup all resources. + ** + ** Returns: None. + ** + *******************************************************************************/ + ~CondVar(); + + /******************************************************************************* + ** + ** Function: wait + ** + ** Description: Block the caller and wait for a condition. + ** + ** Returns: None. + ** + *******************************************************************************/ + void wait(std::mutex& mutex); + + /******************************************************************************* + ** + ** Function: wait + ** + ** Description: Block the caller and wait for a condition. + ** millisec: Timeout in milliseconds. + ** + ** Returns: True if wait is successful; false if timeout occurs. + ** + *******************************************************************************/ + bool wait(std::mutex& mutex, long millisec); + + /******************************************************************************* + ** + ** Function: notifyOne + ** + ** Description: Unblock the waiting thread. + ** + ** Returns: None. + ** + *******************************************************************************/ + void notifyOne(); + + private: + pthread_cond_t mCondition; +}; diff --git a/nfc/aidl/vts/functional/SyncEvent.h b/nfc/aidl/vts/functional/SyncEvent.h new file mode 100644 index 0000000000..352a549aa1 --- /dev/null +++ b/nfc/aidl/vts/functional/SyncEvent.h @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2012 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. + */ + +/* + * Synchronize two or more threads using a condition variable and a mutex. + */ +#pragma once +#include + +#include "CondVar.h" + +class SyncEvent { + public: + /******************************************************************************* + ** + ** Function: ~SyncEvent + ** + ** Description: Cleanup all resources. + ** + ** Returns: None. + ** + *******************************************************************************/ + ~SyncEvent() {} + + /******************************************************************************* + ** + ** Function: start + ** + ** Description: Start a synchronization operation. + ** + ** Returns: None. + ** + *******************************************************************************/ + void start() { mMutex.lock(); } + + /******************************************************************************* + ** + ** Function: wait + ** + ** Description: Block the thread and wait for the event to occur. + ** + ** Returns: None. + ** + *******************************************************************************/ + void wait() { mCondVar.wait(mMutex); } + + /******************************************************************************* + ** + ** Function: wait + ** + ** Description: Block the thread and wait for the event to occur. + ** millisec: Timeout in milliseconds. + ** + ** Returns: True if wait is successful; false if timeout occurs. + ** + *******************************************************************************/ + bool wait(long millisec) { + bool retVal = mCondVar.wait(mMutex, millisec); + return retVal; + } + + /******************************************************************************* + ** + ** Function: notifyOne + ** + ** Description: Notify a blocked thread that the event has occurred. + *Unblocks it. + ** + ** Returns: None. + ** + *******************************************************************************/ + void notifyOne() { mCondVar.notifyOne(); } + + /******************************************************************************* + ** + ** Function: end + ** + ** Description: End a synchronization operation. + ** + ** Returns: None. + ** + *******************************************************************************/ + void end() { mMutex.unlock(); } + + private: + CondVar mCondVar; + std::mutex mMutex; +}; + +/*****************************************************************************/ +/*****************************************************************************/ + +/***************************************************************************** +** +** Name: SyncEventGuard +** +** Description: Automatically start and end a synchronization event. +** +*****************************************************************************/ +class SyncEventGuard { + public: + /******************************************************************************* + ** + ** Function: SyncEventGuard + ** + ** Description: Start a synchronization operation. + ** + ** Returns: None. + ** + *******************************************************************************/ + SyncEventGuard(SyncEvent& event) : mEvent(event) { + event.start(); // automatically start operation + }; + + /******************************************************************************* + ** + ** Function: ~SyncEventGuard + ** + ** Description: End a synchronization operation. + ** + ** Returns: None. + ** + *******************************************************************************/ + ~SyncEventGuard() { + mEvent.end(); // automatically end operation + }; + + private: + SyncEvent& mEvent; +}; diff --git a/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp b/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp new file mode 100644 index 0000000000..0b73cc991a --- /dev/null +++ b/nfc/aidl/vts/functional/VtsNfcBehaviorChangesTest.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2024 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 "nfc_behavior_changes_test" + +#include +#include +#include +#include + +#include +#include + +#include "NfcAdaptation.h" +#include "SyncEvent.h" +#include "nci_defs.h" +#include "nfa_api.h" +#include "nfa_ee_api.h" + +using android::base::StringPrintf; + +static SyncEvent sNfaEnableEvent; // event for NFA_Enable() +static SyncEvent sNfaVsCommand; // event for VS commands +static SyncEvent sNfaEnableDisablePollingEvent; +static SyncEvent sNfaPowerChangeEvent; +static bool sIsNfaEnabled; +static tNFA_STATUS sVSCmdStatus; + +static void nfaDeviceManagementCallback(uint8_t dmEvent, tNFA_DM_CBACK_DATA* eventData) { + LOG(DEBUG) << StringPrintf("%s: enter; event=0x%X", __func__, dmEvent); + + switch (dmEvent) { + case NFA_DM_ENABLE_EVT: /* Result of NFA_Enable */ + { + SyncEventGuard guard(sNfaEnableEvent); + LOG(DEBUG) << StringPrintf("%s: NFA_DM_ENABLE_EVT; status=0x%X", __func__, + eventData->status); + sIsNfaEnabled = eventData->status == NFA_STATUS_OK; + sNfaEnableEvent.notifyOne(); + } break; + + case NFA_DM_DISABLE_EVT: /* Result of NFA_Disable */ + { + SyncEventGuard guard(sNfaEnableEvent); + LOG(DEBUG) << StringPrintf("%s: NFA_DM_DISABLE_EVT; status=0x%X", __func__, + eventData->status); + sIsNfaEnabled = eventData->status == NFA_STATUS_OK; + sNfaEnableEvent.notifyOne(); + } break; + + case NFA_DM_PWR_MODE_CHANGE_EVT: { + SyncEventGuard guard(sNfaPowerChangeEvent); + LOG(DEBUG) << StringPrintf( + "%s: NFA_DM_PWR_MODE_CHANGE_EVT: status=0x%X, power_mode=0x%X", __func__, + eventData->status, eventData->power_mode.power_mode); + + sNfaPowerChangeEvent.notifyOne(); + + } break; + } +} + +static void nfaConnectionCallback(uint8_t connEvent, tNFA_CONN_EVT_DATA* eventData) { + LOG(DEBUG) << StringPrintf("%s: event= %u", __func__, connEvent); + + switch (connEvent) { + case NFA_LISTEN_DISABLED_EVT: { + SyncEventGuard guard(sNfaEnableDisablePollingEvent); + sNfaEnableDisablePollingEvent.notifyOne(); + } break; + + case NFA_LISTEN_ENABLED_EVT: { + SyncEventGuard guard(sNfaEnableDisablePollingEvent); + sNfaEnableDisablePollingEvent.notifyOne(); + } break; + + case NFA_RF_DISCOVERY_STARTED_EVT: // RF Discovery started + { + LOG(DEBUG) << StringPrintf("%s: NFA_RF_DISCOVERY_STARTED_EVT: status = %u", __func__, + eventData->status); + + SyncEventGuard guard(sNfaEnableDisablePollingEvent); + sNfaEnableDisablePollingEvent.notifyOne(); + } break; + + case NFA_RF_DISCOVERY_STOPPED_EVT: // RF Discovery stopped event + { + LOG(DEBUG) << StringPrintf("%s: NFA_RF_DISCOVERY_STOPPED_EVT: status = %u", __func__, + eventData->status); + + SyncEventGuard guard(sNfaEnableDisablePollingEvent); + sNfaEnableDisablePollingEvent.notifyOne(); + } break; + } +} + +void static nfaVSCallback(uint8_t event, uint16_t /* param_len */, uint8_t* p_param) { + switch (event & NCI_OID_MASK) { + case NCI_MSG_PROP_ANDROID: { + uint8_t android_sub_opcode = p_param[3]; + switch (android_sub_opcode) { + case NCI_ANDROID_PASSIVE_OBSERVE: { + sVSCmdStatus = p_param[4]; + LOG(INFO) << StringPrintf("Observe mode RSP: status: %x", sVSCmdStatus); + SyncEventGuard guard(sNfaVsCommand); + sNfaVsCommand.notifyOne(); + } break; + case NCI_ANDROID_POLLING_FRAME_NTF: { + // TODO + } break; + default: + LOG(WARNING) << StringPrintf("Unknown Android sub opcode %x", + android_sub_opcode); + } + } break; + default: + break; + } +} + +/* + * Enable passive observe mode. + */ +tNFA_STATUS static nfaObserveModeEnable(bool enable) { + tNFA_STATUS status = NFA_STATUS_FAILED; + + status = NFA_StopRfDiscovery(); + if (status == NFA_STATUS_OK) { + if (!sNfaEnableDisablePollingEvent.wait(1000)) { + LOG(WARNING) << "Timeout waiting to disable NFC RF discovery"; + return NFA_STATUS_TIMEOUT; + } + } + + uint8_t cmd[] = {(NCI_MT_CMD << NCI_MT_SHIFT) | NCI_GID_PROP, NCI_MSG_PROP_ANDROID, + NCI_ANDROID_PASSIVE_OBSERVE_PARAM_SIZE, NCI_ANDROID_PASSIVE_OBSERVE, + static_cast(enable ? NCI_ANDROID_PASSIVE_OBSERVE_PARAM_ENABLE + : NCI_ANDROID_PASSIVE_OBSERVE_PARAM_DISABLE)}; + + status = NFA_SendRawVsCommand(sizeof(cmd), cmd, nfaVSCallback); + + if (status == NFA_STATUS_OK) { + if (!sNfaVsCommand.wait(1000)) { + LOG(WARNING) << "Timeout waiting for NFA VS command response"; + return NFA_STATUS_TIMEOUT; + } + } + + return status; +} + +class NfcBehaviorChanges : public testing::Test { + protected: + void SetUp() override { + tNFA_STATUS status = NFA_STATUS_OK; + + sIsNfaEnabled = false; + sVSCmdStatus = NFA_STATUS_OK; + + NfcAdaptation& theInstance = NfcAdaptation::GetInstance(); + theInstance.Initialize(); // start GKI, NCI task, NFC task + + { + SyncEventGuard guard(sNfaEnableEvent); + tHAL_NFC_ENTRY* halFuncEntries = theInstance.GetHalEntryFuncs(); + + NFA_Init(halFuncEntries); + + status = NFA_Enable(nfaDeviceManagementCallback, nfaConnectionCallback); + ASSERT_EQ(status, NFA_STATUS_OK); + + // wait for NFA command to finish + ASSERT_TRUE(sNfaEnableEvent.wait(1000)) + << "Timeout waiting for NFA command on NFA_Enable"; + } + + ASSERT_TRUE(sIsNfaEnabled) << "Could not initialize NFC controller"; + + status = NFA_StartRfDiscovery(); + ASSERT_EQ(status, NFA_STATUS_OK); + ASSERT_TRUE(sNfaEnableDisablePollingEvent.wait(1000)) << "Timeout starting RF discovery"; + } +}; + +/* + * ObserveModeEnable: + * Attempts to enable observe mode. Does not test Observe Mode functionality, + * but simply verifies that the enable command responds successfully. + * + * @VsrTest = GMS-VSR-3.2.8-001 + */ +TEST_F(NfcBehaviorChanges, ObserveModeEnableDisable) { + tNFA_STATUS status = nfaObserveModeEnable(true); + ASSERT_EQ(status, NFA_STATUS_OK); + + status = nfaObserveModeEnable(false); + ASSERT_EQ(status, NFA_STATUS_OK); +} + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + ABinderProcess_startThreadPool(); + std::system("/system/bin/svc nfc disable"); /* Turn off NFC service */ + sleep(5); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + std::system("/system/bin/svc nfc enable"); /* Turn on NFC service */ + sleep(5); + return status; +} From 09639b93bab15552c94adebacd202974e1b284f2 Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Tue, 12 Mar 2024 16:53:54 +0900 Subject: [PATCH 021/161] Remove VNDK definition(s) As of VNDK deprecation, any libraries that defines vndk is no longer valid anymore. This change removes all VNDK definition(s) from modules which was VNDK. Any former VNDK-SP libraries will be marked as double-loadable, so it can keep be able to be referenced by LLNDK libraries. Bug: 328994089 Test: AOSP CF build succeeded Change-Id: Ic4f19113c1a25dc1fb60cdfbf9c0f2d8d7d09726 Ignore-AOSP-First: Merge conflict --- audio/common/2.0/Android.bp | 3 --- automotive/evs/aidl/Android.bp | 3 --- common/aidl/Android.bp | 5 +---- common/fmq/aidl/Android.bp | 5 +---- configstore/1.0/Android.bp | 3 --- configstore/1.1/Android.bp | 3 --- configstore/utils/Android.bp | 9 +++------ confirmationui/support/Android.bp | 3 --- graphics/allocator/2.0/Android.bp | 3 --- graphics/allocator/3.0/Android.bp | 3 --- graphics/allocator/4.0/Android.bp | 3 --- graphics/allocator/aidl/Android.bp | 8 +------- graphics/bufferqueue/1.0/Android.bp | 3 --- graphics/bufferqueue/2.0/Android.bp | 3 --- graphics/common/1.0/Android.bp | 4 ---- graphics/common/1.1/Android.bp | 4 ---- graphics/common/1.2/Android.bp | 4 ---- graphics/common/aidl/Android.bp | 5 +---- graphics/composer/aidl/Android.bp | 8 +------- graphics/mapper/2.0/Android.bp | 4 ---- graphics/mapper/2.1/Android.bp | 4 ---- graphics/mapper/3.0/Android.bp | 4 ---- graphics/mapper/4.0/Android.bp | 4 ---- media/1.0/Android.bp | 3 --- media/bufferpool/2.0/Android.bp | 3 --- media/omx/1.0/Android.bp | 3 --- memtrack/1.0/Android.bp | 3 --- memtrack/aidl/Android.bp | 3 --- renderscript/1.0/Android.bp | 4 ---- soundtrigger/2.0/Android.bp | 3 --- soundtrigger/2.0/default/Android.bp | 3 --- 31 files changed, 8 insertions(+), 115 deletions(-) diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp index 450e04f38d..679d6b0cc4 100644 --- a/audio/common/2.0/Android.bp +++ b/audio/common/2.0/Android.bp @@ -15,9 +15,6 @@ hidl_interface { root: "android.hardware", // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp index 3bfe8f3069..dfb15c6448 100644 --- a/automotive/evs/aidl/Android.bp +++ b/automotive/evs/aidl/Android.bp @@ -42,9 +42,6 @@ aidl_interface { enabled: false, }, ndk: { - vndk: { - enabled: false, - }, min_sdk_version: "29", }, }, diff --git a/common/aidl/Android.bp b/common/aidl/Android.bp index 1457b8a478..11de087557 100644 --- a/common/aidl/Android.bp +++ b/common/aidl/Android.bp @@ -11,10 +11,7 @@ aidl_interface { name: "android.hardware.common", host_supported: true, vendor_available: true, - vndk: { - enabled: true, - support_system_process: true, - }, + double_loadable: true, vndk_use_version: "2", srcs: [ "android/hardware/common/*.aidl", diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp index 6c37213005..17c11ab6c3 100644 --- a/common/fmq/aidl/Android.bp +++ b/common/fmq/aidl/Android.bp @@ -11,10 +11,7 @@ aidl_interface { name: "android.hardware.common.fmq", host_supported: true, vendor_available: true, - vndk: { - enabled: true, - support_system_process: true, - }, + double_loadable: true, srcs: [ "android/hardware/common/fmq/*.aidl", ], diff --git a/configstore/1.0/Android.bp b/configstore/1.0/Android.bp index 51fc44c2ca..ef781d26e0 100644 --- a/configstore/1.0/Android.bp +++ b/configstore/1.0/Android.bp @@ -12,9 +12,6 @@ package { hidl_interface { name: "android.hardware.configstore@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISurfaceFlingerConfigs.hal", diff --git a/configstore/1.1/Android.bp b/configstore/1.1/Android.bp index ec745dd2ba..c8c3f5e188 100644 --- a/configstore/1.1/Android.bp +++ b/configstore/1.1/Android.bp @@ -12,9 +12,6 @@ package { hidl_interface { name: "android.hardware.configstore@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISurfaceFlingerConfigs.hal", diff --git a/configstore/utils/Android.bp b/configstore/utils/Android.bp index 7ed3f68db2..b62f1bcba8 100644 --- a/configstore/utils/Android.bp +++ b/configstore/utils/Android.bp @@ -26,13 +26,10 @@ package { cc_library_shared { name: "android.hardware.configstore-utils", vendor_available: true, - vndk: { - enabled: true, - }, double_loadable: true, defaults: ["hidl_defaults"], - srcs: [ "ConfigStoreUtils.cpp" ], + srcs: ["ConfigStoreUtils.cpp"], export_include_dirs: ["include"], @@ -40,12 +37,12 @@ cc_library_shared { "android.hardware.configstore@1.0", "android.hardware.configstore@1.1", "libbase", - "libhidlbase" + "libhidlbase", ], export_shared_lib_headers: [ "android.hardware.configstore@1.0", "android.hardware.configstore@1.1", "libbase", - "libhidlbase" + "libhidlbase", ], } diff --git a/confirmationui/support/Android.bp b/confirmationui/support/Android.bp index 1200115fcb..67cc04b12a 100644 --- a/confirmationui/support/Android.bp +++ b/confirmationui/support/Android.bp @@ -27,9 +27,6 @@ cc_library { name: "android.hardware.confirmationui-support-lib", vendor_available: true, host_supported: true, - vndk: { - enabled: true, - }, srcs: [ "src/cbor.cpp", "src/confirmationui_utils.cpp", diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp index 36158e9eb8..5d3f883369 100644 --- a/graphics/allocator/2.0/Android.bp +++ b/graphics/allocator/2.0/Android.bp @@ -13,9 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.allocator@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IAllocator.hal", ], diff --git a/graphics/allocator/3.0/Android.bp b/graphics/allocator/3.0/Android.bp index 0100f6f336..767a79f84d 100644 --- a/graphics/allocator/3.0/Android.bp +++ b/graphics/allocator/3.0/Android.bp @@ -13,9 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.allocator@3.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IAllocator.hal", ], diff --git a/graphics/allocator/4.0/Android.bp b/graphics/allocator/4.0/Android.bp index 5d7a4a991a..590ecf4cf7 100644 --- a/graphics/allocator/4.0/Android.bp +++ b/graphics/allocator/4.0/Android.bp @@ -13,9 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.allocator@4.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IAllocator.hal", ], diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index 6e24edcab5..0b916bff18 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -11,10 +11,7 @@ package { aidl_interface { name: "android.hardware.graphics.allocator", vendor_available: true, - vndk: { - enabled: true, - support_system_process: true, - }, + double_loadable: true, vndk_use_version: "2", srcs: ["android/hardware/graphics/allocator/*.aidl"], imports: [ @@ -34,9 +31,6 @@ aidl_interface { "//apex_available:platform", "com.android.media.swcodec", ], - vndk: { - enabled: true, - }, min_sdk_version: "29", }, }, diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp index fe46b5e4a8..c7c64536d1 100644 --- a/graphics/bufferqueue/1.0/Android.bp +++ b/graphics/bufferqueue/1.0/Android.bp @@ -13,9 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.bufferqueue@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IGraphicBufferProducer.hal", "IProducerListener.hal", diff --git a/graphics/bufferqueue/2.0/Android.bp b/graphics/bufferqueue/2.0/Android.bp index c2b0985efd..e9f75c18b9 100644 --- a/graphics/bufferqueue/2.0/Android.bp +++ b/graphics/bufferqueue/2.0/Android.bp @@ -13,9 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.bufferqueue@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IGraphicBufferProducer.hal", diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp index 786953b4ce..b876bf30c7 100644 --- a/graphics/common/1.0/Android.bp +++ b/graphics/common/1.0/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.common@1.0", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", ], diff --git a/graphics/common/1.1/Android.bp b/graphics/common/1.1/Android.bp index d857f8007e..ff6c9b7aa0 100644 --- a/graphics/common/1.1/Android.bp +++ b/graphics/common/1.1/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.common@1.1", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", ], diff --git a/graphics/common/1.2/Android.bp b/graphics/common/1.2/Android.bp index 17d0c205c1..b4663e5ea5 100644 --- a/graphics/common/1.2/Android.bp +++ b/graphics/common/1.2/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.common@1.2", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", ], diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index 570f735e1e..33d0938a92 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -12,10 +12,7 @@ aidl_interface { name: "android.hardware.graphics.common", host_supported: true, vendor_available: true, - vndk: { - enabled: true, - support_system_process: true, - }, + double_loadable: true, vndk_use_version: "5", srcs: [ "android/hardware/graphics/common/*.aidl", diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp index 87ecb16a2f..fad70d840c 100644 --- a/graphics/composer/aidl/Android.bp +++ b/graphics/composer/aidl/Android.bp @@ -28,10 +28,7 @@ aidl_interface { name: "android.hardware.graphics.composer3", host_supported: true, vendor_available: true, - vndk: { - enabled: true, - support_system_process: true, - }, + double_loadable: true, frozen: true, vndk_use_version: "1", srcs: [ @@ -51,9 +48,6 @@ aidl_interface { enabled: false, }, ndk: { - vndk: { - enabled: true, - }, }, rust: { enabled: true, diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp index 81040ab5b0..07ca1cb838 100644 --- a/graphics/mapper/2.0/Android.bp +++ b/graphics/mapper/2.0/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.mapper@2.0", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", "IMapper.hal", diff --git a/graphics/mapper/2.1/Android.bp b/graphics/mapper/2.1/Android.bp index 1308a6cb67..f6e089a37d 100644 --- a/graphics/mapper/2.1/Android.bp +++ b/graphics/mapper/2.1/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.mapper@2.1", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "IMapper.hal", ], diff --git a/graphics/mapper/3.0/Android.bp b/graphics/mapper/3.0/Android.bp index b49806f9ed..0e15af95aa 100644 --- a/graphics/mapper/3.0/Android.bp +++ b/graphics/mapper/3.0/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.mapper@3.0", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", "IMapper.hal", diff --git a/graphics/mapper/4.0/Android.bp b/graphics/mapper/4.0/Android.bp index c07f73c51a..b2dd7d29fb 100644 --- a/graphics/mapper/4.0/Android.bp +++ b/graphics/mapper/4.0/Android.bp @@ -13,10 +13,6 @@ package { hidl_interface { name: "android.hardware.graphics.mapper@4.0", root: "android.hardware", - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", "IMapper.hal", diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp index 22a6d59f6f..d5ef95a73b 100644 --- a/media/1.0/Android.bp +++ b/media/1.0/Android.bp @@ -12,9 +12,6 @@ package { hidl_interface { name: "android.hardware.media@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/media/bufferpool/2.0/Android.bp b/media/bufferpool/2.0/Android.bp index fd6f08b199..470a11f6c3 100644 --- a/media/bufferpool/2.0/Android.bp +++ b/media/bufferpool/2.0/Android.bp @@ -13,9 +13,6 @@ package { hidl_interface { name: "android.hardware.media.bufferpool@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAccessor.hal", diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp index ea6346758d..cd1b9b6631 100644 --- a/media/omx/1.0/Android.bp +++ b/media/omx/1.0/Android.bp @@ -12,9 +12,6 @@ package { hidl_interface { name: "android.hardware.media.omx@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IGraphicBufferSource.hal", diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp index bf8db3f6f4..1aeec594ec 100644 --- a/memtrack/1.0/Android.bp +++ b/memtrack/1.0/Android.bp @@ -12,9 +12,6 @@ package { hidl_interface { name: "android.hardware.memtrack@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IMemtrack.hal", diff --git a/memtrack/aidl/Android.bp b/memtrack/aidl/Android.bp index 0d1c241093..4973d1e7e9 100644 --- a/memtrack/aidl/Android.bp +++ b/memtrack/aidl/Android.bp @@ -34,9 +34,6 @@ aidl_interface { enabled: false, }, ndk: { - vndk: { - enabled: true, - }, }, }, frozen: true, diff --git a/renderscript/1.0/Android.bp b/renderscript/1.0/Android.bp index 1f2ac15f8f..c69914110b 100644 --- a/renderscript/1.0/Android.bp +++ b/renderscript/1.0/Android.bp @@ -14,10 +14,6 @@ hidl_interface { root: "android.hardware", // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, - vndk: { - enabled: true, - support_system_process: true, - }, srcs: [ "types.hal", "IContext.hal", diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp index 996105cc8f..828b9ecfc4 100644 --- a/soundtrigger/2.0/Android.bp +++ b/soundtrigger/2.0/Android.bp @@ -12,9 +12,6 @@ package { hidl_interface { name: "android.hardware.soundtrigger@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISoundTriggerHw.hal", diff --git a/soundtrigger/2.0/default/Android.bp b/soundtrigger/2.0/default/Android.bp index 8236e3012e..2cbf0416f0 100644 --- a/soundtrigger/2.0/default/Android.bp +++ b/soundtrigger/2.0/default/Android.bp @@ -26,9 +26,6 @@ cc_library_shared { name: "android.hardware.soundtrigger@2.0-core", defaults: ["hidl_defaults"], vendor_available: true, - vndk: { - enabled: true, - }, srcs: [ "SoundTriggerHalImpl.cpp", ], From dcfc3db66b7da8f5b562c06b39b496752d75c033 Mon Sep 17 00:00:00 2001 From: Felix Obenhuber Date: Thu, 15 Feb 2024 09:56:08 +0100 Subject: [PATCH 022/161] Add RustDerive to VHAL parcelables. This is not considered an interface change so we update V2 and V3 version as well so that AOSP partners may use it. I manually generate the hash code for V2 and V3 interface using: system/tools/aidl/build/hash_gen.sh hardware/interfaces/automotive\ /vehicle/aidl/aidl_api/android.hardware.automotive.vehicle 2 \ /tmp/hash.2 and system/tools/aidl/build/hash_gen.sh hardware/interfaces/automotive\ /vehicle/aidl/aidl_api/android.hardware.automotive.vehicle 2 1 \ /tmp/hash.3 and append the hash to thehash file under V2 and V3 interface. Test: Presubmit Bug: 329283602 Change-Id: I889c0d51f2c2633908231dd39c9ea5259de36667 --- .../aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash | 1 + .../2/android/hardware/automotive/vehicle/GetValueRequest.aidl | 2 +- .../2/android/hardware/automotive/vehicle/GetValueResult.aidl | 2 +- .../2/android/hardware/automotive/vehicle/RawPropValues.aidl | 2 +- .../2/android/hardware/automotive/vehicle/SetValueRequest.aidl | 2 +- .../2/android/hardware/automotive/vehicle/SetValueResult.aidl | 2 +- .../2/android/hardware/automotive/vehicle/SubscribeOptions.aidl | 2 +- .../android/hardware/automotive/vehicle/VehicleAreaConfig.aidl | 2 +- .../android/hardware/automotive/vehicle/VehiclePropConfig.aidl | 2 +- .../2/android/hardware/automotive/vehicle/VehiclePropError.aidl | 2 +- .../2/android/hardware/automotive/vehicle/VehiclePropValue.aidl | 2 +- .../aidl/aidl_api/android.hardware.automotive.vehicle/3/.hash | 1 + .../3/android/hardware/automotive/vehicle/GetValueRequest.aidl | 2 +- .../3/android/hardware/automotive/vehicle/GetValueResult.aidl | 2 +- .../3/android/hardware/automotive/vehicle/RawPropValues.aidl | 2 +- .../3/android/hardware/automotive/vehicle/SetValueRequest.aidl | 2 +- .../3/android/hardware/automotive/vehicle/SetValueResult.aidl | 2 +- .../3/android/hardware/automotive/vehicle/SubscribeOptions.aidl | 2 +- .../android/hardware/automotive/vehicle/VehicleAreaConfig.aidl | 2 +- .../android/hardware/automotive/vehicle/VehiclePropConfig.aidl | 2 +- .../3/android/hardware/automotive/vehicle/VehiclePropError.aidl | 2 +- .../3/android/hardware/automotive/vehicle/VehiclePropValue.aidl | 2 +- .../android/hardware/automotive/vehicle/GetValueRequest.aidl | 2 +- .../android/hardware/automotive/vehicle/GetValueResult.aidl | 2 +- .../android/hardware/automotive/vehicle/RawPropValues.aidl | 2 +- .../android/hardware/automotive/vehicle/SetValueRequest.aidl | 2 +- .../android/hardware/automotive/vehicle/SetValueResult.aidl | 2 +- .../android/hardware/automotive/vehicle/SubscribeOptions.aidl | 2 +- .../android/hardware/automotive/vehicle/VehicleAreaConfig.aidl | 2 +- .../android/hardware/automotive/vehicle/VehiclePropConfig.aidl | 2 +- .../android/hardware/automotive/vehicle/VehiclePropError.aidl | 2 +- .../android/hardware/automotive/vehicle/VehiclePropValue.aidl | 2 +- .../android/hardware/automotive/vehicle/GetValueRequest.aidl | 1 + .../android/hardware/automotive/vehicle/GetValueResult.aidl | 1 + .../aidl/android/hardware/automotive/vehicle/RawPropValues.aidl | 1 + .../android/hardware/automotive/vehicle/SetValueRequest.aidl | 1 + .../android/hardware/automotive/vehicle/SetValueResult.aidl | 1 + .../android/hardware/automotive/vehicle/SubscribeOptions.aidl | 1 + .../android/hardware/automotive/vehicle/VehicleAreaConfig.aidl | 1 + .../android/hardware/automotive/vehicle/VehiclePropConfig.aidl | 1 + .../android/hardware/automotive/vehicle/VehiclePropError.aidl | 1 + .../android/hardware/automotive/vehicle/VehiclePropValue.aidl | 1 + 42 files changed, 42 insertions(+), 30 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash index b04a6b5bbd..aae94d19a8 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash @@ -1 +1,2 @@ a741c2814ba6e9852e106bc26e820d741f66ebb8 +2e101035a8abf667295ca2106bebb8850b9bdc9c diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl index d88cd8b076..15a2024d78 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable GetValueRequest { long requestId; android.hardware.automotive.vehicle.VehiclePropValue prop; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl index 25f3575862..a8e0ac8862 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable GetValueResult { long requestId; android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl index e7b0a137cf..80e81b2a00 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable RawPropValues { int[] int32Values = {}; float[] floatValues; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl index 6a65307f3c..9b392f5d97 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SetValueRequest { long requestId; android.hardware.automotive.vehicle.VehiclePropValue value; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl index ec5fabb0b4..57aa11fe19 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SetValueResult { long requestId; android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 91e7c1499a..1f89a019b7 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SubscribeOptions { int propId; int[] areaIds; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 6960894f13..c8887d9a1d 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehicleAreaConfig { int areaId; int minInt32Value; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index 8602d2d03d..32dac44618 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropConfig { int prop; android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl index 983529542f..9d49f1db29 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropError { int propId; int areaId; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl index c87379fd9b..f9feff5f67 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropValue { long timestamp; int areaId; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/.hash b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/.hash index 312f8580ed..ce35dbbffd 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/.hash +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/.hash @@ -1 +1,2 @@ c6f1cc74f83dc53c6a5c08e6dbbb6e25e83e3a6b +c046ced69d333e4470cd211e2159cce84faae233 diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueRequest.aidl index d88cd8b076..15a2024d78 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueRequest.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable GetValueRequest { long requestId; android.hardware.automotive.vehicle.VehiclePropValue prop; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueResult.aidl index 25f3575862..a8e0ac8862 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueResult.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable GetValueResult { long requestId; android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/RawPropValues.aidl index e7b0a137cf..80e81b2a00 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/RawPropValues.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable RawPropValues { int[] int32Values = {}; float[] floatValues; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueRequest.aidl index 6a65307f3c..9b392f5d97 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueRequest.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SetValueRequest { long requestId; android.hardware.automotive.vehicle.VehiclePropValue value; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueResult.aidl index ec5fabb0b4..57aa11fe19 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueResult.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SetValueResult { long requestId; android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 1b1696b240..3e19edecaf 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SubscribeOptions { int propId; int[] areaIds; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 08d4ee46e8..eb3028e23e 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehicleAreaConfig { int areaId; int minInt32Value; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index 8602d2d03d..32dac44618 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropConfig { int prop; android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropError.aidl index 983529542f..9d49f1db29 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropError.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropError { int propId; int areaId; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropValue.aidl index c87379fd9b..f9feff5f67 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropValue.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/3/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropValue { long timestamp; int areaId; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl index d88cd8b076..15a2024d78 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable GetValueRequest { long requestId; android.hardware.automotive.vehicle.VehiclePropValue prop; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl index 25f3575862..a8e0ac8862 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable GetValueResult { long requestId; android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl index e7b0a137cf..80e81b2a00 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable RawPropValues { int[] int32Values = {}; float[] floatValues; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl index 6a65307f3c..9b392f5d97 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SetValueRequest { long requestId; android.hardware.automotive.vehicle.VehiclePropValue value; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl index ec5fabb0b4..57aa11fe19 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SetValueResult { long requestId; android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 1b1696b240..3e19edecaf 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable SubscribeOptions { int propId; int[] areaIds; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 08d4ee46e8..eb3028e23e 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehicleAreaConfig { int areaId; int minInt32Value; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index 8602d2d03d..32dac44618 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropConfig { int prop; android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl index 983529542f..9d49f1db29 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropError { int propId; int areaId; diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl index c87379fd9b..f9feff5f67 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@JavaDerive(equals=true, toString=true) @VintfStability +@JavaDerive(equals=true, toString=true) @RustDerive(Clone=true) @VintfStability parcelable VehiclePropValue { long timestamp; int areaId; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl index e5b3929178..1989b3e925 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.VehiclePropValue; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable GetValueRequest { // A unique request ID. For every client, the request ID must start with 1 // and monotonically increase for every SetValueRequest. If it hits diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl index 24c57579dd..208c882d9f 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -21,6 +21,7 @@ import android.hardware.automotive.vehicle.VehiclePropValue; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable GetValueResult { // The ID for the request this response is for. long requestId; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl index 28ccc1da01..032882dd88 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -18,6 +18,7 @@ package android.hardware.automotive.vehicle; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable RawPropValues { /** * This is used for properties of types VehiclePropertyType#INT32, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl index 625f9010e7..c8d413d5b3 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.VehiclePropValue; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable SetValueRequest { // A unique request ID. For every client, the request ID must start with 1 // and monotonically increase for every SetValueRequest. If it hits diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl index b3feeaa1e1..673f812f6c 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.StatusCode; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable SetValueResult { // The ID for the request this response is for. long requestId; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl index 14469b547f..decd859ba5 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -21,6 +21,7 @@ package android.hardware.automotive.vehicle; */ @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable SubscribeOptions { /** Property to subscribe */ int propId; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 96c4a74528..726d4191b9 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.VehiclePropertyAccess; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable VehicleAreaConfig { /** * Area id is always 0 for VehicleArea#GLOBAL properties. diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index c629b821a7..31096219f4 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -22,6 +22,7 @@ import android.hardware.automotive.vehicle.VehiclePropertyChangeMode; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable VehiclePropConfig { /** Property identifier */ int prop; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl index 2c31c72802..7c38b91282 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -20,6 +20,7 @@ import android.hardware.automotive.vehicle.StatusCode; @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable VehiclePropError { // Property ID. int propId; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl index 289f2701af..c78c6358c0 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -26,6 +26,7 @@ import android.hardware.automotive.vehicle.VehiclePropertyStatus; */ @VintfStability @JavaDerive(equals=true, toString=true) +@RustDerive(Clone=true) parcelable VehiclePropValue { /** Time is elapsed nanoseconds since boot */ long timestamp; From 297faa483f840a16b96d129cad616f4eda0513ad Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 4 Mar 2024 21:23:04 +0000 Subject: [PATCH 023/161] Effect Aidl: skipping reopen test for unsupported audio hal Bug: 327678656 Bug: 328009824 Test: atest VtsHalAudioEffectTargetTest Change-Id: I25a27c780253f84f771148b5c30be57f35dbf39c Merged-In: I25a27c780253f84f771148b5c30be57f35dbf39c --- audio/aidl/vts/EffectFactoryHelper.h | 11 +++++++++++ audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h index 7100431dc5..cc29f5e2af 100644 --- a/audio/aidl/vts/EffectFactoryHelper.h +++ b/audio/aidl/vts/EffectFactoryHelper.h @@ -23,6 +23,7 @@ #include #include +#include #include "AudioHalBinderServiceUtil.h" #include "TestUtils.h" @@ -74,6 +75,16 @@ class EffectFactoryHelper { return result; } + static int getHalVersion(const std::shared_ptr& factory) { + int version = 0; + return (factory && factory->getInterfaceVersion(&version).isOk()) ? version : 0; + } + + static bool isReopenSupported(const std::shared_ptr& factory) { + return EffectFactoryHelper::getHalVersion(factory) >= + aidl::android::hardware::audio::effect::kReopenSupportedVersion; + } + private: std::shared_ptr mEffectFactory; std::string mServiceName; diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp index 547982523e..4693f102cb 100644 --- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp @@ -42,6 +42,7 @@ using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::Flags; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; +using aidl::android::hardware::audio::effect::kReopenSupportedVersion; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioDeviceDescription; @@ -613,6 +614,10 @@ TEST_P(AudioEffectTest, SetAndGetParameterVolume) { * verify reopen sequence. */ TEST_P(AudioEffectDataPathTest, SetCommonParameterAndReopen) { + if (!EffectFactoryHelper::isReopenSupported(mFactory)) { + GTEST_SKIP() << "Skipping test as effect does not support reopen"; + } + ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor)); Parameter::Common common = EffectHelper::createParamCommon( @@ -732,6 +737,10 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataAfterRestart) { // Send data to effects and expect it to be consumed after effect reopen (IO AudioConfig change). // Effects exposing bypass flags or operating in offload mode will be skipped. TEST_P(AudioEffectDataPathTest, ConsumeDataAfterReopen) { + if (!EffectFactoryHelper::isReopenSupported(mFactory)) { + GTEST_SKIP() << "Skipping test as effect does not support reopen"; + } + ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor)); Parameter::Common common = EffectHelper::createParamCommon( From 9f79875faa27ab42a3dacc52bd823dca3191ddcc Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 4 Mar 2024 23:25:36 +0000 Subject: [PATCH 024/161] Effect Aidl: make EffectFactoryHelper methods static only Bug: 327678656 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I57d924d19f38257e32dba95d4de0ca00532c5ab4 Merged-In: I57d924d19f38257e32dba95d4de0ca00532c5ab4 --- audio/aidl/vts/EffectFactoryHelper.h | 20 ------------------ .../VtsHalAudioEffectFactoryTargetTest.cpp | 21 ++++++++++--------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h index cc29f5e2af..54b82d3705 100644 --- a/audio/aidl/vts/EffectFactoryHelper.h +++ b/audio/aidl/vts/EffectFactoryHelper.h @@ -36,21 +36,6 @@ using aidl::android::media::audio::common::AudioUuid; class EffectFactoryHelper { public: - explicit EffectFactoryHelper(const std::string& name) : mServiceName(name) {} - - void ConnectToFactoryService() { - mEffectFactory = IFactory::fromBinder(binderUtil.connectToService(mServiceName)); - ASSERT_NE(mEffectFactory, nullptr); - } - - void RestartFactoryService() { - ASSERT_NE(mEffectFactory, nullptr); - mEffectFactory = IFactory::fromBinder(binderUtil.restartService()); - ASSERT_NE(mEffectFactory, nullptr); - } - - std::shared_ptr GetFactory() const { return mEffectFactory; } - static std::vector, Descriptor>> getAllEffectDescriptors( std::string serviceName, std::optional type = std::nullopt) { AudioHalBinderServiceUtil util; @@ -84,9 +69,4 @@ class EffectFactoryHelper { return EffectFactoryHelper::getHalVersion(factory) >= aidl::android::hardware::audio::effect::kReopenSupportedVersion; } - - private: - std::shared_ptr mEffectFactory; - std::string mServiceName; - AudioHalBinderServiceUtil binderUtil; }; diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp index 4e86ec3e13..21df163c5c 100644 --- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -56,10 +56,7 @@ using android::hardware::audio::common::testing::detail::TestExecutionTracer; /// Effect factory testing. class EffectFactoryTest : public testing::TestWithParam { public: - void SetUp() override { - mFactoryHelper = std::make_unique(GetParam()); - connectAndGetFactory(); - } + void SetUp() override { connectAndGetFactory(); } void TearDown() override { for (auto& effect : mEffects) { @@ -68,13 +65,14 @@ class EffectFactoryTest : public testing::TestWithParam { } } - std::unique_ptr mFactoryHelper; + std::string kServiceName = GetParam(); std::shared_ptr mEffectFactory; std::vector> mEffects; const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()}; const Descriptor::Identity kZeroId = {.uuid = getEffectUuidZero()}; const Descriptor kNullDesc = {.common.id = kNullId}; const Descriptor kZeroDesc = {.common.id = kZeroId}; + AudioHalBinderServiceUtil mBinderUtil; template void ForEachId(const std::vector ids, Functor functor) { @@ -117,8 +115,7 @@ class EffectFactoryTest : public testing::TestWithParam { } } void connectAndGetFactory() { - ASSERT_NO_FATAL_FAILURE(mFactoryHelper->ConnectToFactoryService()); - mEffectFactory = mFactoryHelper->GetFactory(); + mEffectFactory = IFactory::fromBinder(mBinderUtil.connectToService(kServiceName)); ASSERT_NE(mEffectFactory, nullptr); } }; @@ -128,7 +125,9 @@ TEST_P(EffectFactoryTest, SetupAndTearDown) { } TEST_P(EffectFactoryTest, CanBeRestarted) { - ASSERT_NO_FATAL_FAILURE(mFactoryHelper->RestartFactoryService()); + ASSERT_NE(mEffectFactory, nullptr); + mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); + ASSERT_NE(mEffectFactory, nullptr); } /** @@ -250,7 +249,8 @@ TEST_P(EffectFactoryTest, CreateDestroyWithRestart) { EXPECT_NE(descs.size(), 0UL); creatAndDestroyDescs(descs); - mFactoryHelper->RestartFactoryService(); + mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); + ASSERT_NE(mEffectFactory, nullptr); connectAndGetFactory(); creatAndDestroyDescs(descs); @@ -263,7 +263,8 @@ TEST_P(EffectFactoryTest, EffectInvalidAfterRestart) { EXPECT_NE(descs.size(), 0UL); std::vector> effects = createWithDescs(descs); - ASSERT_NO_FATAL_FAILURE(mFactoryHelper->RestartFactoryService()); + mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); + ASSERT_NE(mEffectFactory, nullptr); connectAndGetFactory(); destroyEffects(effects, EX_ILLEGAL_ARGUMENT); From c43c4558a0bf0189d12bfbc48888a4ef63021b90 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 13 Mar 2024 22:21:57 +0000 Subject: [PATCH 025/161] minor improvements for VtsHalAudioEffectFactoryTargetTest Bug: 327678656 Test: atest VtsHalAudioEffectFactoryTargetTest Change-Id: I95f19d20883142cd500c552966bd8f02256a1be5 --- .../vts/VtsHalAudioEffectFactoryTargetTest.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp index 21df163c5c..a19aa56ef1 100644 --- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -65,7 +65,7 @@ class EffectFactoryTest : public testing::TestWithParam { } } - std::string kServiceName = GetParam(); + const std::string kServiceName = GetParam(); std::shared_ptr mEffectFactory; std::vector> mEffects; const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()}; @@ -118,6 +118,10 @@ class EffectFactoryTest : public testing::TestWithParam { mEffectFactory = IFactory::fromBinder(mBinderUtil.connectToService(kServiceName)); ASSERT_NE(mEffectFactory, nullptr); } + void restartAndGetFactory() { + mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); + ASSERT_NE(mEffectFactory, nullptr); + } }; TEST_P(EffectFactoryTest, SetupAndTearDown) { @@ -126,8 +130,7 @@ TEST_P(EffectFactoryTest, SetupAndTearDown) { TEST_P(EffectFactoryTest, CanBeRestarted) { ASSERT_NE(mEffectFactory, nullptr); - mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); - ASSERT_NE(mEffectFactory, nullptr); + restartAndGetFactory(); } /** @@ -249,9 +252,7 @@ TEST_P(EffectFactoryTest, CreateDestroyWithRestart) { EXPECT_NE(descs.size(), 0UL); creatAndDestroyDescs(descs); - mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); - ASSERT_NE(mEffectFactory, nullptr); - + restartAndGetFactory(); connectAndGetFactory(); creatAndDestroyDescs(descs); } @@ -263,9 +264,7 @@ TEST_P(EffectFactoryTest, EffectInvalidAfterRestart) { EXPECT_NE(descs.size(), 0UL); std::vector> effects = createWithDescs(descs); - mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); - ASSERT_NE(mEffectFactory, nullptr); - + restartAndGetFactory(); connectAndGetFactory(); destroyEffects(effects, EX_ILLEGAL_ARGUMENT); } From 02beb9b9c1f1af1ac0e6f11119dcbab57c72855c Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 29 Feb 2024 18:38:35 +0000 Subject: [PATCH 026/161] Specify FUEL_* properties don't apply to electric vehicles in HAL docs Bug: 316924644 Bug: 316926630 Bug: 316941652 Test: presubmit Change-Id: Ic838e3e480d71dcab720bab2d1de493e8b7a205a --- ...ardware.automotive.vehicle-types-meta.json | 2 +- .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index c812326d2e..c33cf1b203 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -124,7 +124,7 @@ "value": 290521862 }, { - "name": "FUEL_LEVEL", + "name": "Fuel level in milliliters", "value": 291504903 }, { diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6f5c0c1aaf..0d9bba17d9 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -142,6 +142,11 @@ enum VehicleProperty { /** * Fuel door location * + * This property must communicate the location of the fuel door on the vehicle. This property + * does not apply to electric vehicles. That is, if INFO_FUEL_TYPE only contains + * FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, implement + * INFO_EV_PORT_LOCATION or INFO_MULTI_EV_PORT_LOCATIONS. + * * @change_mode VehiclePropertyChangeMode.STATIC * @data_enum PortLocationType * @access VehiclePropertyAccess.READ @@ -350,9 +355,14 @@ enum VehicleProperty { WHEEL_TICK = 0x0306 + 0x10000000 + 0x01000000 + 0x00510000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64_VEC /** - * Fuel remaining in the vehicle, in milliliters + * Fuel level in milliliters * - * Value may not exceed INFO_FUEL_CAPACITY + * This property must communicate the current amount of fuel remaining in the vehicle in + * milliliters. This property does not apply to electric vehicles. That is, if INFO_FUEL_TYPE + * only contains FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, + * implement EV_BATTERY_LEVEL. + * + * Value may not exceed INFO_FUEL_CAPACITY. * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ @@ -364,6 +374,11 @@ enum VehicleProperty { /** * Fuel door open * + * This property must communicate whether the fuel door on the vehicle is open or not. This + * property does not apply to electric vehicles. That is, if INFO_FUEL_TYPE only contains + * FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, implement + * EV_CHARGE_PORT_OPEN. + * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. * From f0cb5ec61f757edefe0a63dade94a774712077bd Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 14 Mar 2024 01:54:58 +0000 Subject: [PATCH 027/161] Effect AIDL VTS: skip data path testing for offloading effects Bug: 328330990 Test: atest VtsHalBassBoostTargetTest Test: atest VtsHalDownmixTargetTest Test: atest VtsHalLoudnessEnhancerTargetTest Test: atest VtsHalVolumeTargetTest Change-Id: Ic720e74cf25f5282dfa52dca354a5eccf9071f61 --- audio/aidl/vts/TestUtils.h | 12 +++++++----- audio/aidl/vts/VtsHalBassBoostTargetTest.cpp | 6 +++++- audio/aidl/vts/VtsHalDownmixTargetTest.cpp | 6 +++++- audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp | 6 +++++- audio/aidl/vts/VtsHalVolumeTargetTest.cpp | 10 ++++++++-- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h index 515b8a2a2f..0a5addc84c 100644 --- a/audio/aidl/vts/TestUtils.h +++ b/audio/aidl/vts/TestUtils.h @@ -104,11 +104,13 @@ inline ::testing::AssertionResult assertResultOrUnknownTransaction( EXPECT_PRED_FORMAT2(::android::hardware::audio::common::testing::detail::assertResult, \ expected, ret) -#define SKIP_TEST_IF_DATA_UNSUPPORTED(flags) \ - ({ \ - if ((flags).hwAcceleratorMode == Flags::HardwareAccelerator::TUNNEL || (flags).bypass) { \ - GTEST_SKIP() << "Skip data path for offload"; \ - } \ +#define SKIP_TEST_IF_DATA_UNSUPPORTED(flags) \ + ({ \ + if ((flags).hwAcceleratorMode == \ + aidl::android::hardware::audio::effect::Flags::HardwareAccelerator::TUNNEL || \ + (flags).bypass) { \ + GTEST_SKIP() << "Skip data path for offload"; \ + } \ }) // Test that the transaction status 'isOk' if it is a known transaction diff --git a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp index b54b44233f..4cb1f496d4 100644 --- a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp +++ b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp @@ -166,6 +166,7 @@ class BassBoostDataTest : public ::testing::TestWithParamgetInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) { @@ -173,7 +174,10 @@ class BassBoostDataTest : public ::testing::TestWithParam& testFrequencies, diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp index 360bf2671f..ef77f4d51e 100644 --- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp +++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp @@ -230,6 +230,7 @@ class DownmixFoldDataTest : public ::testing::TestWithParamgetInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) { @@ -241,7 +242,10 @@ class DownmixFoldDataTest : public ::testing::TestWithParam(mOpenEffectReturn.outputDataMQ); } - void TearDown() override { TearDownLoudnessEnhancer(); } + void TearDown() override { + SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags); + TearDownLoudnessEnhancer(); + } // Fill inputBuffer with random values between -kMaxAudioSample to kMaxAudioSample void generateInputBuffer() { diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp index 059d6ab984..1c1489deb5 100644 --- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp @@ -163,8 +163,14 @@ class VolumeDataTest : public ::testing::TestWithParam, // Convert Decibel value to Percentage int percentageDb(float level) { return std::round((1 - (pow(10, level / 20))) * 100); } - void SetUp() override { ASSERT_NO_FATAL_FAILURE(SetUpVolumeControl()); } - void TearDown() override { TearDownVolumeControl(); } + void SetUp() override { + SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags); + ASSERT_NO_FATAL_FAILURE(SetUpVolumeControl()); + } + void TearDown() override { + SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags); + TearDownVolumeControl(); + } static constexpr int kMaxAudioSample = 1; static constexpr int kTransitionDuration = 300; From 9a657502da7a5cb83d82c038587b7b4671dfc43e Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 14 Mar 2024 20:10:54 +0000 Subject: [PATCH 028/161] Added documentation to ENV_OUTSIDE_TEMPERATURE on multi sensor readings Bug: 316927617 Test: presubmit Change-Id: I4d2d0d8b554d1ecaeaee985d4b519f51767a80d7 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6f5c0c1aaf..fe97c0992c 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1557,6 +1557,11 @@ enum VehicleProperty { /** * Outside temperature * + * This property must communicate the temperature reading of the environment outside the + * vehicle. If there are multiple sensors for measuring the outside temperature, this property + * should be populated with the mean or a meaningful weighted average of the readings that will + * best represent the temperature of the outside environment. + * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit.CELSIUS From 5e2c3fe16653cf485414936a1e6b2876551bba0e Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 14 Mar 2024 16:43:14 -0400 Subject: [PATCH 029/161] Provide better documentation for CommandErrors Some HWC implementations which do not support DISPLAY_DECORATION are handling DISPLAY_DECORATION layers in VTS by reporting an error (as required by the test) AND by proposing ChangedCompositionTypes. The latter is unnecessary, as SF will never read the changed types. Update the documentation to be more specific that this is unnecessary. Bug: b/324977561 Bug: b/329119344 Bug: b/329017438 Bug: b/327322951 Bug: b/327090469 Test: GraphicsComposerAidlCommandTest#DisplayDecoration Change-Id: I09c90e40818dc43b968c3e79e61e8b13a13e6344 --- .../hardware/graphics/composer3/CommandResultPayload.aidl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl index 106fd87ebd..99c91aa32e 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -28,6 +28,10 @@ import android.hardware.graphics.composer3.ReleaseFences; union CommandResultPayload { /** * Indicates an error generated by a command. + * + * If there is an error from a command, the composer should only respond + * with the CommandError, and not with other results + * (e.g. ChangedCompositionTypes). */ CommandError error; From c6e1808b4b3678ee153132bd612da7f1cc80e48a Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 14 Mar 2024 20:59:44 +0000 Subject: [PATCH 030/161] Fixed _EV_BATTERY_CAPACITY property HAL docs to specify usable capacity Bug: 316940310 Test: presubmit Change-Id: I1b2f04e2c8882b22fefb7cf2bf1431e109dcdfe8 --- .../automotive/vehicle/VehicleProperty.aidl | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6f5c0c1aaf..358d7107bd 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -115,12 +115,13 @@ enum VehicleProperty { INFO_FUEL_TYPE = 0x0105 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC /** - * Nominal battery capacity for EV or hybrid vehicle + * Nominal usable battery capacity for EV or hybrid vehicle * - * Returns the nominal battery capacity, if EV or hybrid. This is the battery capacity when the - * vehicle is new. This value might be different from EV_CURRENT_BATTERY_CAPACITY because - * EV_CURRENT_BATTERY_CAPACITY returns the real-time battery capacity taking into account - * factors such as battery aging and temperature dependency. + * Returns the nominal battery capacity, if EV or hybrid. This is the total usable battery + * capacity when the vehicle is new. This value might be different from + * EV_CURRENT_BATTERY_CAPACITY because EV_CURRENT_BATTERY_CAPACITY returns the real-time usable + * battery capacity taking into account factors such as battery aging and temperature + * dependency. * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ @@ -389,12 +390,13 @@ enum VehicleProperty { EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT /** - * Current battery capacity for EV or hybrid vehicle + * Current usable battery capacity for EV or hybrid vehicle * * Returns the actual value of battery capacity, if EV or hybrid. This property captures the - * real-time battery capacity taking into account factors such as battery aging and temperature - * dependency. Therefore, this value might be different from INFO_EV_BATTERY_CAPACITY because - * INFO_EV_BATTERY_CAPACITY returns the nominal battery capacity from when the vehicle was new. + * real-time usable battery capacity taking into account factors such as battery aging and + * temperature dependency. Therefore, this value might be different from + * INFO_EV_BATTERY_CAPACITY because INFO_EV_BATTERY_CAPACITY returns the nominal battery + * capacity from when the vehicle was new. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ From 37484fc7f7b0ff7cd455e7b257b8da7e9cb458b1 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 14 Mar 2024 18:49:20 +0000 Subject: [PATCH 031/161] Specify additional FUEL_* properties don't apply to EVs in HAL docs Bug: 329678281 Test: atest CarPropertyManagerTest Change-Id: I940f55f6d656fc1fc12694a04a6e8f58e0a159f7 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 245baeb076..d9c4c13289 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -87,6 +87,11 @@ enum VehicleProperty { /** * Fuel capacity of the vehicle in milliliters * + * This property must communicate the maximum amount of the fuel that can be stored in the + * vehicle in milliliters. This property does not apply to electric vehicles. That is, if + * INFO_FUEL_TYPE only contains FuelType::FUEL_TYPE_ELECTRIC, this property must not be + * implemented. For EVs, implement INFO_EV_BATTERY_CAPACITY. + * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit.MILLILITER From dd43b56f56bb88270d3b32be19c52eae7c4efd84 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 14 Mar 2024 22:04:02 +0000 Subject: [PATCH 032/161] Audio effect aidl log reduce and level adjust Bug: 329334917 Test: atest AudioEffectTest Test: atest CtsMediaAudioTestCases Test: atest CtsEffectTestCases Test: audio use cases on pixel AIDL audio hal Change-Id: I49876924b230f2ac834d3b0e494a03b814c4bb6e --- audio/aidl/default/EffectConfig.cpp | 16 +++++----- audio/aidl/default/EffectContext.cpp | 4 +-- audio/aidl/default/EffectFactory.cpp | 31 +++++++++---------- audio/aidl/default/EffectImpl.cpp | 17 ++++------ audio/aidl/default/EffectThread.cpp | 15 +++------ .../include/effect-impl/EffectThread.h | 4 +-- 6 files changed, 35 insertions(+), 52 deletions(-) diff --git a/audio/aidl/default/EffectConfig.cpp b/audio/aidl/default/EffectConfig.cpp index a1fbefa8b9..eb0c0150e1 100644 --- a/audio/aidl/default/EffectConfig.cpp +++ b/audio/aidl/default/EffectConfig.cpp @@ -37,7 +37,6 @@ namespace aidl::android::hardware::audio::effect { EffectConfig::EffectConfig(const std::string& file) { tinyxml2::XMLDocument doc; doc.LoadFile(file.c_str()); - LOG(DEBUG) << __func__ << " loading " << file; // parse the xml file into maps if (doc.Error()) { LOG(ERROR) << __func__ << " tinyxml2 failed to load " << file @@ -143,7 +142,7 @@ bool EffectConfig::parseEffect(const tinyxml2::XMLElement& xml) { std::string name = xml.Attribute("name"); RETURN_VALUE_IF(name == "", false, "effectsNoName"); - LOG(DEBUG) << __func__ << dump(xml); + LOG(VERBOSE) << __func__ << dump(xml); struct Library library; if (std::strcmp(xml.Name(), "effectProxy") == 0) { // proxy lib and uuid @@ -187,11 +186,11 @@ bool EffectConfig::parseLibrary(const tinyxml2::XMLElement& xml, struct Library& } RETURN_VALUE_IF((library.uuid == getEffectUuidZero()), false, "invalidUuidAttribute"); - LOG(DEBUG) << __func__ << (isProxy ? " proxy " : library.name) << " : uuid " - << ::android::audio::utils::toString(library.uuid) - << (library.type.has_value() - ? ::android::audio::utils::toString(library.type.value()) - : ""); + LOG(VERBOSE) << __func__ << (isProxy ? " proxy " : library.name) << " : uuid " + << ::android::audio::utils::toString(library.uuid) + << (library.type.has_value() + ? ::android::audio::utils::toString(library.type.value()) + : ""); return true; } @@ -245,7 +244,7 @@ std::optional EffectConfig::stringToProcessingType(Processing: } bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2::XMLElement& xml) { - LOG(DEBUG) << __func__ << dump(xml); + LOG(VERBOSE) << __func__ << dump(xml); const char* typeStr = xml.Attribute("type"); auto aidlType = stringToProcessingType(typeTag, typeStr); RETURN_VALUE_IF(!aidlType.has_value(), false, "illegalStreamType"); @@ -259,7 +258,6 @@ bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2 } RETURN_VALUE_IF(!name, false, "noEffectAttribute"); mProcessingMap[aidlType.value()].emplace_back(mEffectsMap[name]); - LOG(WARNING) << __func__ << " " << typeStr << " : " << name; } return true; } diff --git a/audio/aidl/default/EffectContext.cpp b/audio/aidl/default/EffectContext.cpp index 9575790644..7b8cfb13ae 100644 --- a/audio/aidl/default/EffectContext.cpp +++ b/audio/aidl/default/EffectContext.cpp @@ -157,7 +157,6 @@ Parameter::VolumeStereo EffectContext::getVolumeStereo() { } RetCode EffectContext::setCommon(const Parameter::Common& common) { - LOG(VERBOSE) << __func__ << common.toString(); auto& input = common.input; auto& output = common.output; @@ -186,7 +185,6 @@ RetCode EffectContext::setCommon(const Parameter::Common& common) { } Parameter::Common EffectContext::getCommon() { - LOG(VERBOSE) << __func__ << mCommon.toString(); return mCommon; } @@ -241,7 +239,7 @@ RetCode EffectContext::notifyDataMqUpdate() { LOG(ERROR) << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } - LOG(DEBUG) << __func__ << " : signal client for reopen"; + LOG(VERBOSE) << __func__ << " : signal client for reopen"; return RetCode::SUCCESS; } } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp index 96f13ba058..ba5b14163d 100644 --- a/audio/aidl/default/EffectFactory.cpp +++ b/audio/aidl/default/EffectFactory.cpp @@ -43,12 +43,12 @@ Factory::Factory(const std::string& file) : mConfig(EffectConfig(file)) { Factory::~Factory() { if (auto count = mEffectMap.size()) { - LOG(ERROR) << __func__ << " remaining " << count - << " effect instances not destroyed indicating resource leak!"; + LOG(WARNING) << __func__ << " remaining " << count + << " effect instances not destroyed indicating resource leak!"; for (const auto& it : mEffectMap) { if (auto spEffect = it.first.lock()) { - LOG(ERROR) << __func__ << " erase remaining instance UUID " - << ::android::audio::utils::toString(it.second.first); + LOG(WARNING) << __func__ << " erase remaining instance UUID " + << ::android::audio::utils::toString(it.second.first); destroyEffectImpl_l(spEffect); } } @@ -139,7 +139,7 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, std::shared_ptr effectSp; RETURN_IF_BINDER_EXCEPTION(libInterface->createEffectFunc(&in_impl_uuid, &effectSp)); if (!effectSp) { - LOG(ERROR) << __func__ << ": library created null instance without return error!"; + LOG(WARNING) << __func__ << ": library created null instance without return error!"; return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED); } *_aidl_return = effectSp; @@ -147,7 +147,6 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, AIBinder_setMinSchedulerPolicy(effectBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); mEffectMap[std::weak_ptr(effectSp)] = std::make_pair(in_impl_uuid, std::move(effectBinder)); - LOG(DEBUG) << __func__ << ": instance " << effectSp.get() << " created successfully"; return ndk::ScopedAStatus::ok(); } else { LOG(ERROR) << __func__ << ": library doesn't exist"; @@ -192,7 +191,6 @@ void Factory::cleanupEffectMap_l() { } ndk::ScopedAStatus Factory::destroyEffect(const std::shared_ptr& in_handle) { - LOG(DEBUG) << __func__ << ": instance " << in_handle.get(); std::lock_guard lg(mMutex); ndk::ScopedAStatus status = destroyEffectImpl_l(in_handle); // always do the cleanup @@ -215,8 +213,8 @@ bool Factory::openEffectLibrary(const AudioUuid& impl, return false; } - LOG(INFO) << __func__ << " dlopen lib:" << path - << "\nimpl:" << ::android::audio::utils::toString(impl) << "\nhandle:" << libHandle; + LOG(DEBUG) << __func__ << " dlopen lib: " << path + << "\nimpl:" << ::android::audio::utils::toString(impl) << "\nhandle:" << libHandle; auto interface = new effect_dl_interface_s{nullptr, nullptr, nullptr}; mEffectLibMap.insert( {impl, @@ -235,11 +233,12 @@ void Factory::createIdentityWithConfig( id.type = typeUuid; id.uuid = configLib.uuid; id.proxy = proxyUuid; - LOG(DEBUG) << __func__ << " loading lib " << path->second << ": typeUuid " - << ::android::audio::utils::toString(id.type) << "\nimplUuid " - << ::android::audio::utils::toString(id.uuid) << " proxyUuid " - << (proxyUuid.has_value() ? ::android::audio::utils::toString(proxyUuid.value()) - : "null"); + LOG(WARNING) << __func__ << " loading lib " << path->second << ": typeUuid " + << ::android::audio::utils::toString(id.type) << "\nimplUuid " + << ::android::audio::utils::toString(id.uuid) << " proxyUuid " + << (proxyUuid.has_value() + ? ::android::audio::utils::toString(proxyUuid.value()) + : "null"); if (openEffectLibrary(id.uuid, path->second)) { mIdentitySet.insert(std::move(id)); } @@ -263,8 +262,8 @@ void Factory::loadEffectLibs() { createIdentityWithConfig(configLib, type, proxyUuid); } } else { - LOG(ERROR) << __func__ << ": can not find type UUID for effect " << configEffects.first - << " skipping!"; + LOG(WARNING) << __func__ << ": can not find type UUID for effect " + << configEffects.first << " skipping!"; } } } diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp index 4d7b9809c6..03de74f43c 100644 --- a/audio/aidl/default/EffectImpl.cpp +++ b/audio/aidl/default/EffectImpl.cpp @@ -35,7 +35,6 @@ extern "C" binder_exception_t destroyEffect(const std::shared_ptr& inst << " in state: " << toString(state) << ", status: " << status.getDescription(); return EX_ILLEGAL_STATE; } - LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed"; return EX_NONE; } @@ -91,7 +90,7 @@ ndk::ScopedAStatus EffectImpl::close() { } RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, - "notifyEventFlagFailed"); + "notifyEventFlagNotEmptyFailed"); // stop the worker thread, ignore the return code RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION, "FailedToDestroyWorker"); @@ -231,8 +230,6 @@ ndk::ScopedAStatus EffectImpl::getState(State* state) NO_THREAD_SAFETY_ANALYSIS ndk::ScopedAStatus EffectImpl::command(CommandId command) { std::lock_guard lg(mImplMutex); RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "instanceNotOpen"); - LOG(DEBUG) << getEffectName() << __func__ << ": receive command: " << toString(command) - << " at state " << toString(mState); switch (command) { case CommandId::START: @@ -240,7 +237,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); mState = State::PROCESSING; RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, - "notifyEventFlagFailed"); + "notifyEventFlagNotEmptyFailed"); startThread(); break; case CommandId::STOP: @@ -248,7 +245,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_OK_IF(mState == State::IDLE); mState = State::IDLE; RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, - "notifyEventFlagFailed"); + "notifyEventFlagNotEmptyFailed"); stopThread(); RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); break; @@ -257,7 +254,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "CommandIdNotSupported"); } - LOG(DEBUG) << getEffectName() << __func__ << " transfer to state: " << toString(mState); + LOG(VERBOSE) << getEffectName() << __func__ << " transfer to state: " << toString(mState); return ndk::ScopedAStatus::ok(); } @@ -294,6 +291,7 @@ RetCode EffectImpl::notifyEventFlag(uint32_t flag) { LOG(ERROR) << getEffectName() << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } + LOG(VERBOSE) << getEffectName() << __func__ << ": " << std::hex << mEventFlag; return RetCode::SUCCESS; } @@ -306,7 +304,7 @@ IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size } void EffectImpl::process() { - ATRACE_CALL(); + ATRACE_NAME(getEffectName().c_str()); /** * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * in the life cycle of workerThread (threadLoop). @@ -344,8 +342,6 @@ void EffectImpl::process() { IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples); outputMQ->write(buffer, status.fmqProduced); statusMQ->writeBlocking(&status, 1); - LOG(VERBOSE) << getEffectName() << __func__ << ": done processing, effect consumed " - << status.fmqConsumed << " produced " << status.fmqProduced; } } } @@ -355,7 +351,6 @@ IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int samples for (int i = 0; i < samples; i++) { *out++ = *in++; } - LOG(VERBOSE) << getEffectName() << __func__ << " done processing " << samples << " samples"; return {STATUS_OK, samples, samples}; } diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp index fdd48034e8..b5153859e1 100644 --- a/audio/aidl/default/EffectThread.cpp +++ b/audio/aidl/default/EffectThread.cpp @@ -27,13 +27,8 @@ namespace aidl::android::hardware::audio::effect { -EffectThread::EffectThread() { - LOG(DEBUG) << __func__; -} - EffectThread::~EffectThread() { destroyThread(); - LOG(DEBUG) << __func__ << " done"; } RetCode EffectThread::createThread(const std::string& name, int priority) { @@ -51,7 +46,7 @@ RetCode EffectThread::createThread(const std::string& name, int priority) { } mThread = std::thread(&EffectThread::threadLoop, this); - LOG(DEBUG) << mName << __func__ << " priority " << mPriority << " done"; + LOG(VERBOSE) << mName << __func__ << " priority " << mPriority << " done"; return RetCode::SUCCESS; } @@ -66,7 +61,7 @@ RetCode EffectThread::destroyThread() { mThread.join(); } - LOG(DEBUG) << mName << __func__; + LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } @@ -77,7 +72,7 @@ RetCode EffectThread::startThread() { mCv.notify_one(); } - LOG(DEBUG) << mName << __func__; + LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } @@ -88,7 +83,7 @@ RetCode EffectThread::stopThread() { mCv.notify_one(); } - LOG(DEBUG) << mName << __func__; + LOG(VERBOSE) << mName << __func__; return RetCode::SUCCESS; } @@ -101,7 +96,7 @@ void EffectThread::threadLoop() { ::android::base::ScopedLockAssertion lock_assertion(mThreadMutex); mCv.wait(l, [&]() REQUIRES(mThreadMutex) { return mExit || !mStop; }); if (mExit) { - LOG(INFO) << __func__ << " EXIT!"; + LOG(VERBOSE) << mName << " threadLoop EXIT!"; return; } } diff --git a/audio/aidl/default/include/effect-impl/EffectThread.h b/audio/aidl/default/include/effect-impl/EffectThread.h index 3dbb0e6798..ec2a65834b 100644 --- a/audio/aidl/default/include/effect-impl/EffectThread.h +++ b/audio/aidl/default/include/effect-impl/EffectThread.h @@ -31,11 +31,9 @@ namespace aidl::android::hardware::audio::effect { class EffectThread { public: - // default priority is same as HIDL: ANDROID_PRIORITY_URGENT_AUDIO - EffectThread(); virtual ~EffectThread(); - // called by effect implementation. + // called by effect implementation RetCode createThread(const std::string& name, int priority = ANDROID_PRIORITY_URGENT_AUDIO); RetCode destroyThread(); RetCode startThread(); From 1ea74efef427e2bdf008a179f87634759e477325 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 15 Mar 2024 00:43:43 +0000 Subject: [PATCH 033/161] Fixed PHEV expansion in INFO_FUEL_TYPE HAL docs Bug: 316942280 Test: presubmit Change-Id: Ie1b8f7ea2bbfb9904e0ac09d2611201cf7d1f330 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 245baeb076..80060eca18 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -102,7 +102,7 @@ enum VehicleProperty { * An FHEV (Fully Hybrid Electric Vehicle) must not include FuelType::FUEL_TYPE_ELECTRIC in * INFO_FUEL_TYPE's INT32_VEC value. So INFO_FUEL_TYPE can be populated as such: * int32Values = { FuelType::FUEL_TYPE_UNLEADED } - * On the other hand, a PHEV (Partially Hybrid Electric Vehicle) is plug in rechargeable, and + * On the other hand, a PHEV (Plug-in Hybrid Electric Vehicle) is plug in rechargeable, and * hence should include FuelType::FUEL_TYPE_ELECTRIC in INFO_FUEL_TYPE's INT32_VEC value. So * INFO_FUEL_TYPE can be populated as such: * int32Values = { FuelType::FUEL_TYPE_UNLEADED, FuelType::FUEL_TYPE_ELECTRIC } From 3d9c1b8d2a3dd753d8f9a1da487e86d866aac7ca Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 15 Mar 2024 01:33:44 +0000 Subject: [PATCH 034/161] Updated _STEERING_ANGLE properties HAL docs with steering wheel info Bug: 316947825 Bug: 316948592 Test: presubmit Change-Id: I0b63bcc112f32a627b50c28126ae4b6882c5597d --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 245baeb076..6f4c607f94 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -254,6 +254,10 @@ enum VehicleProperty { * * Angle is in degrees. Left is negative. * + * This property is independent of the angle of the steering wheel. This property must + * communicate the angle of the front wheels with respect to the vehicle, not the angle of the + * steering wheel. + * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit.DEGREES @@ -266,6 +270,10 @@ enum VehicleProperty { * * Angle is in degrees. Left is negative. * + * This property is independent of the angle of the steering wheel. This property must + * communicate the angle of the rear wheels with respect to the vehicle, not the angle of the + * steering wheel. + * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit.DEGREES From 8191575b6717e99d00b247c6a21b29cda7eb3a52 Mon Sep 17 00:00:00 2001 From: jimmyshiu Date: Fri, 15 Mar 2024 16:37:19 +0000 Subject: [PATCH 035/161] VTSHalPowerTarget: check if HintSession supported Igore HintSession testcases while HintSession isn't supported. Test: atest Power/PowerAidl Bug: 322112957 Change-Id: Ia1161aeafcd541745e7e0da1bd4c1781dc535460 --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 40 +++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 53fcef1a41..67efa7a90e 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -122,10 +122,16 @@ class PowerAidl : public testing::TestWithParam { power = IPower::fromBinder(ndk::SpAIBinder(binder)); auto status = power->getInterfaceVersion(&mServiceVersion); ASSERT_TRUE(status.isOk()); + if (mServiceVersion >= 2) { + status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &mSession); + mSessionSupport = status.isOk(); + } } std::shared_ptr power; int32_t mServiceVersion; + std::shared_ptr mSession; + bool mSessionSupport = false; }; class HintSessionAidl : public PowerAidl { @@ -135,12 +141,11 @@ class HintSessionAidl : public PowerAidl { if (mServiceVersion < 2) { GTEST_SKIP() << "DEVICE not launching with Power V2 and beyond."; } - - auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &mSession); - ASSERT_TRUE(status.isOk()); + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_NE(nullptr, mSession); } - std::shared_ptr mSession; }; class FMQAidl : public PowerAidl { @@ -239,6 +244,9 @@ TEST_P(PowerAidl, isBoostSupported) { } TEST_P(PowerAidl, getHintSessionPreferredRate) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 2) { GTEST_SKIP() << "DEVICE not launching with Power V2 and beyond."; } @@ -250,6 +258,9 @@ TEST_P(PowerAidl, getHintSessionPreferredRate) { } TEST_P(PowerAidl, createHintSessionWithConfig) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 5) { GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; } @@ -271,6 +282,9 @@ TEST_P(PowerAidl, hasFixedPerformance) { } TEST_P(HintSessionAidl, createAndCloseHintSession) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_TRUE(mSession->pause().isOk()); ASSERT_TRUE(mSession->resume().isOk()); // Test normal destroy operation @@ -279,6 +293,9 @@ TEST_P(HintSessionAidl, createAndCloseHintSession) { } TEST_P(HintSessionAidl, createHintSessionFailed) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } std::shared_ptr session; auto status = power->createHintSession(getpid(), getuid(), kEmptyTids, 16666666L, &session); @@ -288,11 +305,17 @@ TEST_P(HintSessionAidl, createHintSessionFailed) { } TEST_P(HintSessionAidl, updateAndReportDurations) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_TRUE(mSession->updateTargetWorkDuration(16666667LL).isOk()); ASSERT_TRUE(mSession->reportActualWorkDuration(kDurations).isOk()); } TEST_P(HintSessionAidl, sendSessionHint) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 4) { GTEST_SKIP() << "DEVICE not launching with Power V4 and beyond."; } @@ -306,6 +329,9 @@ TEST_P(HintSessionAidl, sendSessionHint) { } TEST_P(HintSessionAidl, setThreads) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 4) { GTEST_SKIP() << "DEVICE not launching with Power V4 and beyond."; } @@ -318,6 +344,9 @@ TEST_P(HintSessionAidl, setThreads) { } TEST_P(HintSessionAidl, setSessionMode) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 5) { GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; } @@ -333,6 +362,9 @@ TEST_P(HintSessionAidl, setSessionMode) { } TEST_P(HintSessionAidl, getSessionConfig) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 5) { GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; } From df81c964dfb17513bc2d4977228713f8f8f05e1d Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 6 Mar 2024 10:58:17 -0500 Subject: [PATCH 036/161] Added Fingerprint Virtual HAL AIDL extension Bug: 326227403 Test: atest android.hardware.biometrics.fingerprint.* -c Change-Id: I967c009c99f8dc279f89c21a59cf0462d9590296 --- biometrics/common/config/Config.cpp | 24 +- .../common/config/include/config/Config.h | 27 ++ biometrics/common/config/tests/ConfigTest.cpp | 23 +- biometrics/fingerprint/aidl/Android.bp | 2 +- .../biometrics/fingerprint/IVirtualHal.aidl | 68 ++++ .../biometrics/fingerprint/IVirtualHal.aidl | 300 ++++++++++++++++++ .../fingerprint/aidl/default/Android.bp | 49 ++- .../fingerprint/aidl/default/Fingerprint.cpp | 17 +- .../fingerprint/aidl/default/VirtualHal.cpp | 275 ++++++++++++++++ .../aidl/default/fingerprint-example.xml | 2 +- .../aidl/default/include/Fingerprint.h | 4 +- .../aidl/default/include/VirtualHal.h | 73 +++++ biometrics/fingerprint/aidl/default/main.cpp | 21 +- .../aidl/default/tests/VirtualHalTest.cpp | 232 ++++++++++++++ .../compatibility_matrix.202504.xml | 2 +- 15 files changed, 1078 insertions(+), 41 deletions(-) create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl create mode 100644 biometrics/fingerprint/aidl/default/VirtualHal.cpp create mode 100644 biometrics/fingerprint/aidl/default/include/VirtualHal.h create mode 100644 biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp diff --git a/biometrics/common/config/Config.cpp b/biometrics/common/config/Config.cpp index 01ae86461d..a13bdf0941 100644 --- a/biometrics/common/config/Config.cpp +++ b/biometrics/common/config/Config.cpp @@ -34,7 +34,7 @@ ConfigValue Config::parseBool(const std::string& value) { else if (value == "false") res.emplace(false); else - LOG(ERROR) << "ERROR: invalid bool " << value; + LOG(FATAL) << "ERROR: invalid bool " << value; return res; } @@ -48,7 +48,11 @@ ConfigValue Config::parseInt32(const std::string& value) { OptInt32 res; if (!value.empty()) { std::int32_t val; - if (ParseInt(value, &val)) res.emplace(val); + if (ParseInt(value, &val)) { + res.emplace(val); + } else { + LOG(FATAL) << "ERROR: Could not parse " << value << " as Int32"; + } } return res; } @@ -59,6 +63,8 @@ ConfigValue Config::parseInt64(const std::string& value) { std::int64_t val = std::strtoull(value.c_str(), nullptr, 10); if (val != 0LL or (val == 0LL && value == "0")) { res.emplace(val); + } else { + LOG(FATAL) << "ERROR: Could not parse " << value << " as Int64"; } } return res; @@ -87,7 +93,7 @@ void Config::init() { bool Config::setParam(const std::string& name, const std::string& value) { auto it = mMap.find(name); if (it == mMap.end()) { - LOG(ERROR) << "ERROR: setParam unknown config name " << name; + LOG(FATAL) << "ERROR: setParam unknown config name " << name; return false; } LOG(INFO) << "setParam name=" << name << "=" << value; @@ -102,7 +108,7 @@ bool Config::setParam(const std::string& name, const std::string& value) { ConfigValue Config::getInternal(const std::string& name) { ConfigValue res; - auto data = mMap[name]; + auto& data = mMap[name]; switch (mSource) { case ConfigSourceType::SOURCE_SYSPROP: res = data.getter(); @@ -111,10 +117,10 @@ ConfigValue Config::getInternal(const std::string& name) { res = data.value; break; case ConfigSourceType::SOURCE_FILE: - LOG(WARNING) << "Unsupported"; + UNIMPLEMENTED(ERROR) << " File-based config is not supported yet"; break; default: - LOG(ERROR) << " wrong srouce type " << (int)mSource; + LOG(FATAL) << "Wrong srouce type " << (int)mSource; break; } @@ -127,7 +133,7 @@ ConfigValue Config::getDefault(const std::string& name) { bool Config::setInternal(const std::string& name, const ConfigValue& val) { bool res = false; - auto data = mMap[name]; + auto& data = mMap[name]; switch (mSource) { case ConfigSourceType::SOURCE_SYSPROP: @@ -138,10 +144,10 @@ bool Config::setInternal(const std::string& name, const ConfigValue& val) { res = true; break; case ConfigSourceType::SOURCE_FILE: - LOG(WARNING) << "Unsupported"; + UNIMPLEMENTED(ERROR) << " File-based config is not supported yet"; break; default: - LOG(ERROR) << " wrong srouce type " << (int)mSource; + LOG(FATAL) << "Wrong srouce type " << (int)mSource; break; } diff --git a/biometrics/common/config/include/config/Config.h b/biometrics/common/config/include/config/Config.h index 864e16465f..0367832f7d 100644 --- a/biometrics/common/config/include/config/Config.h +++ b/biometrics/common/config/include/config/Config.h @@ -84,6 +84,33 @@ class Config { virtual Config::Data* getConfigData(int* size) = 0; bool setParam(const std::string& name, const std::string& value); + void sourcedFromAidl() { mSource = ConfigSourceType::SOURCE_AIDL; } + std::string toString(const ConfigValue& v) const { + std::ostringstream os; + if (std::holds_alternative(v)) { + OptInt32 ov = std::get(v); + if (ov.has_value()) os << ov.value(); + } else if (std::holds_alternative(v)) { + OptInt64 ov = std::get(v); + if (ov.has_value()) os << ov.value(); + } else if (std::holds_alternative(v)) { + OptBool ov = std::get(v); + if (ov.has_value()) os << ov.value(); + os << std::get(v).value(); + } else if (std::holds_alternative(v)) { + for (auto x : std::get(v)) + if (x.has_value()) os << x.value() << " "; + } + return os.str(); + } + std::string toString() const { + std::ostringstream os; + for (auto const& [k, v] : mMap) { + os << k << ":" << toString(v.value) << std::endl; + } + return os.str(); + } + ConfigValue parseBool(const std::string& value); ConfigValue parseString(const std::string& name); ConfigValue parseInt32(const std::string& value); diff --git a/biometrics/common/config/tests/ConfigTest.cpp b/biometrics/common/config/tests/ConfigTest.cpp index d92204015d..9794b257bb 100644 --- a/biometrics/common/config/tests/ConfigTest.cpp +++ b/biometrics/common/config/tests/ConfigTest.cpp @@ -115,7 +115,7 @@ class ConfigTest : public ::testing::Test { void SetUp() override { cfg.init(); } void TearDown() override {} - void switch2aidl() { cfg.setParam("astring", "astring"); } + void switch2aidl() { cfg.sourcedFromAidl(); } TestConfig cfg; }; @@ -129,7 +129,6 @@ TEST_F(ConfigTest, parseInt32) { {"1234", 1234}, {"0", 0}, {"", defval}, - {"xyz", defval}, }; for (int i = 0; i < sizeof(values) / sizeof(values[0]); i++) { ASSERT_EQ((std::get(cfg.parseInt32(values[i].strval))).value_or(defval), @@ -143,8 +142,10 @@ TEST_F(ConfigTest, parseInt64) { std::string strval; std::int64_t expval; } values[] = { - {"1234", 1234}, {"12345678909876", 12345678909876}, {"0", 0}, {"", defval}, - {"xyz", defval}, + {"1234", 1234}, + {"12345678909876", 12345678909876}, + {"0", 0}, + {"", defval}, }; for (int i = 0; i < sizeof(values) / sizeof(values[0]); i++) { ASSERT_EQ((std::get(cfg.parseInt64(values[i].strval))).value_or(defval), @@ -160,8 +161,6 @@ TEST_F(ConfigTest, parseBool) { } values[] = { {"false", false}, {"true", true}, - {"", defval}, - {"xyz", defval}, }; for (int i = 0; i < sizeof(values) / sizeof(values[0]); i++) { ASSERT_EQ((std::get(cfg.parseBool(values[i].strval))).value_or(defval), @@ -174,9 +173,7 @@ TEST_F(ConfigTest, parseIntVec) { struct { std::string strval; std::vector> expval; - } values[] = { - {"1", {1}}, {"1,2,3", {1, 2, 3}}, {"1,2,b", defval}, {"", defval}, {"xyz", defval}, - }; + } values[] = {{"1", {1}}, {"1,2,3", {1, 2, 3}}, {"1,2,b", defval}, {"", defval}}; for (int i = 0; i < sizeof(values) / sizeof(values[0]); i++) { ASSERT_EQ(std::get(cfg.parseIntVec(values[i].strval)), values[i].expval); } @@ -255,12 +252,4 @@ TEST_F(ConfigTest, setters_aidl) { EXPECT_EQ(cfg.getopt("avector"), val_avector_new); } -TEST_F(ConfigTest, setParam) { - ASSERT_TRUE(cfg.setParam("aint32", "789")); - ASSERT_EQ(cfg.get("aint32"), 789); - ASSERT_TRUE(cfg.setParam("avector", "7,8,9,10")); - OptIntVec val_avector_new{7, 8, 9, 10}; - EXPECT_EQ(cfg.getopt("avector"), val_avector_new); - ASSERT_FALSE(cfg.setParam("unknown", "any")); -} } // namespace aidl::android::hardware::biometrics diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index 282a702197..a395c01c14 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -57,5 +57,5 @@ aidl_interface { }, ], - frozen: true, + frozen: false, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl new file mode 100644 index 0000000000..2c7e1a0037 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +interface IVirtualHal { + oneway void setEnrollments(in int[] id); + oneway void setEnrollmentHit(in int hit_id); + oneway void setAuthenticatorId(in long id); + oneway void setChallenge(in long challenge); + oneway void setOperationAuthenticateFails(in boolean fail); + oneway void setOperationAuthenticateLatency(in int[] latencyMs); + oneway void setOperationAuthenticateDuration(in int durationMs); + oneway void setOperationAuthenticateError(in int error); + oneway void setOperationAuthenticateAcquired(in int[] acquired); + oneway void setOperationEnrollError(in int error); + oneway void setOperationEnrollLatency(in int[] latencyMs); + oneway void setOperationDetectInteractionLatency(in int[] latencyMs); + oneway void setOperationDetectInteractionError(in int error); + oneway void setOperationDetectInteractionDuration(in int durationMs); + oneway void setOperationDetectInteractionAcquired(in int[] acquired); + oneway void setLockout(in boolean lockout); + oneway void setLockoutEnable(in boolean enable); + oneway void setLockoutTimedThreshold(in int threshold); + oneway void setLockoutTimedDuration(in int durationMs); + oneway void setLockoutPermanentThreshold(in int threshold); + oneway void setType(in android.hardware.biometrics.fingerprint.FingerprintSensorType type); + oneway void setSensorId(in int id); + oneway void setSensorStrength(in android.hardware.biometrics.common.SensorStrength strength); + oneway void setMaxEnrollmentPerUser(in int max); + oneway void setSensorLocation(in android.hardware.biometrics.fingerprint.SensorLocation loc); + oneway void setNavigationGuesture(in boolean v); + oneway void setDetectInteraction(in boolean v); + oneway void setDisplayTouch(in boolean v); + oneway void setControlIllumination(in boolean v); + const int STATUS_INVALID_PARAMETER = 1; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl new file mode 100644 index 0000000000..1599394724 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2024 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. + */ + +package android.hardware.biometrics.fingerprint; + +import android.hardware.biometrics.common.SensorStrength; +import android.hardware.biometrics.fingerprint.FingerprintSensorType; +import android.hardware.biometrics.fingerprint.SensorLocation; + +/** + * @hide + */ +@VintfStability +oneway interface IVirtualHal { + /** + * The operation failed due to invalid input parameters, the error messages should + * gives more details + */ + const int STATUS_INVALID_PARAMETER = 1; + + /** + * Set Fingerprint Virtual HAL behavior parameters + */ + + /** + * setEnrollments + * + * Set the ids of the fingerprints that were currently enrolled in the Virtual HAL, + * + * @param ids ids can contain 1 or more ids, each must be larger than 0 + */ + void setEnrollments(in int[] id); + + /** + * setEnrollmentHit + * + * Set current fingerprint enrollment ids in Fingerprint Virtual HAL, + * + * @param ids ids can contain 1 or more ids, each must be larger than 0 + */ + void setEnrollmentHit(in int hit_id); + + /** + * setAuthenticatorId + * + * Set authenticator id in virtual HAL, the id is returned in ISession#getAuthenticatorId() call + * + * @param id authenticator id value, only applied to the sensor with SensorStrength::STRONG. + */ + void setAuthenticatorId(in long id); + + /** + * setChallenge + * + * Set the challenge generated by the virtual HAL, which is returned in + * ISessionCallback#onChallengeGenerated() + * + * @param challenge + */ + void setChallenge(in long challenge); + + /** + * setOperationAuthenticateFails + * + * Set whether to force authentication to fail. If true, the virtual hal will report failure on + * authentication attempt until it is set to false + * + * @param fail if true, then the next authentication will fail + */ + void setOperationAuthenticateFails(in boolean fail); + + /** + * setOperationAuthenticateLatency + * + * Set authentication latency in the virtual hal in a fixed value (single element) or random + * values (two elements representing the bound values) + * The latency simulates the delay from the time framework requesting HAL to authetication to + * the time when HAL is ready to perform authentication operations. + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in array falls in any of + * the following conditions + * 1. the array contains no element + * 2. the array contains more than two elements + * 3. the array contains any negative value + * The accompanying error message gives more detail + * + * @param latencyMs[] value(s) are in milli-seconds + */ + void setOperationAuthenticateLatency(in int[] latencyMs); + + /** + * setOperationAuthenticateDuration + * + * Set authentication duration covering the HAL authetication from start to end, including + * fingerprint capturing, and matching, acquired info reporting. In case a sequence of acquired + * info code are specified via setOperationAuthenticateAcquired(), the reporting is evenly + * distributed over the duration. + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative + * + * @param duration value is in milli-seconds + */ + void setOperationAuthenticateDuration(in int durationMs); + + /** + * setOperationAuthenticateError + * + * Force authentication to error out for non-zero error + * Check hardware/interfaces/biometrics/fingerprint/aidl/default/README.md for valid error codes + * + * @param error if error < 1000 + * non-vendor error + * else + * vendor error + */ + void setOperationAuthenticateError(in int error); + + /** + * setOperationAuthenticateAcquired + * + * Set one of more acquired info codes for the virtual hal to report during authentication + * Check hardware/interfaces/biometrics/fingerprint/aidl/default/README.md for valid acquired + * info codes + * + * @param acquired[], one or more acquired info codes + */ + void setOperationAuthenticateAcquired(in int[] acquired); + + /** + * setOperationEnrollError + * + * Force enrollment operation to error out for non-zero error + * Check hardware/interfaces/biometrics/fingerprint/aidl/default/README.md for valid error codes + * + * @param error if error < 1000 + * non-vendor error + * else + * vendor error + */ + void setOperationEnrollError(in int error); + + /** + * setOperationEnrollLatency + * + * Set enrollment latency in the virtual hal in a fixed value (single element) or random + * values (two elements representing the bound values) + * The latency simulates the delay from the time framework requesting HAL to enroll to the + * time when HAL is ready to perform enrollment operations. + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in array falls in any of + * the following conditions + * 1. the array contains no element + * 2. the array contains more than two elements + * 3. the array contains any negative value + * The accompanying error message gives more detail + * + * @param latencyMs[] value(s) are in milli-seconds + */ + void setOperationEnrollLatency(in int[] latencyMs); + + /** + * setOperationDetectInteractionLatency + * + * Set detect interaction latency in the virtual hal in a fixed value (single element) or random + * values (two elements representing the bound values) + * The latency simulates the delay from the time framework requesting HAL to detect interaction + * to the time when HAL is ready to perform detect interaction operations. + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in array falls in any of + * the following conditions + * 1. the array contains no element + * 2. the array contains more than two elements + * 3. the array contains any negative value + * The accompanying error message gives more detail + * + * @param latencyMs[] value(s) are in milli-seconds + */ + void setOperationDetectInteractionLatency(in int[] latencyMs); + + /** + * setOperationDetectInteractionError + * + * Force detect interaction operation to error out for non-zero error + * Check hardware/interfaces/biometrics/fingerprint/aidl/default/README.md for valid error codes + * + * @param error if error < 1000 + * non-vendor error + * else + * vendor error + */ + void setOperationDetectInteractionError(in int error); + + /** + * setOperationDetectInteractionDuration + * + * Set detect interaction duration covering the HAL authetication from start to end, including + * fingerprint detect and acquired info reporting. In case a sequence of acquired info code are + * specified via setOperationDetectInteractionAcquired(), the reporting is evenly distributed + * over the duration. + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative + * + * @param duration value is in milli-seconds + */ + void setOperationDetectInteractionDuration(in int durationMs); + + /** + * setOperationDetectInteractionAcquired + * + * Set one of more acquired info codes for the virtual hal to report during detect interaction + * Check hardware/interfaces/biometrics/fingerprint/aidl/default/README.md for valid acquired + * info codes + * + * @param acquired[], one or more acquired info codes + */ + void setOperationDetectInteractionAcquired(in int[] acquired); + + /** + * setLockout + * + * Whether to force to lockout on authentcation operation. If true, the virtual hal will report + * permanent lockout in processing authentication requrest, regardless of whether + * setLockoutEnable(true) is called or not. + * + * @param lockout, set to true if lockout is desired + */ + void setLockout(in boolean lockout); + + /** + * setLockoutEnable + * + * Whether to enable authentication-fail-based lockout tracking or not. The lock tracking + * includes both timed-based (aka temporary) lockout and permanent lockout. + * + * @param enable, set true to enable the lockout tracking + */ + void setLockoutEnable(in boolean enable); + + /** + * setLockoutTimedThreshold + * + * Set the number of consecutive authentication failures that triggers the timed-based lock to + * occur + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative + * + * @param threshold, the number of consecutive failures + */ + void setLockoutTimedThreshold(in int threshold); + + /** + * setLockoutTimedDuration + * + * Set the duration to expire timed-based lock during which there is no authentication failure + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative + * + * @param duration, in milli-seconds + */ + void setLockoutTimedDuration(in int durationMs); + + /** + * setLockoutPermanentThreshold + * + * Set the number of consecutive authentication failures that triggers the permanent lock to + * occur + * + * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative + * + * @param threshold, the number of consecutive failures + */ + void setLockoutPermanentThreshold(in int threshold); + + /** + * The following functions are used to configure Fingerprint Virtual HAL sensor properties + * refer to SensorProps.aidl and CommonProps.aidl for details of each property + */ + void setType(in FingerprintSensorType type); + void setSensorId(in int id); + void setSensorStrength(in SensorStrength strength); + void setMaxEnrollmentPerUser(in int max); + void setSensorLocation(in SensorLocation loc); + void setNavigationGuesture(in boolean v); + void setDetectInteraction(in boolean v); + void setDisplayTouch(in boolean v); + void setControlIllumination(in boolean v); +} diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 501af07c2b..6d8b68b34b 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -21,6 +21,7 @@ cc_binary { "Fingerprint.cpp", "Session.cpp", "FingerprintConfig.cpp", + "VirtualHal.cpp", "main.cpp", ], stl: "c++_static", @@ -31,7 +32,7 @@ cc_binary { static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", "libbase", - "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.fingerprint-V5-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.util", @@ -61,7 +62,7 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.fingerprint-V5-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", @@ -89,7 +90,7 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.fingerprint-V5-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", @@ -115,7 +116,7 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.fingerprint-V5-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", @@ -143,7 +144,7 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.fingerprint-V5-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", @@ -155,6 +156,44 @@ cc_test { require_root: true, } +cc_test { + name: "android.hardware.biometrics.fingerprint.VirtualHalTest", + local_include_dirs: ["include"], + srcs: [ + "tests/VirtualHalTest.cpp", + "Session.cpp", + "VirtualHal.cpp", + "FakeFingerprintEngineRear.cpp", + "FakeFingerprintEngineUdfps.cpp", + "FakeFingerprintEngineSide.cpp", + "FakeFingerprintEngine.cpp", + "FakeLockoutTracker.cpp", + "Fingerprint.cpp", + "FingerprintConfig.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + ], + static_libs: [ + "libandroid.hardware.biometrics.fingerprint.VirtualProps", + "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.common-V4-ndk", + "android.hardware.keymaster-V4-ndk", + "android.hardware.biometrics.common.util", + "android.hardware.biometrics.common.thread", + "android.hardware.biometrics.common.config", + ], + product_variables: { + debuggable: { + cflags: ["-DFPS_DEBUGGABLE"], + }, + }, + vendor: true, + test_suites: ["general-tests"], + require_root: true, +} + sysprop_library { name: "android.hardware.biometrics.fingerprint.VirtualProps", srcs: ["fingerprint.sysprop"], diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index dded54b436..e407f17232 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -171,7 +171,7 @@ void Fingerprint::resetConfigToDefault() { } void Fingerprint::clearConfigSysprop() { - LOG(INFO) << __func__ << ": clear all systprop configuration"; + LOG(INFO) << __func__ << ": clear all sysprop configuration"; #define RESET_CONFIG_O(__NAME__) \ if (FingerprintHalProperties::__NAME__()) FingerprintHalProperties::__NAME__(std::nullopt) #define RESET_CONFIG_V(__NAME__) \ @@ -209,4 +209,19 @@ void Fingerprint::clearConfigSysprop() { RESET_CONFIG_O(lockout_permanent_threshold); } +const char* Fingerprint::type2String(FingerprintSensorType type) { + switch (type) { + case FingerprintSensorType::REAR: + return "rear"; + case FingerprintSensorType::POWER_BUTTON: + return "side"; + case FingerprintSensorType::UNDER_DISPLAY_OPTICAL: + return "udfps"; + case FingerprintSensorType::UNDER_DISPLAY_ULTRASONIC: + return "udfps"; + default: + return "unknown"; + } +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/VirtualHal.cpp b/biometrics/fingerprint/aidl/default/VirtualHal.cpp new file mode 100644 index 0000000000..d2baaf5256 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/VirtualHal.cpp @@ -0,0 +1,275 @@ +/* + * Copyright (C) 2024 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. + */ + +#include + +#include "VirtualHal.h" + +#include + +#include "util/CancellationSignal.h" + +#undef LOG_TAG +#define LOG_TAG "FingerprintVirtualHalAidl" + +namespace aidl::android::hardware::biometrics::fingerprint { + +::ndk::ScopedAStatus VirtualHal::setEnrollments(const std::vector& enrollments) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().setopt("enrollments", intVec2OptIntVec(enrollments)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setEnrollmentHit(int32_t enrollment_hit) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("enrollment_hit", enrollment_hit); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setAuthenticatorId(int64_t in_id) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("authenticator_id", in_id); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setChallenge(int64_t in_challenge) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("challenge", in_challenge); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateFails(bool in_fail) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("operation_authenticate_fails", in_fail); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateLatency( + const std::vector& in_latency) { + ndk::ScopedAStatus status = sanityCheckLatency(in_latency); + if (!status.isOk()) { + return status; + } + + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().setopt("operation_authenticate_latency", + intVec2OptIntVec(in_latency)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateDuration(int32_t in_duration) { + if (in_duration < 0) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, "Error: duration can not be negative")); + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("operation_authenticate_duration", in_duration); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateError(int32_t in_error) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("operation_authenticate_error", in_error); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateAcquired( + const std::vector& in_acquired) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().setopt("operation_authenticate_acquired", + intVec2OptIntVec(in_acquired)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationEnrollError(int32_t in_error) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("operation_enroll_error", in_error); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationEnrollLatency(const std::vector& in_latency) { + ndk::ScopedAStatus status = sanityCheckLatency(in_latency); + if (!status.isOk()) { + return status; + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().setopt("operation_enroll_latency", intVec2OptIntVec(in_latency)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionLatency( + const std::vector& in_latency) { + ndk::ScopedAStatus status = sanityCheckLatency(in_latency); + if (!status.isOk()) { + return status; + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().setopt("operation_detect_interact_latency", + intVec2OptIntVec(in_latency)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionError(int32_t in_error) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("operation_detect_interaction_error", in_error); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionDuration(int32_t in_duration) { + if (in_duration < 0) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, "Error: duration can not be negative")); + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("operation_detect_interaction_duration", in_duration); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionAcquired( + const std::vector& in_acquired) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().setopt("operation_detect_interaction_acquired", + intVec2OptIntVec(in_acquired)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setLockout(bool in_lockout) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("lockout", in_lockout); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setLockoutEnable(bool in_enable) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("lockout_enable", in_enable); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setLockoutTimedThreshold(int32_t in_threshold) { + if (in_threshold < 0) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, "Error: threshold can not be negative")); + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("lockout_timed_threshold", in_threshold); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setLockoutTimedDuration(int32_t in_duration) { + if (in_duration < 0) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, "Error: duration can not be negative")); + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("lockout_timed_duration", in_duration); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setLockoutPermanentThreshold(int32_t in_threshold) { + if (in_threshold < 0) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, "Error: threshold can not be negative")); + } + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("lockout_permanent_threshold", in_threshold); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setType( + ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType in_type) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("type", Fingerprint::type2String(in_type)); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setSensorId(int32_t in_id) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("sensor_id", in_id); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setSensorStrength(SensorStrength in_strength) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("sensor_strength", (int32_t)in_strength); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setMaxEnrollmentPerUser(int32_t in_max) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("max_enrollments", in_max); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setSensorLocation(const SensorLocation& in_loc) { + std::string str = std::to_string(in_loc.sensorLocationX) + ":" + + std::to_string(in_loc.sensorLocationY) + ":" + + std::to_string(in_loc.sensorRadius); + ; + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("sensor_location", str); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setNavigationGuesture(bool in_v) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("navigation_guesture", in_v); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setDetectInteraction(bool in_v) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("detect_interaction", in_v); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setDisplayTouch(bool in_v) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("display_touch", in_v); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus VirtualHal::setControlIllumination(bool in_v) { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().set("control_illumination", in_v); + return ndk::ScopedAStatus::ok(); +} + +OptIntVec VirtualHal::intVec2OptIntVec(const std::vector& in_vec) { + OptIntVec optIntVec; + std::transform(in_vec.begin(), in_vec.end(), std::back_inserter(optIntVec), + [](int value) { return std::optional(value); }); + return optIntVec; +} + +::ndk::ScopedAStatus VirtualHal::sanityCheckLatency(const std::vector& in_latency) { + if (in_latency.size() == 0 || in_latency.size() > 2) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, + "Error: input input array must contain 1 or 2 elements")); + } + + for (auto x : in_latency) { + if (x < 0) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IVirtualHal::STATUS_INVALID_PARAMETER, + "Error: input data must not be negative")); + } + } + + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.xml b/biometrics/fingerprint/aidl/default/fingerprint-example.xml index 827813ffc0..ee529e9875 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.xml +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.xml @@ -1,7 +1,7 @@ android.hardware.biometrics.fingerprint - 4 + 5 IFingerprint/virtual diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h index 1576f0715c..90f89cbe02 100644 --- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h +++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h @@ -40,6 +40,7 @@ class Fingerprint : public BnFingerprint { std::shared_ptr* out) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs); binder_status_t handleShellCommand(int in, int out, int err, const char** argv, uint32_t argc); + bool connected() { return mEngine != nullptr; } static FingerprintConfig& cfg() { static FingerprintConfig* cfg = nullptr; @@ -49,9 +50,10 @@ class Fingerprint : public BnFingerprint { } return *cfg; } + void resetConfigToDefault(); + static const char* type2String(FingerprintSensorType type); private: - void resetConfigToDefault(); void onHelp(int); void onSimFingerDown(); void clearConfigSysprop(); diff --git a/biometrics/fingerprint/aidl/default/include/VirtualHal.h b/biometrics/fingerprint/aidl/default/include/VirtualHal.h new file mode 100644 index 0000000000..6cc4b669fb --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/VirtualHal.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 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 + +#include "Fingerprint.h" + +namespace aidl::android::hardware::biometrics::fingerprint { + +class VirtualHal : public BnVirtualHal { + public: + VirtualHal(Fingerprint* fp) : mFp(fp) {} + + ::ndk::ScopedAStatus setEnrollments(const std::vector& in_id) override; + ::ndk::ScopedAStatus setEnrollmentHit(int32_t in_hit_id) override; + ::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override; + ::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override; + ::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override; + ::ndk::ScopedAStatus setOperationAuthenticateLatency( + const std::vector& in_latency) override; + ::ndk::ScopedAStatus setOperationAuthenticateDuration(int32_t in_duration) override; + ::ndk::ScopedAStatus setOperationAuthenticateError(int32_t in_error) override; + ::ndk::ScopedAStatus setOperationAuthenticateAcquired( + const std::vector& in_acquired) override; + ::ndk::ScopedAStatus setOperationEnrollError(int32_t in_error) override; + ::ndk::ScopedAStatus setOperationEnrollLatency(const std::vector& in_latency) override; + ::ndk::ScopedAStatus setOperationDetectInteractionLatency( + const std::vector& in_latency) override; + ::ndk::ScopedAStatus setOperationDetectInteractionError(int32_t in_error) override; + ::ndk::ScopedAStatus setOperationDetectInteractionDuration(int32_t in_duration) override; + ::ndk::ScopedAStatus setOperationDetectInteractionAcquired( + const std::vector& in_acquired) override; + ::ndk::ScopedAStatus setLockout(bool in_lockout) override; + ::ndk::ScopedAStatus setLockoutEnable(bool in_enable) override; + ::ndk::ScopedAStatus setLockoutTimedThreshold(int32_t in_threshold) override; + ::ndk::ScopedAStatus setLockoutTimedDuration(int32_t in_duration) override; + ::ndk::ScopedAStatus setLockoutPermanentThreshold(int32_t in_threshold) override; + ::ndk::ScopedAStatus setType( + ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType in_type) + override; + ::ndk::ScopedAStatus setSensorId(int32_t in_id) override; + ::ndk::ScopedAStatus setSensorStrength(SensorStrength in_strength) override; + ::ndk::ScopedAStatus setMaxEnrollmentPerUser(int32_t in_max) override; + ::ndk::ScopedAStatus setSensorLocation( + const ::aidl::android::hardware::biometrics::fingerprint::SensorLocation& in_loc) + override; + ::ndk::ScopedAStatus setNavigationGuesture(bool in_v) override; + ::ndk::ScopedAStatus setDetectInteraction(bool in_v) override; + ::ndk::ScopedAStatus setDisplayTouch(bool in_v) override; + ::ndk::ScopedAStatus setControlIllumination(bool in_v) override; + + private: + OptIntVec intVec2OptIntVec(const std::vector& intVec); + ::ndk::ScopedAStatus sanityCheckLatency(const std::vector& in_latency); + Fingerprint* mFp; +}; + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp index 7df015b381..ba0c8ecadb 100644 --- a/biometrics/fingerprint/aidl/default/main.cpp +++ b/biometrics/fingerprint/aidl/default/main.cpp @@ -15,23 +15,34 @@ */ #include "Fingerprint.h" +#include "VirtualHal.h" #include #include #include using aidl::android::hardware::biometrics::fingerprint::Fingerprint; +using aidl::android::hardware::biometrics::fingerprint::VirtualHal; int main() { LOG(INFO) << "Fingerprint HAL started"; ABinderProcess_setThreadPoolMaxThreadCount(0); std::shared_ptr hal = ndk::SharedRefBase::make(); + auto binder = hal->asBinder(); - const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; - binder_status_t status = - AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str()); - CHECK_EQ(status, STATUS_OK); - AServiceManager_forceLazyServicesPersist(true); + std::shared_ptr hal_ext = ndk::SharedRefBase::make(hal.get()); + auto binder_ext = hal_ext->asBinder(); + + if (hal->connected()) { + CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get())); + const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; + binder_status_t status = + AServiceManager_registerLazyService(binder.get(), instance.c_str()); + CHECK_EQ(status, STATUS_OK); + AServiceManager_forceLazyServicesPersist(true); + } else { + LOG(ERROR) << "Fingerprint HAL is not connected"; + } ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach diff --git a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp new file mode 100644 index 0000000000..d8495d1638 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2024 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. + */ + +#include +#include +#include + +#include + +#include "Fingerprint.h" +#include "VirtualHal.h" + +using namespace ::android::fingerprint::virt; +using namespace ::aidl::android::hardware::biometrics::fingerprint; + +namespace aidl::android::hardware::biometrics::fingerprint { + +class VirtualHalTest : public ::testing::Test { + public: + static const int32_t STATUS_FAILED_TO_SET_PARAMETER = 2; + + protected: + void SetUp() override { + mHal = ndk::SharedRefBase::make(); + mVhal = ndk::SharedRefBase::make(mHal.get()); + ASSERT_TRUE(mVhal != nullptr); + mHal->resetConfigToDefault(); + } + + void TearDown() override { mHal->resetConfigToDefault(); } + + std::shared_ptr mVhal; + + ndk::ScopedAStatus validateNonNegativeInputOfInt32(const char* name, + ndk::ScopedAStatus (VirtualHal::*f)(int32_t), + const std::vector& in_good); + + private: + std::shared_ptr mHal; +}; + +ndk::ScopedAStatus VirtualHalTest::validateNonNegativeInputOfInt32( + const char* name, ndk::ScopedAStatus (VirtualHal::*f)(int32_t), + const std::vector& in_params_good) { + ndk::ScopedAStatus status; + for (auto& param : in_params_good) { + status = (*mVhal.*f)(param); + if (!status.isOk()) return status; + if (Fingerprint::cfg().get(name) != param) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER, + "Error: fail to set non-negative parameter")); + } + } + + int32_t old_param = Fingerprint::cfg().get(name); + status = (*mVhal.*f)(-1); + if (status.isOk()) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER, "Error: should return NOK")); + } + if (status.getServiceSpecificError() != IVirtualHal::STATUS_INVALID_PARAMETER) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER, + "Error: unexpected return error code")); + } + if (Fingerprint::cfg().get(name) != old_param) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER, + "Error: unexpected parameter change on failed attempt")); + } + return ndk::ScopedAStatus::ok(); +} + +TEST_F(VirtualHalTest, init) { + mVhal->setLockout(false); + ASSERT_TRUE(Fingerprint::cfg().get("lockout") == false); + ASSERT_TRUE(Fingerprint::cfg().get("type") == "rear"); + ASSERT_TRUE(Fingerprint::cfg().get("sensor_strength") == 2); + std::int64_t id = Fingerprint::cfg().get("authenticator_id"); + ASSERT_TRUE(Fingerprint::cfg().get("authenticator_id") == 0); + ASSERT_TRUE(Fingerprint::cfg().getopt("enrollments") == OptIntVec()); +} + +TEST_F(VirtualHalTest, enrollment_hit_int32) { + mVhal->setEnrollmentHit(11); + ASSERT_TRUE(Fingerprint::cfg().get("enrollment_hit") == 11); +} + +TEST_F(VirtualHalTest, authenticator_id_int64) { + mVhal->setAuthenticatorId(12345678900); + ASSERT_TRUE(Fingerprint::cfg().get("authenticator_id") == 12345678900); +} + +TEST_F(VirtualHalTest, opeationAuthenticateFails_bool) { + mVhal->setOperationAuthenticateFails(true); + ASSERT_TRUE(Fingerprint::cfg().get("operation_authenticate_fails")); +} + +TEST_F(VirtualHalTest, operationAuthenticateAcquired_int32_vector) { + std::vector ac{1, 2, 3, 4, 5, 6, 7}; + mVhal->setOperationAuthenticateAcquired(ac); + OptIntVec ac_get = Fingerprint::cfg().getopt("operation_authenticate_acquired"); + ASSERT_TRUE(ac_get.size() == ac.size()); + for (int i = 0; i < ac.size(); i++) { + ASSERT_TRUE(ac[i] == ac_get[i]); + } +} + +TEST_F(VirtualHalTest, type) { + struct { + FingerprintSensorType type; + const char* typeStr; + } typeMap[] = {{FingerprintSensorType::REAR, "rear"}, + {FingerprintSensorType::POWER_BUTTON, "side"}, + {FingerprintSensorType::UNDER_DISPLAY_OPTICAL, "udfps"}, + {FingerprintSensorType::UNDER_DISPLAY_ULTRASONIC, "udfps"}, + {FingerprintSensorType::UNKNOWN, "unknown"}}; + for (auto const& x : typeMap) { + mVhal->setType(x.type); + ASSERT_TRUE(Fingerprint::cfg().get("type") == x.typeStr); + } +} + +TEST_F(VirtualHalTest, sensorStrength) { + SensorStrength strengths[] = {SensorStrength::CONVENIENCE, SensorStrength::WEAK, + SensorStrength::STRONG}; + + for (auto const& strength : strengths) { + mVhal->setSensorStrength(strength); + ASSERT_TRUE(Fingerprint::cfg().get("sensor_strength") == (int32_t)(strength)); + } +} + +TEST_F(VirtualHalTest, sensorLocation) { + SensorLocation loc = {.sensorLocationX = 1, .sensorLocationY = 2, .sensorRadius = 3}; + mVhal->setSensorLocation(loc); + ASSERT_TRUE(Fingerprint::cfg().get("sensor_location") == "1:2:3"); +} + +TEST_F(VirtualHalTest, setLatency) { + ndk::ScopedAStatus status; + std::vector in_lats[] = {{1}, {2, 3}, {5, 4}}; + for (auto const& in_lat : in_lats) { + status = mVhal->setOperationAuthenticateLatency(in_lat); + ASSERT_TRUE(status.isOk()); + OptIntVec out_lat = Fingerprint::cfg().getopt("operation_authenticate_latency"); + ASSERT_TRUE(in_lat.size() == out_lat.size()); + for (int i = 0; i < in_lat.size(); i++) { + ASSERT_TRUE(in_lat[i] == out_lat[i]); + } + } + + std::vector bad_in_lats[] = {{}, {1, 2, 3}, {1, -3}}; + for (auto const& in_lat : bad_in_lats) { + status = mVhal->setOperationAuthenticateLatency(in_lat); + ASSERT_TRUE(!status.isOk()); + ASSERT_TRUE(status.getServiceSpecificError() == IVirtualHal::STATUS_INVALID_PARAMETER); + } +} + +TEST_F(VirtualHalTest, setOperationAuthenticateDuration) { + ndk::ScopedAStatus status = validateNonNegativeInputOfInt32( + "operation_authenticate_duration", &IVirtualHal::setOperationAuthenticateDuration, + {0, 33}); + ASSERT_TRUE(status.isOk()); +} + +TEST_F(VirtualHalTest, setOperationDetectInteractionDuration) { + ndk::ScopedAStatus status = validateNonNegativeInputOfInt32( + "operation_detect_interaction_duration", + &IVirtualHal::setOperationDetectInteractionDuration, {0, 34}); + ASSERT_TRUE(status.isOk()); +} + +TEST_F(VirtualHalTest, setLockoutTimedDuration) { + ndk::ScopedAStatus status = validateNonNegativeInputOfInt32( + "lockout_timed_duration", &IVirtualHal::setLockoutTimedDuration, {0, 35}); + ASSERT_TRUE(status.isOk()); +} + +TEST_F(VirtualHalTest, setLockoutTimedThreshold) { + ndk::ScopedAStatus status = validateNonNegativeInputOfInt32( + "lockout_timed_threshold", &IVirtualHal::setLockoutTimedThreshold, {0, 36}); + ASSERT_TRUE(status.isOk()); +} + +TEST_F(VirtualHalTest, setLockoutPermanentThreshold) { + ndk::ScopedAStatus status = validateNonNegativeInputOfInt32( + "lockout_permanent_threshold", &IVirtualHal::setLockoutPermanentThreshold, {0, 37}); + ASSERT_TRUE(status.isOk()); +} + +TEST_F(VirtualHalTest, setOthers) { + // Verify that there is no CHECK() failures + mVhal->setEnrollments({7, 6, 5}); + mVhal->setChallenge(111222333444555666); + mVhal->setOperationAuthenticateError(4); + mVhal->setOperationEnrollError(5); + mVhal->setOperationEnrollLatency({4, 5}); + mVhal->setOperationDetectInteractionError(6); + mVhal->setOperationDetectInteractionAcquired({4, 3, 2}); + mVhal->setLockout(false); + mVhal->setLockoutEnable(false); + mVhal->setSensorId(5); + mVhal->setMaxEnrollmentPerUser(6); + mVhal->setNavigationGuesture(false); + mVhal->setDetectInteraction(false); + mVhal->setDisplayTouch(false); + mVhal->setControlIllumination(false); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml index 62756bdc31..09dbf0c36d 100644 --- a/compatibility_matrices/compatibility_matrix.202504.xml +++ b/compatibility_matrices/compatibility_matrix.202504.xml @@ -116,7 +116,7 @@ android.hardware.biometrics.fingerprint - 3-4 + 3-5 IFingerprint default From e259d7e0ff7282a2a1b42b391620380ab1567bda Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Sat, 16 Mar 2024 17:15:50 -0700 Subject: [PATCH 037/161] Add documentation to all connector types Mention to use TESLA_SUPERCHARGER instead of TESLA_HPWC because they are the same standard. Mention that TESLA_SUPERCHARGER refers to the new NACS standard. Bug: 328106085 Test: m Change-Id: I8821f8a26b5971fcc7597b56c5e239a093e5795a --- .../automotive/vehicle/EvConnectorType.aidl | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvConnectorType.aidl index 6e77f5376c..7891dd9336 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvConnectorType.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvConnectorType.aidl @@ -28,16 +28,65 @@ enum EvConnectorType { * type. */ UNKNOWN = 0, + /** + * IEC 62196 Type 1 connector + * + * Also known as the "Yazaki connector" or "J1772 connector". + */ IEC_TYPE_1_AC = 1, + /** + * IEC 62196 Type 2 connector + * + * Also known as the "Mennekes connector". + */ IEC_TYPE_2_AC = 2, + /** + * IEC 62196 Type 3 connector + * + * Also known as the "Scame connector". + */ IEC_TYPE_3_AC = 3, + /** + * IEC 62196 Type AA connector + * + * Also known as the "Chademo connector". + */ IEC_TYPE_4_DC = 4, + /** + * IEC 62196 Type EE connector + * + * Also known as the “CCS1 connector” or “Combo1 connector". + */ IEC_TYPE_1_CCS_DC = 5, + /** + * IEC 62196 Type EE connector + * + * Also known as the “CCS2 connector” or “Combo2 connector”. + */ IEC_TYPE_2_CCS_DC = 6, + /** + * DO NOT USE + * + * Connector of Tesla Roadster. + */ TESLA_ROADSTER = 7, + /** + * DO NOT USE + * Use TESLA_SUPERCHARGER instead. + * + * High Power Wall Charger of Tesla. + */ TESLA_HPWC = 8, + /** + * SAE J3400 connector + * + * Also known as the "North American Charging Standard" (NACS) + * or the "Tesla charging standard" connector. + */ TESLA_SUPERCHARGER = 9, + /** GBT_AC Fast Charging Standard */ GBT_AC = 10, + /** GBT_DC Fast Charging Standard */ GBT_DC = 11, /** * Connector type to use when no other types apply. Before using this From 38bc1add0343eba3c26b06fe10337986147b41f9 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 13 Mar 2024 16:43:17 -0700 Subject: [PATCH 038/161] Sort the enum types alphabetically. Sort them so that they are in a stable order. Test: Presubmit Bug: 329269744 Change-Id: Ic541713024442ccfb88088f9bd829e71b20ef832 --- ...ardware.automotive.vehicle-types-meta.json | 1908 ++++++++--------- .../car/tool/EmuMetadataGenerator.java | 13 +- 2 files changed, 966 insertions(+), 955 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 1cfeb72927..1a93e17150 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -1393,7 +1393,7 @@ ] }, { - "name": "LaneDepartureWarningState", + "name": "AutomaticEmergencyBrakingState", "package": "android.hardware.automotive.vehicle", "values": [ { @@ -1401,21 +1401,21 @@ "value": 0 }, { - "name": "NO_WARNING", + "name": "ENABLED", "value": 1 }, { - "name": "WARNING_LEFT", + "name": "ACTIVATED", "value": 2 }, { - "name": "WARNING_RIGHT", + "name": "USER_OVERRIDE", "value": 3 } ] }, { - "name": "HandsOnDetectionWarning", + "name": "BlindSpotWarningState", "package": "android.hardware.automotive.vehicle", "values": [ { @@ -1432,6 +1432,194 @@ } ] }, + { + "name": "CameraServiceState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNAVAILABLE", + "value": 0 + }, + { + "name": "INACTIVE", + "value": 1 + }, + { + "name": "REQUESTED", + "value": 2 + }, + { + "name": "ACTIVE", + "value": 3 + } + ] + }, + { + "name": "CrossTrafficMonitoringWarningState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "NO_WARNING", + "value": 1 + }, + { + "name": "WARNING_FRONT_LEFT", + "value": 2 + }, + { + "name": "WARNING_FRONT_RIGHT", + "value": 3 + }, + { + "name": "WARNING_FRONT_BOTH", + "value": 4 + }, + { + "name": "WARNING_REAR_LEFT", + "value": 5 + }, + { + "name": "WARNING_REAR_RIGHT", + "value": 6 + }, + { + "name": "WARNING_REAR_BOTH", + "value": 7 + } + ] + }, + { + "name": "CruiseControlCommand", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "ACTIVATE", + "value": 1 + }, + { + "name": "SUSPEND", + "value": 2 + }, + { + "name": "INCREASE_TARGET_SPEED", + "value": 3 + }, + { + "name": "DECREASE_TARGET_SPEED", + "value": 4 + }, + { + "name": "INCREASE_TARGET_TIME_GAP", + "value": 5 + }, + { + "name": "DECREASE_TARGET_TIME_GAP", + "value": 6 + } + ] + }, + { + "name": "CruiseControlState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "ENABLED", + "value": 1 + }, + { + "name": "ACTIVATED", + "value": 2 + }, + { + "name": "USER_OVERRIDE", + "value": 3 + }, + { + "name": "SUSPENDED", + "value": 4 + }, + { + "name": "FORCED_DEACTIVATION_WARNING", + "value": 5 + } + ] + }, + { + "name": "CruiseControlType", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "STANDARD", + "value": 1 + }, + { + "name": "ADAPTIVE", + "value": 2 + }, + { + "name": "PREDICTIVE", + "value": 3 + } + ] + }, + { + "name": "CustomInputType", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "CUSTOM_EVENT_F1", + "value": 1001 + }, + { + "name": "CUSTOM_EVENT_F2", + "value": 1002 + }, + { + "name": "CUSTOM_EVENT_F3", + "value": 1003 + }, + { + "name": "CUSTOM_EVENT_F4", + "value": 1004 + }, + { + "name": "CUSTOM_EVENT_F5", + "value": 1005 + }, + { + "name": "CUSTOM_EVENT_F6", + "value": 1006 + }, + { + "name": "CUSTOM_EVENT_F7", + "value": 1007 + }, + { + "name": "CUSTOM_EVENT_F8", + "value": 1008 + }, + { + "name": "CUSTOM_EVENT_F9", + "value": 1009 + }, + { + "name": "CUSTOM_EVENT_F10", + "value": 1010 + } + ] + }, { "name": "DriverDistractionState", "package": "android.hardware.automotive.vehicle", @@ -1451,34 +1639,312 @@ ] }, { - "name": "VehicleTurnSignal", + "name": "DriverDistractionWarning", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "NONE", + "name": "OTHER", "value": 0 }, { - "name": "RIGHT", + "name": "NO_WARNING", "value": 1 }, { - "name": "LEFT", + "name": "WARNING", "value": 2 } ] }, { - "name": "RotaryInputType", + "name": "DriverDrowsinessAttentionState", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "ROTARY_INPUT_TYPE_SYSTEM_NAVIGATION", + "name": "OTHER", "value": 0 }, { - "name": "ROTARY_INPUT_TYPE_AUDIO_VOLUME", + "name": "KSS_RATING_1_EXTREMELY_ALERT", "value": 1 + }, + { + "name": "KSS_RATING_2_VERY_ALERT", + "value": 2 + }, + { + "name": "KSS_RATING_3_ALERT", + "value": 3 + }, + { + "name": "KSS_RATING_4_RATHER_ALERT", + "value": 4 + }, + { + "name": "KSS_RATING_5_NEITHER_ALERT_NOR_SLEEPY", + "value": 5 + }, + { + "name": "KSS_RATING_6_SOME_SLEEPINESS", + "value": 6 + }, + { + "name": "KSS_RATING_7_SLEEPY_NO_EFFORT", + "value": 7 + }, + { + "name": "KSS_RATING_8_SLEEPY_SOME_EFFORT", + "value": 8 + }, + { + "name": "KSS_RATING_9_VERY_SLEEPY", + "value": 9 + } + ] + }, + { + "name": "DriverDrowsinessAttentionWarning", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "NO_WARNING", + "value": 1 + }, + { + "name": "WARNING", + "value": 2 + } + ] + }, + { + "name": "ElectronicStabilityControlState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "ENABLED", + "value": 1 + }, + { + "name": "ACTIVATED", + "value": 2 + } + ] + }, + { + "name": "ElectronicTollCollectionCardStatus", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNKNOWN", + "value": 0 + }, + { + "name": "ELECTRONIC_TOLL_COLLECTION_CARD_VALID", + "value": 1 + }, + { + "name": "ELECTRONIC_TOLL_COLLECTION_CARD_INVALID", + "value": 2 + }, + { + "name": "ELECTRONIC_TOLL_COLLECTION_CARD_NOT_INSERTED", + "value": 3 + } + ] + }, + { + "name": "ElectronicTollCollectionCardType", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNKNOWN", + "value": 0 + }, + { + "name": "JP_ELECTRONIC_TOLL_COLLECTION_CARD", + "value": 1 + }, + { + "name": "JP_ELECTRONIC_TOLL_COLLECTION_CARD_V2", + "value": 2 + } + ] + }, + { + "name": "EmergencyLaneKeepAssistState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "ENABLED", + "value": 1 + }, + { + "name": "WARNING_LEFT", + "value": 2 + }, + { + "name": "WARNING_RIGHT", + "value": 3 + }, + { + "name": "ACTIVATED_STEER_LEFT", + "value": 4 + }, + { + "name": "ACTIVATED_STEER_RIGHT", + "value": 5 + }, + { + "name": "USER_OVERRIDE", + "value": 6 + } + ] + }, + { + "name": "ErrorState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER_ERROR_STATE", + "value": -1 + }, + { + "name": "NOT_AVAILABLE_DISABLED", + "value": -2 + }, + { + "name": "NOT_AVAILABLE_SPEED_LOW", + "value": -3 + }, + { + "name": "NOT_AVAILABLE_SPEED_HIGH", + "value": -4 + }, + { + "name": "NOT_AVAILABLE_POOR_VISIBILITY", + "value": -5 + }, + { + "name": "NOT_AVAILABLE_SAFETY", + "value": -6 + } + ] + }, + { + "name": "EvChargeState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNKNOWN", + "value": 0 + }, + { + "name": "CHARGING", + "value": 1 + }, + { + "name": "FULLY_CHARGED", + "value": 2 + }, + { + "name": "NOT_CHARGING", + "value": 3 + }, + { + "name": "ERROR", + "value": 4 + } + ] + }, + { + "name": "EvConnectorType", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNKNOWN", + "value": 0 + }, + { + "name": "IEC_TYPE_1_AC", + "value": 1 + }, + { + "name": "IEC_TYPE_2_AC", + "value": 2 + }, + { + "name": "IEC_TYPE_3_AC", + "value": 3 + }, + { + "name": "IEC_TYPE_4_DC", + "value": 4 + }, + { + "name": "IEC_TYPE_1_CCS_DC", + "value": 5 + }, + { + "name": "IEC_TYPE_2_CCS_DC", + "value": 6 + }, + { + "name": "TESLA_ROADSTER", + "value": 7 + }, + { + "name": "TESLA_HPWC", + "value": 8 + }, + { + "name": "TESLA_SUPERCHARGER", + "value": 9 + }, + { + "name": "GBT_AC", + "value": 10 + }, + { + "name": "GBT_DC", + "value": 11 + }, + { + "name": "OTHER", + "value": 101 + } + ] + }, + { + "name": "EvRegenerativeBrakingState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNKNOWN", + "value": 0 + }, + { + "name": "DISABLED", + "value": 1 + }, + { + "name": "PARTIALLY_ENABLED", + "value": 2 + }, + { + "name": "FULLY_ENABLED", + "value": 3 } ] }, @@ -1505,19 +1971,19 @@ ] }, { - "name": "VehicleLightState", + "name": "ForwardCollisionWarningState", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "OFF", + "name": "OTHER", "value": 0 }, { - "name": "ON", + "name": "NO_WARNING", "value": 1 }, { - "name": "DAYTIME_RUNNING", + "name": "WARNING", "value": 2 } ] @@ -1581,37 +2047,223 @@ ] }, { - "name": "VehicleIgnitionState", + "name": "GsrComplianceRequirementType", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "UNDEFINED", + "name": "GSR_COMPLIANCE_NOT_REQUIRED", "value": 0 }, { - "name": "LOCK", + "name": "GSR_COMPLIANCE_REQUIRED_V1", + "value": 1 + } + ] + }, + { + "name": "HandsOnDetectionDriverState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "HANDS_ON", "value": 1 }, { - "name": "OFF", + "name": "HANDS_OFF", + "value": 2 + } + ] + }, + { + "name": "HandsOnDetectionWarning", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "NO_WARNING", + "value": 1 + }, + { + "name": "WARNING", + "value": 2 + } + ] + }, + { + "name": "ImpactSensorLocation", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 1 + }, + { + "name": "FRONT", "value": 2 }, { - "name": "ACC", - "value": 3 - }, - { - "name": "ON", + "name": "FRONT_LEFT_DOOR_SIDE", "value": 4 }, { - "name": "START", + "name": "FRONT_RIGHT_DOOR_SIDE", + "value": 8 + }, + { + "name": "REAR_LEFT_DOOR_SIDE", + "value": 16 + }, + { + "name": "REAR_RIGHT_DOOR_SIDE", + "value": 32 + }, + { + "name": "REAR", + "value": 64 + } + ] + }, + { + "name": "LaneCenteringAssistCommand", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "ACTIVATE", + "value": 1 + }, + { + "name": "DEACTIVATE", + "value": 2 + } + ] + }, + { + "name": "LaneCenteringAssistState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "ENABLED", + "value": 1 + }, + { + "name": "ACTIVATION_REQUESTED", + "value": 2 + }, + { + "name": "ACTIVATED", + "value": 3 + }, + { + "name": "USER_OVERRIDE", + "value": 4 + }, + { + "name": "FORCED_DEACTIVATION_WARNING", "value": 5 } ] }, { - "name": "EvConnectorType", + "name": "LaneDepartureWarningState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "NO_WARNING", + "value": 1 + }, + { + "name": "WARNING_LEFT", + "value": 2 + }, + { + "name": "WARNING_RIGHT", + "value": 3 + } + ] + }, + { + "name": "LaneKeepAssistState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "ENABLED", + "value": 1 + }, + { + "name": "ACTIVATED_STEER_LEFT", + "value": 2 + }, + { + "name": "ACTIVATED_STEER_RIGHT", + "value": 3 + }, + { + "name": "USER_OVERRIDE", + "value": 4 + } + ] + }, + { + "name": "LowSpeedAutomaticEmergencyBrakingState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "ENABLED", + "value": 1 + }, + { + "name": "ACTIVATED", + "value": 2 + }, + { + "name": "USER_OVERRIDE", + "value": 3 + } + ] + }, + { + "name": "LowSpeedCollisionWarningState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OTHER", + "value": 0 + }, + { + "name": "NO_WARNING", + "value": 1 + }, + { + "name": "WARNING", + "value": 2 + } + ] + }, + { + "name": "PortLocationType", "package": "android.hardware.automotive.vehicle", "values": [ { @@ -1619,52 +2271,42 @@ "value": 0 }, { - "name": "IEC_TYPE_1_AC", + "name": "FRONT_LEFT", "value": 1 }, { - "name": "IEC_TYPE_2_AC", + "name": "FRONT_RIGHT", "value": 2 }, { - "name": "IEC_TYPE_3_AC", + "name": "REAR_RIGHT", "value": 3 }, { - "name": "IEC_TYPE_4_DC", + "name": "REAR_LEFT", "value": 4 }, { - "name": "IEC_TYPE_1_CCS_DC", + "name": "FRONT", "value": 5 }, { - "name": "IEC_TYPE_2_CCS_DC", + "name": "REAR", "value": 6 + } + ] + }, + { + "name": "RotaryInputType", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "ROTARY_INPUT_TYPE_SYSTEM_NAVIGATION", + "value": 0 }, { - "name": "TESLA_ROADSTER", - "value": 7 - }, - { - "name": "TESLA_HPWC", - "value": 8 - }, - { - "name": "TESLA_SUPERCHARGER", - "value": 9 - }, - { - "name": "GBT_AC", - "value": 10 - }, - { - "name": "GBT_DC", - "value": 11 - }, - { - "name": "OTHER", - "value": 101 + "name": "ROTARY_INPUT_TYPE_AUDIO_VOLUME", + "value": 1 } ] }, @@ -1691,66 +2333,66 @@ ] }, { - "name": "DriverDrowsinessAttentionState", + "name": "VehicleAirbagLocation", "package": "android.hardware.automotive.vehicle", "values": [ { "name": "OTHER", - "value": 0 - }, - { - "name": "KSS_RATING_1_EXTREMELY_ALERT", "value": 1 }, { - "name": "KSS_RATING_2_VERY_ALERT", + "name": "FRONT", "value": 2 }, { - "name": "KSS_RATING_3_ALERT", - "value": 3 - }, - { - "name": "KSS_RATING_4_RATHER_ALERT", + "name": "KNEE", "value": 4 }, { - "name": "KSS_RATING_5_NEITHER_ALERT_NOR_SLEEPY", - "value": 5 - }, - { - "name": "KSS_RATING_6_SOME_SLEEPINESS", - "value": 6 - }, - { - "name": "KSS_RATING_7_SLEEPY_NO_EFFORT", - "value": 7 - }, - { - "name": "KSS_RATING_8_SLEEPY_SOME_EFFORT", + "name": "LEFT_SIDE", "value": 8 }, { - "name": "KSS_RATING_9_VERY_SLEEPY", - "value": 9 + "name": "RIGHT_SIDE", + "value": 16 + }, + { + "name": "CURTAIN", + "value": 32 } ] }, { - "name": "DriverDistractionWarning", + "name": "VehicleApPowerStateShutdownParam", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "OTHER", - "value": 0 - }, - { - "name": "NO_WARNING", + "name": "SHUTDOWN_IMMEDIATELY", "value": 1 }, { - "name": "WARNING", + "name": "CAN_SLEEP", "value": 2 + }, + { + "name": "SHUTDOWN_ONLY", + "value": 3 + }, + { + "name": "SLEEP_IMMEDIATELY", + "value": 4 + }, + { + "name": "HIBERNATE_IMMEDIATELY", + "value": 5 + }, + { + "name": "CAN_HIBERNATE", + "value": 6 + }, + { + "name": "EMERGENCY_SHUTDOWN", + "value": 7 } ] }, @@ -1800,6 +2442,176 @@ } ] }, + { + "name": "VehicleAutonomousState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "LEVEL_0", + "value": 0 + }, + { + "name": "LEVEL_1", + "value": 1 + }, + { + "name": "LEVEL_2", + "value": 2 + }, + { + "name": "LEVEL_3", + "value": 3 + }, + { + "name": "LEVEL_4", + "value": 4 + }, + { + "name": "LEVEL_5", + "value": 5 + } + ] + }, + { + "name": "VehicleGear", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "GEAR_UNKNOWN", + "value": 0 + }, + { + "name": "GEAR_NEUTRAL", + "value": 1 + }, + { + "name": "GEAR_REVERSE", + "value": 2 + }, + { + "name": "GEAR_PARK", + "value": 4 + }, + { + "name": "GEAR_DRIVE", + "value": 8 + }, + { + "name": "GEAR_1", + "value": 16 + }, + { + "name": "GEAR_2", + "value": 32 + }, + { + "name": "GEAR_3", + "value": 64 + }, + { + "name": "GEAR_4", + "value": 128 + }, + { + "name": "GEAR_5", + "value": 256 + }, + { + "name": "GEAR_6", + "value": 512 + }, + { + "name": "GEAR_7", + "value": 1024 + }, + { + "name": "GEAR_8", + "value": 2048 + }, + { + "name": "GEAR_9", + "value": 4096 + } + ] + }, + { + "name": "VehicleHvacFanDirection", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNKNOWN", + "value": 0 + }, + { + "name": "FACE", + "value": 1 + }, + { + "name": "FLOOR", + "value": 2 + }, + { + "name": "FACE_AND_FLOOR", + "value": 3 + }, + { + "name": "DEFROST", + "value": 4 + }, + { + "name": "DEFROST_AND_FLOOR", + "value": 6 + } + ] + }, + { + "name": "VehicleIgnitionState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "UNDEFINED", + "value": 0 + }, + { + "name": "LOCK", + "value": 1 + }, + { + "name": "OFF", + "value": 2 + }, + { + "name": "ACC", + "value": 3 + }, + { + "name": "ON", + "value": 4 + }, + { + "name": "START", + "value": 5 + } + ] + }, + { + "name": "VehicleLightState", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "OFF", + "value": 0 + }, + { + "name": "ON", + "value": 1 + }, + { + "name": "DAYTIME_RUNNING", + "value": 2 + } + ] + }, { "name": "VehicleLightSwitch", "package": "android.hardware.automotive.vehicle", @@ -1822,260 +2634,6 @@ } ] }, - { - "name": "WindshieldWipersSwitch", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "OFF", - "value": 1 - }, - { - "name": "MIST", - "value": 2 - }, - { - "name": "INTERMITTENT_LEVEL_1", - "value": 3 - }, - { - "name": "INTERMITTENT_LEVEL_2", - "value": 4 - }, - { - "name": "INTERMITTENT_LEVEL_3", - "value": 5 - }, - { - "name": "INTERMITTENT_LEVEL_4", - "value": 6 - }, - { - "name": "INTERMITTENT_LEVEL_5", - "value": 7 - }, - { - "name": "CONTINUOUS_LEVEL_1", - "value": 8 - }, - { - "name": "CONTINUOUS_LEVEL_2", - "value": 9 - }, - { - "name": "CONTINUOUS_LEVEL_3", - "value": 10 - }, - { - "name": "CONTINUOUS_LEVEL_4", - "value": 11 - }, - { - "name": "CONTINUOUS_LEVEL_5", - "value": 12 - }, - { - "name": "AUTO", - "value": 13 - }, - { - "name": "SERVICE", - "value": 14 - } - ] - }, - { - "name": "CrossTrafficMonitoringWarningState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "NO_WARNING", - "value": 1 - }, - { - "name": "WARNING_FRONT_LEFT", - "value": 2 - }, - { - "name": "WARNING_FRONT_RIGHT", - "value": 3 - }, - { - "name": "WARNING_FRONT_BOTH", - "value": 4 - }, - { - "name": "WARNING_REAR_LEFT", - "value": 5 - }, - { - "name": "WARNING_REAR_RIGHT", - "value": 6 - }, - { - "name": "WARNING_REAR_BOTH", - "value": 7 - } - ] - }, - { - "name": "LaneCenteringAssistCommand", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "ACTIVATE", - "value": 1 - }, - { - "name": "DEACTIVATE", - "value": 2 - } - ] - }, - { - "name": "VehicleSeatOccupancyState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "VACANT", - "value": 1 - }, - { - "name": "OCCUPIED", - "value": 2 - } - ] - }, - { - "name": "ErrorState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER_ERROR_STATE", - "value": -1 - }, - { - "name": "NOT_AVAILABLE_DISABLED", - "value": -2 - }, - { - "name": "NOT_AVAILABLE_SPEED_LOW", - "value": -3 - }, - { - "name": "NOT_AVAILABLE_SPEED_HIGH", - "value": -4 - }, - { - "name": "NOT_AVAILABLE_POOR_VISIBILITY", - "value": -5 - }, - { - "name": "NOT_AVAILABLE_SAFETY", - "value": -6 - } - ] - }, - { - "name": "BlindSpotWarningState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "NO_WARNING", - "value": 1 - }, - { - "name": "WARNING", - "value": 2 - } - ] - }, - { - "name": "WindshieldWipersState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "OFF", - "value": 1 - }, - { - "name": "ON", - "value": 2 - }, - { - "name": "SERVICE", - "value": 3 - } - ] - }, - { - "name": "VehicleAirbagLocation", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 1 - }, - { - "name": "FRONT", - "value": 2 - }, - { - "name": "KNEE", - "value": 4 - }, - { - "name": "LEFT_SIDE", - "value": 8 - }, - { - "name": "RIGHT_SIDE", - "value": 16 - }, - { - "name": "CURTAIN", - "value": 32 - } - ] - }, - { - "name": "DriverDrowsinessAttentionWarning", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "NO_WARNING", - "value": 1 - }, - { - "name": "WARNING", - "value": 2 - } - ] - }, { "name": "VehicleOilLevel", "package": "android.hardware.automotive.vehicle", @@ -2103,19 +2661,37 @@ ] }, { - "name": "ForwardCollisionWarningState", + "name": "VehicleSeatOccupancyState", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "OTHER", + "name": "UNKNOWN", "value": 0 }, { - "name": "NO_WARNING", + "name": "VACANT", "value": 1 }, { - "name": "WARNING", + "name": "OCCUPIED", + "value": 2 + } + ] + }, + { + "name": "VehicleTurnSignal", + "package": "android.hardware.automotive.vehicle", + "values": [ + { + "name": "NONE", + "value": 0 + }, + { + "name": "RIGHT", + "value": 1 + }, + { + "name": "LEFT", "value": 2 } ] @@ -2263,37 +2839,7 @@ ] }, { - "name": "VehicleHvacFanDirection", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "FACE", - "value": 1 - }, - { - "name": "FLOOR", - "value": 2 - }, - { - "name": "FACE_AND_FLOOR", - "value": 3 - }, - { - "name": "DEFROST", - "value": 4 - }, - { - "name": "DEFROST_AND_FLOOR", - "value": 6 - } - ] - }, - { - "name": "LowSpeedCollisionWarningState", + "name": "WindshieldWipersState", "package": "android.hardware.automotive.vehicle", "values": [ { @@ -2301,628 +2847,82 @@ "value": 0 }, { - "name": "NO_WARNING", + "name": "OFF", "value": 1 }, { - "name": "WARNING", + "name": "ON", "value": 2 + }, + { + "name": "SERVICE", + "value": 3 } ] }, { - "name": "CruiseControlCommand", + "name": "WindshieldWipersSwitch", "package": "android.hardware.automotive.vehicle", "values": [ { - "name": "ACTIVATE", + "name": "OTHER", + "value": 0 + }, + { + "name": "OFF", "value": 1 }, { - "name": "SUSPEND", + "name": "MIST", "value": 2 }, { - "name": "INCREASE_TARGET_SPEED", + "name": "INTERMITTENT_LEVEL_1", "value": 3 }, { - "name": "DECREASE_TARGET_SPEED", + "name": "INTERMITTENT_LEVEL_2", "value": 4 }, { - "name": "INCREASE_TARGET_TIME_GAP", + "name": "INTERMITTENT_LEVEL_3", "value": 5 }, { - "name": "DECREASE_TARGET_TIME_GAP", - "value": 6 - } - ] - }, - { - "name": "ElectronicStabilityControlState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "ENABLED", - "value": 1 - }, - { - "name": "ACTIVATED", - "value": 2 - } - ] - }, - { - "name": "EvRegenerativeBrakingState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "DISABLED", - "value": 1 - }, - { - "name": "PARTIALLY_ENABLED", - "value": 2 - }, - { - "name": "FULLY_ENABLED", - "value": 3 - } - ] - }, - { - "name": "LowSpeedAutomaticEmergencyBrakingState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "ENABLED", - "value": 1 - }, - { - "name": "ACTIVATED", - "value": 2 - }, - { - "name": "USER_OVERRIDE", - "value": 3 - } - ] - }, - { - "name": "LaneCenteringAssistState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "ENABLED", - "value": 1 - }, - { - "name": "ACTIVATION_REQUESTED", - "value": 2 - }, - { - "name": "ACTIVATED", - "value": 3 - }, - { - "name": "USER_OVERRIDE", - "value": 4 - }, - { - "name": "FORCED_DEACTIVATION_WARNING", - "value": 5 - } - ] - }, - { - "name": "VehicleGear", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "GEAR_UNKNOWN", - "value": 0 - }, - { - "name": "GEAR_NEUTRAL", - "value": 1 - }, - { - "name": "GEAR_REVERSE", - "value": 2 - }, - { - "name": "GEAR_PARK", - "value": 4 - }, - { - "name": "GEAR_DRIVE", - "value": 8 - }, - { - "name": "GEAR_1", - "value": 16 - }, - { - "name": "GEAR_2", - "value": 32 - }, - { - "name": "GEAR_3", - "value": 64 - }, - { - "name": "GEAR_4", - "value": 128 - }, - { - "name": "GEAR_5", - "value": 256 - }, - { - "name": "GEAR_6", - "value": 512 - }, - { - "name": "GEAR_7", - "value": 1024 - }, - { - "name": "GEAR_8", - "value": 2048 - }, - { - "name": "GEAR_9", - "value": 4096 - } - ] - }, - { - "name": "ElectronicTollCollectionCardType", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "JP_ELECTRONIC_TOLL_COLLECTION_CARD", - "value": 1 - }, - { - "name": "JP_ELECTRONIC_TOLL_COLLECTION_CARD_V2", - "value": 2 - } - ] - }, - { - "name": "VehicleApPowerStateShutdownParam", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "SHUTDOWN_IMMEDIATELY", - "value": 1 - }, - { - "name": "CAN_SLEEP", - "value": 2 - }, - { - "name": "SHUTDOWN_ONLY", - "value": 3 - }, - { - "name": "SLEEP_IMMEDIATELY", - "value": 4 - }, - { - "name": "HIBERNATE_IMMEDIATELY", - "value": 5 - }, - { - "name": "CAN_HIBERNATE", + "name": "INTERMITTENT_LEVEL_4", "value": 6 }, { - "name": "EMERGENCY_SHUTDOWN", + "name": "INTERMITTENT_LEVEL_5", "value": 7 - } - ] - }, - { - "name": "AutomaticEmergencyBrakingState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 }, { - "name": "ENABLED", - "value": 1 - }, - { - "name": "ACTIVATED", - "value": 2 - }, - { - "name": "USER_OVERRIDE", - "value": 3 - } - ] - }, - { - "name": "ImpactSensorLocation", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 1 - }, - { - "name": "FRONT", - "value": 2 - }, - { - "name": "FRONT_LEFT_DOOR_SIDE", - "value": 4 - }, - { - "name": "FRONT_RIGHT_DOOR_SIDE", + "name": "CONTINUOUS_LEVEL_1", "value": 8 }, { - "name": "REAR_LEFT_DOOR_SIDE", - "value": 16 + "name": "CONTINUOUS_LEVEL_2", + "value": 9 }, { - "name": "REAR_RIGHT_DOOR_SIDE", - "value": 32 + "name": "CONTINUOUS_LEVEL_3", + "value": 10 }, { - "name": "REAR", - "value": 64 - } - ] - }, - { - "name": "CruiseControlType", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 + "name": "CONTINUOUS_LEVEL_4", + "value": 11 }, { - "name": "STANDARD", - "value": 1 + "name": "CONTINUOUS_LEVEL_5", + "value": 12 }, { - "name": "ADAPTIVE", - "value": 2 + "name": "AUTO", + "value": 13 }, { - "name": "PREDICTIVE", - "value": 3 - } - ] - }, - { - "name": "LaneKeepAssistState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "ENABLED", - "value": 1 - }, - { - "name": "ACTIVATED_STEER_LEFT", - "value": 2 - }, - { - "name": "ACTIVATED_STEER_RIGHT", - "value": 3 - }, - { - "name": "USER_OVERRIDE", - "value": 4 - } - ] - }, - { - "name": "CustomInputType", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "CUSTOM_EVENT_F1", - "value": 1001 - }, - { - "name": "CUSTOM_EVENT_F2", - "value": 1002 - }, - { - "name": "CUSTOM_EVENT_F3", - "value": 1003 - }, - { - "name": "CUSTOM_EVENT_F4", - "value": 1004 - }, - { - "name": "CUSTOM_EVENT_F5", - "value": 1005 - }, - { - "name": "CUSTOM_EVENT_F6", - "value": 1006 - }, - { - "name": "CUSTOM_EVENT_F7", - "value": 1007 - }, - { - "name": "CUSTOM_EVENT_F8", - "value": 1008 - }, - { - "name": "CUSTOM_EVENT_F9", - "value": 1009 - }, - { - "name": "CUSTOM_EVENT_F10", - "value": 1010 - } - ] - }, - { - "name": "ElectronicTollCollectionCardStatus", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "ELECTRONIC_TOLL_COLLECTION_CARD_VALID", - "value": 1 - }, - { - "name": "ELECTRONIC_TOLL_COLLECTION_CARD_INVALID", - "value": 2 - }, - { - "name": "ELECTRONIC_TOLL_COLLECTION_CARD_NOT_INSERTED", - "value": 3 - } - ] - }, - { - "name": "HandsOnDetectionDriverState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "HANDS_ON", - "value": 1 - }, - { - "name": "HANDS_OFF", - "value": 2 - } - ] - }, - { - "name": "EmergencyLaneKeepAssistState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "ENABLED", - "value": 1 - }, - { - "name": "WARNING_LEFT", - "value": 2 - }, - { - "name": "WARNING_RIGHT", - "value": 3 - }, - { - "name": "ACTIVATED_STEER_LEFT", - "value": 4 - }, - { - "name": "ACTIVATED_STEER_RIGHT", - "value": 5 - }, - { - "name": "USER_OVERRIDE", - "value": 6 - } - ] - }, - { - "name": "VehicleAutonomousState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "LEVEL_0", - "value": 0 - }, - { - "name": "LEVEL_1", - "value": 1 - }, - { - "name": "LEVEL_2", - "value": 2 - }, - { - "name": "LEVEL_3", - "value": 3 - }, - { - "name": "LEVEL_4", - "value": 4 - }, - { - "name": "LEVEL_5", - "value": 5 - } - ] - }, - { - "name": "EvChargeState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "CHARGING", - "value": 1 - }, - { - "name": "FULLY_CHARGED", - "value": 2 - }, - { - "name": "NOT_CHARGING", - "value": 3 - }, - { - "name": "ERROR", - "value": 4 - } - ] - }, - { - "name": "CameraServiceState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNAVAILABLE", - "value": 0 - }, - { - "name": "INACTIVE", - "value": 1 - }, - { - "name": "REQUESTED", - "value": 2 - }, - { - "name": "ACTIVE", - "value": 3 - } - ] - }, - { - "name": "GsrComplianceRequirementType", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "GSR_COMPLIANCE_NOT_REQUIRED", - "value": 0 - }, - { - "name": "GSR_COMPLIANCE_REQUIRED_V1", - "value": 1 - } - ] - }, - { - "name": "PortLocationType", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "UNKNOWN", - "value": 0 - }, - { - "name": "FRONT_LEFT", - "value": 1 - }, - { - "name": "FRONT_RIGHT", - "value": 2 - }, - { - "name": "REAR_RIGHT", - "value": 3 - }, - { - "name": "REAR_LEFT", - "value": 4 - }, - { - "name": "FRONT", - "value": 5 - }, - { - "name": "REAR", - "value": 6 - } - ] - }, - { - "name": "CruiseControlState", - "package": "android.hardware.automotive.vehicle", - "values": [ - { - "name": "OTHER", - "value": 0 - }, - { - "name": "ENABLED", - "value": 1 - }, - { - "name": "ACTIVATED", - "value": 2 - }, - { - "name": "USER_OVERRIDE", - "value": 3 - }, - { - "name": "SUSPENDED", - "value": 4 - }, - { - "name": "FORCED_DEACTIVATION_WARNING", - "value": 5 + "name": "SERVICE", + "value": 14 } ] } diff --git a/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java b/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java index 8e12f6774b..b719a70031 100644 --- a/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java +++ b/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java @@ -47,7 +47,9 @@ import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.lang.reflect.Field; +import java.text.Collator; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -321,7 +323,6 @@ public final class EmuMetadataGenerator { ValueField field = new ValueField(name, propertyId); List blockTags = doc.getBlockTags(); - List dataEnums = new ArrayList<>(); for (int j = 0; j < blockTags.size(); j++) { String commentTagName = blockTags.get(j).getTagName(); String commentTagContent = blockTags.get(j).getContent().toText(); @@ -344,6 +345,16 @@ public final class EmuMetadataGenerator { enumTypes.add(dataEnum); } + // Sort the enum types based on their packageName, name. + // Make sure VehicleProperty is always at the first. + Collections.sort(enumTypes.subList(1, enumTypes.size()), (Enum enum1, Enum enum2) -> { + var collator = Collator.getInstance(); + if (enum1.packageName.equals(enum2.packageName)) { + return collator.compare(enum1.name, enum2.name); + } + return collator.compare(enum1.packageName, enum2.packageName); + }); + // Output enumTypes as JSON to output. JSONArray jsonEnums = new JSONArray(); for (int i = 0; i < enumTypes.size(); i++) { From d3753ec91db5416f939e633e5020f50ced84c0e9 Mon Sep 17 00:00:00 2001 From: jimmyshiu Date: Tue, 19 Mar 2024 08:56:42 +0000 Subject: [PATCH 039/161] VTSHalPowerTarget: Add condition check for FMQAidl teardown While FMQAidl Setup() was skipped, some uninitialized objects would be used in FMQAidl Teardown() which caused the test failed. Add some condition check to prevent from using uninitialized objects. Test: atest VTSHalPowerTarget Bug: 328330332 Change-Id: I83081cbef66da1d74d87e191f266cb16fb559b85 --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 67efa7a90e..939deb2966 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -180,8 +180,12 @@ class FMQAidl : public PowerAidl { ASSERT_NE(mEventFlag, nullptr); } virtual void TearDown() { - mSession->close(); - ASSERT_TRUE(power->closeSessionChannel(getpid(), getuid()).isOk()); + if (mSession) { + mSession->close(); + if (mChannel->isValid()) { + ASSERT_TRUE(power->closeSessionChannel(getpid(), getuid()).isOk()); + } + } } protected: From dfb1d75acbd44d560e79b1d5fc2b4b0ec9a166d5 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 19 Mar 2024 12:50:28 -0700 Subject: [PATCH 040/161] Fix flaky TestWakeupClientServiceImplUnitTest. Previously the test will block forever if buildAndStart returns a nullptr if the test grpc server fails to start. This CL fixes this issue by adding a timeout and stop the wait even if the return value is nullptr. This CL also lets grpc randomly pick an available port instead of hard coding the port to make test more stable. Test: atest --host TestWakeupClientServiceImplUnitTest Bug: 330115017 Change-Id: I1113f95f92a25254e850b7a2eec249d1101c0dfe --- .../TestWakeupClientServiceImplUnitTest.cpp | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp index 4bc008697d..dd08e325cb 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp @@ -41,7 +41,6 @@ const std::vector kTestData = {0xde, 0xad, 0xbe, 0xef}; constexpr int32_t kTestCount = 1234; constexpr int64_t kTestStartTimeInEpochSeconds = 2345; constexpr int64_t kTestPeriodicInSeconds = 123; -const std::string kTestGrpcAddr = "localhost:50051"; class MyTestWakeupClientServiceImpl final : public ServiceImpl { public: @@ -53,27 +52,38 @@ class MyTestWakeupClientServiceImpl final : public ServiceImpl { class TestWakeupClientServiceImplUnitTest : public ::testing::Test { public: virtual void SetUp() override { - mServerThread = std::thread([this] { + int selectedPort = 0; + mServerThread = std::thread([this, &selectedPort] { mService = std::make_unique(); ServerBuilder builder; - builder.AddListeningPort(kTestGrpcAddr, grpc::InsecureServerCredentials()); + builder.AddListeningPort("localhost:0", grpc::InsecureServerCredentials(), + &selectedPort); WakeupClientServiceImpl wakeupClientService(mService.get()); builder.RegisterService(&wakeupClientService); mServer = builder.BuildAndStart(); + mServerStarted = true; { std::unique_lock lock(mLock); mServerStartCv.notify_one(); } - mServer->Wait(); + if (mServer != nullptr) { + mServer->Wait(); + } }); { std::unique_lock lock(mLock); - mServerStartCv.wait(lock, [this] { + bool serverStarted = mServerStartCv.wait_for(lock, std::chrono::seconds(10), [this] { ScopedLockAssertion lockAssertion(mLock); - return mServer != nullptr; + return mServerStarted.load(); }); + ASSERT_TRUE(serverStarted) << "Failed to wait for mServerStarted to be set within 10s"; } - mChannel = grpc::CreateChannel(kTestGrpcAddr, grpc::InsecureChannelCredentials()); + if (mServer == nullptr) { + GTEST_SKIP() << "Failed to start the test grpc server"; + } + std::string address = "localhost:" + std::to_string(selectedPort); + std::cout << "Test grpc server started at: " << address << std::endl; + mChannel = grpc::CreateChannel(address, grpc::InsecureChannelCredentials()); mStub = WakeupClient::NewStub(mChannel); } @@ -147,6 +157,7 @@ class TestWakeupClientServiceImplUnitTest : public ::testing::Test { std::thread mServerThread; std::unique_ptr mService; std::unique_ptr mServer; + std::atomic mServerStarted = false; std::shared_ptr mChannel; std::unique_ptr mStub; std::vector mRemoteTaskResponses; From a81a13a50de3fcda2f3e783ce763f6b6128c6e4a Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 13 Mar 2024 17:58:00 -0700 Subject: [PATCH 041/161] Add description field to meta.json file. This allows emulator to show the detailed desription for each VHAL property by hovering on the property name. Test: Manually inspect the JSON file. Bug: 324486041 Change-Id: Ie07dc055d30ae9b84641f952401871348141b398 --- .../vehicle/aidl/emu_metadata/.clang-format | 1 + ...ardware.automotive.vehicle-types-meta.json | 798 ++++++++++++------ .../car/tool/EmuMetadataGenerator.java | 37 +- 3 files changed, 566 insertions(+), 270 deletions(-) create mode 100644 automotive/vehicle/aidl/emu_metadata/.clang-format diff --git a/automotive/vehicle/aidl/emu_metadata/.clang-format b/automotive/vehicle/aidl/emu_metadata/.clang-format new file mode 100644 index 0000000000..e3845288a2 --- /dev/null +++ b/automotive/vehicle/aidl/emu_metadata/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 1a93e17150..735f8e6c6f 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -5,23 +5,28 @@ "values": [ { "name": "VIN of vehicle", - "value": 286261504 + "value": 286261504, + "description": "VIN of vehicle" }, { "name": "Manufacturer of vehicle", - "value": 286261505 + "value": 286261505, + "description": "Manufacturer of vehicle" }, { "name": "Model of vehicle", - "value": 286261506 + "value": 286261506, + "description": "Model of vehicle" }, { "name": "INFO_MODEL_YEAR", - "value": 289407235 + "value": 289407235, + "description": "Model year of vehicle in YYYY format based on the Gregorian calendar." }, { "name": "INFO_FUEL_CAPACITY", - "value": 291504388 + "value": 291504388, + "description": "Fuel capacity of the vehicle in milliliters\nThis property must communicate the maximum amount of the fuel that can be stored in the vehicle in milliliters. This property does not apply to electric vehicles. That is, if INFO_FUEL_TYPE only contains FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, implement INFO_EV_BATTERY_CAPACITY." }, { "name": "INFO_FUEL_TYPE", @@ -29,11 +34,13 @@ "data_enums": [ "FuelType" ], - "data_enum": "FuelType" + "data_enum": "FuelType", + "description": "List of fuels the vehicle may use.\nFuelType::FUEL_TYPE_ELECTRIC must only be included if the vehicle is plug in rechargeable. For example: An FHEV (Fully Hybrid Electric Vehicle) must not include FuelType::FUEL_TYPE_ELECTRIC in INFO_FUEL_TYPE's INT32_VEC value. So INFO_FUEL_TYPE can be populated as such: int32Values = { FuelType::FUEL_TYPE_UNLEADED } On the other hand, a PHEV (Plug-in Hybrid Electric Vehicle) is plug in rechargeable, and hence should include FuelType::FUEL_TYPE_ELECTRIC in INFO_FUEL_TYPE's INT32_VEC value. So INFO_FUEL_TYPE can be populated as such: int32Values = { FuelType::FUEL_TYPE_UNLEADED, FuelType::FUEL_TYPE_ELECTRIC }" }, { "name": "INFO_EV_BATTERY_CAPACITY", - "value": 291504390 + "value": 291504390, + "description": "Nominal usable battery capacity for EV or hybrid vehicle\nReturns the nominal battery capacity, if EV or hybrid. This is the total usable battery capacity when the vehicle is new. This value might be different from EV_CURRENT_BATTERY_CAPACITY because EV_CURRENT_BATTERY_CAPACITY returns the real-time usable battery capacity taking into account factors such as battery aging and temperature dependency." }, { "name": "INFO_EV_CONNECTOR_TYPE", @@ -41,7 +48,8 @@ "data_enums": [ "EvConnectorType" ], - "data_enum": "EvConnectorType" + "data_enum": "EvConnectorType", + "description": "List of connectors this EV may use" }, { "name": "Fuel door location", @@ -49,7 +57,8 @@ "data_enums": [ "PortLocationType" ], - "data_enum": "PortLocationType" + "data_enum": "PortLocationType", + "description": "Fuel door location\nThis property must communicate the location of the fuel door on the vehicle. This property does not apply to electric vehicles. That is, if INFO_FUEL_TYPE only contains FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, implement INFO_EV_PORT_LOCATION or INFO_MULTI_EV_PORT_LOCATIONS." }, { "name": "EV port location", @@ -57,7 +66,8 @@ "data_enums": [ "PortLocationType" ], - "data_enum": "PortLocationType" + "data_enum": "PortLocationType", + "description": "EV port location" }, { "name": "INFO_DRIVER_SEAT", @@ -65,11 +75,13 @@ "data_enums": [ "VehicleAreaSeat" ], - "data_enum": "VehicleAreaSeat" + "data_enum": "VehicleAreaSeat", + "description": "Driver's seat location VHAL implementations must ignore the areaId. Use VehicleArea:GLOBAL." }, { "name": "INFO_EXTERIOR_DIMENSIONS", - "value": 289472779 + "value": 289472779, + "description": "Exterior dimensions of vehicle.\nint32Values[0] = height int32Values[1] = length int32Values[2] = width int32Values[3] = width including mirrors int32Values[4] = wheel base int32Values[5] = track width front int32Values[6] = track width rear int32Values[7] = curb to curb turning diameter" }, { "name": "Multiple EV port locations", @@ -77,31 +89,38 @@ "data_enums": [ "PortLocationType" ], - "data_enum": "PortLocationType" + "data_enum": "PortLocationType", + "description": "Multiple EV port locations\nImplement this property if the vehicle has multiple EV ports. Port locations are defined in PortLocationType. For example, a car has one port in front left and one port in rear left: int32Values[0] = PortLocationType::FRONT_LEFT int32Values[0] = PortLocationType::REAR_LEFT" }, { "name": "PERF_ODOMETER", - "value": 291504644 + "value": 291504644, + "description": "Current odometer value of the vehicle" }, { "name": "Speed of the vehicle", - "value": 291504647 + "value": 291504647, + "description": "Speed of the vehicle\nThe value must be positive when the vehicle is moving forward and negative when the vehicle is moving backward. This value is independent of gear value (CURRENT_GEAR or GEAR_SELECTION), for example, if GEAR_SELECTION is GEAR_NEUTRAL, PERF_VEHICLE_SPEED is positive when the vehicle is moving forward, negative when moving backward, and zero when not moving." }, { "name": "PERF_VEHICLE_SPEED_DISPLAY", - "value": 291504648 + "value": 291504648, + "description": "Speed of the vehicle for displays\nSome cars display a slightly slower speed than the actual speed. This is usually displayed on the speedometer." }, { "name": "PERF_STEERING_ANGLE", - "value": 291504649 + "value": 291504649, + "description": "Front bicycle model steering angle for vehicle\nAngle is in degrees. Left is negative.\nThis property is independent of the angle of the steering wheel. This property must communicate the angle of the front wheels with respect to the vehicle, not the angle of the steering wheel." }, { "name": "PERF_REAR_STEERING_ANGLE", - "value": 291504656 + "value": 291504656, + "description": "Rear bicycle model steering angle for vehicle\nAngle is in degrees. Left is negative.\nThis property is independent of the angle of the steering wheel. This property must communicate the angle of the rear wheels with respect to the vehicle, not the angle of the steering wheel." }, { "name": "Temperature of engine coolant", - "value": 291504897 + "value": 291504897, + "description": "Temperature of engine coolant" }, { "name": "Engine oil level", @@ -109,67 +128,83 @@ "data_enums": [ "VehicleOilLevel" ], - "data_enum": "VehicleOilLevel" + "data_enum": "VehicleOilLevel", + "description": "Engine oil level" }, { "name": "Temperature of engine oil", - "value": 291504900 + "value": 291504900, + "description": "Temperature of engine oil" }, { "name": "Engine rpm", - "value": 291504901 + "value": 291504901, + "description": "Engine rpm" }, { "name": "Reports wheel ticks", - "value": 290521862 + "value": 290521862, + "description": "Reports wheel ticks\nThe first element in the vector is a reset count. A reset indicates previous tick counts are not comparable with this and future ones. Some sort of discontinuity in tick counting has occurred.\nThe next four elements represent ticks for individual wheels in the following order: front left, front right, rear right, rear left. All tick counts are cumulative. Tick counts increment when the vehicle moves forward, and decrement when vehicles moves in reverse. The ticks should be reset to 0 when the vehicle is started by the user.\nint64Values[0] = reset count int64Values[1] = front left ticks int64Values[2] = front right ticks int64Values[3] = rear right ticks int64Values[4] = rear left ticks\nconfigArray is used to indicate the micrometers-per-wheel-tick value and which wheels are supported. configArray is set as follows:\nconfigArray[0], bits [0:3] = supported wheels. Uses enum Wheel. For example, if all wheels are supported, then configArray[0] = VehicleAreaWheel::LEFT_FRONT | VehicleAreaWheel::RIGHT_FRONT | VehicleAreaWheel::LEFT_REAR | VehicleAreaWheel::RIGHT_REAR configArray[1] = micrometers per front left wheel tick configArray[2] = micrometers per front right wheel tick configArray[3] = micrometers per rear right wheel tick configArray[4] = micrometers per rear left wheel tick\nNOTE: If a wheel is not supported, its value shall always be set to 0.\nVehiclePropValue.timestamp must be correctly filled in." }, { "name": "Fuel level in milliliters", - "value": 291504903 + "value": 291504903, + "description": "Fuel level in milliliters\nThis property must communicate the current amount of fuel remaining in the vehicle in milliliters. This property does not apply to electric vehicles. That is, if INFO_FUEL_TYPE only contains FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, implement EV_BATTERY_LEVEL.\nValue may not exceed INFO_FUEL_CAPACITY." }, { "name": "Fuel door open", - "value": 287310600 + "value": 287310600, + "description": "Fuel door open\nThis property must communicate whether the fuel door on the vehicle is open or not. This property does not apply to electric vehicles. That is, if INFO_FUEL_TYPE only contains FuelType::FUEL_TYPE_ELECTRIC, this property must not be implemented. For EVs, implement EV_CHARGE_PORT_OPEN.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV_BATTERY_LEVEL", - "value": 291504905 + "value": 291504905, + "description": "Battery level for EV or hybrid vehicle\nReturns the current battery level, if EV or hybrid. This value will not exceed EV_CURRENT_BATTERY_CAPACITY. To calculate the battery percentage, use: (EV_BATTERY_LEVEL\/EV_CURRENT_BATTERY_CAPACITY)*100." }, { "name": "EV_CURRENT_BATTERY_CAPACITY", - "value": 291504909 + "value": 291504909, + "description": "Current usable battery capacity for EV or hybrid vehicle\nReturns the actual value of battery capacity, if EV or hybrid. This property captures the real-time usable battery capacity taking into account factors such as battery aging and temperature dependency. Therefore, this value might be different from INFO_EV_BATTERY_CAPACITY because INFO_EV_BATTERY_CAPACITY returns the nominal battery capacity from when the vehicle was new." }, { "name": "EV charge port open", - "value": 287310602 + "value": 287310602, + "description": "EV charge port open\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV charge port connected", - "value": 287310603 + "value": 287310603, + "description": "EV charge port connected" }, { "name": "EV_BATTERY_INSTANTANEOUS_CHARGE_RATE", - "value": 291504908 + "value": 291504908, + "description": "EV instantaneous charge rate in milliwatts\nPositive value indicates battery is being charged. Negative value indicates battery being discharged." }, { "name": "Range remaining", - "value": 291504904 + "value": 291504904, + "description": "Range remaining\nMeters remaining of fuel and charge. Range remaining shall account for all energy sources in a vehicle. For example, a hybrid car's range will be the sum of the ranges based on fuel and battery.\nThis property is defined as VehiclePropertyAccess.READ_WRITE because a navigation app could update the range if it has a more accurate estimate based on the upcoming route. However, this property can be implemented as VehiclePropertyAccess.READ only at the OEM's discretion." }, { "name": "EV battery average temperature", - "value": 291504910 + "value": 291504910, + "description": "EV battery average temperature\nExposes the temperature of the battery in an EV. If multiple batteries exist in the EV, or multiple temperature sensors exist, this property should be set to the mean or a meaningful weighted average that best represents the overall temperature of the battery system." }, { "name": "Tire pressure", - "value": 392168201 + "value": 392168201, + "description": "Tire pressure\nEach tires is identified by its areaConfig.areaId config and their minFloatValue\/maxFloatValue are used to store OEM recommended pressure range. The minFloatValue and maxFloatValue in VehicleAreaConfig must be defined. The minFloatValue in the areaConfig data represents the lower bound of the recommended tire pressure. The maxFloatValue in the areaConfig data represents the upper bound of the recommended tire pressure. For example: The following areaConfig indicates the recommended tire pressure of left_front tire is from 200.0 KILOPASCAL to 240.0 KILOPASCAL. .areaConfigs = { VehicleAreaConfig { .areaId = VehicleAreaWheel::LEFT_FRONT, .minFloatValue = 200.0, .maxFloatValue = 240.0, } }," }, { "name": "Critically low tire pressure", - "value": 392168202 + "value": 392168202, + "description": "Critically low tire pressure\nThis property indicates the critically low pressure threshold for each tire. It indicates when it is time for tires to be replaced or fixed. The value must be less than or equal to minFloatValue in TIRE_PRESSURE. Minimum and maximum property values (that is, minFloatValue, maxFloatValue) are not applicable to this property." }, { "name": "ENGINE_IDLE_AUTO_STOP_ENABLED", - "value": 287310624 + "value": 287310624, + "description": "Represents feature for engine idle automatic stop.\nIf true, the vehicle may automatically shut off the engine when it is not needed and then automatically restart it when needed.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Impact detected.", @@ -177,7 +212,8 @@ "data_enums": [ "ImpactSensorLocation" ], - "data_enum": "ImpactSensorLocation" + "data_enum": "ImpactSensorLocation", + "description": "Impact detected.\nBit flag property to relay information on whether an impact has occurred on a particular side of the vehicle as described through the ImpactSensorLocation enum. As a bit flag property, this property can be set to multiple ORed together values of the enum when necessary.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all bit flags of ImpactSensorLocation are supported." }, { "name": "Currently selected gear", @@ -185,7 +221,8 @@ "data_enums": [ "VehicleGear" ], - "data_enum": "VehicleGear" + "data_enum": "VehicleGear", + "description": "Currently selected gear\nThis is the gear selected by the user.\nValues in the config data must represent the list of supported gears for this vehicle. For example, config data for an automatic transmission must contain {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_PARK, GEAR_DRIVE, GEAR_1, GEAR_2,...} and for manual transmission the list must be {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...}\nIn the case of an automatic transmission vehicle that allows the driver to select specific gears on demand (i.e. \"manual mode\"), GEAR_SELECTION's value must be set to the specific gear selected by the driver instead of simply GEAR_DRIVE." }, { "name": "CURRENT_GEAR", @@ -193,27 +230,33 @@ "data_enums": [ "VehicleGear" ], - "data_enum": "VehicleGear" + "data_enum": "VehicleGear", + "description": "Current gear. In non-manual case, selected gear may not match the current gear. For example, if the selected gear is GEAR_DRIVE, the current gear will be one of GEAR_1, GEAR_2 etc, which reflects the actual gear the transmission is currently running in.\nValues in the config data must represent the list of supported gears for this vehicle. For example, config data for an automatic transmission must contain {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_PARK, GEAR_1, GEAR_2,...} and for manual transmission the list must be {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...}. This list need not be the same as that of the supported gears reported in GEAR_SELECTION." }, { "name": "Parking brake state.", - "value": 287310850 + "value": 287310850, + "description": "Parking brake state.\nThis property is true indicates that the car's parking brake is currently engaged. False implies that the car's parking brake is currently disengaged." }, { "name": "Auto-apply parking brake.", - "value": 287310851 + "value": 287310851, + "description": "Auto-apply parking brake.\nThis property is true indicates that the car's automatic parking brake feature is currently enabled. False indicates that the car's automatic parking brake feature is currently disabled.\nThis property is often confused with PARKING_BRAKE_ON. The difference is that PARKING_BRAKE_ON describes whether the actual parking brake is currently on\/off, whereas PARKING_BRAKE_AUTO_APPLY describes whether the feature of automatic parking brake is enabled\/ disabled, and does not describe the current state of the actual parking brake." }, { "name": "EV_BRAKE_REGENERATION_LEVEL", - "value": 289408012 + "value": 289408012, + "description": "Regenerative braking level of a electronic vehicle\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported. The minInt32Value must be 0.\nThe maxInt32Value indicates the maximum amount of energy regenerated from braking. The minInt32Value indicates no regenerative braking.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Warning for fuel low level.", - "value": 287310853 + "value": 287310853, + "description": "Warning for fuel low level.\nThis property corresponds to the low fuel warning on the dashboard. Once FUEL_LEVEL_LOW is set, it should not be cleared until more fuel is added to the vehicle. This property may take into account all fuel sources for a vehicle - for example:\nFor a gas powered vehicle, this property is based soley on gas level. For a battery powered vehicle, this property is based solely on battery level. For a hybrid vehicle, this property may be based on the combination of gas and battery levels, at the OEM's discretion." }, { "name": "Night mode", - "value": 287310855 + "value": 287310855, + "description": "Night mode\nTrue indicates that the night mode sensor has detected that the car cabin environment has low light. The platform could use this, for example, to enable appropriate UI for better viewing in dark or low light environments." }, { "name": "TURN_SIGNAL_STATE", @@ -221,7 +264,8 @@ "data_enums": [ "VehicleTurnSignal" ], - "data_enum": "VehicleTurnSignal" + "data_enum": "VehicleTurnSignal", + "description": "State of the vehicles turn signals" }, { "name": "Represents ignition state", @@ -229,15 +273,18 @@ "data_enums": [ "VehicleIgnitionState" ], - "data_enum": "VehicleIgnitionState" + "data_enum": "VehicleIgnitionState", + "description": "Represents ignition state" }, { "name": "ABS is active", - "value": 287310858 + "value": 287310858, + "description": "ABS is active\nSet to true when ABS is active. Reset to false when ABS is off. This property may be intermittently set (pulsing) based on the real-time state of the ABS system." }, { "name": "Traction Control is active", - "value": 287310859 + "value": 287310859, + "description": "Traction Control is active\nSet to true when traction control (TC) is active. Reset to false when TC is off. This property may be intermittently set (pulsing) based on the real-time state of the TC system." }, { "name": "EV_STOPPING_MODE", @@ -245,11 +292,13 @@ "data_enums": [ "EvStoppingMode" ], - "data_enum": "EvStoppingMode" + "data_enum": "EvStoppingMode", + "description": "Represents property for the current stopping mode of the vehicle.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless all enum values of EvStoppingMode are supported.\nThe EvStoppingMode enum may be extended to include more states in the future.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "ELECTRONIC_STABILITY_CONTROL_ENABLED", - "value": 287310862 + "value": 287310862, + "description": "Enable or disable Electronic Stability Control (ESC).\nSet true to enable ESC and false to disable ESC. When ESC is enabled, a system in the vehicle should be controlling the tires during instances with high risk of skidding to actively prevent the same from happening.\nIn general, ELECTRONIC_STABILITY_CONTROL_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too high, that information must be conveyed through the ErrorState values in the ELECTRONIC_STABILITY_CONTROL_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "ELECTRONIC_STABILITY_CONTROL_STATE", @@ -258,11 +307,13 @@ "ElectronicStabilityControlState", "ErrorState" ], - "data_enum": "ElectronicStabilityControlState" + "data_enum": "ElectronicStabilityControlState", + "description": "Electronic Stability Control (ESC) state.\nReturns the current state of ESC. This property must always return a valid state defined in ElectronicStabilityControlState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both ElectronicStabilityControlState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "Fan speed setting", - "value": 356517120 + "value": 356517120, + "description": "Fan speed setting\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the lowest fan speed. The maxInt32Value indicates the highest fan speed.\nThis property is not in any particular unit but in a specified range of relative speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Fan direction setting", @@ -270,55 +321,68 @@ "data_enums": [ "VehicleHvacFanDirection" ], - "data_enum": "VehicleHvacFanDirection" + "data_enum": "VehicleHvacFanDirection", + "description": "Fan direction setting\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HVAC current temperature.", - "value": 358614274 + "value": 358614274, + "description": "HVAC current temperature." }, { "name": "HVAC_TEMPERATURE_SET", - "value": 358614275 + "value": 358614275, + "description": "HVAC target temperature set in Celsius.\nThe minFloatValue and maxFloatValue in VehicleAreaConfig must be defined.\nThe minFloatValue indicates the minimum temperature setting in Celsius. The maxFloatValue indicates the maximum temperature setting in Celsius.\nIf all the values between minFloatValue and maxFloatValue are not supported, the configArray can be used to list the valid temperature values that can be set. It also describes a lookup table to convert the temperature from Celsius to Fahrenheit and vice versa for this vehicle. The configArray must be defined if standard unit conversion is not supported on this vehicle.\nThe configArray is set as follows: configArray[0] = [the lower bound of the supported temperature in Celsius] * 10. configArray[1] = [the upper bound of the supported temperature in Celsius] * 10. configArray[2] = [the increment in Celsius] * 10. configArray[3] = [the lower bound of the supported temperature in Fahrenheit] * 10. configArray[4] = [the upper bound of the supported temperature in Fahrenheit] * 10. configArray[5] = [the increment in Fahrenheit] * 10.\nThe minFloatValue and maxFloatValue in VehicleAreaConfig must be equal to configArray[0] and configArray[1] respectively.\nFor example, if the vehicle supports temperature values as: [16.0, 16.5, 17.0 ,..., 28.0] in Celsius [60.5, 61.5, 62.5 ,..., 84.5] in Fahrenheit The configArray should be configArray = {160, 280, 5, 605, 845, 10}.\nIdeally, the ratio of the Celsius increment to the Fahrenheit increment should be as close to the actual ratio of 1 degree Celsius to 1.8 degrees Fahrenheit.\nThere must be a one to one mapping of all Celsius values to Fahrenheit values defined by the configArray. The configArray will be used by clients to convert this property's temperature from Celsius to Fahrenheit. Also, it will let clients know what Celsius value to set the property to achieve their desired Fahreneheit value for the system. If the ECU does not have a one to one mapping of all Celsius values to Fahrenheit values, then the config array should only define the list of Celsius and Fahrenheit values that do have a one to one mapping.\nFor example, if the ECU supports Celsius values from 16 to 28 and Fahrenheit values from 60 to 85 both with an increment of 1, then one possible configArray would be {160, 280, 10, 600, 840, 20}. In this case, 85 would not be a supported temperature.\nAny value set in between a valid value should be rounded to the closest valid value.\nIt is highly recommended that the OEM also implement the HVAC_TEMPERATURE_VALUE_SUGGESTION vehicle property because it provides applications a simple method for determining temperature values that can be set for this vehicle and for converting values between Celsius and Fahrenheit.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HVAC_DEFROSTER", - "value": 320865540 + "value": 320865540, + "description": "Fan-based defrost for designated window.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HVAC_AC_ON", - "value": 354419973 + "value": 354419973, + "description": "On\/off AC for designated areaId\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "On\/off max AC", - "value": 354419974 + "value": 354419974, + "description": "On\/off max AC\nWhen MAX AC is on, the ECU may adjust the vent position, fan speed, temperature, etc as necessary to cool the vehicle as quickly as possible. Any parameters modified as a side effect of turning on\/off the MAX AC parameter shall generate onPropertyEvent() callbacks to the VHAL.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "On\/off max defrost", - "value": 354419975 + "value": 354419975, + "description": "On\/off max defrost\nWhen MAX DEFROST is on, the ECU may adjust the vent position, fan speed, temperature, etc as necessary to defrost the windows as quickly as possible. Any parameters modified as a side effect of turning on\/off the MAX DEFROST parameter shall generate onPropertyEvent() callbacks to the VHAL. The AreaIDs for HVAC_MAX_DEFROST_ON indicate MAX DEFROST can be controlled in the area. For example: areaConfig.areaId = {ROW_1_LEFT | ROW_1_RIGHT} indicates HVAC_MAX_DEFROST_ON only can be controlled for the front rows.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Recirculation on\/off", - "value": 354419976 + "value": 354419976, + "description": "Recirculation on\/off\nControls the supply of exterior air to the cabin. Recirc “on” means the majority of the airflow into the cabin is originating in the cabin. Recirc “off” means the majority of the airflow into the cabin is coming from outside the car.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HVAC_DUAL_ON", - "value": 354419977 + "value": 354419977, + "description": "Enable temperature coupling between areas.\nThe AreaIDs for HVAC_DUAL_ON property shall contain a combination of HVAC_TEMPERATURE_SET AreaIDs that can be coupled together. If HVAC_TEMPERATURE_SET is mapped to AreaIDs [a_1, a_2, ..., a_n], and if HVAC_DUAL_ON can be enabled to couple a_i and a_j, then HVAC_DUAL_ON property must be mapped to [a_i | a_j]. Further, if a_k and a_l can also be coupled together separately then HVAC_DUAL_ON must be mapped to [a_i | a_j, a_k | a_l].\nExample: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). There are two temperature control units -- driver side and passenger side -- which can be optionally synchronized. This may be expressed in the AreaIDs this way: - HVAC_TEMPERATURE_SET->[ROW_1_LEFT | ROW_2_LEFT, ROW_1_RIGHT | ROW_2_CENTER | ROW_2_RIGHT] - HVAC_DUAL_ON->[ROW_1_LEFT | ROW_2_LEFT | ROW_1_RIGHT | ROW_2_CENTER | ROW_2_RIGHT]\nWhen the property is enabled, the ECU must synchronize the temperature for the affected areas. Any parameters modified as a side effect of turning on\/off the DUAL_ON parameter shall generate onPropertyEvent() callbacks to the VHAL. In addition, if setting a temperature (i.e. driver's temperature) changes another temperature (i.e. front passenger's temperature), then the appropriate onPropertyEvent() callbacks must be generated. If a user changes a temperature that breaks the coupling (e.g. setting the passenger temperature independently) then the VHAL must send the appropriate onPropertyEvent() callbacks (i.e. HVAC_DUAL_ON = false, HVAC_TEMPERATURE_SET[AreaID] = xxx, etc).\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HVAC_AUTO_ON", - "value": 354419978 + "value": 354419978, + "description": "On\/off automatic climate control.\nIf true, automatic climate control is on. If false, automatic climate control is off.\nIf the vehicle does not support directly turning off automatic climate control, then OEMs should add logic in their VHAL implementation so that setting HVAC_AUTO_ON to false would change the necessary HVAC settings to indirectly turn off HVAC_AUTO_ON. Ideally, this should not be disruptive to the user, so OEMs should change back to the previous state any settings that were modified once automatic climate control is off. That way the only outcome should be that HVAC_AUTO_ON is off. If restoring the HVAC settings to its previous settings is not possible, then the OEM should choose the least disruptive change and implement that.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat heating\/cooling", - "value": 356517131 + "value": 356517131, + "description": "Seat heating\/cooling\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the maximum seat temperature heating setting. The minInt32Value must be 0, unless the vehicle supports seat cooling as well. In this case, minInt32Value indicates the maximum seat temperature cooling setting.\nThis property is not in any particular unit, but in a specified range of relative temperature settings.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Side Mirror Heat", - "value": 339739916 + "value": 339739916, + "description": "Side Mirror Heat\nIncreasing values denote higher heating levels for side mirrors.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value in the config data represents the maximum heating level. The minInt32Value in the config data MUST be zero and indicates no heating.\nThis property is not in any particular unit but in a specified range of relative heating settings.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Steering Wheel Heating\/Cooling", - "value": 289408269 + "value": 289408269, + "description": "Steering Wheel Heating\/Cooling\nSets the amount of heating\/cooling for the steering wheel.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the maximum steering wheel heating setting. The minInt32Value should be 0, unless the vehicle supports steering wheel cooling as well. In such a case, the minInt32Value indicates the maximum steering wheel cooling setting.\nThis property is not in any particular unit but in a specified range of heating settings.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Temperature units for display", @@ -326,15 +390,18 @@ "data_enums": [ "VehicleUnit" ], - "data_enum": "VehicleUnit" + "data_enum": "VehicleUnit", + "description": "Temperature units for display\nIndicates whether the vehicle is displaying temperature to the user as Celsius or Fahrenheit. VehiclePropConfig.configArray is used to indicate the supported temperature display units. For example: configArray[0] = CELSIUS configArray[1] = FAHRENHEIT\nThis parameter MAY be used for displaying any HVAC temperature in the system. Values must be one of VehicleUnit.CELSIUS or VehicleUnit.FAHRENHEIT Note that internally, all temperatures are represented in floating point Celsius.\nIf updating HVAC_TEMPERATURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, then their values must be updated and communicated to the AAOS framework as well.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Actual fan speed", - "value": 356517135 + "value": 356517135, + "description": "Actual fan speed" }, { "name": "HVAC_POWER_ON", - "value": 354419984 + "value": 354419984, + "description": "Represents global power state for HVAC. Setting this property to false MAY mark some properties that control individual HVAC features\/subsystems to UNAVAILABLE state. Setting this property to true MAY mark some properties that control individual HVAC features\/subsystems to AVAILABLE state (unless any\/all of them are UNAVAILABLE on their own individual merits).\n[Definition] HvacPower_DependentProperties: Properties that need HVAC to be powered on in order to enable their functionality. For example, in some cars, in order to turn on the AC, HVAC must be powered on first.\nHvacPower_DependentProperties list must be set in the VehiclePropConfig.configArray. HvacPower_DependentProperties must only contain properties that are associated with VehicleArea:SEAT. Properties that are not associated with VehicleArea:SEAT, for example, HVAC_DEFROSTER, must never depend on HVAC_POWER_ON property and must never be part of HvacPower_DependentProperties list.\nAreaID mapping for HVAC_POWER_ON property must contain all AreaIDs that HvacPower_DependentProperties are mapped to.\nExample 1: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). If the HVAC features (AC, Temperature etc.) throughout the car are dependent on a single HVAC power controller then HVAC_POWER_ON must be mapped to [ROW_1_LEFT | ROW_1_RIGHT | ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT].\nExample 2: A car has two seats in the front row (ROW_1_LEFT, ROW_1_RIGHT) and three seats in the second (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT) and third rows (ROW_3_LEFT, ROW_3_CENTER, ROW_3_RIGHT). If the car has temperature controllers in the front row which can operate entirely independently of temperature controllers in the back of the vehicle, then HVAC_POWER_ON must be mapped to a two element array: - ROW_1_LEFT | ROW_1_RIGHT - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Fan Positions Available", @@ -342,23 +409,28 @@ "data_enums": [ "VehicleHvacFanDirection" ], - "data_enum": "VehicleHvacFanDirection" + "data_enum": "VehicleHvacFanDirection", + "description": "Fan Positions Available\nThis is a bit mask of fan positions available for the zone. Each available fan direction is denoted by a separate entry in the vector. A fan direction may have multiple bits from vehicle_hvac_fan_direction set. For instance, a typical car may have the following fan positions: - FAN_DIRECTION_FACE (0x1) - FAN_DIRECTION_FLOOR (0x2) - FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR (0x3) - FAN_DIRECTION_DEFROST (0x4) - FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST (0x6)" }, { "name": "Automatic recirculation on\/off", - "value": 354419986 + "value": 354419986, + "description": "Automatic recirculation on\/off\nWhen automatic recirculation is ON, the HVAC system may automatically switch to recirculation mode if the vehicle detects poor incoming air quality.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat ventilation", - "value": 356517139 + "value": 356517139, + "description": "Seat ventilation\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value must be 0. The maxInt32Value indicates the maximum ventilation setting available for the seat.\nThis property is not in any particular unit but in the specified range of ventilation settings.\nUsed by HVAC apps and Assistant to enable, change, or read state of seat ventilation. This is different than seating cooling. It can be on at the same time as cooling, or not.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Electric defrosters' status", - "value": 320865556 + "value": 320865556, + "description": "Electric defrosters' status\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HVAC_TEMPERATURE_VALUE_SUGGESTION", - "value": 291570965 + "value": 291570965, + "description": "Suggested values for setting HVAC temperature.\nImplement the property to help applications understand the closest supported temperature value in Celsius or Fahrenheit.\nfloatValues[0] = the requested value that an application wants to set a temperature to. floatValues[1] = the unit for floatValues[0]. It should be one of {VehicleUnit.CELSIUS, VehicleUnit.FAHRENHEIT}. floatValues[2] = the value OEMs suggested in CELSIUS. This value is not included in the request. floatValues[3] = the value OEMs suggested in FAHRENHEIT. This value is not included in the request.\nAn application calls set(VehiclePropValue propValue) with the requested value and unit for the value. OEMs need to return the suggested values in floatValues[2] and floatValues[3] by onPropertyEvent() callbacks. The suggested values must conform to the values that can be derived from the HVAC_TEMPERATURE_SET configArray. In other words, the suggested values and the table of values from the configArray should be the same. It is recommended for the OEM to add custom logic in their VHAL implementation in order to avoid making requests to the HVAC ECU.\nThe logic can be as follows: For converting the temperature from celsius to fahrenheit use the following: \/\/ Given tempC and the configArray float minTempC = configArray[0] \/ 10.0; float temperatureIncrementCelsius = configArray[2] \/ 10.0; float minTempF = configArray[3] \/ 10.0; float temperatureIncrementFahrenheit = configArray[5] \/ 10.0; \/\/ Round to the closest increment int numIncrements = round((tempC - minTempC) \/ temperatureIncrementCelsius); tempF = temperatureIncrementFahrenheit * numIncrements + minTempF;\nFor example, when a user uses the voice assistant to set HVAC temperature to 66.2 in Fahrenheit. First, an application will set this property with the value [66.2, (float)VehicleUnit.FAHRENHEIT,0,0]. If OEMs suggest to set 19.0 in Celsius or 66.5 in Fahrenheit for user's request, then VHAL must generate a callback with property value [66.2, (float)VehicleUnit.FAHRENHEIT, 19.0, 66.5]. After the voice assistant gets the callback, it will inform the user and set HVAC temperature to the suggested value.\nAnother example, an application receives 21 Celsius as the current temperature value by querying HVC_TEMPERATURE_SET. But the application wants to know what value is displayed on the car's UI in Fahrenheit. For this, the application sets the property to [21, (float)VehicleUnit.CELSIUS, 0, 0]. If the suggested value by the OEM for 21 Celsius is 70 Fahrenheit, then VHAL must generate a callback with property value [21, (float)VehicleUnit.CELSIUS, 21.0, 70.0]. In this case, the application can know that the value is 70.0 Fahrenheit in the car’s UI." }, { "name": "Distance units for display", @@ -366,7 +438,8 @@ "data_enums": [ "VehicleUnit" ], - "data_enum": "VehicleUnit" + "data_enum": "VehicleUnit", + "description": "Distance units for display\nIndicates which units the car is using to display distances to the user. Eg. Mile, Meter Kilometer.\nDistance units are defined in VehicleUnit. VehiclePropConfig.configArray is used to indicate the supported distance display units. For example: configArray[0] = METER configArray[1] = KILOMETER configArray[2] = MILE\nIf updating DISTANCE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, then their values must be updated and communicated to the AAOS framework as well.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Fuel volume units for display", @@ -374,7 +447,8 @@ "data_enums": [ "VehicleUnit" ], - "data_enum": "VehicleUnit" + "data_enum": "VehicleUnit", + "description": "Fuel volume units for display\nIndicates which units the car is using to display fuel volume to the user. Eg. Liter or Gallon.\nVehiclePropConfig.configArray is used to indicate the supported fuel volume display units. Volume units are defined in VehicleUnit. For example: configArray[0] = LITER configArray[1] = GALLON\nIf updating FUEL_VOLUME_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, then their values must be updated and communicated to the AAOS framework as well.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "TIRE_PRESSURE_DISPLAY_UNITS", @@ -382,7 +456,8 @@ "data_enums": [ "VehicleUnit" ], - "data_enum": "VehicleUnit" + "data_enum": "VehicleUnit", + "description": "Tire pressure units for display\nIndicates which units the car is using to display tire pressure to the user. Eg. PSI, Bar or Kilopascal.\nVehiclePropConfig.configArray is used to indicate the supported pressure display units. Pressure units are defined in VehicleUnit. For example: configArray[0] = KILOPASCAL configArray[1] = PSI configArray[2] = BAR\nIf updating TIRE_PRESSURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, then their values must be updated and communicated to the AAOS framework as well.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV battery units for display", @@ -390,71 +465,88 @@ "data_enums": [ "VehicleUnit" ], - "data_enum": "VehicleUnit" + "data_enum": "VehicleUnit", + "description": "EV battery units for display\nIndicates which units the car is using to display EV battery information to the user. Eg. watt-hours(Wh), kilowatt-hours(kWh) or ampere-hours(Ah).\nVehiclePropConfig.configArray is used to indicate the supported electrical energy units. Electrical energy units are defined in VehicleUnit. For example: configArray[0] = WATT_HOUR configArray[1] = AMPERE_HOURS configArray[2] = KILOWATT_HOUR\nIf updating EV_BATTERY_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, then their values must be updated and communicated to the AAOS framework as well.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME", - "value": 287311364 + "value": 287311364, + "description": "Fuel consumption units for display\nIndicates type of units the car is using to display fuel consumption information to user True indicates units are distance over volume such as MPG. False indicates units are volume over distance such as L\/100KM.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Speed units for display", - "value": 289408517 + "value": 289408517, + "description": "Speed units for display\nIndicates type of units the car is using to display speed to user. Eg. m\/s, km\/h, or mph.\nVehiclePropConfig.configArray is used to indicate the supported speed display units. Pressure units are defined in VehicleUnit. For example: configArray[0] = METER_PER_SEC configArray[1] = MILES_PER_HOUR configArray[2] = KILOMETERS_PER_HOUR\nIf updating VEHICLE_SPEED_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, then their values must be updated and communicated to the AAOS framework as well.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EXTERNAL_CAR_TIME", - "value": 290457096 + "value": 290457096, + "description": "Current date and time suggestion for the Car, encoded as Epoch time (in milliseconds). This value denotes the number of milliseconds seconds that have elapsed since 1\/1\/1970 UTC.\nThis property signals a change in CarTime to Android. If the property is supported, VHAL must report the most accurate current CarTime when this property is read, and publish a change to this property when the CarTime value has changed. An on-change event for this property must be published when CarTime changes for any reason other than the natural elapse of time (time delta smaller than 500ms should not trigger an on change event). Android will read and subscribe to this property to fetch time from VHAL. This can be useful to synchronize Android's time with other vehicle systems (dash clock etc). int64Values[0] = provided Epoch time (in milliseconds)\nWhenever a new Value for the property is received, AAOS will create and send an \"ExternalTimeSuggestion\" to the \"TimeDetectorService\". If other sources do not have a higher priority, Android will use this to set the system time. For information on how to adjust time source priorities and how time suggestions are handled (including how Android handles gitter, drift, and minimum resolution) see Time Detector Service documentation.\nNote that the property may take >0 ms to get propagated through the stack and, having a timestamped property helps reduce any time drift. So, for all reads to the property, the timestamp can be used to negate this drift: drift = elapsedTime - PropValue.timestamp effectiveTime = PropValue.value.int64Values[0] + drift\nIt is strongly recommended that this property must not be used to retrieve time from ECUs using protocols (GNSS, NTP, Telephony etc). Since these protocols are already supported by Android, it is recommended to use Android’s own systems for them instead of wiring those through the VHAL using this property.\nWARNING: The value available through this property should not be dependent on value written by Android to ANDROID_EPOCH_TIME property in any way." }, { "name": "ANDROID_EPOCH_TIME", - "value": 290457094 + "value": 290457094, + "description": "Current date and time, encoded as Epoch time (in milliseconds). This value denotes the number of milliseconds seconds that have elapsed since 1\/1\/1970 UTC.\nCarServices will write to this value to give VHAL the Android system's time, if the VHAL supports this property. This can be useful to synchronize other vehicle systems (dash clock etc) with Android's time.\nAAOS writes to this property once during boot, and will thereafter write only when some time-source changes are propagated. AAOS will fill in VehiclePropValue.timestamp correctly. Note that AAOS will not send updates for natural elapse of time. int64Values[0] = provided Unix time (in milliseconds)\nNote that the property may take >0 ms to get propagated through the stack and, having a timestamped property helps reduce any time drift. So, for all writes to the property, the timestamp can be used to negate this drift: drift = elapsedTime - PropValue.timestamp effectiveTime = PropValue.value.int64Values[0] + drift" }, { "name": "STORAGE_ENCRYPTION_BINDING_SEED", - "value": 292554247 + "value": 292554247, + "description": "External encryption binding seed.\nThis value is mixed with the local key storage encryption key. This property holds 16 bytes, and is expected to be persisted on an ECU separate from the IVI. The property is initially set by AAOS, who generates it using a CSRNG. AAOS will then read the property on subsequent boots. The binding seed is expected to be reliably persisted. Any loss of the seed results in a factory reset of the IVI." }, { "name": "Outside temperature", - "value": 291505923 + "value": 291505923, + "description": "Outside temperature\nThis property must communicate the temperature reading of the environment outside the vehicle. If there are multiple sensors for measuring the outside temperature, this property should be populated with the mean or a meaningful weighted average of the readings that will best represent the temperature of the outside environment." }, { "name": "AP_POWER_STATE_REQ", - "value": 289475072 + "value": 289475072, + "description": "Property to control power state of application processor\nIt is assumed that AP's power state is controlled by a separate power controller.\nFor configuration information, VehiclePropConfig.configArray must have bit flag combining values in VehicleApPowerStateConfigFlag.\nint32Values[0] : VehicleApPowerStateReq enum value int32Values[1] : additional parameter relevant for each state, 0 if not used." }, { "name": "AP_POWER_STATE_REPORT", - "value": 289475073 + "value": 289475073, + "description": "Property to report power state of application processor\nIt is assumed that AP's power state is controller by separate power controller.\nint32Values[0] : VehicleApPowerStateReport enum value int32Values[1] : Time in ms to wake up, if necessary. Otherwise 0." }, { "name": "AP_POWER_BOOTUP_REASON", - "value": 289409538 + "value": 289409538, + "description": "Property to report bootup reason for the current power on. This is a static property that will not change for the whole duration until power off. For example, even if user presses power on button after automatic power on with door unlock, bootup reason must stay with VehicleApPowerBootupReason#USER_UNLOCK.\nint32Values[0] must be VehicleApPowerBootupReason." }, { "name": "DISPLAY_BRIGHTNESS", - "value": 289409539 + "value": 289409539, + "description": "Property to represent brightness of the display.\nSome cars have single control for the brightness of all displays and this property is to share change in that control. In cars which have displays whose brightness is controlled separately, they must use PER_DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nIf this is writable, android side can set this value when user changes display brightness from Settings. If this is read only, user may still change display brightness from Settings, but that must not be reflected to other displays." }, { "name": "PER_DISPLAY_BRIGHTNESS", - "value": 289475076 + "value": 289475076, + "description": "Property to represent brightness of the displays which are controlled separately.\nSome cars have one or more displays whose brightness is controlled separately and this property is to inform the brightness of each passenger display. In cars where all displays' brightness is controlled together, they must use DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nThe display port uniquely identifies a physical connector on the device for display output, ranging from 0 to 255.\nint32Values[0] : display port int32Values[1] : brightness" }, { "name": "Valet mode enabled", - "value": 287312389 + "value": 287312389, + "description": "Valet mode enabled\nThis property allows the user to enable\/disable valet mode in their vehicle. Valet mode is a privacy and security setting that prevents an untrusted driver to access more private areas in the vehicle, such as the glove box or the trunk(s).\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Head up display (HUD) enabled", - "value": 354421254 + "value": 354421254, + "description": "Head up display (HUD) enabled\nThis property allows the user to turn on\/off the HUD for their seat.\nEach HUD in the vehicle should be assigned to the seat that is intended to use it. For example, if there is a single HUD in the vehicle that is used by the driver so that they no longer need to continuously look at the instrument cluster, then this property should be defined with a single area ID equal to the driver's seat area value." }, { "name": "HW_KEY_INPUT", - "value": 289475088 + "value": 289475088, + "description": "Property to feed H\/W input events to android\nint32Values[0] : action defined by VehicleHwKeyInputAction int32Values[1] : key code, must use standard android key code int32Values[2] : target display defined in VehicleDisplay. Events not tied to specific display must be sent to VehicleDisplay#MAIN. int32Values[3] : [optional] Number of ticks. The value must be equal or greater than 1. When omitted, Android will default to 1." }, { "name": "HW_KEY_INPUT_V2", - "value": 367004177 + "value": 367004177, + "description": "Property to feed H\/W input events to android\nint32array[0]: target display defined by VehicleDisplay like VehicleDisplay::MAIN, VehicleDisplay::INSTRUMENT_CLUSTER, VehicleDisplay::AUX int32array[1]: key code, must use standard android key code like KEYCODE_HOME, KEYCODE_BACK int32array[2]: action defined in VehicleHwKeyInputAction like VehicleHwKeyInputAction::ACTION_UP, VehicleHwKeyInputAction::ACTION_UP int32array[3]: repeat count of the event. For key down events, this is the repeat count with the first down starting at 0 and counting up from there. For key up events, this is always equal to 0\nint64array[0]: down time, elapsed nanoseconds since boot. Denotes the time of the most recent key down event. For the down event, it will be the event time of the down event itself" }, { "name": "HW_MOTION_INPUT", - "value": 367004178 + "value": 367004178, + "description": "Property to feed H\/W input events to android\nint32array[0]: target display defined by VehicleDisplay like VehicleDisplay::MAIN, VehicleDisplay::INSTRUMENT_CLUSTER, VehicleDisplay::AUX int32array[1]: input type defined in VehicleHwMotionInputSource like VehicleHwMotionInputSource::SOURCE_KEYBOARD, VehicleHwMotionInputSource::SOURCE_DPAD int32array[2]: action code defined in VehicleHwMotionInputAction like VehicleHwMotionInputAction::ACTION_UP, VehicleHwMotionInputAction::ACTION_DOWN int32array[3]: button state flag defined in VehicleHwMotionButtonStateFlag like VehicleHwMotionButtonStateFlag::BUTTON_PRIMARY, VehicleHwMotionButtonStateFlag::BUTTON_SECONDARY int32array[4]: pointer events count, N. N must be a positive integer int32array[5:5+N-1]: pointer id, length N int32array[5+N:5+2*N-1] : tool type, length N. As defined in VehicleHwMotionToolType like VehicleHwMotionToolType::TOOL_TYPE_FINGER, VehicleHwMotionToolType::TOOL_TYPE_STYLUS\nfloatArray[0:N-1] : x data, length N floatArray[N:2*N-1] : y data, length N floatArray[2*N:3*N-1] : pressure data, length N floatArray[3*N:4*N-1] : size data, length N\nint64array[0]: down time, elapsed nanoseconds since boot. Denotes the time when the user originally pressed down to start a stream of position events. For the down event, it will be the event time of the down event itself" }, { "name": "HW_ROTARY_INPUT", @@ -462,7 +554,8 @@ "data_enums": [ "RotaryInputType" ], - "data_enum": "RotaryInputType" + "data_enum": "RotaryInputType", + "description": "Property to feed H\/W rotary events to android\nint32Values[0] : RotaryInputType identifying which rotary knob rotated int32Values[1] : number of detents (clicks), positive for clockwise, negative for counterclockwise int32Values[2] : target display defined in VehicleDisplay. Events not tied to specific display must be sent to VehicleDisplay#MAIN. int32values[3 .. 3 + abs(number of detents) - 2]: nanosecond deltas between pairs of consecutive detents, if the number of detents is > 1 or < -1\nVehiclePropValue.timestamp: when the rotation occurred. If the number of detents is > 1 or < -1, this is when the first detent of rotation occurred." }, { "name": "HW_CUSTOM_INPUT", @@ -470,167 +563,208 @@ "data_enums": [ "CustomInputType" ], - "data_enum": "CustomInputType" + "data_enum": "CustomInputType", + "description": "Defines a custom OEM partner input event.\nThis input event must be used by OEM partners who wish to propagate events not supported by Android. It is composed by an array of int32 values only.\nThe Android properties are:\nint32Values[0] : Input code identifying the function representing this event. Valid event types are defined by CustomInputType.CUSTOM_EVENT_F1 up to CustomInputType.CUSTOM_EVENT_F10. They represent the custom event to be defined by OEM partners. int32Values[1] : target display type defined in VehicleDisplay. Events not tied to specific display must be sent to VehicleDisplay#MAIN. int32Values[2] : repeat counter, if 0 then event is not repeated. Values 1 or above means how many times this event repeated." }, { "name": "Door position", - "value": 373295872 + "value": 373295872, + "description": "Door position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the door is closed. The minInt32Value must be 0. The maxInt32Value indicates the door is fully open.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the closed and fully open positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nSome vehicles (minivans) can open the door electronically. Hence, the ability to write this property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Door move", - "value": 373295873 + "value": 373295873, + "description": "Door move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the door while opening. The minInt32Value represents the maximum movement speed of the door while closing.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the door reaches the positional limit, the value must reset to 0. If DOOR_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Door lock", - "value": 371198722 + "value": 371198722, + "description": "Door lock\n'true' indicates door is locked\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "DOOR_CHILD_LOCK_ENABLED", - "value": 371198723 + "value": 371198723, + "description": "Door child lock feature enabled\nReturns true if the door child lock feature is enabled and false if it is disabled.\nIf enabled, the door is unable to be opened from the inside.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Mirror Z Position", - "value": 339741504 + "value": 339741504, + "description": "Mirror Z Position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the mirror is tilted completely downwards. This must be a non-positive value. The maxInt32Value indicates the mirror is tilted completely upwards. This must be a non-negative value. 0 indicates the mirror is not tilted in either direction.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the fully downward and fully upwards positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Mirror Z Move", - "value": 339741505 + "value": 339741505, + "description": "Mirror Z Move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the mirror while tilting upwards. The minInt32Value represents the maximum movement speed of the mirror while tilting downwards.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the mirror reaches the positional limit, the value must reset to 0. If MIRROR_Z_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Mirror Y Position", - "value": 339741506 + "value": 339741506, + "description": "Mirror Y Position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the mirror is tilted completely to the left. This must be a non-positive value. The maxInt32Value indicates the mirror is tilted completely to the right. This must be a non-negative value. 0 indicates the mirror is not tilted in either direction.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the left extreme and right extreme positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Mirror Y Move", - "value": 339741507 + "value": 339741507, + "description": "Mirror Y Move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the mirror while tilting right. The minInt32Value represents the maximum movement speed of the mirror while tilting left.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the mirror reaches the positional limit, the value must reset to 0. If MIRROR_Y_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Mirror Lock", - "value": 287312708 + "value": 287312708, + "description": "Mirror Lock\nTrue indicates mirror positions are locked and not changeable\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Mirror Fold", - "value": 287312709 + "value": 287312709, + "description": "Mirror Fold\nTrue indicates mirrors are folded\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "MIRROR_AUTO_FOLD_ENABLED", - "value": 337644358 + "value": 337644358, + "description": "Represents property for Mirror Auto Fold feature.\nThis property is true when the feature for automatically folding the vehicle's side mirrors (for example, when the mirrors fold inward automatically when one exits and locks the vehicle) is enabled.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "MIRROR_AUTO_TILT_ENABLED", - "value": 337644359 + "value": 337644359, + "description": "Represents property for Mirror Auto Tilt feature.\nThis property is true when the feature for automatically tilting the vehicle's side mirrors (for example, when the mirrors tilt downward automatically when one reverses the vehicle) is enabled.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat memory select", - "value": 356518784 + "value": 356518784, + "description": "Seat memory select\nThis parameter selects the memory preset to use to select the seat position. The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported. The minInt32Value is always 0, and the maxInt32Value determines the number of seat preset memory slots available (i.e. numSeatPresets - 1).\nFor instance, if the driver's seat has 3 memory presets, the maxInt32Value will be 2. When the user wants to select a preset, the desired preset number (0, 1, or 2) is set." }, { "name": "Seat memory set", - "value": 356518785 + "value": 356518785, + "description": "Seat memory set\nThis setting allows the user to save the current seat position settings into the selected preset slot. The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. The minInt32Value must be 0, and the maxInt32Value for each seat position must match the maxInt32Value for SEAT_MEMORY_SELECT." }, { "name": "Seatbelt buckled", - "value": 354421634 + "value": 354421634, + "description": "Seatbelt buckled\nTrue indicates belt is buckled.\nWrite access indicates automatic seat buckling capabilities. There are no known cars at this time, but you never know...\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seatbelt height position", - "value": 356518787 + "value": 356518787, + "description": "Seatbelt height position\nAdjusts the shoulder belt anchor point.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat belt's shoulder anchor is at its lowest position. The maxInt32Value indicates the seat belt's shoulder anchor is at its highest position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the lowest and highest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seatbelt height move", - "value": 356518788 + "value": 356518788, + "description": "Seatbelt height move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat belt's shoulder anchor while moving upwards. The minInt32Value represents the maximum movement speed of the seat belt's shoulder anchor while moving downwards.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat belt reaches the positional limit, the value must reset to 0. If SEAT_BELT_HEIGHT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat fore\/aft position", - "value": 356518789 + "value": 356518789, + "description": "Seat fore\/aft position\nSets the seat position forward and backwards.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat is at its rearward-most linear position. The maxInt32Value indicates the seat is at its forward-most linear position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the closest and farthest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat fore\/aft move", - "value": 356518790 + "value": 356518790, + "description": "Seat fore\/aft move\nThis property moves the entire seat forward\/backward in the direction that it is facing.\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat while moving forward. The minInt32Value represents the maximum movement speed of the seat while moving backward.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat reaches the positional limit, the value must reset to 0. If SEAT_FORE_AFT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat backrest angle 1 position", - "value": 356518791 + "value": 356518791, + "description": "Seat backrest angle 1 position\nBackrest angle 1 is the actuator closest to the bottom of the seat.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat backrest's full recline position w.r.t the actuator at the bottom of the seat. The maxInt32Value indicates the seat backrest's most upright\/forward position w.r.t the actuator at the bottom of the seat.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the full recline and upright\/forward positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat backrest angle 1 move", - "value": 356518792 + "value": 356518792, + "description": "Seat backrest angle 1 move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat backrest while angling forward. The minInt32Value represents the maximum movement speed of the seat backrest while reclining.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat backrest reaches the positional limit, the value must reset to 0. If SEAT_BACKREST_ANGLE_1_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat backrest angle 2 position", - "value": 356518793 + "value": 356518793, + "description": "Seat backrest angle 2 position\nBackrest angle 2 is the next actuator up from the bottom of the seat.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat backrest's full recline position w.r.t the next actuator in the backrest from the one at the bottom of the seat (see SEAT_BACKREST_ANGLE_1_POS for additional details). The maxInt32Value indicates the seat backrest's most upright\/forward position w.r.t the next actuator in the backrest from the one at the bottom of the seat(see SEAT_BACKREST_ANGLE_1_POS for additional details).\nValues in between minInt32Value and maxInt32Value indicate a transition state between the full recline and upright\/forward positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat backrest angle 2 move", - "value": 356518794 + "value": 356518794, + "description": "Seat backrest angle 2 move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat backrest while angling forward. The minInt32Value represents the maximum movement speed of the seat backrest while reclining.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat backrest reaches the positional limit, the value must reset to 0. If SEAT_BACKREST_ANGLE_2_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat height position", - "value": 356518795 + "value": 356518795, + "description": "Seat height position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat is in its lowest position. The maxInt32Value indicates the seat is in its highest position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the lowest and highest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat height move", - "value": 356518796 + "value": 356518796, + "description": "Seat height move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat while moving upward. The minInt32Value represents the maximum movement speed of the seat while moving downward.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat reaches the positional limit, the value must reset to 0. If SEAT_HEIGHT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat depth position", - "value": 356518797 + "value": 356518797, + "description": "Seat depth position\nSets the seat depth, distance from back rest to front edge of seat.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat is in its shallowest position (i.e. the position with the smallest distance between the front edge of the seat cushion and the rear end of the seat). The maxInt32Value indicates the seat is in its deepest position (i.e. the position with the largest distance between the front edge of the seat cushion and the rear end of the seat).\nValues in between minInt32Value and maxInt32Value indicate a transition state between the shallowest and deepest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat depth move", - "value": 356518798 + "value": 356518798, + "description": "Seat depth move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat while getting deeper The minInt32Value represents the maximum movement speed of the seat while getting shallower.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat backrest reaches the positional limit, the value must reset to 0. If SEAT_DEPTH_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat tilt position", - "value": 356518799 + "value": 356518799, + "description": "Seat tilt position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the seat bottom is angled at its lowest angular position. This corresponds to the seat's front edge at its lowest possible position relative to the rear end of the seat. The maxInt32Value indicates the seat bottom is angled at its highest angular position. This corresponds to the seat's front edge at its highest possible position relative to the rear end of the seat.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the lowest and highest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat tilt move", - "value": 356518800 + "value": 356518800, + "description": "Seat tilt move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the front edge of the seat while moving upward. The minInt32Value represents the maximum movement speed of the front edge of the seat while moving downward.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat bottom reaches the positional limit, the value must reset to 0. If SEAT_TILT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Lumber fore\/aft position", - "value": 356518801 + "value": 356518801, + "description": "Lumber fore\/aft position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the lumbar support is in its rearward most position (i.e. least supportive position). The maxInt32Value indicates the lumbar support is in its forward most position (i.e. most supportive position).\nValues in between minInt32Value and maxInt32Value indicate a transition state between the forward and rearward positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Lumbar fore\/aft move", - "value": 356518802 + "value": 356518802, + "description": "Lumbar fore\/aft move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat's lumbar support while moving forward. The minInt32Value represents the maximum movement speed of the seat's lumbar support while moving backward.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat's lumbar support reaches the positional limit, the value must reset to 0. If SEAT_LUMBAR_FORE_AFT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Lumbar side support position", - "value": 356518803 + "value": 356518803, + "description": "Lumbar side support position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the lumbar side support is in its thinnest position (i.e. most support). The maxInt32Value indicates the lumbar side support is in its widest position (i.e. least support).\nValues in between minInt32Value and maxInt32Value indicate a transition state between the thinnest and widest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Lumbar side support move", - "value": 356518804 + "value": 356518804, + "description": "Lumbar side support move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat's lumbar side support while getting wider. The minInt32Value represents the maximum movement speed of the seat's lumbar side support while getting thinner.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat's lumbar side support reaches the positional limit, the value must reset to 0. If SEAT_LUMBAR_SIDE_SUPPORT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_HEADREST_HEIGHT_POS", - "value": 289409941 + "value": 289409941, + "description": "(Deprecated) Headrest height position\nThis property is deprecated because it is defined as type VehicleArea:GLOBAL, which means all seats use the same value. Use SEAT_HEADREST_HEIGHT_POS_V2 instead which fixes this issue by being defined as type VehicleArea:SEAT.\nSets the headrest height. Max value indicates tallest setting. Min value indicates shortest setting.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Headrest height position", - "value": 356518820 + "value": 356518820, + "description": "Headrest height position\nSets the headrest height for supported seats. VehiclePropConfig.areaConfigs specifies which seats are supported.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the headrest is in its lowest position. The maxInt32Value indicates the headrest is in its highest position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the lowest and highest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Headrest height move", - "value": 356518806 + "value": 356518806, + "description": "Headrest height move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat's headrest while moving up. The minInt32Value represents the maximum movement speed of the seat's headrest while moving down.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat's headrest reaches the positional limit, the value must reset to 0. If SEAT_HEADREST_HEIGHT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Headrest angle position", - "value": 356518807 + "value": 356518807, + "description": "Headrest angle position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the headrest is in its full recline position. The maxInt32Value indicates the headrest is in its most upright\/forward position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the full recline and most upright\/forward positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Headrest angle move", - "value": 356518808 + "value": 356518808, + "description": "Headrest angle move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat's headrest while moving into an upright\/forward position. The minInt32Value represents the maximum movement speed of the seat's headrest while moving into a shallow position.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat's headrest reaches the positional limit, the value must reset to 0. If SEAT_HEADREST_ANGLE_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Headrest fore\/aft position", - "value": 356518809 + "value": 356518809, + "description": "Headrest fore\/aft position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the headrest is in its rearward-most linear position. The maxInt32Value indicates the headrest is in its forward-most linear position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the forward and rearward positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Headrest fore\/aft move", - "value": 356518810 + "value": 356518810, + "description": "Headrest fore\/aft move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat's headrest while moving forward. The minInt32Value represents the maximum movement speed of the seat's headrest while moving backward.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat's headrest reaches the positional limit, the value must reset to 0. If SEAT_HEADREST_FORE_AFT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_FOOTWELL_LIGHTS_STATE", @@ -638,7 +772,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Represents property for the seat footwell lights state.\nSEAT_FOOTWELL_LIGHTS_STATE reflects the current state of the lights at any point in time. This is different from the function of SEAT_FOOTWELL_LIGHTS_SWITCH which represents the position of the switch controlling the lights. Therefore, SEAT_FOOTWELL_LIGHTS_STATE may not match the value of SEAT_FOOTWELL_LIGHTS_SWITCH (e.g. SEAT_FOOTWELL_LIGHTS_SWITCH=AUTOMATIC and SEAT_FOOTWELL_LIGHTS_STATE=ON).\nThis property should only be implemented if SEAT_FOOTWELL_LIGHTS_STATE's value may be different from that of CABIN_LIGHTS_STATE.\nFor each supported area ID, the VehicleAreaConfig#supportedEnumValues must be defined unless all enum values of VehicleLightState are supported." }, { "name": "SEAT_FOOTWELL_LIGHTS_SWITCH", @@ -646,15 +781,18 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Represents property for the seat footwell lights switch.\nSEAT_FOOTWELL_LIGHTS_SWITCH represents the position of the switch controlling the lights. This is different from the function of SEAT_FOOTWELL_LIGHTS_STATE which reflects the current state of the lights at any point in time. Therefore, SEAT_FOOTWELL_LIGHTS_SWITCH may not match the value of SEAT_FOOTWELL_LIGHTS_STATE (e.g. SEAT_FOOTWELL_LIGHTS_SWITCH=AUTOMATIC and SEAT_FOOTWELL_LIGHTS_STATE=ON).\nThis property should only be implemented if SEAT_FOOTWELL_LIGHTS_SWITCH's value may be different from that of CABIN_LIGHTS_SWITCH.\nFor each supported area ID, the VehicleAreaConfig#supportedEnumValues must be defined unless all enum values of VehicleLightSwitch are supported.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_EASY_ACCESS_ENABLED", - "value": 354421661 + "value": 354421661, + "description": "Represents property for Seat easy access feature.\nIf true, the seat will automatically adjust to make it easier for the occupant to enter and exit the vehicle. Each area ID must map to the seat that the user is trying to enter\/exit with the help of the easy access feature.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_AIRBAG_ENABLED", - "value": 354421662 + "value": 354421662, + "description": "Represents feature to enable\/disable a seat's ability to deploy airbag(s) when triggered (e.g. by a crash).\nIf true, it means the seat's airbags are enabled, and if triggered (e.g. by a crash), they will deploy. If false, it means the seat's airbags are disabled, and they will not deploy under any circumstance. This property does not indicate if the airbags are deployed or not.\nThis property can be set to VehiclePropertyAccess.READ read only for the sake of regulation or safety concerns.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Seat airbags deployed", @@ -662,31 +800,38 @@ "data_enums": [ "VehicleAirbagLocation" ], - "data_enum": "VehicleAirbagLocation" + "data_enum": "VehicleAirbagLocation", + "description": "Seat airbags deployed\nBit flag property to relay information on which airbags have been deployed in the vehicle at each seat, vs which ones are currently still armed. If SEAT_AIRBAG_ENABLED is set to false at a particular areaId, this property should return status code UNAVAILABLE at that areaId.\nEnums apply to each seat, not the global vehicle. For example, VehicleAirbagsLocation#CURTAIN at the driver seat areaId represents whether the driver side curtain airbag has been deployed. Multiple bit flags can be set to indicate that multiple different airbags have been deployed for the seat.\nFor each seat area ID, the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of VehicleAirbagLocation are supported (including OTHER, which is not recommended)." }, { "name": "SEAT_CUSHION_SIDE_SUPPORT_POS", - "value": 356518815 + "value": 356518815, + "description": "Represents property for seat’s hipside (bottom cushion’s side) support position.\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the seat cushion side support is in its widest position (i.e. least support). The minInt32Value indicates the seat cushion side support is in its thinnest position (i.e. most support).\nValues in between minInt32Value and maxInt32Value indicate a transition state between the thinnest and widest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_CUSHION_SIDE_SUPPORT_MOVE", - "value": 356518816 + "value": 356518816, + "description": "Represents property for movement direction and speed of seat cushion side support.\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value represents the maximum movement speed of the seat cushion side support when growing wider (i.e. support is decreasing). The minInt32Value represents the maximum movement speed of the seat cushion side support when growing thinner (i.e. support is increasing).\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat cushion side support reaches the positional limit, the value must reset to 0. If SEAT_CUSHION_SIDE_SUPPORT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_LUMBAR_VERTICAL_POS", - "value": 356518817 + "value": 356518817, + "description": "Represents property for seat’s lumbar support vertical position.\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the lumbar support's highest position. The minInt32Value indicates the lumbar support's lowest position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the lowest and highest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_LUMBAR_VERTICAL_MOVE", - "value": 356518818 + "value": 356518818, + "description": "Represents property for vertical movement direction and speed of seat lumbar support.\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the lumbar support is moving at the fastest upward speed. The minInt32Value indicates the lumbar support is moving at the fastest downward speed.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the seat cushion side support reaches the positional limit, the value must reset to 0. If SEAT_LUMBAR_VERTICAL_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_WALK_IN_POS", - "value": 356518819 + "value": 356518819, + "description": "Represents property that indicates the current walk-in position of the seat.\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the normal seat position. The minInt32Value must be 0. The maxInt32Value indicates the seat is in the full walk-in position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the normal and walk-in positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThe area ID must match the seat that actually moves when the walk-in feature activates, not the intended seat the passengers will sit in.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SEAT_BELT_PRETENSIONER_DEPLOYED", - "value": 354421670 + "value": 354421670, + "description": "Seat belt pretensioner deployed.\nProperty to relay information on whether the seat belt pretensioner has been deployed for a particular seat due to a collision. This is different from the regular seat belt tightening system that continuously adds tension to the seat belts so that they fit snugly around the person sitting in the seat, nor is it the seat belt retractor system that locks the seat belt in place during sudden brakes or when the user jerks the seat belt.\nIf this property is dependant on the state of other properties, and those properties are currently in the state that doesn't support this property, this should return StatusCode#NOT_AVAILABLE" }, { "name": "Seat Occupancy", @@ -694,23 +839,28 @@ "data_enums": [ "VehicleSeatOccupancyState" ], - "data_enum": "VehicleSeatOccupancyState" + "data_enum": "VehicleSeatOccupancyState", + "description": "Seat Occupancy\nIndicates whether a particular seat is occupied or not, to the best of the car's ability to determine. Valid values are from the VehicleSeatOccupancyState enum." }, { "name": "Window Position", - "value": 322964416 + "value": 322964416, + "description": "Window Position\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates the window is closed\/fully open out of plane. If the window cannot open out of plane, then minInt32Value is the position of the window when fully closed and must be 0. If the window can open out of plane, the minInt32Value indicates the window is fully open in its position out of plane and will be a negative value. See the example below for a more detailed explanation. The maxInt32Value indicates the window is fully open.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the closed\/fully open out-of-plane and fully open positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nFor example, this is how the property should work for a window that can move out of plane: For a window that may open out of plane (i.e. vent mode of sunroof) this parameter will work with negative values as follows: Max = sunroof completely open 0 = sunroof closed. Min = sunroof vent completely open\nNote that in this mode, 0 indicates the window is closed.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Window Move", - "value": 322964417 + "value": 322964417, + "description": "Window Move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the window is opening in plane\/closing in the out of plane direction at the fastest speed. The minInt32Value indicates the window is closing in plane\/opening in the out of plane direction at the fastest speed.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the window reaches the positional limit, the value must reset to 0. If WINDOW_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nFor a window that may open out of plane (i.e. vent mode of sunroof) this parameter will work as follows:\nIf sunroof is open: Max = open the sunroof further, automatically stop when fully open. Min = close the sunroof, automatically stop when sunroof is closed.\nIf vent is open: Max = close the vent, automatically stop when vent is closed. Min = open the vent further, automatically stop when vent is fully open.\nIf sunroof is in the closed position: Max = open the sunroof, automatically stop when sunroof is fully open. Min = open the vent, automatically stop when vent is fully open.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Window Lock", - "value": 320867268 + "value": 320867268, + "description": "Window Lock\nTrue indicates windows are locked and can't be moved.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "WINDSHIELD_WIPERS_PERIOD", - "value": 322964421 + "value": 322964421, + "description": "Windshield wipers period (milliseconds).\nReturns the instantaneous time period for 1 full cycle of the windshield wipers in milliseconds. A full cycle is defined as a wiper moving from and returning to its rest position.\nWhen an intermittent wiper setting is selected, this property value must be set to 0 during the \"pause\" period of the intermittent wiping.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. The maxInt32Value for each area ID must specify the longest wiper period. The minInt32Value must be set to 0 for each area ID." }, { "name": "Windshield wipers state.", @@ -718,7 +868,8 @@ "data_enums": [ "WindshieldWipersState" ], - "data_enum": "WindshieldWipersState" + "data_enum": "WindshieldWipersState", + "description": "Windshield wipers state.\nReturns the current state of the windshield wipers. The value of WINDSHIELD_WIPERS_STATE may not match the value of WINDSHIELD_WIPERS_SWITCH. (e.g. WINDSHIELD_WIPERS_STATE = ON and WINDSHIELD_WIPERS_SWITCH = WindshieldWipersSwitch#AUTO).\nIf WINDSHIELD_WIPERS_STATE = ON and WINDSHIELD_WIPERS_PERIOD is implemented, then WINDSHIELD_WIPERS_PERIOD must reflect the time period of 1 full cycle of the wipers.\nFor each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined unless all states in WindshieldWipersState are supported (including OTHER, which is not recommended)." }, { "name": "Windshield wipers switch.", @@ -726,91 +877,113 @@ "data_enums": [ "WindshieldWipersSwitch" ], - "data_enum": "WindshieldWipersSwitch" + "data_enum": "WindshieldWipersSwitch", + "description": "Windshield wipers switch.\nRepresents the position of the switch controlling the windshield wipers. The value of WINDSHIELD_WIPERS_SWITCH may not match the value of WINDSHIELD_WIPERS_STATE (e.g. WINDSHIELD_WIPERS_SWITCH = AUTO and WINDSHIELD_WIPERS_STATE = WindshieldWipersState#ON).\nFor each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined unless all states in WindshieldWipersSwitch are supported (including OTHER, which is not recommended).\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only.\nIf this property is implemented as VehiclePropertyAccess.READ_WRITE and the OTHER state is listed in the VehicleAreaConfig#supportedEnumValues array, then OTHER is not a supported value for writing. It is only a supported value for reading." }, { "name": "Steering wheel depth position", - "value": 289410016 + "value": 289410016, + "description": "Steering wheel depth position\nAll steering wheel properties' unique ids start from 0x0BE0.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the steering wheel position furthest from the driver. The minInt32Value indicates the steering wheel position closest to the driver.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the closest and furthest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Steering wheel depth movement", - "value": 289410017 + "value": 289410017, + "description": "Steering wheel depth movement\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the steering wheel moving away from the driver. The minInt32Value indicates the steering wheel moving towards the driver.\nLarger integers, either positive or negative, indicate a faster movement speed. Once the steering wheel reaches the positional limit, the value must reset to 0. If STEERING_WHEEL_DEPTH_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Steering wheel height position", - "value": 289410018 + "value": 289410018, + "description": "Steering wheel height position\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the steering wheel being in the highest position. The minInt32Value indicates the steering wheel being in the lowest position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the lowest and highest positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Steering wheel height movement", - "value": 289410019 + "value": 289410019, + "description": "Steering wheel height movement\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the steering wheel moving upwards. The minInt32Value indicates the steering wheel moving downwards.\nLarger integers, either positive or negative, indicate a faster movement speed. Once the steering wheel reaches the positional limit, the value must reset to 0. If STEERING_WHEEL_HEIGHT_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "STEERING_WHEEL_THEFT_LOCK_ENABLED", - "value": 287312868 + "value": 287312868, + "description": "Steering wheel theft lock feature enabled\nIf true, the steering wheel will lock automatically to prevent theft in certain situations.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Steering wheel locked", - "value": 287312869 + "value": 287312869, + "description": "Steering wheel locked\nIf true, the steering wheel's position is locked and not changeable.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "STEERING_WHEEL_EASY_ACCESS_ENABLED", - "value": 287312870 + "value": 287312870, + "description": "Steering wheel easy access feature enabled\nIf true, the driver’s steering wheel will automatically adjust to make it easier for the driver to enter and exit the vehicle.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "GLOVE_BOX_DOOR_POS", - "value": 356518896 + "value": 356518896, + "description": "Property that represents the current position of the glove box door.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe minInt32Value indicates that the glove box door is closed. The minInt32Value must be 0. The maxInt32Value indicates that the glove box door is in the fully open position.\nValues in between minInt32Value and maxInt32Value indicate a transition state between the closed and fully open positions.\nThis property is not in any particular unit but in a specified range of relative positions.\nThe area ID must match the seat by which the glove box is intended to be used (e.g. if the front right dashboard has a glove box embedded in it, then the area ID should be SEAT_1_RIGHT).\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Lock or unlock the glove box.", - "value": 354421745 + "value": 354421745, + "description": "Lock or unlock the glove box.\nIf true, the glove box is locked. If false, the glove box is unlocked.\nThe area ID must match the seat by which the glove box is intended to be used (e.g. if the front right dashboard has a glove box embedded in it, then the area ID should be VehicleAreaSeat#ROW_1_RIGHT).\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "VEHICLE_MAP_SERVICE", - "value": 299895808 + "value": 299895808, + "description": "Vehicle Maps Service (VMS) message\nThis property uses MIXED data to communicate vms messages.\nIts contents are to be interpreted as follows: the indices defined in VmsMessageIntegerValuesIndex are to be used to read from int32Values; bytes is a serialized VMS message as defined in the vms protocol which is opaque to the framework;\nIVehicle#get must always return StatusCode::NOT_AVAILABLE." }, { "name": "LOCATION_CHARACTERIZATION", - "value": 289410064 + "value": 289410064, + "description": "Characterization of inputs used for computing location.\nThis property must indicate what (if any) data and sensor inputs are considered by the system when computing the vehicle's location that is shared with Android through the GNSS HAL.\nThe value must return a collection of bit flags. The bit flags are defined in LocationCharacterization. The value must also include exactly one of DEAD_RECKONED or RAW_GNSS_ONLY among its collection of bit flags.\nWhen this property is not supported, it is assumed that no additional sensor inputs are fused into the GNSS updates provided through the GNSS HAL. That is unless otherwise specified through the GNSS HAL interfaces." }, { "name": "ULTRASONICS_SENSOR_POSITION", - "value": 406916128 + "value": 406916128, + "description": "Static data for the position of each ultrasonic sensor installed on the vehicle.\nEach individual sensor is identified by its unique VehicleAreaConfig#areaId and returns the sensor's position formatted as [x, y, z] where:\nint32Values[0] = x, the position of the sensor along the x-axis relative to the origin of the Android Automotive sensor coordinate frame in millimeters int32Values[1] = y, the position of the sensor along the y-axis relative to the origin of the Android Automotive sensor coordinate frame in millimeters. int32Values[2] = z, the position of the sensor along the z-axis relative to the origin of the Android Automotive sensor coordinate frame in millimeters.\nIf the data is aggregated by another ECU, then OEMs have the option of reporting the same reading across all included sensors or reporting a virtual representation of all the included sensors as if they were one sensor." }, { "name": "ULTRASONICS_SENSOR_ORIENTATION", - "value": 409013281 + "value": 409013281, + "description": "Static data for the orientation of each ultrasonic sensor installed on the vehicle.\nEach individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's orientation formatted as [qw, qx, qy, qz] where:\nint32Values[0] = qw, the quaternion coefficient w within the quaterinion (w + xi + yj + zk) describing the rotation of the sensor relative to the Android Automotive sensor coordinate frame. int32Values[1] = qx, the quaternion coefficient x within the quaterinion (w + xi + yj + zk) describing the rotation of the sensor relative to the Android Automotive sensor coordinate frame. int32Values[2] = qy, the quaternion coefficient y within the quaterinion (w + xi + yj + zk) describing the rotation of the sensor relative to the Android Automotive sensor coordinate frame. int32Values[3] = qz, the quaternion coefficient z within the quaterinion (w + xi + yj + zk) describing the rotation of the sensor relative to the Android Automotive sensor coordinate frame.\nThis assumes each sensor uses the same axes conventions as Android Automotive.\nIf the data is aggregated by another ECU, then OEMs have the option of reporting the same reading across all included sensors or reporting a virtual representation of all the included sensors as if they were one sensor." }, { "name": "ULTRASONICS_SENSOR_FIELD_OF_VIEW", - "value": 406916130 + "value": 406916130, + "description": "Static data for the field of view of each ultrasonic sensor in degrees.\nEach individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's field of view formatted as [horizontal, vertical] where:\nint32Values[0] = horizontal, the horizontal field of view for the specified ultrasonic sensor in degrees. int32Values[1] = vertical, the vertical field of view for the associated specified ultrasonic sensor in degrees.\nThis assumes each sensor uses the same axes conventions as Android Automotive.\nIf the data is aggregated by another ECU, then OEMs have the option of reporting the same reading across all included sensors or reporting a virtual representation of all the included sensors as if they were one sensor." }, { "name": "ULTRASONICS_SENSOR_DETECTION_RANGE", - "value": 406916131 + "value": 406916131, + "description": "Static data for the detection range of each ultrasonic sensor in millimeters.\nEach individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's detection range formatted as [minimum, maximum] where:\nint32Values[0] = minimum, the minimum range detectable by the ultrasonic sensor in millimeters. int32Values[1] = maximum, the maximum range detectable by the ultrasonic sensor in millimeters.\nIf the data is aggregated by another ECU, then OEMs have the option of reporting the same reading across all included sensors or reporting a virtual representation of all the included sensors as if they were one sensor." }, { "name": "ULTRASONICS_SENSOR_SUPPORTED_RANGES", - "value": 406916132 + "value": 406916132, + "description": "Static data for the supported ranges of each ultrasonic sensor in millimeters.\nFor ultrasonic sensors that only support readings within a specific range. For example, if an ultrasonic sensor detects an object at 700mm, but can only report that an object has been detected between 500mm and 1000mm.\nEach individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's supported ranges formatted as [range_min_1, range_max_1, range_min_2, range_max_2, ...] where:\nint32Values[0] = range_min_1, the minimum of one supported range by the specified sensor in millimeters, inclusive. int32Values[1] = range_max_1, the maximum of one supported range by the specified sensor in millimeters, inclusive. int32Values[2] = range_min_2, the minimum of another supported range by the specified sensor in millimeters, inclusive. int32Values[3] = range_max_2, the maximum of another supported range by the specified sensor in millimeters, inclusive.\nExample: - Ultrasonic sensor supports the following ranges: - 150mm to 499mm - 500mm to 999mm - 1000mm to 1500mm - The associated supported ranges should be formatted as: - int32Values[0] = 150 - int32Values[1] = 499 - int32Values[2] = 500 - int32Values[3] = 999 - int32Values[4] = 1000 - int32Values[5] = 1500\nIf this property is not defined, all the values within the ULTRASONICS_SENSOR_DETECTION_RANGE for the specified sensor are assumed to be supported.\nIf the data is aggregated by another ECU, then OEMs have the option of reporting the same reading across all included sensors or reporting a virtual representation of all the included sensors as if they were one sensor." }, { "name": "ULTRASONICS_SENSOR_MEASURED_DISTANCE", - "value": 406916133 + "value": 406916133, + "description": "The distance reading of the nearest detected object per sensor in millimeters.\nEach individual sensor is identified by its VehicleAreaConfig#areaId and returns the sensor's measured distance formatted as [distance, distance_error] where:\nint32Values[0] = distance, the measured distance of the nearest object in millimeters. If only a range is supported, this value must be set to the minimum supported distance in the detected range as specified in ULTRASONICS_SENSOR_SUPPORTED_RANGES. int32Values[1] = distance_error, the error of the measured distance value in millimeters.\nIf no object is detected, an empty vector must be returned. If distance_error is not available then an array of only the measured distance must be returned.\nIf the data is aggregated by another ECU, then OEMs have the option of reporting the same reading across all included sensors or reporting a virtual representation of all the included sensors as if they were one sensor." }, { "name": "OBD2 Live Sensor Data", - "value": 299896064 + "value": 299896064, + "description": "OBD2 Live Sensor Data\nReports a snapshot of the current (live) values of the OBD2 sensors available.\nThe configArray is set as follows: configArray[0] = number of vendor-specific integer-valued sensors configArray[1] = number of vendor-specific float-valued sensors\nThe values of this property are to be interpreted as in the following example. Considering a configArray = {2,3} int32Values must be a vector containing Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + 2 elements (that is, 33 elements); floatValues must be a vector containing Obd2FloatSensorIndex.LAST_SYSTEM_INDEX + 3 elements (that is, 73 elements);\nIt is possible for each frame to contain a different subset of sensor values, both system provided sensors, and vendor-specific ones. In order to support that, the bytes element of the property value is used as a bitmask,.\nbytes must have a sufficient number of bytes to represent the total number of possible sensors (in this case, 14 bytes to represent 106 possible values); it is to be read as a contiguous bitmask such that each bit indicates the presence or absence of a sensor from the frame, starting with as many bits as the size of int32Values, immediately followed by as many bits as the size of floatValues.\nFor example, should bytes[0] = 0x4C (0b01001100) it would mean that: int32Values[0 and 1] are not valid sensor values int32Values[2 and 3] are valid sensor values int32Values[4 and 5] are not valid sensor values int32Values[6] is a valid sensor value int32Values[7] is not a valid sensor value Should bytes[5] = 0x61 (0b01100001) it would mean that: int32Values[32] is a valid sensor value floatValues[0 thru 3] are not valid sensor values floatValues[4 and 5] are valid sensor values floatValues[6] is not a valid sensor value" }, { "name": "OBD2 Freeze Frame Sensor Data", - "value": 299896065 + "value": 299896065, + "description": "OBD2 Freeze Frame Sensor Data\nReports a snapshot of the value of the OBD2 sensors available at the time that a fault occurred and was detected.\nA configArray must be provided with the same meaning as defined for OBD2_LIVE_FRAME.\nThe values of this property are to be interpreted in a similar fashion as those for OBD2_LIVE_FRAME, with the exception that the stringValue field may contain a non-empty diagnostic troubleshooting code (DTC).\nA IVehicle#get request of this property must provide a value for int64Values[0]. This will be interpreted as the timestamp of the freeze frame to retrieve. A list of timestamps can be obtained by a IVehicle#get of OBD2_FREEZE_FRAME_INFO.\nShould no freeze frame be available at the given timestamp, a response of NOT_AVAILABLE must be returned by the implementation. Because vehicles may have limited storage for freeze frames, it is possible for a frame request to respond with NOT_AVAILABLE even if the associated timestamp has been recently obtained via OBD2_FREEZE_FRAME_INFO." }, { "name": "OBD2 Freeze Frame Information", - "value": 299896066 + "value": 299896066, + "description": "OBD2 Freeze Frame Information\nThis property describes the current freeze frames stored in vehicle memory and available for retrieval via OBD2_FREEZE_FRAME.\nThe values are to be interpreted as follows: each element of int64Values must be the timestamp at which a a fault code has been detected and the corresponding freeze frame stored, and each such element can be used as the key to OBD2_FREEZE_FRAME to retrieve the corresponding freeze frame." }, { "name": "OBD2 Freeze Frame Clear", - "value": 299896067 + "value": 299896067, + "description": "OBD2 Freeze Frame Clear\nThis property allows deletion of any of the freeze frames stored in vehicle memory, as described by OBD2_FREEZE_FRAME_INFO.\nThe configArray is set as follows: configArray[0] = 1 if the implementation is able to clear individual freeze frames by timestamp, 0 otherwise\nIVehicle#set of this property is to be interpreted as follows: if int64Values contains no elements, then all frames stored must be cleared; if int64Values contains one or more elements, then frames at the timestamps stored in int64Values must be cleared, and the others not cleared. Should the vehicle not support selective clearing of freeze frames, this latter mode must return NOT_AVAILABLE." }, { "name": "Headlights State", @@ -818,7 +991,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Headlights State\nReturn the current state of headlights." }, { "name": "High beam lights state", @@ -826,7 +1000,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "High beam lights state\nReturn the current state of high beam lights." }, { "name": "Fog light state", @@ -834,7 +1009,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Fog light state\nReturn the current state of fog lights.\nIf the car has both front and rear fog lights: If front and rear fog lights can only be controlled together: FOG_LIGHTS_STATE must be implemented. FRONT_FOG_LIGHTS_STATE and REAR_FOG_LIGHTS_STATE must not be implemented.\nIf the front and rear fog lights can only be controlled independently: FOG_LIGHTS_STATE must not be implemented. FRONT_FOG_LIGHTS_STATE and REAR_FOG_LIGHTS_STATE must be implemented.\nIf the car has only front fog lights: Only one of FOG_LIGHTS_STATE or FRONT_FOG_LIGHTS_STATE must be implemented and not both. REAR_FOG_LIGHTS_STATE must not be implemented.\nIf the car has only rear fog lights: Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented and not both. FRONT_FOG_LIGHTS_STATE must not be implemented." }, { "name": "Hazard light status", @@ -842,7 +1018,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Hazard light status\nReturn the current status of hazard lights." }, { "name": "Headlight switch", @@ -850,7 +1027,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Headlight switch\nThe setting that the user wants.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "High beam light switch", @@ -858,7 +1036,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "High beam light switch\nThe setting that the user wants.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Fog light switch", @@ -866,7 +1045,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Fog light switch\nThe setting that the user wants.\nIf the car has both front and rear fog lights: If front and rear fog lights can only be controlled together: FOG_LIGHTS_SWITCH must be implemented. FRONT_FOG_LIGHTS_SWITCH and REAR_FOG_LIGHTS_SWITCH must not be implemented.\nIf the front and rear fog lights can only be controlled independently: FOG_LIGHTS_SWITCH must not be implemented. FRONT_FOG_LIGHTS_SWITCH and REAR_FOG_LIGHTS_SWITCH must be implemented.\nIf the car has only front fog lights: Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented and not both. REAR_FOG_LIGHTS_SWITCH must not be implemented.\nIf the car has only rear fog lights: Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented and not both. FRONT_FOG_LIGHTS_SWITCH must not be implemented.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Hazard light switch", @@ -874,7 +1054,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Hazard light switch\nThe setting that the user wants.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Cabin lights", @@ -882,7 +1063,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Cabin lights\nReturn current status of cabin lights." }, { "name": "Cabin lights switch", @@ -890,7 +1072,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Cabin lights switch\nThe position of the physical switch which controls the cabin lights. This might be different than the CABIN_LIGHTS_STATE if the lights are on because a door is open or because of a voice command. For example, while the switch is in the \"off\" or \"automatic\" position.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Reading lights", @@ -898,7 +1081,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Reading lights\nReturn current status of reading lights." }, { "name": "Reading lights switch", @@ -906,7 +1090,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Reading lights switch\nThe position of the physical switch which controls the reading lights. This might be different than the READING_LIGHTS_STATE if the lights are on because a door is open or because of a voice command. For example, while the switch is in the \"off\" or \"automatic\" position.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Steering wheel lights state", @@ -914,7 +1099,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Steering wheel lights state\nRepresents the current state of the steering wheel lights. This is different from STEERING_WHEEL_LIGHTS_SWITCH which represents the position of the switch controlling the lights. Therefore, STEERING_WHEEL_LIGHTS_STATE may not match the value of STEERING_WHEEL_LIGHTS_SWITCH (e.g. STEERING_WHEEL_LIGHTS_SWITCH=AUTOMATIC and STEERING_WHEEL_LIGHTS_STATE=ON).\nThis property should only be implemented if STEERING_WHEEL_LIGHTS_STATE's value may be different from that of CABIN_LIGHTS_STATE.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless all enum values of VehicleLightState are supported." }, { "name": "Steering wheel lights switch", @@ -922,83 +1108,103 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Steering wheel lights switch\nRepresents the position of the switch controlling the steering wheel lights. This is different from STEERING_WHEEL_LIGHTS_STATE which represents the current state of the steering wheel lights. Therefore, STEERING_WHEEL_LIGHTS_SWITCH may not match the value of STEERING_WHEEL_LIGHTS_STATE (e.g. STEERING_WHEEL_LIGHTS_SWITCH=AUTOMATIC and STEERING_WHEEL_LIGHTS_STATE=ON).\nThis property should only be implemented if STEERING_WHEEL_LIGHTS_SWITCH's value may be different from that of CABIN_LIGHTS_SWITCH.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless all enum values of VehicleLightSwitch are supported.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "SUPPORT_CUSTOMIZE_VENDOR_PERMISSION", - "value": 287313669 + "value": 287313669, + "description": "Support customize permissions for vendor properties\nImplement this property if vehicle hal support customize vendor permissions feature. VehiclePropConfig.configArray is used to indicate vendor properties and permissions which selected for this vendor property. The permission must be one of enum in VehicleVendorPermission. The configArray is set as follows: configArray[n] = propId : property ID for the vendor property configArray[n+1] = one of enums in VehicleVendorPermission. It indicates the permission for reading value of the property. configArray[n+2] = one of enums in VehicleVendorPermission. It indicates the permission for writing value of the property.\nFor example: configArray = { vendor_prop_1, PERMISSION_VENDOR_SEAT_READ, PERMISSION_VENDOR_SEAT_WRITE, vendor_prop_2, PERMISSION_VENDOR_INFO, PERMISSION_NOT_ACCESSIBLE, } If vendor properties are not in this array, they will have the default vendor permission. If vendor chose PERMISSION_NOT_ACCESSIBLE, android will not have access to the property. In the example, Android can not write value for vendor_prop_2." }, { "name": "DISABLED_OPTIONAL_FEATURES", - "value": 286265094 + "value": 286265094, + "description": "Allow disabling optional featurs from vhal.\nThis property reports optional features that should be disabled. All allowed optional features for the system is declared in Car service overlay, config_allowed_optional_car_features. This property allows disabling features defined in the overlay. Without this property, all the features declared in the overlay will be enabled.\nValue read should include all features disabled with ',' separation. ex) \"com.android.car.user.CarUserNoticeService,storage_monitoring\"" }, { "name": "INITIAL_USER_INFO", - "value": 299896583 + "value": 299896583, + "description": "Defines the initial Android user to be used during initialization.\nThis property is called by the Android system when it initializes and it lets the HAL define which Android user should be started.\nThis request is made by setting a VehiclePropValue (defined by InitialUserInfoRequest), and the HAL must respond with a property change event (defined by InitialUserInfoResponse). If the HAL doesn't respond after some time (defined by the Android system), the Android system will proceed as if HAL returned a response of action InitialUserInfoResponseAction:DEFAULT.\nFor example, on first boot, the request could be:\nint32[0]: 42 \/\/ request id (arbitrary number set by Android system) int32[1]: 1 \/\/ InitialUserInfoRequestType::FIRST_BOOT int32[2]: 0 \/\/ id of current user (usersInfo.currentUser.userId) int32[3]: 1 \/\/ flag of current user (usersInfo.currentUser.flags = SYSTEM) int32[4]: 1 \/\/ number of existing users (usersInfo.numberUsers); int32[5]: 0 \/\/ user #0 (usersInfo.existingUsers[0].userId) int32[6]: 1 \/\/ flags of user #0 (usersInfo.existingUsers[0].flags)\nAnd if the HAL want to respond with the creation of an admin user called \"Owner\", the response would be:\nint32[0]: 42 \/\/ must match the request id from the request int32[1]: 2 \/\/ action = InitialUserInfoResponseAction::CREATE int32[2]: -10000 \/\/ userToSwitchOrCreate.userId (not used as user will be created) int32[3]: 8 \/\/ userToSwitchOrCreate.flags = ADMIN string: \"||Owner\" \/\/ userLocales + separator + userNameToCreate\nNotice the string value represents multiple values, separated by ||. The first value is the (optional) system locales for the user to be created (in this case, it's empty, meaning it will use Android's default value), while the second value is the (also optional) name of the to user to be created (when the type of response is InitialUserInfoResponseAction:CREATE). For example, to create the same \"Owner\" user with \"en-US\" and \"pt-BR\" locales, the string value of the response would be \"en-US,pt-BR||Owner\". As such, neither the locale nor the name can have || on it, although a single | is fine.\nNOTE: if the HAL doesn't support user management, then it should not define this property, which in turn would disable the other user-related properties (for example, the Android system would never issue them and user-related requests from the HAL layer would be ignored by the Android System). But if it supports user management, then it must support all core user-related properties (INITIAL_USER_INFO, SWITCH_USER, CREATE_USER, and REMOVE_USER)." }, { "name": "SWITCH_USER", - "value": 299896584 + "value": 299896584, + "description": "Defines a request to switch the foreground Android user.\nThis property is used primarily by the Android System to inform the HAL that the current foreground Android user is switching, but it could also be used by the HAL to request the Android system to switch users - the\nWhen the request is made by Android, it sets a VehiclePropValue and the HAL must responde with a property change event; when the HAL is making the request, it must also do it through a property change event (the main difference is that the request id will be positive in the former case, and negative in the latter; the SwitchUserMessageType will also be different).\nThe format of both request is defined by SwitchUserRequest and the format of the response (when needed) is defined by SwitchUserResponse. How the HAL (or Android System) should proceed depends on the message type (which is defined by the SwitchUserMessageType parameter), as defined below.\n1.LEGACY_ANDROID_SWITCH -----------------------\nCalled by the Android System to indicate the Android user is about to change, when the change request was made in a way that is not integrated with the HAL (for example, through adb shell am switch-user).\nThe HAL can switch its internal user once it receives this request, but it doesn't need to reply back to the Android System. If its internal user cannot be changed for some reason, then it must wait for the SWITCH_USER(type=ANDROID_POST_SWITCH) call to recover (for example, it could issue a SWITCH_USER(type=VEHICLE_REQUEST) to switch back to the previous user), but ideally it should never fail (as switching back could result in a confusing experience for the end user).\nFor example, if the system have users (0, 10, 11) and it's switching from 0 to 11 (where none of them have any special flag), the request would be:\nint32[0]: 42 \/\/ request id int32[1]: 1 \/\/ SwitchUserMessageType::LEGACY_ANDROID_SWITCH int32[2]: 11 \/\/ target user id int32[3]: 0 \/\/ target user flags (none) int32[4]: 10 \/\/ current user int32[5]: 0 \/\/ current user flags (none) int32[6]: 3 \/\/ number of users int32[7]: 0 \/\/ user #0 (Android user id 0) int32[8]: 0 \/\/ flags of user #0 (none) int32[9]: 10 \/\/ user #1 (Android user id 10) int32[10]: 0 \/\/ flags of user #1 (none) int32[11]: 11 \/\/ user #2 (Android user id 11) int32[12]: 0 \/\/ flags of user #2 (none)\n2.ANDROID_SWITCH ---------------- Called by the Android System to indicate the Android user is about to change, but Android will wait for the HAL's response (up to some time) before proceeding.\nThe HAL must switch its internal user once it receives this request, then respond back to Android with a SWITCH_USER(type=VEHICLE_RESPONSE) indicating whether its internal user was switched or not (through the SwitchUserStatus enum).\nFor example, if Android has users (0, 10, 11) and it's switching from 10 to 11 (where none of them have any special flag), the request would be:\nint32[0]: 42 \/\/ request id int32[1]: 2 \/\/ SwitchUserMessageType::ANDROID_SWITCH int32[2]: 11 \/\/ target user id int32[3]: 0 \/\/ target user flags (none) int32[4]: 10 \/\/ current user int32[5]: 0 \/\/ current user flags (none) int32[6]: 3 \/\/ number of users int32[7]: 0 \/\/ 1st user (user 0) int32[8]: 1 \/\/ 1st user flags (SYSTEM) int32[9]: 10 \/\/ 2nd user (user 10) int32[10]: 0 \/\/ 2nd user flags (none) int32[11]: 11 \/\/ 3rd user (user 11) int32[12]: 0 \/\/ 3rd user flags (none)\nIf the request succeeded, the HAL must update the property with:\nint32[0]: 42 \/\/ request id int32[1]: 3 \/\/ messageType = SwitchUserMessageType::VEHICLE_RESPONSE int32[2]: 1 \/\/ status = SwitchUserStatus::SUCCESS\nBut if it failed, the response would be something like:\nint32[0]: 42 \/\/ request id int32[1]: 3 \/\/ messageType = SwitchUserMessageType::VEHICLE_RESPONSE int32[2]: 2 \/\/ status = SwitchUserStatus::FAILURE string: \"108-D'OH!\" \/\/ OEM-specific error message\n3.VEHICLE_RESPONSE ------------------ Called by the HAL to indicate whether a request of type ANDROID_SWITCH should proceed or abort - see the ANDROID_SWITCH section above for more info.\n4.VEHICLE_REQUEST ------------------ Called by the HAL to request that the current foreground Android user is switched.\nThis is useful in situations where Android started as one user, but the vehicle identified the driver as another user. For example, user A unlocked the car using the key fob of user B; the INITIAL_USER_INFO request returned user B, but then a face recognition subsubsystem identified the user as A.\nThe HAL makes this request by a property change event (passing a negative request id), and the Android system will response by issue an ANDROID_POST_SWITCH call which the same request id.\nFor example, if the current foreground Android user is 10 and the HAL asked it to switch to 11, the request would be:\nint32[0]: -108 \/\/ request id int32[1]: 4 \/\/ messageType = SwitchUserMessageType::VEHICLE_REQUEST int32[2]: 11 \/\/ Android user id\nIf the request succeeded and Android has 3 users (0, 10, 11), the response would be:\nint32[0]: -108 \/\/ request id int32[1]: 5 \/\/ messageType = SwitchUserMessageType::ANDROID_POST_SWITCH int32[2]: 11 \/\/ target user id int32[3]: 0 \/\/ target user id flags (none) int32[4]: 11 \/\/ current user int32[5]: 0 \/\/ current user flags (none) int32[6]: 3 \/\/ number of users int32[7]: 0 \/\/ 1st user (user 0) int32[8]: 0 \/\/ 1st user flags (none) int32[9]: 10 \/\/ 2nd user (user 10) int32[10]: 4 \/\/ 2nd user flags (none) int32[11]: 11 \/\/ 3rd user (user 11) int32[12]: 3 \/\/ 3rd user flags (none)\nNotice that both the current and target user ids are the same - if the request failed, then they would be different (i.e, target user would be 11, but current user would still be 10).\n5.ANDROID_POST_SWITCH --------------------- Called by the Android System after a request to switch a user was made.\nThis property is called after switch requests of any type (i.e., LEGACY_ANDROID_SWITCH, ANDROID_SWITCH, or VEHICLE_REQUEST) and can be used to determine if the request succeeded or failed:\n1. When it succeeded, it's called when the Android user is in the unlocked state and the value of the current and target users ids in the response are the same. This would be equivalent to receiving an Intent.ACTION_USER_UNLOCKED in an Android app. 2. When it failed it's called right away and the value of the current and target users ids in the response are different (as the current user didn't change to the target). 3. If a new switch request is made before the HAL responded to the previous one or before the user was unlocked, then the ANDROID_POST_SWITCH request is not made. For example, the driver could accidentally switch to the wrong user which has lock credentials, then switch to the right one before entering the credentials.\nThe HAL can update its internal state once it receives this request, but it doesn't need to reply back to the Android System.\nRequest: the first N values as defined by INITIAL_USER_INFO (where the request-specific value at index 1 is SwitchUserMessageType::ANDROID_POST_SWITCH), then 2 more values for the target user id (i.e., the Android user id that was requested to be switched to) and its flags (as defined by UserFlags).\nResponse: none.\nExample: see VEHICLE_REQUEST section above." }, { "name": "CREATE_USER", - "value": 299896585 + "value": 299896585, + "description": "Called by the Android System after an Android user was created.\nThe HAL can use this property to create its equivalent user.\nThis is an async request: Android makes the request by setting a VehiclePropValue, and HAL must respond with a property change indicating whether the request succeeded or failed. If it failed, the Android system will remove the user.\nThe format of the request is defined by CreateUserRequest and the format of the response by CreateUserResponse.\nFor example, if system had 2 users (0 and 10) and a 3rd one (which is an ephemeral guest) was created, the request would be:\nint32[0]: 42 \/\/ request id int32[1]: 11 \/\/ Android id of the created user int32[2]: 6 \/\/ Android flags (ephemeral guest) of the created user int32[3]: 10 \/\/ current user int32[4]: 0 \/\/ current user flags (none) int32[5]: 3 \/\/ number of users int32[6]: 0 \/\/ 1st user (user 0) int32[7]: 0 \/\/ 1st user flags (none) int32[8]: 10 \/\/ 2nd user (user 10) int32[9]: 0 \/\/ 2nd user flags (none) int32[19]: 11 \/\/ 3rd user (user 11) int32[11]: 6 \/\/ 3rd user flags (ephemeral guest) string: \"ElGuesto\" \/\/ name of the new user\nThen if the request succeeded, the HAL would return:\nint32[0]: 42 \/\/ request id int32[1]: 1 \/\/ CreateUserStatus::SUCCESS\nBut if it failed:\nint32[0]: 42 \/\/ request id int32[1]: 2 \/\/ CreateUserStatus::FAILURE string: \"D'OH!\" \/\/ The meaning is a blackbox - it's passed to the caller (like Settings UI), \/\/ which in turn can take the proper action." }, { "name": "REMOVE_USER", - "value": 299896586 + "value": 299896586, + "description": "Called by the Android System after an Android user was removed.\nThe HAL can use this property to remove its equivalent user.\nThis is write-only call - the Android System is not expecting a reply from the HAL. Hence, this request should not fail - if the equivalent HAL user cannot be removed, then HAL should mark it as inactive or recover in some other way.\nThe request is made by setting the VehiclePropValue with the contents defined by RemoveUserRequest.\nFor example, if system had 3 users (0, 10, and 11) and user 11 was removed, the request would be:\nint32[0]: 42 \/\/ request id int32[1]: 11 \/\/ (Android user id of the removed user) int32[2]: 0 \/\/ (Android user flags of the removed user) int32[3]: 10 \/\/ current user int32[4]: 0 \/\/ current user flags (none) int32[5]: 2 \/\/ number of users int32[6]: 0 \/\/ 1st user (user 0) int32[7]: 0 \/\/ 1st user flags (none) int32[8]: 10 \/\/ 2nd user (user 10) int32[9]: 0 \/\/ 2nd user flags (none)" }, { "name": "USER_IDENTIFICATION_ASSOCIATION", - "value": 299896587 + "value": 299896587, + "description": "Property used to associate (or query the association) the current user with vehicle-specific identification mechanisms (such as key FOB).\nThis is an optional user management property - the OEM could still support user management without defining it. In fact, this property could be used without supporting the core user-related functions described on INITIAL_USER_INFO.\nTo query the association, the Android system gets the property, passing a VehiclePropValue containing the types of associations are being queried, as defined by UserIdentificationGetRequest. The HAL must return right away, returning a VehiclePropValue with a UserIdentificationResponse. Notice that user identification should have already happened while system is booting up and the VHAL implementation should only return the already identified association (like the key FOB used to unlock the car), instead of starting a new association from the get call.\nTo associate types, the Android system sets the property, passing a VehiclePropValue containing the types and values of associations being set, as defined by the UserIdentificationSetRequest. The HAL will then use a property change event (whose VehiclePropValue is defined by UserIdentificationResponse) indicating the current status of the types after the request.\nFor example, to query if the current user (10) is associated with the FOB that unlocked the car and a custom mechanism provided by the OEM, the request would be:\nint32[0]: 42 \/\/ request id int32[1]: 10 (Android user id) int32[2]: 0 (Android user flags) int32[3]: 2 (number of types queried) int32[4]: 1 (1st type queried, UserIdentificationAssociationType::KEY_FOB) int32[5]: 101 (2nd type queried, UserIdentificationAssociationType::CUSTOM_1)\nIf the user is associated with the FOB but not with the custom mechanism, the response would be:\nint32[0]: 42 \/\/ request id int32[1]: 2 (number of associations in the response) int32[2]: 1 (1st type: UserIdentificationAssociationType::KEY_FOB) int32[3]: 2 (1st value: UserIdentificationAssociationValue::ASSOCIATED_CURRENT_USER) int32[4]: 101 (2st type: UserIdentificationAssociationType::CUSTOM_1) int32[5]: 4 (2nd value: UserIdentificationAssociationValue::NOT_ASSOCIATED_ANY_USER)\nThen to associate the user with the custom mechanism, a set request would be made:\nint32[0]: 43 \/\/ request id int32[1]: 10 (Android user id) int32[2]: 0 (Android user flags) int32[3]: 1 (number of associations being set) int32[4]: 101 (1st type: UserIdentificationAssociationType::CUSTOM_1) int32[5]: 1 (1st value: UserIdentificationAssociationSetValue::ASSOCIATE_CURRENT_USER)\nIf the request succeeded, the response would be simply:\nint32[0]: 43 \/\/ request id int32[1]: 1 (number of associations in the response) int32[2]: 101 (1st type: UserIdentificationAssociationType::CUSTOM_1) int32[3]: 1 (1st value: UserIdentificationAssociationValue::ASSOCIATED_CURRENT_USER)\nNotice that the set request adds associations, but doesn't remove the existing ones. In the example above, the end state would be 2 associations (FOB and CUSTOM_1). If we wanted to associate the user with just CUSTOM_1 but not FOB, then the request should have been:\nint32[0]: 43 \/\/ request id int32[1]: 10 (Android user id) int32[2]: 2 (number of types set) int32[3]: 1 (1st type: UserIdentificationAssociationType::KEY_FOB) int32[4]: 2 (1st value: UserIdentificationAssociationValue::DISASSOCIATE_CURRENT_USER) int32[5]: 101 (2nd type: UserIdentificationAssociationType::CUSTOM_1) int32[6]: 1 (2nd value: UserIdentificationAssociationValue::ASSOCIATE_CURRENT_USER)" }, { "name": "Enable\/request an EVS service.", - "value": 289476368 + "value": 289476368, + "description": "Enable\/request an EVS service.\nThe property provides a generalized way to trigger EVS services. VHAL should use this property to request Android to start or stop EVS service.\nint32Values[0] = a type of the EVS service. The value must be one of enums in EvsServiceType. int32Values[1] = the state of the EVS service. The value must be one of enums in EvsServiceState.\nFor example, to enable rear view EVS service, android side can set the property value as [EvsServiceType::REAR_VIEW, EvsServiceState::ON]." }, { "name": "POWER_POLICY_REQ", - "value": 286265121 + "value": 286265121, + "description": "Defines a request to apply power policy.\nVHAL sets this property to change car power policy. Car power policy service subscribes to this property and actually changes the power policy. The request is made by setting the VehiclePropValue with the ID of a power policy which is defined at \/vendor\/etc\/automotive\/power_policy.xml. If the given ID is not defined, car power policy service ignores the request and the current power policy is maintained.\nstring: \"sample_policy_id\" \/\/ power policy ID" }, { "name": "POWER_POLICY_GROUP_REQ", - "value": 286265122 + "value": 286265122, + "description": "Defines a request to set the power polic group used to decide a default power policy per power status transition.\nVHAL sets this property with the ID of a power policy group in order to set the default power policy applied at power status transition. Power policy groups are defined at \/vendor\/etc\/power_policy.xml. If the given ID is not defined, car power policy service ignores the request. Car power policy service subscribes to this property and sets the power policy group. The actual application of power policy takes place when the system power status changes and there is a valid mapped power policy for the new power status.\nstring: \"sample_policy_group_id\" \/\/ power policy group ID" }, { "name": "CURRENT_POWER_POLICY", - "value": 286265123 + "value": 286265123, + "description": "Notifies the current power policy to VHAL layer.\nCar power policy service sets this property when the current power policy is changed.\nstring: \"sample_policy_id\" \/\/ power policy ID" }, { "name": "WATCHDOG_ALIVE", - "value": 290459441 + "value": 290459441, + "description": "Defines an event that car watchdog updates to tell it's alive.\nCar watchdog sets this property to system uptime in milliseconds at every 3 second. During the boot, the update may take longer time." }, { "name": "WATCHDOG_TERMINATED_PROCESS", - "value": 299896626 + "value": 299896626, + "description": "Defines a process terminated by car watchdog and the reason of termination.\nint32Values[0]: 1 \/\/ ProcessTerminationReason showing why a process is terminated. string: \"\/system\/bin\/log\" \/\/ Process execution command." }, { "name": "VHAL_HEARTBEAT", - "value": 290459443 + "value": 290459443, + "description": "Defines an event that VHAL signals to car watchdog as a heartbeat.\nIf VHAL supports this property, VHAL should write system uptime to this property at every 3 second. Car watchdog subscribes to this property and checks if the property is updated at every 3 second. With the buffer time of 3 second, car watchdog waits for a heart beat to be signaled up to 6 seconds from the last heart beat. If it isn’t, car watchdog considers VHAL unhealthy and terminates it. If this property is not supported by VHAL, car watchdog doesn't check VHAL health status." }, { "name": "CLUSTER_SWITCH_UI", - "value": 289410868 + "value": 289410868, + "description": "Starts the ClusterUI in cluster display.\nint32: the type of ClusterUI to show 0 indicates ClusterHome, that is a home screen of cluster display, and provides the default UI and a kind of launcher functionality for cluster display. the other values are followed by OEM's definition." }, { "name": "CLUSTER_DISPLAY_STATE", - "value": 289476405 + "value": 289476405, + "description": "Changes the state of the cluster display.\nBounds: the area to render the cluster Activity. Inset: the area which Activity should avoid from placing any important information.\nint32[0]: on\/off: 0 - off, 1 - on, -1 - don't care int32[1]: Bounds - left: positive number - left position in pixels -1 - don't care (should set all Bounds fields) int32[2]: Bounds - top: same format with 'left' int32[3]: Bounds - right: same format with 'left' int32[4]: Bounds - bottom: same format with 'left' int32[5]: Inset - left: positive number - actual left inset value in pixels -1 - don't care (should set \"don't care\" all Inset fields) int32[6]: Inset - top: same format with 'left' int32[7]: Inset - right: same format with 'left' int32[8]: Inset - bottom: same format with 'left'" }, { "name": "CLUSTER_REPORT_STATE", - "value": 299896630 + "value": 299896630, + "description": "Reports the current display state and ClusterUI state.\nClusterHome will send this message when it handles CLUSTER_SWITCH_UI, CLUSTER_DISPLAY_STATE.\nIn addition, ClusterHome should send this message when it starts for the first time. When ClusterOS receives this message and if the internal expectation is different with the received message, then it should send CLUSTER_SWITCH_UI, CLUSTER_DISPLAY_STATE again to match the state.\nint32[0]: on\/off: 0 - off, 1 - on int32[1]: Bounds - left int32[2]: Bounds - top int32[3]: Bounds - right int32[4]: Bounds - bottom int32[5]: Inset - left int32[6]: Inset - top int32[7]: Inset - right int32[8]: Inset - bottom int32[9]: the type of ClusterUI in the fullscreen or main screen. 0 indicates ClusterHome. the other values are followed by OEM's definition. int32[10]: the type of ClusterUI in sub screen if the currently two UIs are shown. -1 indicates the area isn't used any more. bytes: the array to represent the availability of ClusterUI. 0 indicates non-available and 1 indicates available. For example, let's assume a car supports 3 OEM defined ClusterUI like HOME, MAPS, CALL, and it only supports CALL UI only when the cellular network is available. Then, if the nework is avaibale, it'll send [1 1 1], and if it's out of network, it'll send [1 1 0]." }, { "name": "CLUSTER_REQUEST_DISPLAY", - "value": 289410871 + "value": 289410871, + "description": "Requests to change the cluster display state to show some ClusterUI.\nWhen the current display state is off and ClusterHome sends this message to ClusterOS to request to turn the display on to show some specific ClusterUI. ClusterOS should response this with CLUSTER_DISPLAY_STATE.\nint32: the type of ClusterUI to show" }, { "name": "CLUSTER_NAVIGATION_STATE", - "value": 292556600 + "value": 292556600, + "description": "Informs the current navigation state.\nbytes: the serialized message of NavigationStateProto." }, { "name": "ELECTRONIC_TOLL_COLLECTION_CARD_TYPE", @@ -1006,7 +1212,8 @@ "data_enums": [ "ElectronicTollCollectionCardType" ], - "data_enum": "ElectronicTollCollectionCardType" + "data_enum": "ElectronicTollCollectionCardType", + "description": "Electronic Toll Collection card type.\nThis property indicates the type of ETC card in this vehicle. If the head unit is aware of an ETC card attached to the vehicle, this property should return the type of card attached; otherwise, this property should be UNAVAILABLE." }, { "name": "ELECTRONIC_TOLL_COLLECTION_CARD_STATUS", @@ -1014,7 +1221,8 @@ "data_enums": [ "ElectronicTollCollectionCardStatus" ], - "data_enum": "ElectronicTollCollectionCardStatus" + "data_enum": "ElectronicTollCollectionCardStatus", + "description": "Electronic Toll Collection card status.\nThis property indicates the status of ETC card in this vehicle. If the head unit is aware of an ETC card attached to the vehicle, ELECTRONIC_TOLL_COLLECTION_CARD_TYPE gives that status of the card; otherwise, this property should be UNAVAILABLE." }, { "name": "Front fog lights state", @@ -1022,7 +1230,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Front fog lights state\nReturn the current state of the front fog lights. Only one of FOG_LIGHTS_STATE or FRONT_FOG_LIGHTS_STATE must be implemented. Please refer to the documentation on FOG_LIGHTS_STATE for more information." }, { "name": "Front fog lights switch", @@ -1030,7 +1239,8 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Front fog lights switch\nThe setting that the user wants. Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented. Please refer to the documentation on FOG_LIGHTS_SWITCH for more information.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Rear fog lights state", @@ -1038,7 +1248,8 @@ "data_enums": [ "VehicleLightState" ], - "data_enum": "VehicleLightState" + "data_enum": "VehicleLightState", + "description": "Rear fog lights state\nReturn the current state of the rear fog lights. Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented. Please refer to the documentation on FOG_LIGHTS_STATE for more information." }, { "name": "Rear fog lights switch", @@ -1046,15 +1257,18 @@ "data_enums": [ "VehicleLightSwitch" ], - "data_enum": "VehicleLightSwitch" + "data_enum": "VehicleLightSwitch", + "description": "Rear fog lights switch\nThe setting that the user wants. Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented. Please refer to the documentation on FOG_LIGHTS_SWITCH for more information.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV_CHARGE_CURRENT_DRAW_LIMIT", - "value": 291508031 + "value": 291508031, + "description": "Indicates the maximum current draw threshold for charging set by the user\nconfigArray[0] is used to specify the max current draw allowed by the vehicle in Amperes.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV_CHARGE_PERCENT_LIMIT", - "value": 291508032 + "value": 291508032, + "description": "Indicates the maximum charge percent threshold set by the user\nReturns a float value from 0 to 100.\nconfigArray is used to specify the valid values. For example, if the vehicle supports the following charge percent limit values: [20, 40, 60, 80, 100] then the configArray should be {20, 40, 60, 80, 100} If the configArray is empty then all values from 0 to 100 must be valid.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Charging state of the car", @@ -1062,15 +1276,18 @@ "data_enums": [ "EvChargeState" ], - "data_enum": "EvChargeState" + "data_enum": "EvChargeState", + "description": "Charging state of the car\nReturns the current charging state of the car." }, { "name": "EV_CHARGE_SWITCH", - "value": 287313730 + "value": 287313730, + "description": "Start or stop charging the EV battery\nThe setting that the user wants. Setting this property to true starts the battery charging and setting to false stops charging.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV_CHARGE_TIME_REMAINING", - "value": 289410883 + "value": 289410883, + "description": "Estimated charge time remaining in seconds\nReturns 0 if the vehicle is not charging." }, { "name": "EV_REGENERATIVE_BRAKING_STATE", @@ -1078,7 +1295,8 @@ "data_enums": [ "EvRegenerativeBrakingState" ], - "data_enum": "EvRegenerativeBrakingState" + "data_enum": "EvRegenerativeBrakingState", + "description": "Regenerative braking or one-pedal drive state of the car\nReturns the current state associated with the regenerative braking setting in the car" }, { "name": "TRAILER_PRESENT", @@ -1086,11 +1304,13 @@ "data_enums": [ "TrailerState" ], - "data_enum": "TrailerState" + "data_enum": "TrailerState", + "description": "Indicates if there is a trailer present or not.\nReturns the trailer state of the car." }, { "name": "VEHICLE_CURB_WEIGHT", - "value": 289410886 + "value": 289410886, + "description": "Vehicle’s curb weight in kilograms.\nReturns the vehicle's curb weight in kilograms. Curb weight is the total weight of the vehicle with standard equipment and all necessary operating consumables such as motor oil,transmission oil, brake fluid, coolant, air conditioning refrigerant, and weight of fuel at nominal tank capacity, while not loaded with either passengers or cargo.\nconfigArray[0] is used to specify the vehicle’s gross weight in kilograms. The vehicle’s gross weight is the maximum operating weight of the vehicle as specified by the manufacturer including the vehicle's chassis, body, engine, engine fluids, fuel, accessories, driver, passengers and cargo but excluding that of any trailers." }, { "name": "GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT", @@ -1098,11 +1318,13 @@ "data_enums": [ "GsrComplianceRequirementType" ], - "data_enum": "GsrComplianceRequirementType" + "data_enum": "GsrComplianceRequirementType", + "description": "EU's General security regulation compliance requirement.\nReturns whether general security regulation compliance is required, if so, what type of requirement." }, { "name": "SUPPORTED_PROPERTY_IDS", - "value": 289476424 + "value": 289476424, + "description": "(Deprecated) List of all supported property IDs.\nA list of all supported property IDs (including this property). This property is required for HIDL VHAL to work with large amount of vehicle prop configs where the getAllPropConfigs payload exceeds the binder limitation. This issue is fixed in AIDL version using LargeParcelable in getAllPropConfigs, so this property is deprecated.\nIn HIDL VHAL implementation, if the amount of data returned in getAllPropConfigs exceeds the binder limitation, vendor must support this property and return all the supported property IDs. Car service will divide this list into smaller sub lists and use getPropConfigs([ids]) to query the sub lists. The results will be merged together in Car Service.\nThe config array for this property must contain one int element which is the number of configs per getPropConfigs request by Car Service. This number must be small enough so that each getPropConfigs payload will not exceed binder limitation, however, a smaller number will cause more requests, which increase overhead to fetch all the configs." }, { "name": "SHUTDOWN_REQUEST", @@ -1110,15 +1332,18 @@ "data_enums": [ "VehicleApPowerStateShutdownParam" ], - "data_enum": "VehicleApPowerStateShutdownParam" + "data_enum": "VehicleApPowerStateShutdownParam", + "description": "Request the head unit to be shutdown.\n

This is required for executing a task when the head unit is powered off (remote task feature). After the head unit is powered-on to execute the task, the head unit should be shutdown. The head unit will send this message once the task is finished.\n

This is not for the case when a user wants to shutdown the head unit.\n

This usually involves telling a separate system outside the head unit (e.g. a power controller) to prepare shutting down the head unit.\n

Note that the external system must validate whether this request is valid by checking whether the vehicle is currently in use. If a user enters the vehicle after a SHUTDOWN_REQUEST is sent, then the system must ignore this request. It is recommended to store a VehicleInUse property in the power controller and exposes it through VEHICLE_IN_USE property. A shutdown request must be ignored if VehicleInUse is true.\n

If allowed, the external system will start sending a shutdown signal to the head unit, which will cause VHAL to send SHUTDOWN_PREPARE message to Android. Android will then start the shut down process by handling the message.\n

This property is only for issuing a request and only supports writing. Every time this property value is set, the request to shutdown will be issued no matter what the current property value is. The current property value is meaningless.\n

Since this property is write-only, subscribing is not allowed and no property change event will be generated.\n

The value to set indicates the shutdown option, it must be one of {@code VehicleApPowerStateShutdownParam}, e.g., VehicleApPowerStateShutdownParam.SLEEP_IMMEDIATELY. This shutdown option might not be honored if the system doesn't support such option. In such case, an error will not be returned.\n

For configuration information, VehiclePropConfig.configArray must have bit flag combining values in {@code VehicleApPowerStateConfigFlag} to indicate which shutdown options are supported.\n

Returns error if failed to send the shutdown request to the other system." }, { "name": "VEHICLE_IN_USE", - "value": 287313738 + "value": 287313738, + "description": "Whether the vehicle is currently in use.\n

In-use means a human user is present and is intended to use the vehicle. This doesn't necessarily means the human user is in the vehicle. For example, if the human user unlocks the vehicle remotely, the vehicle is considered in use.\n

If this property is supported:\n

Each time user powers on the vehicle or the system detects the user is present, VEHICLE_IN_USE must be set to true. Each time user powers off the vehicle or the system detects the user is not present, VEHICLE_IN_USE must be set to false.\n

This property is different than AP_POWER_BOOTUP_REASON in the sense that AP_POWER_BOOTUP_REASON is only set once during the system bootup. However, this property might change multiple times during a system bootup cycle.\n

For example, a device is currently not in use. The system bootup to execute a remote task. VEHICLE_IN_USE is false. While the remote task is executing, the user enters the vehicle and powers on the vehicle. VEHICLE_IN_USE is set to true. After a driving session, user powers off the vehicle, VEHICLE_IN_USE is set to false.\n

This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "CLUSTER_HEARTBEAT", - "value": 299896651 + "value": 299896651, + "description": "Sends the heartbeat signal to ClusterOS.\nint64[0]: epochTimeNs int64[1]: the visibility of ClusterUI, 0 - invisible, 1 - visible bytes: the app specific metadata, this can be empty when ClusterHomeService use the heartbeat to deliver the change of the visibility." }, { "name": "VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL", @@ -1126,7 +1351,8 @@ "data_enums": [ "VehicleAutonomousState" ], - "data_enum": "VehicleAutonomousState" + "data_enum": "VehicleAutonomousState", + "description": "Current state of vehicle autonomy.\nDefines the level of autonomy currently engaged in the vehicle from the J3016_202104 revision of the SAE standard levels 0-5, with 0 representing no autonomy and 5 representing full driving automation. These levels should be used in accordance with the standards defined in https:\/\/www.sae.org\/standards\/content\/j3016_202104\/ and https:\/\/www.sae.org\/blog\/sae-j3016-update\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of VehicleAutonomousState are supported." }, { "name": "CAMERA_SERVICE_CURRENT_STATE", @@ -1134,11 +1360,13 @@ "data_enums": [ "CameraServiceState" ], - "data_enum": "CameraServiceState" + "data_enum": "CameraServiceState", + "description": "Reports current state of CarEvsService types.\nInforms other components of current state of each CarEvsService service type with values defined in CameraServiceState. CarEvsService will update this property whenever a service type transitions into a new state.\nint32[0]: Current state of REARVIEW service type. int32[1]: Current state of SURROUNDVIEW service type. int32[2]: Current state of FRONTVIEW service type. int32[3]: Current state of LEFTVIEW service type. int32[4]: Current state of RIGHTVIEW service type. int32[5]: Current state of DRIVERVIEW service type. int32[6]: Current state of FRONT_PASSENGERVIEW service type. int32[7]: Current state of REAR_PASSENGERVIEW service type." }, { "name": "AUTOMATIC_EMERGENCY_BRAKING_ENABLED", - "value": 287313920 + "value": 287313920, + "description": "Enable or disable Automatic Emergency Braking (AEB).\nSet true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the vehicle should be turned on and monitoring to avoid potential collisions. This property should apply for higher speed applications only. For enabling low speed automatic emergency braking, LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED should be used.\nIn general, AUTOMATIC_EMERGENCY_BRAKING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low, that information must be conveyed through the ErrorState values in the AUTOMATIC_EMERGENCY_BRAKING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "AUTOMATIC_EMERGENCY_BRAKING_STATE", @@ -1147,11 +1375,13 @@ "AutomaticEmergencyBrakingState", "ErrorState" ], - "data_enum": "AutomaticEmergencyBrakingState" + "data_enum": "AutomaticEmergencyBrakingState", + "description": "Automatic Emergency Braking (AEB) state.\nReturns the current state of AEB. This property must always return a valid state defined in AutomaticEmergencyBrakingState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead. This property should apply for higher speed applications only. For representing the state of the low speed automatic emergency braking system, LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE should be used.\nIf AEB includes forward collision warnings before activating the brakes, those warnings must be surfaced through the Forward Collision Warning (FCW) properties.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both AutomaticEmergencyBrakingState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "FORWARD_COLLISION_WARNING_ENABLED", - "value": 287313922 + "value": 287313922, + "description": "Enable or disable Forward Collision Warning (FCW).\nSet true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the vehicle should be turned on and monitoring for potential collisions.\nIn general, FORWARD_COLLISION_WARNING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low, that information must be conveyed through the ErrorState values in the FORWARD_COLLISION_WARNING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "FORWARD_COLLISION_WARNING_STATE", @@ -1160,11 +1390,13 @@ "ForwardCollisionWarningState", "ErrorState" ], - "data_enum": "ForwardCollisionWarningState" + "data_enum": "ForwardCollisionWarningState", + "description": "Forward Collision Warning (FCW) state.\nReturns the current state of FCW. This property must always return a valid state defined in ForwardCollisionWarningState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both ForwardCollisionWarningState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "BLIND_SPOT_WARNING_ENABLED", - "value": 287313924 + "value": 287313924, + "description": "Enable and disable Blind Spot Warning (BSW).\nSet true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the vehicle should be turned on and monitoring for objects in the vehicle’s blind spots.\nIn general, BLIND_SPOT_WARNING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low, that information must be conveyed through the ErrorState values in the BLIND_SPOT_WARNING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "BLIND_SPOT_WARNING_STATE", @@ -1173,11 +1405,13 @@ "BlindSpotWarningState", "ErrorState" ], - "data_enum": "BlindSpotWarningState" + "data_enum": "BlindSpotWarningState", + "description": "Blind Spot Warning (BSW) state.\nReturns the current state of BSW. This property must always return a valid state defined in BlindSpotWarningState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nFor each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both BlindSpotWarningState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "LANE_DEPARTURE_WARNING_ENABLED", - "value": 287313926 + "value": 287313926, + "description": "Enable or disable Lane Departure Warning (LDW).\nSet true to enable LDW and false to disable LDW. When LDW is enabled, the ADAS system in the vehicle should be turned on and monitoring if the vehicle is approaching or crossing lane lines, in which case a warning will be given.\nIn general, LANE_DEPARTURE_WARNING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low or too high, that information must be conveyed through the ErrorState values in the LANE_DEPARTURE_WARNING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "LANE_DEPARTURE_WARNING_STATE", @@ -1186,11 +1420,13 @@ "LaneDepartureWarningState", "ErrorState" ], - "data_enum": "LaneDepartureWarningState" + "data_enum": "LaneDepartureWarningState", + "description": "Lane Departure Warning (LDW) state.\nReturns the current state of LDW. This property must always return a valid state defined in LaneDepartureWarningState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both LaneDepartureWarningState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "LANE_KEEP_ASSIST_ENABLED", - "value": 287313928 + "value": 287313928, + "description": "Enable or disable Lane Keep Assist (LKA).\nSet true to enable LKA and false to disable LKA. When LKA is enabled, the ADAS system in the vehicle should be turned on and monitoring if the driver unintentionally drifts toward or over the lane marking. If an unintentional lane departure is detected, the system applies steering control to return the vehicle into the current lane.\nThis is different from Lane Centering Assist (LCA) which, when activated, applies continuous steering control to keep the vehicle centered in the current lane.\nIn general, LANE_KEEP_ASSIST_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low or too high, that information must be conveyed through the ErrorState values in the LANE_KEEP_ASSIST_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Lane Keep Assist (LKA) state.", @@ -1199,11 +1435,13 @@ "LaneKeepAssistState", "ErrorState" ], - "data_enum": "LaneKeepAssistState" + "data_enum": "LaneKeepAssistState", + "description": "Lane Keep Assist (LKA) state.\nReturns the current state of LKA. This property must always return a valid state defined in LaneKeepAssistState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nIf LKA includes lane departure warnings before applying steering corrections, those warnings must be surfaced through the Lane Departure Warning (LDW) properties.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both LaneKeepAssistState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "LANE_CENTERING_ASSIST_ENABLED", - "value": 287313930 + "value": 287313930, + "description": "Enable or disable Lane Centering Assist (LCA).\nSet true to enable LCA and false to disable LCA. When LCA is enabled, the ADAS system in the vehicle should be turned on and waiting for an activation signal from the driver. Once the feature is activated, the ADAS system should be steering the vehicle to keep it centered in its current lane.\nThis is different from Lane Keep Assist (LKA) which monitors if the driver unintentionally drifts toward or over the lane marking. If an unintentional lane departure is detected, the system applies steering control to return the vehicle into the current lane.\nIn general, LANE_CENTERING_ASSIST_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low or too high, that information must be conveyed through the ErrorState values in the LANE_CENTERING_ASSIST_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "LANE_CENTERING_ASSIST_COMMAND", @@ -1211,7 +1449,8 @@ "data_enums": [ "LaneCenteringAssistCommand" ], - "data_enum": "LaneCenteringAssistCommand" + "data_enum": "LaneCenteringAssistCommand", + "description": "Lane Centering Assist (LCA) commands.\nCommands to activate and suspend LCA.\nWhen the command ACTIVATE from LaneCenteringAssistCommand is sent, LANE_CENTERING_ASSIST_STATE must be set to LaneCenteringAssistState#ACTIVATION_REQUESTED. When the ACTIVATE command succeeds, LANE_CENTERING_ASSIST_STATE must be set to LaneCenteringAssistState#ACTIVATED. When the command DEACTIVATE from LaneCenteringAssistCommand succeeds, LANE_CENTERING_ASSIST_STATE must be set to LaneCenteringAssistState#ENABLED.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless all enum values of LaneCenteringAssistCommand are supported.\nWhen this property is not available because LCA is disabled (i.e. LANE_CENTERING_ASSIST_ENABLED is false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If LANE_CENTERING_ASSIST_STATE is implemented and the state is set to an ErrorState value, then this property must return a StatusCode that aligns with the ErrorState value. For example, if LANE_CENTERING_ASSIST_STATE is set to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return StatusCode#NOT_AVAILABLE_SPEED_LOW." }, { "name": "LANE_CENTERING_ASSIST_STATE", @@ -1220,11 +1459,13 @@ "LaneCenteringAssistState", "ErrorState" ], - "data_enum": "LaneCenteringAssistState" + "data_enum": "LaneCenteringAssistState", + "description": "Lane Centering Assist (LCA) state.\nReturns the current state of LCA. This property must always return a valid state defined in LaneCenteringAssistState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nIf LCA includes lane departure warnings, those warnings must be surfaced through the Lane Departure Warning (LDW) properties.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both LaneCenteringAssistState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "EMERGENCY_LANE_KEEP_ASSIST_ENABLED", - "value": 287313933 + "value": 287313933, + "description": "Enable or disable Emergency Lane Keep Assist (ELKA).\nSet true to enable ELKA and false to disable ELKA. When ELKA is enabled, the ADAS system in the vehicle should be on and monitoring for unsafe lane changes by the driver. When an unsafe maneuver is detected, ELKA alerts the driver and applies steering corrections to keep the vehicle in its original lane.\nIn general, EMERGENCY_LANE_KEEP_ASSIST_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low, that information must be conveyed through the ErrorState values in the EMERGENCY_LANE_KEEP_ASSIST_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EMERGENCY_LANE_KEEP_ASSIST_STATE", @@ -1233,11 +1474,13 @@ "EmergencyLaneKeepAssistState", "ErrorState" ], - "data_enum": "EmergencyLaneKeepAssistState" + "data_enum": "EmergencyLaneKeepAssistState", + "description": "Emergency Lane Keep Assist (ELKA) state.\nReturns the current state of ELKA. Generally, this property should return a valid state defined in the EmergencyLaneKeepAssistState or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through ErrorState.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of EmergencyLaneKeepAssistState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "CRUISE_CONTROL_ENABLED", - "value": 287313935 + "value": 287313935, + "description": "Enable or disable cruise control (CC).\nSet true to enable CC and false to disable CC. This property is shared by all forms of CruiseControlType(s).\nWhen CC is enabled, the ADAS system in the vehicle should be turned on and responding to commands.\nIn general, CRUISE_CONTROL_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low, that information must be conveyed through the ErrorState values in the CRUISE_CONTROL_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "CRUISE_CONTROL_TYPE", @@ -1246,7 +1489,8 @@ "CruiseControlType", "ErrorState" ], - "data_enum": "CruiseControlType" + "data_enum": "CruiseControlType", + "description": "Current type of Cruise Control (CC).\nWhen CRUISE_CONTROL_ENABLED is true, this property returns the type of CC that is currently enabled (for example, standard CC, adaptive CC, predictive CC, etc.). Generally, this property should return a valid state defined in the CruiseControlType or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through ErrorState.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of CruiseControlType (including OTHER, which is not recommended) and ErrorState are supported.\nTrying to write CruiseControlType#OTHER or an ErrorState to this property will throw an IllegalArgumentException.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "CRUISE_CONTROL_STATE", @@ -1255,7 +1499,8 @@ "CruiseControlState", "ErrorState" ], - "data_enum": "CruiseControlState" + "data_enum": "CruiseControlState", + "description": "Current state of Cruise Control (CC).\nThis property returns the current state of CC. Generally, this property should return a valid state defined in the CruiseControlState or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through ErrorState.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of CruiseControlState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "CRUISE_CONTROL_COMMAND", @@ -1263,23 +1508,28 @@ "data_enums": [ "CruiseControlCommand" ], - "data_enum": "CruiseControlCommand" + "data_enum": "CruiseControlCommand", + "description": "Write Cruise Control (CC) commands.\nSee CruiseControlCommand for the details about each supported command.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of CruiseControlState are supported. Any unsupported commands sent through this property must return StatusCode#INVALID_ARG.\nWhen this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE is implemented and the state is set to an ErrorState value, then this property must return a StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return StatusCode#NOT_AVAILABLE_SPEED_LOW." }, { "name": "CRUISE_CONTROL_TARGET_SPEED", - "value": 291508243 + "value": 291508243, + "description": "Current target speed for Cruise Control (CC).\nOEMs should set the minFloatValue and maxFloatValue values for this property to define the min and max target speed values. These values must be non-negative.\nThe maxFloatValue represents the upper bound of the target speed. The minFloatValue represents the lower bound of the target speed.\nWhen this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE is implemented and the state is set to an ErrorState value, then this property must return a StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return StatusCode#NOT_AVAILABLE_SPEED_LOW." }, { "name": "ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP", - "value": 289411092 + "value": 289411092, + "description": "Current target time gap for Adaptive Cruise Control (ACC) or Predictive Cruise Control in milliseconds.\nThis property should specify the target time gap to a leading vehicle. This gap is defined as the time to travel the distance between the leading vehicle's rear-most point to the ACC vehicle's front-most point. The actual time gap from a leading vehicle can be above or below this value.\nThe possible values to set for the target time gap should be specified in configArray in ascending order. All values must be positive. If the property is writable, all values must be writable.\nWhen this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE is implemented and the state is set to an ErrorState value, then this property must return a StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return StatusCode#NOT_AVAILABLE_SPEED_LOW.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE", - "value": 289411093 + "value": 289411093, + "description": "Measured distance from leading vehicle when using Adaptive Cruise Control (ACC) or Predictive Cruise Control.\nReturns the measured distance in millimeters between the rear-most point of the leading vehicle and the front-most point of the ACC vehicle.\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. The minInt32Value should be 0. The maxInt32Value should be populated with the maximum range the distance sensor can support. This value should be non-negative.\nWhen no lead vehicle is detected (that is, when there is no leading vehicle or the leading vehicle is too far away for the sensor to detect), this property should return StatusCode.NOT_AVAILABLE.\nWhen this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE is implemented and the state is set to an ErrorState value, then this property must return a StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return StatusCode#NOT_AVAILABLE_SPEED_LOW." }, { "name": "HANDS_ON_DETECTION_ENABLED", - "value": 287313942 + "value": 287313942, + "description": "Enable or disable Hands On Detection (HOD).\nSet true to enable HOD and false to disable HOD. When HOD is enabled, a system inside the vehicle should be monitoring the presence of the driver's hands on the steering wheel and send a warning if it detects that the driver's hands are no longer on the steering wheel.\nIn general, HANDS_ON_DETECTION_ENABLED should always return true or false. If the feature is not available due to some temporary state, that information must be conveyed through the ErrorState values in the HANDS_ON_DETECTION_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "HANDS_ON_DETECTION_DRIVER_STATE", @@ -1288,7 +1538,8 @@ "HandsOnDetectionDriverState", "ErrorState" ], - "data_enum": "HandsOnDetectionDriverState" + "data_enum": "HandsOnDetectionDriverState", + "description": "Hands On Detection (HOD) driver state.\nReturns whether the driver's hands are on the steering wheel. Generally, this property should return a valid state defined in the HandsOnDetectionDriverState or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through ErrorState.\nIf the vehicle wants to send a warning to the user because the driver's hands have been off the steering wheel for too long, the warning should be surfaced through HANDS_ON_DETECTION_WARNING.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both HandsOnDetectionDriverState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "HANDS_ON_DETECTION_WARNING", @@ -1297,11 +1548,13 @@ "HandsOnDetectionWarning", "ErrorState" ], - "data_enum": "HandsOnDetectionWarning" + "data_enum": "HandsOnDetectionWarning", + "description": "Hands On Detection (HOD) warning.\nReturns whether a warning is being sent to the driver for having their hands off the wheel for too long a duration.\nGenerally, this property should return a valid state defined in HandsOnDetectionWarning or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through an ErrorState.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both HandsOnDetectionWarning (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED", - "value": 287313945 + "value": 287313945, + "description": "Enable or disable driver drowsiness and attention monitoring.\nSet true to enable driver drowsiness and attention monitoring and false to disable driver drowsiness and attention monitoring. When driver drowsiness and attention monitoring is enabled, a system inside the vehicle should be monitoring the drowsiness and attention level of the driver and warn the driver if needed.\nIn general, DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED should always return true or false. If the feature is not available due to some temporary state, that information must be conveyed through the ErrorState values in the DRIVER_DROWSINESS_ATTENTION_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "DRIVER_DROWSINESS_ATTENTION_STATE", @@ -1310,11 +1563,13 @@ "DriverDrowsinessAttentionState", "ErrorState" ], - "data_enum": "DriverDrowsinessAttentionState" + "data_enum": "DriverDrowsinessAttentionState", + "description": "Driver drowsiness and attention level state.\nReturns the current detected state of driver drowiness and attention level based on the Karolinska Sleepiness scale. If alternative measurement methods are used, the value should be translated to the Karolinska Sleepiness Scale equivalent.\nGenerally, this property should return a valid state defined in the DriverDrowsinessAttentionState or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through ErrorState.\nIf the vehicle is sending a warning to the user because the driver is too drowsy, the warning should be surfaced through {@link #DRIVER_DROWSINESS_ATTENTION_WARNING}.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both DriverDrowsinessAttentionState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED", - "value": 287313947 + "value": 287313947, + "description": "Enable or disable driver drowsiness and attention warnings.\nSet true to enable driver drowsiness and attention warnings and false to disable driver drowsiness and attention warnings.\nWhen driver drowsiness and attention warnings are enabled, the driver drowsiness and attention monitoring system inside the vehicle should warn the driver when it detects the driver is drowsy or not attentive.\nIn general, DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED should always return true or false. If the feature is not available due to some temporary state, that information must be conveyed through the ErrorState values in the DRIVER_DROWSINESS_ATTENTION_WARNING property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "DRIVER_DROWSINESS_ATTENTION_WARNING", @@ -1323,11 +1578,13 @@ "DriverDrowsinessAttentionWarning", "ErrorState" ], - "data_enum": "DriverDrowsinessAttentionWarning" + "data_enum": "DriverDrowsinessAttentionWarning", + "description": "Driver drowsiness and attention warning.\nReturns whether a warning is being sent to the driver for being drowsy or not attentive.\nGenerally, this property should return a valid state defined in DriverDrowsinessAttentionWarning or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through an ErrorState.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both DriverDrowsinessAttentionWarning (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "DRIVER_DISTRACTION_SYSTEM_ENABLED", - "value": 287313949 + "value": 287313949, + "description": "Enable or disable driver distraction monitoring.\nSet true to enable driver distraction monitoring and false to disable driver distraction monitoring. When driver distraction monitoring is enabled, a system inside the vehicle should be monitoring the distraction level of the driver and warn the driver if needed.\nIn general, DRIVER_DISTRACTION_SYSTEM_ENABLED should always return true or false. If the feature is not available due to some temporary state, that information must be conveyed through the ErrorState values in the DRIVER_DISTRACTION_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Driver distraction state.", @@ -1336,11 +1593,13 @@ "DriverDistractionState", "ErrorState" ], - "data_enum": "DriverDistractionState" + "data_enum": "DriverDistractionState", + "description": "Driver distraction state.\nReturns the current detected driver distraction state.\nGenerally, this property should return a valid state defined in the DriverDistractionState or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through ErrorState.\nIf the vehicle is sending a warning to the user because the driver is too distracted, the warning should be surfaced through {@link #DRIVER_DISTRACTION_WARNING}.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both DriverDistractionState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "DRIVER_DISTRACTION_WARNING_ENABLED", - "value": 287313951 + "value": 287313951, + "description": "Enable or disable driver distraction warnings.\nSet true to enable driver distraction warnings and false to disable driver distraction warnings.\nWhen driver distraction warnings are enabled, the driver distraction monitoring system inside the vehicle should warn the driver when it detects the driver is distracted.\nIn general, DRIVER_DISTRACTION_WARNING_ENABLED should always return true or false. If the feature is not available due to some temporary state, that information must be conveyed through the ErrorState values in the DRIVER_DISTRACTION_WARNING property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Driver distraction warning.", @@ -1349,11 +1608,13 @@ "DriverDistractionWarning", "ErrorState" ], - "data_enum": "DriverDistractionWarning" + "data_enum": "DriverDistractionWarning", + "description": "Driver distraction warning.\nReturns whether a warning is being sent to the driver for being distracted.\nGenerally, this property should return a valid state defined in DriverDistractionWarning or ErrorState. For example, if the feature is not available due to some temporary state, that information should be conveyed through an ErrorState.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both DriverDistractionWarning (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "LOW_SPEED_COLLISION_WARNING_ENABLED", - "value": 287313953 + "value": 287313953, + "description": "Enable or disable Low Speed Collision Warning.\nSet true to enable low speed collision warning and false to disable low speed collision warning. When low speed collision warning is enabled, the ADAS system in the vehicle should warn the driver of potential collisions at low speeds. This property is different from the pre-existing FORWARD_COLLISION_WARNING_ENABLED, which should apply to higher speed applications only. If the vehicle doesn't have a separate collision detection system for low speed environments, this property should not be implemented.\nIn general, LOW_SPEED_COLLISION_WARNING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too high, that information must be conveyed through the ErrorState values in the LOW_SPEED_COLLISION_WARNING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "LOW_SPEED_COLLISION_WARNING_STATE", @@ -1362,11 +1623,13 @@ "LowSpeedCollisionWarningState", "ErrorState" ], - "data_enum": "LowSpeedCollisionWarningState" + "data_enum": "LowSpeedCollisionWarningState", + "description": "Low Speed Collision Warning state.\nReturns the current state of Low Speed Collision Warning. This property must always return a valid state defined in LowSpeedCollisionWarningState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead. This property is different from the pre-existing FORWARD_COLLISION_WARNING_STATE, which should apply to higher speed applications only. If the vehicle doesn't have a separate collision detection system for low speed environments, this property should not be implemented.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both LowSpeedCollisionWarningState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "CROSS_TRAFFIC_MONITORING_ENABLED", - "value": 287313955 + "value": 287313955, + "description": "Enable or disable Cross Traffic Monitoring.\nSet true to enable Cross Traffic Monitoring and false to disable Cross Traffic Monitoring. When Cross Traffic Monitoring is enabled, the ADAS system in the vehicle should be turned on and monitoring for potential sideways collisions.\nIn general, CROSS_TRAFFIC_MONITORING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too high, that information must be conveyed through the ErrorState values in the CROSS_TRAFFIC_MONITORING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "CROSS_TRAFFIC_MONITORING_WARNING_STATE", @@ -1375,11 +1638,13 @@ "CrossTrafficMonitoringWarningState", "ErrorState" ], - "data_enum": "CrossTrafficMonitoringWarningState" + "data_enum": "CrossTrafficMonitoringWarningState", + "description": "Cross Traffic Monitoring warning state.\nReturns the current state of Cross Traffic Monitoring Warning. This property must always return a valid state defined in CrossTrafficMonitoringWarningState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both CrossTrafficMonitoringWarningState (including OTHER, which is not recommended) and ErrorState are supported." }, { "name": "LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED", - "value": 287313957 + "value": 287313957, + "description": "Enable or disable Low Speed Automatic Emergency Braking.\nSet true to enable Low Speed Automatic Emergency Braking or false to disable Low Speed Automatic Emergency Braking. When Low Speed Automatic Emergency Braking is enabled, the ADAS system in the vehicle should be turned on and monitoring to avoid potential collisions in low speed conditions. This property is different from the pre-existing AUTOMATIC_EMERGENCY_BRAKING_ENABLED, which should apply to higher speed applications only. If the vehicle doesn't have a separate collision avoidance system for low speed environments, this property should not be implemented.\nIn general, LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED should always return true or false. If the feature is not available due to some temporary state, such as the vehicle speed being too low, that information must be conveyed through the ErrorState values in the LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE property.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE", @@ -1388,7 +1653,8 @@ "LowSpeedAutomaticEmergencyBrakingState", "ErrorState" ], - "data_enum": "LowSpeedAutomaticEmergencyBrakingState" + "data_enum": "LowSpeedAutomaticEmergencyBrakingState", + "description": "Low Speed Automatic Emergency Braking state.\nReturns the current state of Low Speed Automatic Emergency Braking. This property must always return a valid state defined in LowSpeedAutomaticEmergencyBrakingState or ErrorState. It must not surface errors through StatusCode and must use the supported error states instead. This property is different from the pre-existing AUTOMATIC_EMERGENCY_BRAKING_STATE, which should apply to higher speed applications only. If the vehicle doesn't have a separate collision avoidance system for low speed environments, this property should not be implemented.\nIf Low Speed Automatic Emergency Braking includes collision warnings before activating the brakes, those warnings must be surfaced through use of LOW_SPEED_COLLISION_WARNING_ENABLED and LOW_SPEED_COLLISION_WARNING_STATE.\nFor the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined unless all states of both LowSpeedAutomaticEmergencyBrakingState (including OTHER, which is not recommended) and ErrorState are supported." } ] }, diff --git a/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java b/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java index b719a70031..bea5951bfb 100644 --- a/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java +++ b/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java @@ -95,6 +95,8 @@ public final class EmuMetadataGenerator { private static final String CHECK_FILE_PATH = "${ANDROID_BUILD_TOP}/hardware/interfaces/automotive/vehicle/aidl/emu_metadata/" + "android.hardware.automotive.vehicle-types-meta.json"; + private static final List ANNOTATIONS = + List.of("@change_mode", "@access", "@version", "@data_enum", "@unit"); // Emulator can display at least this many characters before cutting characters. private static final int MAX_PROPERTY_NAME_LENGTH = 30; @@ -141,6 +143,7 @@ public final class EmuMetadataGenerator { public String name; public Integer value; public final List dataEnums = new ArrayList<>(); + public String description = ""; ValueField(String name, Integer value) { this.name = name; @@ -313,14 +316,36 @@ public final class EmuMetadataGenerator { int propertyId = parseIntEnumField(propertyDef); // We use the first paragraph as the property's name - String propertyDescription = doc.getDescription().toText().split("\n\n")[0]; - String name = propertyDescription; - if (propertyDescription.indexOf("\n") != -1 - || propertyDescription.length() > MAX_PROPERTY_NAME_LENGTH) { + String propertyDescription = doc.getDescription().toText(); + String firstLine = propertyDescription.split("\n\n")[0]; + String name = firstLine; + if (firstLine.indexOf("\n") != -1 || firstLine.length() > MAX_PROPERTY_NAME_LENGTH) { // The description is too long, we just use the property name. name = propertyName; } + ValueField field = new ValueField(name, propertyId); + String fieldDescription = ""; + for (String line : propertyDescription.split("\n")) { + String stripped = line.strip(); + // If this is an empty line, starts a new paragraph. + if (stripped.isEmpty()) { + fieldDescription += "\n"; + } + // Ignore annotation lines. + for (int j = 0; j < ANNOTATIONS.size(); j++) { + if (stripped.startsWith(ANNOTATIONS.get(j))) { + continue; + } + } + // If this is a new line, we concat it with the previous line with a space. + if (!fieldDescription.isEmpty() + && fieldDescription.charAt(fieldDescription.length() - 1) != '\n') { + fieldDescription += " "; + } + fieldDescription += stripped; + } + field.description = fieldDescription.strip(); List blockTags = doc.getBlockTags(); for (int j = 0; j < blockTags.size(); j++) { @@ -381,6 +406,9 @@ public final class EmuMetadataGenerator { // entry. jsonValueField.put("data_enum", valueField.dataEnums.get(0)); } + if (!valueField.description.isEmpty()) { + jsonValueField.put("description", valueField.description); + } values.put(jsonValueField); } @@ -390,6 +418,7 @@ public final class EmuMetadataGenerator { try (FileOutputStream outputStream = new FileOutputStream(parsedArgs.output)) { outputStream.write(jsonEnums.toString(4).getBytes()); } + System.out.println("Input at folder: " + parsedArgs.inputDir + " successfully parsed. Output at: " + parsedArgs.output); From a46d52771a3e4a7816ea722088153ee6b65f59c3 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 19 Mar 2024 17:31:55 -0700 Subject: [PATCH 042/161] audio: Do not use A2DP/LE status when populating device port The events about the status of A2DP and LE are sent by the framework asynchronously with attempts to connect an external device. As a result, the connection attempt may be rejected by the bluetooth HAL module. Bug: 327711955 Test: atest VtsHalAudioCoreTargetTest Change-Id: Iecef0ee6a66cd290237fdcccd6a7016e9622c4b0 --- .../default/bluetooth/ModuleBluetooth.cpp | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/audio/aidl/default/bluetooth/ModuleBluetooth.cpp b/audio/aidl/default/bluetooth/ModuleBluetooth.cpp index ac375a069e..8c381cd89a 100644 --- a/audio/aidl/default/bluetooth/ModuleBluetooth.cpp +++ b/audio/aidl/default/bluetooth/ModuleBluetooth.cpp @@ -224,31 +224,19 @@ ndk::ScopedAStatus ModuleBluetooth::populateConnectedDevicePort(AudioPort* audio const auto& devicePort = audioPort->ext.get(); const auto& description = devicePort.device.type; // This method must return an error when the device can not be connected. - if (description.connection == AudioDeviceDescription::CONNECTION_BT_A2DP) { - bool isA2dpEnabled = false; - if (!!mBluetoothA2dp) { - RETURN_STATUS_IF_ERROR((*mBluetoothA2dp).isEnabled(&isA2dpEnabled)); - } - LOG(DEBUG) << __func__ << ": isA2dpEnabled: " << isA2dpEnabled; - if (!isA2dpEnabled) return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } else if (description.connection == AudioDeviceDescription::CONNECTION_BT_LE) { - bool isLeEnabled = false; - if (!!mBluetoothLe) { - RETURN_STATUS_IF_ERROR((*mBluetoothLe).isEnabled(&isLeEnabled)); - } - LOG(DEBUG) << __func__ << ": isLeEnabled: " << isLeEnabled; - if (!isLeEnabled) return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } else if (description.connection == AudioDeviceDescription::CONNECTION_WIRELESS && - description.type == AudioDeviceType::OUT_HEARING_AID) { - // Hearing aids can use a number of profiles, no single switch exists. - } else { + // Since A2DP/LE status events are sent asynchronously, it is more reliable + // to attempt connecting to the BT stack rather than judge by the A2DP/LE status. + if (description.connection != AudioDeviceDescription::CONNECTION_BT_A2DP && + description.connection != AudioDeviceDescription::CONNECTION_BT_LE && + !(description.connection == AudioDeviceDescription::CONNECTION_WIRELESS && + description.type == AudioDeviceType::OUT_HEARING_AID)) { LOG(ERROR) << __func__ << ": unsupported device type: " << audioPort->toString(); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } CachedProxy proxy; RETURN_STATUS_IF_ERROR(createProxy(*audioPort, nextPortId, proxy)); - // Since the device is already connected and configured by the BT stack, provide - // the current configuration instead of all possible profiles. + // If the device is actually connected, it is configured by the BT stack. + // Provide the current configuration instead of all possible profiles. const auto& pcmConfig = proxy.pcmConfig; audioPort->profiles.clear(); audioPort->profiles.push_back( From d1e6b6a5569461b642b2884b3677fb88dd4d43ef Mon Sep 17 00:00:00 2001 From: Mathieu Mandret Date: Wed, 13 Mar 2024 14:51:32 +0100 Subject: [PATCH 043/161] Disable UWB before starting VtsHalUwbTargetTest VtsHalUwbTargetTest opens/closes UWB HAL multiple times. However UWB HAL only accepts 1 client at a time so if UWB is enabled Android Framework will have UWB HAL open and prevent any other client from opening it. Matching NFC VTS behavior from VtsAidlHalNfcTargetTest.cpp, VtsHalUwbTargetTest now disables UWB before running its tests. Test: atest VtsHalUwbTargetTest Bug: 328326697 (cherry picked from https://android-review.googlesource.com/q/commit:6bab73f7eaf9704347cbf5e7a56463b18c5773f9) Merged-In: I4dfff45015232bbd0a4445e42b13db3ff2d9e87c Change-Id: I4dfff45015232bbd0a4445e42b13db3ff2d9e87c 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- uwb/aidl/vts/VtsHalUwbTargetTest.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/uwb/aidl/vts/VtsHalUwbTargetTest.cpp b/uwb/aidl/vts/VtsHalUwbTargetTest.cpp index 81d26ba06b..3b0b60657e 100644 --- a/uwb/aidl/vts/VtsHalUwbTargetTest.cpp +++ b/uwb/aidl/vts/VtsHalUwbTargetTest.cpp @@ -216,5 +216,12 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ProcessState::self()->setThreadPoolMaxThreadCount(1); ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); + // UWB HAL only allows 1 client, make sure framework + // does not have UWB HAL open before running + std::system("/system/bin/cmd uwb disable-uwb"); + sleep(3); + auto status = RUN_ALL_TESTS(); + sleep(3); + std::system("/system/bin/cmd uwb enable-uwb"); + return status; } From a18a54d5ae1b7fc14709b728a23a7874142f81b9 Mon Sep 17 00:00:00 2001 From: Jimmy Shiu Date: Wed, 20 Mar 2024 08:21:22 +0000 Subject: [PATCH 044/161] VTSHalPowerTarget.FMQAidl: Make sure session status OK before running test While PowerHal version >= 5 but devices didn't support HintSession. We should skip the test. Otherwise, it would fail. Change-Id: I0f757ab825020ded02c31231969e13f3375e47f3 Test: atest VTSHalPowerTarget Bug: 328330332 --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 939deb2966..272674f194 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -159,7 +159,10 @@ class FMQAidl : public PowerAidl { auto status = power->createHintSessionWithConfig(getpid(), getuid(), kSelfTids, 16666666L, SessionTag::OTHER, &mSessionConfig, &mSession); - ASSERT_TRUE(status.isOk()); + mSessionSupport = status.isOk(); + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_NE(nullptr, mSession); status = power->getSessionChannel(getpid(), getuid(), &mChannelConfig); From 59a5d543b02165762c3ad54ef62d0a9a558966d7 Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Tue, 12 Mar 2024 11:53:00 +0000 Subject: [PATCH 045/161] Fix binder transaction errors on vibrator benchmark tests Setup binder process thread pool for vibrator HAL benchmark tests to fix binder transaction errors of the type: E Vibrator: Failed completion callback: -129 This change also adds checks for HAL results, which will cause them to fail earlier with a useful error message when the device reaches a bad state. This should avoid timeout failures for the whole test suite. Other fixes: - Fix vibrator.on(ms) tests to use a valid max duration value (previously failing with illegal argument); - Use a smaller fixed # of iterations on tests that iterate on vibrate calls, and add wait for vibration to be complete to measure the HAL in a more stable state; - Skip getSupportedAlwaysOnEffects on devices without capability; Fix: 329239120 Bug: 329899022 Bug: 329203383 Test: atest VibratorHalIntegrationBenchmark Change-Id: Id541a62745320a601934fd3f176f8ba42b5a7b2d --- vibrator/bench/benchmark.cpp | 498 +++++++++++++++++++++++++---------- 1 file changed, 363 insertions(+), 135 deletions(-) diff --git a/vibrator/bench/benchmark.cpp b/vibrator/bench/benchmark.cpp index b96e06da5b..dd618a5bc1 100644 --- a/vibrator/bench/benchmark.cpp +++ b/vibrator/bench/benchmark.cpp @@ -20,6 +20,8 @@ #include #include #include +#include +#include using ::android::enum_range; using ::android::sp; @@ -31,9 +33,8 @@ using ::benchmark::Fixture; using ::benchmark::kMicrosecond; using ::benchmark::State; using ::benchmark::internal::Benchmark; -using ::std::chrono::duration; -using ::std::chrono::duration_cast; -using ::std::chrono::high_resolution_clock; + +using namespace ::std::chrono_literals; namespace Aidl = ::android::hardware::vibrator; namespace V1_0 = ::android::hardware::vibrator::V1_0; @@ -41,14 +42,28 @@ namespace V1_1 = ::android::hardware::vibrator::V1_1; namespace V1_2 = ::android::hardware::vibrator::V1_2; namespace V1_3 = ::android::hardware::vibrator::V1_3; +// Fixed number of iterations for benchmarks that trigger a vibration on the loop. +// They require slow cleanup to ensure a stable state on each run and less noisy metrics. +static constexpr auto VIBRATION_ITERATIONS = 500; + +// Timeout to wait for vibration callback completion. +static constexpr auto VIBRATION_CALLBACK_TIMEOUT = 100ms; + +// Max duration the vibrator can be turned on, in milliseconds. +static constexpr uint32_t MAX_ON_DURATION_MS = UINT16_MAX; + template class BaseBench : public Fixture { public: + void SetUp(State& /*state*/) override { + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + } + void TearDown(State& /*state*/) override { - if (!mVibrator) { - return; + if (mVibrator) { + mVibrator->off(); } - mVibrator->off(); } static void DefaultConfig(Benchmark* b) { b->Unit(kMicrosecond); } @@ -66,7 +81,19 @@ class BaseBench : public Fixture { template class VibratorBench : public BaseBench { public: - void SetUp(State& /*state*/) override { this->mVibrator = I::getService(); } + void SetUp(State& state) override { + BaseBench::SetUp(state); + this->mVibrator = I::getService(); + } + + protected: + bool shouldSkipWithError(State& state, const android::hardware::Return&& ret) { + if (!ret.isOk()) { + state.SkipWithError(ret.description()); + return true; + } + return false; + } }; enum class EmptyEnum : uint32_t; @@ -118,16 +145,25 @@ class VibratorEffectsBench : public VibratorBench { }); if (!supported) { - state->SkipWithMessage("performApi returned UNSUPPORTED_OPERATION"); + state->SkipWithMessage("effect unsupported"); return; } for (auto _ : *state) { - state->ResumeTiming(); - (*this->mVibrator.*performApi)(effect, strength, - [](Status /*status*/, uint32_t /*lengthMs*/) {}); + // Test + auto ret = (*this->mVibrator.*performApi)( + effect, strength, [](Status /*status*/, uint32_t /*lengthMs*/) {}); + + // Cleanup state->PauseTiming(); - this->mVibrator->off(); + if (!ret.isOk()) { + state->SkipWithError(ret.description()); + return; + } + if (this->shouldSkipWithError(*state, this->mVibrator->off())) { + return; + } + state->ResumeTiming(); } } @@ -157,24 +193,38 @@ class VibratorEffectsBench : public VibratorBench { using VibratorBench_V1_0 = VibratorBench; BENCHMARK_WRAPPER(VibratorBench_V1_0, on, { - uint32_t ms = UINT32_MAX; + auto ms = MAX_ON_DURATION_MS; for (auto _ : state) { - state.ResumeTiming(); - mVibrator->on(ms); + // Test + if (shouldSkipWithError(state, mVibrator->on(ms))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->off(); + if (shouldSkipWithError(state, mVibrator->off())) { + return; + } + state.ResumeTiming(); } }); BENCHMARK_WRAPPER(VibratorBench_V1_0, off, { - uint32_t ms = UINT32_MAX; + auto ms = MAX_ON_DURATION_MS; for (auto _ : state) { + // Setup state.PauseTiming(); - mVibrator->on(ms); + if (shouldSkipWithError(state, mVibrator->on(ms))) { + return; + } state.ResumeTiming(); - mVibrator->off(); + + // Test + if (shouldSkipWithError(state, mVibrator->off())) { + return; + } } }); @@ -185,20 +235,23 @@ BENCHMARK_WRAPPER(VibratorBench_V1_0, supportsAmplitudeControl, { }); BENCHMARK_WRAPPER(VibratorBench_V1_0, setAmplitude, { + auto ms = MAX_ON_DURATION_MS; uint8_t amplitude = UINT8_MAX; if (!mVibrator->supportsAmplitudeControl()) { - state.SkipWithMessage("Amplitude control unavailable"); + state.SkipWithMessage("amplitude control unavailable"); return; } - mVibrator->on(UINT32_MAX); - - for (auto _ : state) { - mVibrator->setAmplitude(amplitude); + if (shouldSkipWithError(state, mVibrator->on(ms))) { + return; } - mVibrator->off(); + for (auto _ : state) { + if (shouldSkipWithError(state, mVibrator->setAmplitude(amplitude))) { + return; + } + } }); using VibratorEffectsBench_V1_0 = VibratorEffectsBench; @@ -218,7 +271,15 @@ using VibratorEffectsBench_V1_2 = BENCHMARK_WRAPPER(VibratorEffectsBench_V1_2, perform_1_2, { performBench(&state, &V1_2::IVibrator::perform_1_2); }); -using VibratorBench_V1_3 = VibratorBench; +class VibratorBench_V1_3 : public VibratorBench { + public: + void TearDown(State& state) override { + VibratorBench::TearDown(state); + if (mVibrator) { + mVibrator->setExternalControl(false); + } + } +}; BENCHMARK_WRAPPER(VibratorBench_V1_3, supportsExternalControl, { for (auto _ : state) { @@ -227,18 +288,23 @@ BENCHMARK_WRAPPER(VibratorBench_V1_3, supportsExternalControl, { }); BENCHMARK_WRAPPER(VibratorBench_V1_3, setExternalControl, { - bool enable = true; - if (!mVibrator->supportsExternalControl()) { state.SkipWithMessage("external control unavailable"); return; } for (auto _ : state) { - state.ResumeTiming(); - mVibrator->setExternalControl(enable); + // Test + if (shouldSkipWithError(state, mVibrator->setExternalControl(true))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->setExternalControl(false); + if (shouldSkipWithError(state, mVibrator->setExternalControl(false))) { + return; + } + state.ResumeTiming(); } }); @@ -248,13 +314,13 @@ BENCHMARK_WRAPPER(VibratorBench_V1_3, supportsExternalAmplitudeControl, { return; } - mVibrator->setExternalControl(true); + if (shouldSkipWithError(state, mVibrator->setExternalControl(true))) { + return; + } for (auto _ : state) { mVibrator->supportsAmplitudeControl(); } - - mVibrator->setExternalControl(false); }); BENCHMARK_WRAPPER(VibratorBench_V1_3, setExternalAmplitude, { @@ -265,7 +331,9 @@ BENCHMARK_WRAPPER(VibratorBench_V1_3, setExternalAmplitude, { return; } - mVibrator->setExternalControl(true); + if (shouldSkipWithError(state, mVibrator->setExternalControl(true))) { + return; + } if (!mVibrator->supportsAmplitudeControl()) { state.SkipWithMessage("amplitude control unavailable"); @@ -273,10 +341,10 @@ BENCHMARK_WRAPPER(VibratorBench_V1_3, setExternalAmplitude, { } for (auto _ : state) { - mVibrator->setAmplitude(amplitude); + if (shouldSkipWithError(state, mVibrator->setAmplitude(amplitude))) { + return; + } } - - mVibrator->setExternalControl(false); }); using VibratorEffectsBench_V1_3 = VibratorEffectsBench; @@ -286,9 +354,42 @@ BENCHMARK_WRAPPER(VibratorEffectsBench_V1_3, perform_1_3, class VibratorBench_Aidl : public BaseBench { public: - void SetUp(State& /*state*/) override { + void SetUp(State& state) override { + BaseBench::SetUp(state); this->mVibrator = android::waitForVintfService(); } + + void TearDown(State& state) override { + BaseBench::TearDown(state); + if (mVibrator) { + mVibrator->setExternalControl(false); + } + } + + protected: + int32_t hasCapabilities(int32_t capabilities) { + int32_t deviceCapabilities = 0; + this->mVibrator->getCapabilities(&deviceCapabilities); + return (deviceCapabilities & capabilities) == capabilities; + } + + bool shouldSkipWithError(State& state, const android::binder::Status&& status) { + if (!status.isOk()) { + state.SkipWithError(status.toString8().c_str()); + return true; + } + return false; + } + + static void SlowBenchConfig(Benchmark* b) { b->Iterations(VIBRATION_ITERATIONS); } +}; + +class SlowVibratorBench_Aidl : public VibratorBench_Aidl { + public: + static void DefaultConfig(Benchmark* b) { + VibratorBench_Aidl::DefaultConfig(b); + SlowBenchConfig(b); + } }; class HalCallback : public Aidl::BnVibratorCallback { @@ -296,30 +397,70 @@ class HalCallback : public Aidl::BnVibratorCallback { HalCallback() = default; ~HalCallback() = default; - android::binder::Status onComplete() override { return android::binder::Status::ok(); } + android::binder::Status onComplete() override { + mPromise.set_value(); + return android::binder::Status::ok(); + } + + void waitForComplete() { + // Wait until the HAL has finished processing previous vibration before starting a new one, + // so the HAL state is consistent on each run and metrics are less noisy. Some of the newest + // HAL implementations are waiting on previous vibration cleanup and might be significantly + // slower, so make sure we measure vibrations on a clean slate. + mPromise.get_future().wait_for(VIBRATION_CALLBACK_TIMEOUT); + } + + private: + std::promise mPromise; }; -BENCHMARK_WRAPPER(VibratorBench_Aidl, on, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - - int32_t ms = INT32_MAX; - auto cb = (capabilities & Aidl::IVibrator::CAP_ON_CALLBACK) ? new HalCallback() : nullptr; +BENCHMARK_WRAPPER(SlowVibratorBench_Aidl, on, { + auto ms = MAX_ON_DURATION_MS; for (auto _ : state) { - state.ResumeTiming(); - mVibrator->on(ms, cb); + auto cb = hasCapabilities(Aidl::IVibrator::CAP_ON_CALLBACK) ? new HalCallback() : nullptr; + + // Test + if (shouldSkipWithError(state, mVibrator->on(ms, cb))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->off(); + if (shouldSkipWithError(state, mVibrator->off())) { + return; + } + if (cb) { + cb->waitForComplete(); + } + state.ResumeTiming(); } }); -BENCHMARK_WRAPPER(VibratorBench_Aidl, off, { +BENCHMARK_WRAPPER(SlowVibratorBench_Aidl, off, { + auto ms = MAX_ON_DURATION_MS; + for (auto _ : state) { + auto cb = hasCapabilities(Aidl::IVibrator::CAP_ON_CALLBACK) ? new HalCallback() : nullptr; + + // Setup state.PauseTiming(); - mVibrator->on(INT32_MAX, nullptr); + if (shouldSkipWithError(state, mVibrator->on(ms, cb))) { + return; + } + state.ResumeTiming(); + + // Test + if (shouldSkipWithError(state, mVibrator->off())) { + return; + } + + // Cleanup + state.PauseTiming(); + if (cb) { + cb->waitForComplete(); + } state.ResumeTiming(); - mVibrator->off(); } }); @@ -327,76 +468,102 @@ BENCHMARK_WRAPPER(VibratorBench_Aidl, getCapabilities, { int32_t capabilities = 0; for (auto _ : state) { - mVibrator->getCapabilities(&capabilities); + if (shouldSkipWithError(state, mVibrator->getCapabilities(&capabilities))) { + return; + } } }); BENCHMARK_WRAPPER(VibratorBench_Aidl, setAmplitude, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_AMPLITUDE_CONTROL) == 0) { + auto ms = MAX_ON_DURATION_MS; + float amplitude = 1.0f; + + if (!hasCapabilities(Aidl::IVibrator::CAP_AMPLITUDE_CONTROL)) { state.SkipWithMessage("amplitude control unavailable"); return; } - float amplitude = 1.0f; - mVibrator->on(INT32_MAX, nullptr); - - for (auto _ : state) { - mVibrator->setAmplitude(amplitude); + auto cb = hasCapabilities(Aidl::IVibrator::CAP_ON_CALLBACK) ? new HalCallback() : nullptr; + if (shouldSkipWithError(state, mVibrator->on(ms, cb))) { + return; } - mVibrator->off(); + for (auto _ : state) { + if (shouldSkipWithError(state, mVibrator->setAmplitude(amplitude))) { + return; + } + } + + shouldSkipWithError(state, mVibrator->off()); + if (cb) { + cb->waitForComplete(); + } }); BENCHMARK_WRAPPER(VibratorBench_Aidl, setExternalControl, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_EXTERNAL_CONTROL) == 0) { + if (!hasCapabilities(Aidl::IVibrator::CAP_EXTERNAL_CONTROL)) { state.SkipWithMessage("external control unavailable"); return; } for (auto _ : state) { - state.ResumeTiming(); - mVibrator->setExternalControl(true); + // Test + if (shouldSkipWithError(state, mVibrator->setExternalControl(true))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->setExternalControl(false); + if (shouldSkipWithError(state, mVibrator->setExternalControl(false))) { + return; + } + state.ResumeTiming(); } }); BENCHMARK_WRAPPER(VibratorBench_Aidl, setExternalAmplitude, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_EXTERNAL_CONTROL) == 0 || - (capabilities & Aidl::IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL) == 0) { + auto externalControl = static_cast(Aidl::IVibrator::CAP_EXTERNAL_CONTROL); + auto externalAmplitudeControl = + static_cast(Aidl::IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL); + if (!hasCapabilities(externalControl | externalAmplitudeControl)) { state.SkipWithMessage("external amplitude control unavailable"); return; } - float amplitude = 1.0f; - mVibrator->setExternalControl(true); - - for (auto _ : state) { - mVibrator->setAmplitude(amplitude); + if (shouldSkipWithError(state, mVibrator->setExternalControl(true))) { + return; } - mVibrator->setExternalControl(false); + float amplitude = 1.0f; + for (auto _ : state) { + if (shouldSkipWithError(state, mVibrator->setAmplitude(amplitude))) { + return; + } + } }); BENCHMARK_WRAPPER(VibratorBench_Aidl, getSupportedEffects, { std::vector supportedEffects; for (auto _ : state) { - mVibrator->getSupportedEffects(&supportedEffects); + if (shouldSkipWithError(state, mVibrator->getSupportedEffects(&supportedEffects))) { + return; + } } }); BENCHMARK_WRAPPER(VibratorBench_Aidl, getSupportedAlwaysOnEffects, { + if (!hasCapabilities(Aidl::IVibrator::CAP_ALWAYS_ON_CONTROL)) { + state.SkipWithMessage("always on control unavailable"); + return; + } + std::vector supportedEffects; for (auto _ : state) { - mVibrator->getSupportedAlwaysOnEffects(&supportedEffects); + if (shouldSkipWithError(state, mVibrator->getSupportedAlwaysOnEffects(&supportedEffects))) { + return; + } } }); @@ -404,7 +571,9 @@ BENCHMARK_WRAPPER(VibratorBench_Aidl, getSupportedPrimitives, { std::vector supportedPrimitives; for (auto _ : state) { - mVibrator->getSupportedPrimitives(&supportedPrimitives); + if (shouldSkipWithError(state, mVibrator->getSupportedPrimitives(&supportedPrimitives))) { + return; + } } }); @@ -427,12 +596,30 @@ class VibratorEffectsBench_Aidl : public VibratorBench_Aidl { auto getStrength(const State& state) const { return static_cast(this->getOtherArg(state, 1)); } + + bool isEffectSupported(const Aidl::Effect& effect) { + std::vector supported; + mVibrator->getSupportedEffects(&supported); + return std::find(supported.begin(), supported.end(), effect) != supported.end(); + } + + bool isAlwaysOnEffectSupported(const Aidl::Effect& effect) { + std::vector supported; + mVibrator->getSupportedAlwaysOnEffects(&supported); + return std::find(supported.begin(), supported.end(), effect) != supported.end(); + } +}; + +class SlowVibratorEffectsBench_Aidl : public VibratorEffectsBench_Aidl { + public: + static void DefaultConfig(Benchmark* b) { + VibratorEffectsBench_Aidl::DefaultConfig(b); + SlowBenchConfig(b); + } }; BENCHMARK_WRAPPER(VibratorEffectsBench_Aidl, alwaysOnEnable, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_ALWAYS_ON_CONTROL) == 0) { + if (!hasCapabilities(Aidl::IVibrator::CAP_ALWAYS_ON_CONTROL)) { state.SkipWithMessage("always on control unavailable"); return; } @@ -441,25 +628,28 @@ BENCHMARK_WRAPPER(VibratorEffectsBench_Aidl, alwaysOnEnable, { auto effect = getEffect(state); auto strength = getStrength(state); - std::vector supported; - mVibrator->getSupportedAlwaysOnEffects(&supported); - if (std::find(supported.begin(), supported.end(), effect) == supported.end()) { - state.SkipWithMessage("always on effects unavailable"); + if (!isAlwaysOnEffectSupported(effect)) { + state.SkipWithMessage("always on effect unsupported"); return; } for (auto _ : state) { - state.ResumeTiming(); - mVibrator->alwaysOnEnable(id, effect, strength); + // Test + if (shouldSkipWithError(state, mVibrator->alwaysOnEnable(id, effect, strength))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->alwaysOnDisable(id); + if (shouldSkipWithError(state, mVibrator->alwaysOnDisable(id))) { + return; + } + state.ResumeTiming(); } }); BENCHMARK_WRAPPER(VibratorEffectsBench_Aidl, alwaysOnDisable, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_ALWAYS_ON_CONTROL) == 0) { + if (!hasCapabilities(Aidl::IVibrator::CAP_ALWAYS_ON_CONTROL)) { state.SkipWithMessage("always on control unavailable"); return; } @@ -468,42 +658,55 @@ BENCHMARK_WRAPPER(VibratorEffectsBench_Aidl, alwaysOnDisable, { auto effect = getEffect(state); auto strength = getStrength(state); - std::vector supported; - mVibrator->getSupportedAlwaysOnEffects(&supported); - if (std::find(supported.begin(), supported.end(), effect) == supported.end()) { - state.SkipWithMessage("always on effects unavailable"); + if (!isAlwaysOnEffectSupported(effect)) { + state.SkipWithMessage("always on effect unsupported"); return; } for (auto _ : state) { + // Setup state.PauseTiming(); - mVibrator->alwaysOnEnable(id, effect, strength); + if (shouldSkipWithError(state, mVibrator->alwaysOnEnable(id, effect, strength))) { + return; + } state.ResumeTiming(); - mVibrator->alwaysOnDisable(id); + + // Test + if (shouldSkipWithError(state, mVibrator->alwaysOnDisable(id))) { + return; + } } }); -BENCHMARK_WRAPPER(VibratorEffectsBench_Aidl, perform, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - +BENCHMARK_WRAPPER(SlowVibratorEffectsBench_Aidl, perform, { auto effect = getEffect(state); auto strength = getStrength(state); - auto cb = (capabilities & Aidl::IVibrator::CAP_PERFORM_CALLBACK) ? new HalCallback() : nullptr; - int32_t lengthMs = 0; - std::vector supported; - mVibrator->getSupportedEffects(&supported); - if (std::find(supported.begin(), supported.end(), effect) == supported.end()) { - state.SkipWithMessage("effects unavailable"); + if (!isEffectSupported(effect)) { + state.SkipWithMessage("effect unsupported"); return; } + int32_t lengthMs = 0; + for (auto _ : state) { - state.ResumeTiming(); - mVibrator->perform(effect, strength, cb, &lengthMs); + auto cb = hasCapabilities(Aidl::IVibrator::CAP_PERFORM_CALLBACK) ? new HalCallback() + : nullptr; + + // Test + if (shouldSkipWithError(state, mVibrator->perform(effect, strength, cb, &lengthMs))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->off(); + if (shouldSkipWithError(state, mVibrator->off())) { + return; + } + if (cb) { + cb->waitForComplete(); + } + state.ResumeTiming(); } }); @@ -520,13 +723,29 @@ class VibratorPrimitivesBench_Aidl : public VibratorBench_Aidl { auto getPrimitive(const State& state) const { return static_cast(this->getOtherArg(state, 0)); } + + bool isPrimitiveSupported(const Aidl::CompositePrimitive& primitive) { + std::vector supported; + mVibrator->getSupportedPrimitives(&supported); + return std::find(supported.begin(), supported.end(), primitive) != supported.end(); + } +}; + +class SlowVibratorPrimitivesBench_Aidl : public VibratorPrimitivesBench_Aidl { + public: + static void DefaultConfig(Benchmark* b) { + VibratorPrimitivesBench_Aidl::DefaultConfig(b); + SlowBenchConfig(b); + } }; BENCHMARK_WRAPPER(VibratorBench_Aidl, getCompositionDelayMax, { int32_t ms = 0; for (auto _ : state) { - mVibrator->getCompositionDelayMax(&ms); + if (shouldSkipWithError(state, mVibrator->getCompositionDelayMax(&ms))) { + return; + } } }); @@ -534,14 +753,14 @@ BENCHMARK_WRAPPER(VibratorBench_Aidl, getCompositionSizeMax, { int32_t size = 0; for (auto _ : state) { - mVibrator->getCompositionSizeMax(&size); + if (shouldSkipWithError(state, mVibrator->getCompositionSizeMax(&size))) { + return; + } } }); BENCHMARK_WRAPPER(VibratorPrimitivesBench_Aidl, getPrimitiveDuration, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_COMPOSE_EFFECTS) == 0) { + if (!hasCapabilities(Aidl::IVibrator::CAP_COMPOSE_EFFECTS)) { state.SkipWithMessage("compose effects unavailable"); return; } @@ -549,22 +768,20 @@ BENCHMARK_WRAPPER(VibratorPrimitivesBench_Aidl, getPrimitiveDuration, { auto primitive = getPrimitive(state); int32_t ms = 0; - std::vector supported; - mVibrator->getSupportedPrimitives(&supported); - if (std::find(supported.begin(), supported.end(), primitive) == supported.end()) { - state.SkipWithMessage("supported primitives unavailable"); + if (!isPrimitiveSupported(primitive)) { + state.SkipWithMessage("primitive unsupported"); return; } for (auto _ : state) { - mVibrator->getPrimitiveDuration(primitive, &ms); + if (shouldSkipWithError(state, mVibrator->getPrimitiveDuration(primitive, &ms))) { + return; + } } }); -BENCHMARK_WRAPPER(VibratorPrimitivesBench_Aidl, compose, { - int32_t capabilities = 0; - mVibrator->getCapabilities(&capabilities); - if ((capabilities & Aidl::IVibrator::CAP_COMPOSE_EFFECTS) == 0) { +BENCHMARK_WRAPPER(SlowVibratorPrimitivesBench_Aidl, compose, { + if (!hasCapabilities(Aidl::IVibrator::CAP_COMPOSE_EFFECTS)) { state.SkipWithMessage("compose effects unavailable"); return; } @@ -574,22 +791,33 @@ BENCHMARK_WRAPPER(VibratorPrimitivesBench_Aidl, compose, { effect.scale = 1.0f; effect.delayMs = 0; - std::vector supported; - mVibrator->getSupportedPrimitives(&supported); - if (std::find(supported.begin(), supported.end(), effect.primitive) == supported.end()) { - state.SkipWithMessage("supported primitives unavailable"); + if (effect.primitive == Aidl::CompositePrimitive::NOOP) { + state.SkipWithMessage("skipping primitive NOOP"); + return; + } + if (!isPrimitiveSupported(effect.primitive)) { + state.SkipWithMessage("primitive unsupported"); return; } - auto cb = new HalCallback(); std::vector effects; effects.push_back(effect); for (auto _ : state) { - state.ResumeTiming(); - mVibrator->compose(effects, cb); + auto cb = new HalCallback(); + + // Test + if (shouldSkipWithError(state, mVibrator->compose(effects, cb))) { + return; + } + + // Cleanup state.PauseTiming(); - mVibrator->off(); + if (shouldSkipWithError(state, mVibrator->off())) { + return; + } + cb->waitForComplete(); + state.ResumeTiming(); } }); From d53f5f3ad43d556fc4b94727727b0fe0c719afcc Mon Sep 17 00:00:00 2001 From: jimmyshiu Date: Fri, 15 Mar 2024 16:37:19 +0000 Subject: [PATCH 046/161] VTSHalPowerTarget: check if HintSession supported Ignore HintSession testcases while HintSession isn't supported. Test: atest Power/PowerAidl Bug: 322112957 Change-Id: Ia1161aeafcd541745e7e0da1bd4c1781dc535460 Merged-In: Ia1161aeafcd541745e7e0da1bd4c1781dc535460 (cherry picked from commit 8191575b6717e99d00b247c6a21b29cda7eb3a52) --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 40 +++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 53fcef1a41..67efa7a90e 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -122,10 +122,16 @@ class PowerAidl : public testing::TestWithParam { power = IPower::fromBinder(ndk::SpAIBinder(binder)); auto status = power->getInterfaceVersion(&mServiceVersion); ASSERT_TRUE(status.isOk()); + if (mServiceVersion >= 2) { + status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &mSession); + mSessionSupport = status.isOk(); + } } std::shared_ptr power; int32_t mServiceVersion; + std::shared_ptr mSession; + bool mSessionSupport = false; }; class HintSessionAidl : public PowerAidl { @@ -135,12 +141,11 @@ class HintSessionAidl : public PowerAidl { if (mServiceVersion < 2) { GTEST_SKIP() << "DEVICE not launching with Power V2 and beyond."; } - - auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &mSession); - ASSERT_TRUE(status.isOk()); + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_NE(nullptr, mSession); } - std::shared_ptr mSession; }; class FMQAidl : public PowerAidl { @@ -239,6 +244,9 @@ TEST_P(PowerAidl, isBoostSupported) { } TEST_P(PowerAidl, getHintSessionPreferredRate) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 2) { GTEST_SKIP() << "DEVICE not launching with Power V2 and beyond."; } @@ -250,6 +258,9 @@ TEST_P(PowerAidl, getHintSessionPreferredRate) { } TEST_P(PowerAidl, createHintSessionWithConfig) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 5) { GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; } @@ -271,6 +282,9 @@ TEST_P(PowerAidl, hasFixedPerformance) { } TEST_P(HintSessionAidl, createAndCloseHintSession) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_TRUE(mSession->pause().isOk()); ASSERT_TRUE(mSession->resume().isOk()); // Test normal destroy operation @@ -279,6 +293,9 @@ TEST_P(HintSessionAidl, createAndCloseHintSession) { } TEST_P(HintSessionAidl, createHintSessionFailed) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } std::shared_ptr session; auto status = power->createHintSession(getpid(), getuid(), kEmptyTids, 16666666L, &session); @@ -288,11 +305,17 @@ TEST_P(HintSessionAidl, createHintSessionFailed) { } TEST_P(HintSessionAidl, updateAndReportDurations) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_TRUE(mSession->updateTargetWorkDuration(16666667LL).isOk()); ASSERT_TRUE(mSession->reportActualWorkDuration(kDurations).isOk()); } TEST_P(HintSessionAidl, sendSessionHint) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 4) { GTEST_SKIP() << "DEVICE not launching with Power V4 and beyond."; } @@ -306,6 +329,9 @@ TEST_P(HintSessionAidl, sendSessionHint) { } TEST_P(HintSessionAidl, setThreads) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 4) { GTEST_SKIP() << "DEVICE not launching with Power V4 and beyond."; } @@ -318,6 +344,9 @@ TEST_P(HintSessionAidl, setThreads) { } TEST_P(HintSessionAidl, setSessionMode) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 5) { GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; } @@ -333,6 +362,9 @@ TEST_P(HintSessionAidl, setSessionMode) { } TEST_P(HintSessionAidl, getSessionConfig) { + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } if (mServiceVersion < 5) { GTEST_SKIP() << "DEVICE not launching with Power V5 and beyond."; } From 7371e370dc1219f1ee38f21935103bc4d70e06c7 Mon Sep 17 00:00:00 2001 From: jimmyshiu Date: Tue, 19 Mar 2024 08:56:42 +0000 Subject: [PATCH 047/161] VTSHalPowerTarget: Add condition check for FMQAidl teardown While FMQAidl Setup() was skipped, some uninitialized objects would be used in FMQAidl Teardown() which caused the test failed. Add some condition check to prevent from using uninitialized objects. Test: atest VTSHalPowerTarget Bug: 328330332 Merged-In: I83081cbef66da1d74d87e191f266cb16fb559b85 Change-Id: I83081cbef66da1d74d87e191f266cb16fb559b85 (cherry picked from commit d3753ec91db5416f939e633e5020f50ced84c0e9) --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 67efa7a90e..939deb2966 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -180,8 +180,12 @@ class FMQAidl : public PowerAidl { ASSERT_NE(mEventFlag, nullptr); } virtual void TearDown() { - mSession->close(); - ASSERT_TRUE(power->closeSessionChannel(getpid(), getuid()).isOk()); + if (mSession) { + mSession->close(); + if (mChannel->isValid()) { + ASSERT_TRUE(power->closeSessionChannel(getpid(), getuid()).isOk()); + } + } } protected: From d594e608c3bba914b84be9e848a1040962b4df0c Mon Sep 17 00:00:00 2001 From: Jimmy Shiu Date: Wed, 20 Mar 2024 08:21:22 +0000 Subject: [PATCH 048/161] VTSHalPowerTarget.FMQAidl: Make sure session status OK before running test While PowerHal version >= 5 but devices didn't support HintSession. We should skip the test. Otherwise, it would fail. Merged-In: I0f757ab825020ded02c31231969e13f3375e47f3 Change-Id: I0f757ab825020ded02c31231969e13f3375e47f3 Test: atest VTSHalPowerTarget Bug: 328330332 --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 939deb2966..272674f194 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -159,7 +159,10 @@ class FMQAidl : public PowerAidl { auto status = power->createHintSessionWithConfig(getpid(), getuid(), kSelfTids, 16666666L, SessionTag::OTHER, &mSessionConfig, &mSession); - ASSERT_TRUE(status.isOk()); + mSessionSupport = status.isOk(); + if (!mSessionSupport) { + GTEST_SKIP() << "DEVICE not support Hint Session."; + } ASSERT_NE(nullptr, mSession); status = power->getSessionChannel(getpid(), getuid(), &mChannelConfig); From 9b8607e5030203a4bb6b6743bdacaf08348119d6 Mon Sep 17 00:00:00 2001 From: shrikar Date: Sat, 16 Mar 2024 17:39:03 +0000 Subject: [PATCH 049/161] Specified in INFO_MAKE and INFO_MODEL HAL docs to use public names Bug: 316921360 Bug: 316922545 Test: presubmit Change-Id: I3f3956ba59381ce4580d92814cfcb096ebd35c17 --- .../android.hardware.automotive.vehicle-types-meta.json | 4 ++-- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 735f8e6c6f..0dc628145d 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -11,12 +11,12 @@ { "name": "Manufacturer of vehicle", "value": 286261505, - "description": "Manufacturer of vehicle" + "description": "Manufacturer of vehicle\nThis property must communicate the vehicle's public brand name." }, { "name": "Model of vehicle", "value": 286261506, - "description": "Model of vehicle" + "description": "Model of vehicle\nThis property must communicate the vehicle's public model name." }, { "name": "INFO_MODEL_YEAR", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 099323cfff..1f3e9676dd 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -59,6 +59,8 @@ enum VehicleProperty { /** * Manufacturer of vehicle * + * This property must communicate the vehicle's public brand name. + * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @version 2 @@ -68,6 +70,8 @@ enum VehicleProperty { /** * Model of vehicle * + * This property must communicate the vehicle's public model name. + * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @version 2 From 2f2f97ccb1a07b019a9fba0810a0501e827f1665 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 21 Mar 2024 02:58:52 +0000 Subject: [PATCH 050/161] Updated EV_CHARGE_STATE HAL docs with behavior on reaching user target Bug: 324447986 Test: presubmit Change-Id: I33250f4a78a048a90f3f06ed66553e83200dd87b --- .../android.hardware.automotive.vehicle-types-meta.json | 2 +- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 735f8e6c6f..57e2df0e7c 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -1277,7 +1277,7 @@ "EvChargeState" ], "data_enum": "EvChargeState", - "description": "Charging state of the car\nReturns the current charging state of the car." + "description": "Charging state of the car\nReturns the current charging state of the car.\nIf the vehicle has a target charge percentage other than 100, this property must return EvChargeState::STATE_FULLY_CHARGED when the battery charge level has reached the target level. See EV_CHARGE_PERCENT_LIMIT for more context." }, { "name": "EV_CHARGE_SWITCH", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 099323cfff..dd4541a55b 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4901,6 +4901,10 @@ enum VehicleProperty { * * Returns the current charging state of the car. * + * If the vehicle has a target charge percentage other than 100, this property must return + * EvChargeState::STATE_FULLY_CHARGED when the battery charge level has reached the target + * level. See EV_CHARGE_PERCENT_LIMIT for more context. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @data_enum EvChargeState From 6507376fb940198e8c39ad6d5345d132b1dd7219 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 22 Mar 2024 10:29:56 -0700 Subject: [PATCH 051/161] audio: Implement blocking in remote submix when there is no sink The HIDL implementation blocked for the audio buffer duration when the output side of the remote submix pipe does not have the sink connected. This behavior was accidentally removed when fixing b/327220024. Also, limit the amount of the debug messages displayed when the sink is shutdown to avoid spamming the syslog. Bug: 328347445 Test: repro steps from the bug Test: atest VtsHalAudioCoreTargetTest Test: atest --test-filter=".*AudioPlaybackCaptureTest.*" CtsMediaAudioTestCases Change-Id: Ia66cb7b4567d42a41bf4715b7d725d36510ac50c --- .../include/core-impl/StreamRemoteSubmix.h | 5 +++-- .../default/r_submix/StreamRemoteSubmix.cpp | 22 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h index b2cdc28f5c..0d50c9696a 100644 --- a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h +++ b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h @@ -55,8 +55,8 @@ class StreamRemoteSubmix : public StreamCommonImpl { r_submix::AudioConfig mStreamConfig; std::shared_ptr mCurrentRoute = nullptr; - // limit for number of read error log entries to avoid spamming the logs - static constexpr int kMaxReadErrorLogs = 5; + // Limit for the number of error log entries to avoid spamming the logs. + static constexpr int kMaxErrorLogs = 5; // The duration of kMaxReadFailureAttempts * READ_ATTEMPT_SLEEP_MS must be strictly inferior // to the duration of a record buffer at the current record sample rate (of the device, not of // the recording itself). Here we have: 3 * 5ms = 15ms < 1024 frames * 1000 / 48000 = 21.333ms @@ -68,6 +68,7 @@ class StreamRemoteSubmix : public StreamCommonImpl { long mFramesSinceStart = 0; int mReadErrorCount = 0; int mReadFailureCount = 0; + int mWriteShutdownCount = 0; }; class StreamInRemoteSubmix final : public StreamIn, public StreamSwitcher { diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp index 2376ed9371..ca3f91aefc 100644 --- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp +++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp @@ -134,11 +134,16 @@ void StreamRemoteSubmix::shutdown() { *latencyMs = getDelayInUsForFrameCount(getStreamPipeSizeInFrames()) / 1000; LOG(VERBOSE) << __func__ << ": Latency " << *latencyMs << "ms"; mCurrentRoute->exitStandby(mIsInput); - RETURN_STATUS_IF_ERROR(mIsInput ? inRead(buffer, frameCount, actualFrameCount) - : outWrite(buffer, frameCount, actualFrameCount)); + ::android::status_t status = mIsInput ? inRead(buffer, frameCount, actualFrameCount) + : outWrite(buffer, frameCount, actualFrameCount); + if ((status != ::android::OK && mIsInput) || + ((status != ::android::OK && status != ::android::DEAD_OBJECT) && !mIsInput)) { + return status; + } mFramesSinceStart += *actualFrameCount; - if (!mIsInput) return ::android::OK; - // Only input streams need to block, for output this is implemented by MonoPipe. + if (!mIsInput && status != ::android::DEAD_OBJECT) return ::android::OK; + // Input streams always need to block, output streams need to block when there is no sink. + // When the sink exists, more sophisticated blocking algorithm is implemented by MonoPipe. const long bufferDurationUs = (*actualFrameCount) * MICROS_PER_SECOND / mContext.getSampleRate(); const auto totalDurationUs = (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND; @@ -188,14 +193,17 @@ size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() { if (sink != nullptr) { if (sink->isShutdown()) { sink.clear(); - LOG(DEBUG) << __func__ << ": pipe shutdown, ignoring the write"; + if (++mWriteShutdownCount < kMaxErrorLogs) { + LOG(DEBUG) << __func__ << ": pipe shutdown, ignoring the write. (limited logging)"; + } *actualFrameCount = frameCount; - return ::android::OK; + return ::android::DEAD_OBJECT; // Induce wait in `transfer`. } } else { LOG(FATAL) << __func__ << ": without a pipe!"; return ::android::UNKNOWN_ERROR; } + mWriteShutdownCount = 0; LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount << " frames"; @@ -262,7 +270,7 @@ size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() { // about to read from audio source sp source = mCurrentRoute->getSource(); if (source == nullptr) { - if (++mReadErrorCount < kMaxReadErrorLogs) { + if (++mReadErrorCount < kMaxErrorLogs) { LOG(ERROR) << __func__ << ": no audio pipe yet we're trying to read! (not all errors will be " "logged)"; From 9cd1970b9bae3a0b056ec97069842a27b304f54b Mon Sep 17 00:00:00 2001 From: Steve Pomeroy Date: Fri, 22 Mar 2024 18:51:37 +0000 Subject: [PATCH 052/161] Add VSR min API level Bug: 331231122 Test: atest VtsNfcBehaviorChangesTest Change-Id: I6685e75f04330c9f5d497ce219d8da00a753ffdf --- nfc/aidl/vts/functional/Android.bp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nfc/aidl/vts/functional/Android.bp b/nfc/aidl/vts/functional/Android.bp index fcaaf33ac4..d0b684b32d 100644 --- a/nfc/aidl/vts/functional/Android.bp +++ b/nfc/aidl/vts/functional/Android.bp @@ -83,6 +83,9 @@ cc_test { "server_configurable_flags", ], require_root: true, + test_options: { + vsr_min_shipping_api_level: 202404, // 2024Q2 + }, test_suites: [ "vts", ], From 69bc05cd8928b4779adfda641d35a73eb03b219d Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 21 Mar 2024 02:42:10 +0000 Subject: [PATCH 053/161] Updated relevant EV_prop HAL docs with expected behavior in multiport EV Bug: 316927574 Test: presubmit Change-Id: I5bbb4d5bd11c2b858852125c50a289f21c12bd23 --- .../android.hardware.automotive.vehicle-types-meta.json | 6 +++--- .../hardware/automotive/vehicle/VehicleProperty.aidl | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 735f8e6c6f..56183cf827 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -49,7 +49,7 @@ "EvConnectorType" ], "data_enum": "EvConnectorType", - "description": "List of connectors this EV may use" + "description": "List of connectors this EV may use\nIf the vehicle has multiple charging ports, this property must return all possible connector types that can be used by at least one charging port on the vehicle." }, { "name": "Fuel door location", @@ -169,12 +169,12 @@ { "name": "EV charge port open", "value": 287310602, - "description": "EV charge port open\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." + "description": "EV charge port open\nIf the vehicle has multiple charging ports, this property must return true if any of the charge ports are open.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "EV charge port connected", "value": 287310603, - "description": "EV charge port connected" + "description": "EV charge port connected\nIf the vehicle has multiple charging ports, this property must return true if any of the charge ports are connected." }, { "name": "EV_BATTERY_INSTANTANEOUS_CHARGE_RATE", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 099323cfff..d08d8c977a 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -138,6 +138,9 @@ enum VehicleProperty { /** * List of connectors this EV may use * + * If the vehicle has multiple charging ports, this property must return all possible connector + * types that can be used by at least one charging port on the vehicle. + * * @change_mode VehiclePropertyChangeMode.STATIC * @data_enum EvConnectorType * @access VehiclePropertyAccess.READ @@ -436,6 +439,9 @@ enum VehicleProperty { /** * EV charge port open * + * If the vehicle has multiple charging ports, this property must return true if any of the + * charge ports are open. + * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. * @@ -449,6 +455,9 @@ enum VehicleProperty { /** * EV charge port connected * + * If the vehicle has multiple charging ports, this property must return true if any of the + * charge ports are connected. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @version 2 From db8ffbb07710bfd899442856703d6a82c8b64248 Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Tue, 26 Mar 2024 12:03:07 +0000 Subject: [PATCH 054/161] Remove cleanup after bench loop from setAmplitude test Fix error on waiting for long vibration callback that might have been already cleared by the HAL when vibration finished. Test run crash log: FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xf5a83bbc) Keep all test cleanup logic in teardown methods. Bug: 329899022 Change-Id: If7c13296b870e792063a9ad7b307d57fb5c333aa Test: atest VibratorHalIntegrationBenchmark --- vibrator/bench/benchmark.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vibrator/bench/benchmark.cpp b/vibrator/bench/benchmark.cpp index dd618a5bc1..deaa6f2c55 100644 --- a/vibrator/bench/benchmark.cpp +++ b/vibrator/bench/benchmark.cpp @@ -493,11 +493,6 @@ BENCHMARK_WRAPPER(VibratorBench_Aidl, setAmplitude, { return; } } - - shouldSkipWithError(state, mVibrator->off()); - if (cb) { - cb->waitForComplete(); - } }); BENCHMARK_WRAPPER(VibratorBench_Aidl, setExternalControl, { From d975a9e6ec0b6f0eeac99673b9b06e11146874ba Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 26 Mar 2024 17:19:48 -0700 Subject: [PATCH 055/161] audio: Allow to inherit Binder RT priority in AIDL This option is on by default for HIDL interfaces, however in AIDL it needs to be enabled explicitly. Bug: 331469541 Test: m Change-Id: I971185a46da4222160fb04b8b77f805ef0396562 --- audio/aidl/default/EffectFactory.cpp | 1 + audio/aidl/default/Module.cpp | 10 ++++++---- audio/aidl/default/include/core-impl/ChildInterface.h | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp index ba5b14163d..e3894f9517 100644 --- a/audio/aidl/default/EffectFactory.cpp +++ b/audio/aidl/default/EffectFactory.cpp @@ -145,6 +145,7 @@ ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, *_aidl_return = effectSp; ndk::SpAIBinder effectBinder = effectSp->asBinder(); AIBinder_setMinSchedulerPolicy(effectBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); + AIBinder_setInheritRt(effectBinder.get(), true); mEffectMap[std::weak_ptr(effectSp)] = std::make_pair(in_impl_uuid, std::move(effectBinder)); return ndk::ScopedAStatus::ok(); diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 94aa4dc657..3a36d43291 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -855,8 +855,9 @@ ndk::ScopedAStatus Module::openInputStream(const OpenInputStreamArguments& in_ar RETURN_STATUS_IF_ERROR( streamWrapper.setConnectedDevices(findConnectedDevices(in_args.portConfigId))); } - AIBinder_setMinSchedulerPolicy(streamWrapper.getBinder().get(), SCHED_NORMAL, - ANDROID_PRIORITY_AUDIO); + auto streamBinder = streamWrapper.getBinder(); + AIBinder_setMinSchedulerPolicy(streamBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); + AIBinder_setInheritRt(streamBinder.get(), true); mStreams.insert(port->id, in_args.portConfigId, std::move(streamWrapper)); _aidl_return->stream = std::move(stream); return ndk::ScopedAStatus::ok(); @@ -901,8 +902,9 @@ ndk::ScopedAStatus Module::openOutputStream(const OpenOutputStreamArguments& in_ RETURN_STATUS_IF_ERROR( streamWrapper.setConnectedDevices(findConnectedDevices(in_args.portConfigId))); } - AIBinder_setMinSchedulerPolicy(streamWrapper.getBinder().get(), SCHED_NORMAL, - ANDROID_PRIORITY_AUDIO); + auto streamBinder = streamWrapper.getBinder(); + AIBinder_setMinSchedulerPolicy(streamBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); + AIBinder_setInheritRt(streamBinder.get(), true); mStreams.insert(port->id, in_args.portConfigId, std::move(streamWrapper)); _aidl_return->stream = std::move(stream); return ndk::ScopedAStatus::ok(); diff --git a/audio/aidl/default/include/core-impl/ChildInterface.h b/audio/aidl/default/include/core-impl/ChildInterface.h index f5f1855aab..161f6db6c0 100644 --- a/audio/aidl/default/include/core-impl/ChildInterface.h +++ b/audio/aidl/default/include/core-impl/ChildInterface.h @@ -48,9 +48,9 @@ struct ChildInterface : private std::pair, ndk::SpAIBinder> { } AIBinder* getBinder() { if (this->second.get() == nullptr) { - this->second = this->first->asBinder(); - AIBinder_setMinSchedulerPolicy(this->second.get(), SCHED_NORMAL, - ANDROID_PRIORITY_AUDIO); + const auto binder = this->second = this->first->asBinder(); + AIBinder_setMinSchedulerPolicy(binder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); + AIBinder_setInheritRt(binder.get(), true); } return this->second.get(); } From c48341706e21b4489fbb401105300b6f63af1ce7 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Tue, 19 Mar 2024 11:01:26 +0900 Subject: [PATCH 056/161] Update APF VTS for VSR-14 compliance Modified the VTS to check the APF version is 4 (or higher) as mandated by VSR-14. Test: TH (cherry picked from https://android-review.googlesource.com/q/commit:fe83a98b3e139a0caf7d7f5b64ec3144e26b9b41) Merged-In: I28f6579bf426e5338880fcc6afff33c769f29634 Change-Id: I28f6579bf426e5338880fcc6afff33c769f29634 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index b426cdbf1c..e8b2d5709a 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -180,9 +180,9 @@ TEST_P(WifiStaIfaceAidlTest, CheckApfIsSupported) { EXPECT_TRUE(isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)); StaApfPacketFilterCapabilities apf_caps = {}; EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); - // The APF version must be 4 and the usable memory must be at least + // The APF version must be 4 or higher and the usable memory must be at least // 1024 bytes. - EXPECT_EQ(apf_caps.version, 4); + EXPECT_GE(apf_caps.version, 4); EXPECT_GE(apf_caps.maxLength, 1024); } } From bc4498f3d1aef7bcd8951fe1142c1b0ce3bac2cc Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Mon, 19 Feb 2024 16:55:53 +0900 Subject: [PATCH 057/161] Adapt CheckApfIsSupported for VSR-15 compatibility This commit updates CheckApfIsSupported to align with VSR-15 requirements. APF should have minimum of 2000 bytes usable memory. Bug: <303356901> Test: TH (cherry picked from https://android-review.googlesource.com/q/commit:641f0aed53c80751a8f19e551c522d7c4671691f) Merged-In: I2a2dbc22e1532fcb11ab256830cecba9f6c54446 Change-Id: I2a2dbc22e1532fcb11ab256830cecba9f6c54446 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../functional/wifi_sta_iface_aidl_test.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index e8b2d5709a..c87fe13298 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -176,14 +176,18 @@ TEST_P(WifiStaIfaceAidlTest, CheckApfIsSupported) { } StaApfPacketFilterCapabilities apf_caps = {}; EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); - } else { - EXPECT_TRUE(isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)); - StaApfPacketFilterCapabilities apf_caps = {}; - EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); - // The APF version must be 4 or higher and the usable memory must be at least - // 1024 bytes. - EXPECT_GE(apf_caps.version, 4); - EXPECT_GE(apf_caps.maxLength, 1024); + return; + } + + EXPECT_TRUE(isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)); + StaApfPacketFilterCapabilities apf_caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); + EXPECT_GE(apf_caps.version, 4); + // Based on VSR-14 the usable memory must be at least 1024 bytes. + EXPECT_GE(apf_caps.maxLength, 1024); + if (vendor_api_level >= __ANDROID_API_V__) { + // Based on VSR-15 the usable memory must be at least 2000 bytes. + EXPECT_GE(apf_caps.maxLength, 2000); } } From 33405cce29b5dd518d4375022c4738878d6a2723 Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 27 Mar 2024 23:09:25 +0000 Subject: [PATCH 058/161] Updated VehicleIgnitionState.aidl docs to explain state behavior in BEVs Bug: 322556750 Test: presubmit Change-Id: I97b672fa7892de45169ae568d330f5382aa38dc1 --- .../hardware/automotive/vehicle/VehicleIgnitionState.aidl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl index 4de97f6639..2338008d59 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl @@ -28,6 +28,10 @@ enum VehicleIgnitionState { * Steering wheel is not locked, engine and all accessories are OFF. If * car can be in LOCK and OFF state at the same time than HAL must report * LOCK state. + * + * If IGNITION_STATE is implemented on a BEV, then this state must + * communicate that the BEV's High Voltage battery is disconnected and thus + * the vehicle is OFF. */ OFF, /** @@ -38,6 +42,10 @@ enum VehicleIgnitionState { /** * Ignition is in state ON. Accessories and instrument cluster available, * engine might be running or ready to be started. + * + * If IGNITION_STATE is implemented on a BEV, then this state must + * communicate that the BEV's High Voltage battery is connected and thus the + * vehicle is ON. */ ON, /** From 85b7f66b7762f17769629c2fd5843ce8447626ec Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 28 Mar 2024 20:06:48 +0000 Subject: [PATCH 059/161] Fix fmq_test when HIDL is not supported If HIDL is not supported on the device, don't expect to be able to register the HIDL service. Test: atest fmq_test Bug: 218588089 Change-Id: I1764b26f06ef8f280f719d8ab44db2ebfe562944 --- tests/msgq/1.0/default/mq_test_service.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/msgq/1.0/default/mq_test_service.cpp b/tests/msgq/1.0/default/mq_test_service.cpp index 72ffe41b74..66ad12f236 100644 --- a/tests/msgq/1.0/default/mq_test_service.cpp +++ b/tests/msgq/1.0/default/mq_test_service.cpp @@ -21,13 +21,15 @@ #include #include #include +#include using aidl::android::fmq::test::TestAidlMsgQ; #include -using android::hardware::tests::msgq::V1_0::ITestMsgQ; using android::hardware::defaultPassthroughServiceImplementation; +using android::hardware::isHidlSupported; +using android::hardware::tests::msgq::V1_0::ITestMsgQ; int main() { android::hardware::details::setTrebleTestingOverride(true); @@ -39,8 +41,10 @@ int main() { LOG(INFO) << "instance: " << instance; CHECK(AServiceManager_addService(store->asBinder().get(), instance.c_str()) == STATUS_OK); - // Register HIDL service - CHECK(defaultPassthroughServiceImplementation() == android::OK); + if (isHidlSupported()) { + // Register HIDL service + CHECK(defaultPassthroughServiceImplementation() == android::OK); + } ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach From 7a621b0215dd0e2fa52c3c3fb0bc5dae405f5ad8 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 28 Mar 2024 18:02:56 +0000 Subject: [PATCH 060/161] Add relationship between EV_BRAKE_REGENERATION_LEVEL and _STATE in HAL Bug: 316958353 Test: presubmit Change-Id: I16d5b1c0b54d7fcef419446f88d0c186b61ae8dd --- ....hardware.automotive.vehicle-types-meta.json | 4 ++-- .../automotive/vehicle/VehicleProperty.aidl | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 735f8e6c6f..9ffb247654 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -246,7 +246,7 @@ { "name": "EV_BRAKE_REGENERATION_LEVEL", "value": 289408012, - "description": "Regenerative braking level of a electronic vehicle\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported. The minInt32Value must be 0.\nThe maxInt32Value indicates the maximum amount of energy regenerated from braking. The minInt32Value indicates no regenerative braking.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." + "description": "Regenerative braking level of a electronic vehicle\nThe maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between minInt32Value and maxInt32Value must be supported. The minInt32Value must be 0.\nThe maxInt32Value indicates the setting for the maximum amount of energy regenerated from braking. The minInt32Value indicates the setting for no regenerative braking.\nThis property is a more granular form of EV_REGENERATIVE_BRAKING_STATE. It allows the user to set a more specific level of regenerative braking if the states in EvRegenerativeBrakingState are not granular enough for the OEM.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "Warning for fuel low level.", @@ -1296,7 +1296,7 @@ "EvRegenerativeBrakingState" ], "data_enum": "EvRegenerativeBrakingState", - "description": "Regenerative braking or one-pedal drive state of the car\nReturns the current state associated with the regenerative braking setting in the car" + "description": "Regenerative braking or one-pedal drive setting of the car\nReturns the current setting associated with the regenerative braking setting in the car\nIf the OEM requires more setting than those provided in EvRegenerativeBrakingState, the EV_BRAKE_REGENERATION_LEVEL property can be used instead, which provides a more granular way of providing the same information." }, { "name": "TRAILER_PRESENT", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 099323cfff..2a84bce314 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -655,8 +655,12 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. The minInt32Value must be 0. * - * The maxInt32Value indicates the maximum amount of energy regenerated from braking. The - * minInt32Value indicates no regenerative braking. + * The maxInt32Value indicates the setting for the maximum amount of energy regenerated from + * braking. The minInt32Value indicates the setting for no regenerative braking. + * + * This property is a more granular form of EV_REGENERATIVE_BRAKING_STATE. It allows the user to + * set a more specific level of regenerative braking if the states in EvRegenerativeBrakingState + * are not granular enough for the OEM. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -4940,10 +4944,13 @@ enum VehicleProperty { + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 /** - * Regenerative braking or one-pedal drive state of the car + * Regenerative braking or one-pedal drive setting of the car * - * Returns the current state associated with the regenerative braking - * setting in the car + * Returns the current setting associated with the regenerative braking setting in the car + * + * If the OEM requires more setting than those provided in EvRegenerativeBrakingState, the + * EV_BRAKE_REGENERATION_LEVEL property can be used instead, which provides a more granular + * way of providing the same information. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ From 53238b1afd9bd940ab0f567ce28f67cde20bad34 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Fri, 29 Mar 2024 23:09:04 +0000 Subject: [PATCH 061/161] Effect AIDL VTS: relax dynamics processing effect parameter validations relaxing several parameter checking to align with HIDL - no need to have stage in use to set bands/channels - band settings no need to be sorted by frequency Bug: 328012516 Test: atest VtsHalDynamicsProcessingTargetTest Change-Id: If12d978ee69ee7f087a7e8758513a9c6bacf817f --- audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp index 3f7a76dae6..e95bd4d1d1 100644 --- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp +++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp @@ -195,48 +195,42 @@ const std::set> template bool DynamicsProcessingTestHelper::isBandConfigValid(const std::vector& cfgs, int bandCount) { - std::vector freqs(cfgs.size(), -1); + std::unordered_set freqs; for (auto cfg : cfgs) { if (cfg.channel < 0 || cfg.channel >= mChannelCount) return false; if (cfg.band < 0 || cfg.band >= bandCount) return false; - freqs[cfg.band] = cfg.cutoffFrequencyHz; + // duplicated band index + if (freqs.find(cfg.band) != freqs.end()) return false; + freqs.insert(cfg.band); } - if (std::count(freqs.begin(), freqs.end(), -1)) return false; - return std::is_sorted(freqs.begin(), freqs.end()); + return true; } bool DynamicsProcessingTestHelper::isParamValid(const DynamicsProcessing::Tag& tag, const DynamicsProcessing& dp) { switch (tag) { case DynamicsProcessing::preEq: { - if (!mEngineConfigApplied.preEqStage.inUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::postEq: { - if (!mEngineConfigApplied.postEqStage.inUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::mbc: { - if (!mEngineConfigApplied.mbcStage.inUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::preEqBand: { - if (!mEngineConfigApplied.preEqStage.inUse) return false; return isBandConfigValid(dp.get(), mEngineConfigApplied.preEqStage.bandCount); } case DynamicsProcessing::postEqBand: { - if (!mEngineConfigApplied.postEqStage.inUse) return false; return isBandConfigValid(dp.get(), mEngineConfigApplied.postEqStage.bandCount); } case DynamicsProcessing::mbcBand: { - if (!mEngineConfigApplied.mbcStage.inUse) return false; return isBandConfigValid(dp.get(), mEngineConfigApplied.mbcStage.bandCount); } case DynamicsProcessing::limiter: { - if (!mEngineConfigApplied.limiterInUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::inputGain: { From 40d9d9ee7b654546597a0a710a5ed38092926788 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 25 Mar 2024 17:52:34 +0000 Subject: [PATCH 062/161] Effect VTS: skip VolumeDataTest for U Volume effect implementation was not ready on early U releases Bug: 327497904 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I7e909cdabbd167bd2e012dbe378ccb3402d33f53 --- audio/aidl/vts/VtsHalVolumeTargetTest.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp index 1c1489deb5..4597b39b16 100644 --- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp @@ -140,7 +140,9 @@ using VolumeDataTestParam = std::pair, Descriptor>; class VolumeDataTest : public ::testing::TestWithParam, public VolumeControlHelper { public: - VolumeDataTest() { + VolumeDataTest() + : kVsrApiLevel( + android::base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__)) { std::tie(mFactory, mDescriptor) = GetParam(); mInput.resize(kBufferSize); mInputMag.resize(mTestFrequencies.size()); @@ -165,13 +167,17 @@ class VolumeDataTest : public ::testing::TestWithParam, void SetUp() override { SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags); + // Skips test fixture if api_level <= 34 (__ANDROID_API_U__). + if (kVsrApiLevel <= __ANDROID_API_U__) GTEST_SKIP(); ASSERT_NO_FATAL_FAILURE(SetUpVolumeControl()); } void TearDown() override { SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags); + if (kVsrApiLevel <= __ANDROID_API_U__) GTEST_SKIP(); TearDownVolumeControl(); } + const int kVsrApiLevel; static constexpr int kMaxAudioSample = 1; static constexpr int kTransitionDuration = 300; static constexpr int kNPointFFT = 32768; From aff4c5569ab3f2f00c16b3ae151f946d20ead65c Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 1 Apr 2024 23:55:08 +0000 Subject: [PATCH 063/161] Update behavior of EV_PORT_LOCATION properties HAL docs in multiport EVs Bug: 316941251 Test: presubmit Change-Id: I64f0e965a459c8f8ad0b3b23c635fbc38c600840 --- ...android.hardware.automotive.vehicle-types-meta.json | 4 ++-- .../hardware/automotive/vehicle/VehicleProperty.aidl | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 735f8e6c6f..958ba46da3 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -67,7 +67,7 @@ "PortLocationType" ], "data_enum": "PortLocationType", - "description": "EV port location" + "description": "EV port location\nThis property must communicate the location of the charging port on the EV using the PortLocationType enum. If there are multiple ports available on the vehicle, this property must return the port that allows the fastest charging. To communicate all port locations, use INFO_MULTI_EV_PORT_LOCATIONS." }, { "name": "INFO_DRIVER_SEAT", @@ -90,7 +90,7 @@ "PortLocationType" ], "data_enum": "PortLocationType", - "description": "Multiple EV port locations\nImplement this property if the vehicle has multiple EV ports. Port locations are defined in PortLocationType. For example, a car has one port in front left and one port in rear left: int32Values[0] = PortLocationType::FRONT_LEFT int32Values[0] = PortLocationType::REAR_LEFT" + "description": "Multiple EV port locations\nImplement this property if the vehicle has multiple EV ports. Port locations are defined in PortLocationType. For example, a car has one port in front left and one port in rear left: int32Values[0] = PortLocationType::FRONT_LEFT int32Values[1] = PortLocationType::REAR_LEFT\nIf only one port exists on the vehicle, this property's value should list just one element. See INFO_EV_PORT_LOCATION for describing just one port location." }, { "name": "PERF_ODOMETER", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 099323cfff..cf174ee8c8 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -163,6 +163,11 @@ enum VehicleProperty { /** * EV port location * + * This property must communicate the location of the charging port on the EV using the + * PortLocationType enum. If there are multiple ports available on the vehicle, this property + * must return the port that allows the fastest charging. To communicate all port locations, + * use INFO_MULTI_EV_PORT_LOCATIONS. + * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @data_enum PortLocationType @@ -207,7 +212,10 @@ enum VehicleProperty { * Port locations are defined in PortLocationType. * For example, a car has one port in front left and one port in rear left: * int32Values[0] = PortLocationType::FRONT_LEFT - * int32Values[0] = PortLocationType::REAR_LEFT + * int32Values[1] = PortLocationType::REAR_LEFT + * + * If only one port exists on the vehicle, this property's value should list just one element. + * See INFO_EV_PORT_LOCATION for describing just one port location. * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ From 8aa5d8a57ba0dcd4fef6e2ea9639b3a5bf5edc04 Mon Sep 17 00:00:00 2001 From: Satish Yalla Date: Tue, 2 Apr 2024 06:45:44 +0000 Subject: [PATCH 064/161] Revert "Fix fmq_test when HIDL is not supported" Revert submission 26722372-nomo_hidl Reason for revert: Reverted changes: /q/submissionid:26722372-nomo_hidl Change-Id: I65174dd90ce94bc7d39d7bbafa2dd51886a89eee --- tests/msgq/1.0/default/mq_test_service.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/msgq/1.0/default/mq_test_service.cpp b/tests/msgq/1.0/default/mq_test_service.cpp index 66ad12f236..72ffe41b74 100644 --- a/tests/msgq/1.0/default/mq_test_service.cpp +++ b/tests/msgq/1.0/default/mq_test_service.cpp @@ -21,15 +21,13 @@ #include #include #include -#include using aidl::android::fmq::test::TestAidlMsgQ; #include -using android::hardware::defaultPassthroughServiceImplementation; -using android::hardware::isHidlSupported; using android::hardware::tests::msgq::V1_0::ITestMsgQ; +using android::hardware::defaultPassthroughServiceImplementation; int main() { android::hardware::details::setTrebleTestingOverride(true); @@ -41,10 +39,8 @@ int main() { LOG(INFO) << "instance: " << instance; CHECK(AServiceManager_addService(store->asBinder().get(), instance.c_str()) == STATUS_OK); - if (isHidlSupported()) { - // Register HIDL service - CHECK(defaultPassthroughServiceImplementation() == android::OK); - } + // Register HIDL service + CHECK(defaultPassthroughServiceImplementation() == android::OK); ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach From 6f8224538efa2dd2e9fd3588ecb1177c33200ec0 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Fri, 29 Mar 2024 18:45:30 +0000 Subject: [PATCH 065/161] Use customized toString for UUID in VTS Bug: 331955595 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I561d68645f3f159b029135b0dfa66511a2800d72 Merged-In: I561d68645f3f159b029135b0dfa66511a2800d72 --- audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp | 10 +++++----- .../vts/VtsHalEnvironmentalReverbTargetTest.cpp | 17 ++++++++--------- .../vts/VtsHalHapticGeneratorTargetTest.cpp | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp index 3f7a76dae6..69ab91b0bc 100644 --- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp +++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp @@ -559,7 +559,7 @@ INSTANTIATE_TEST_SUITE_P( ::android::internal::ToString(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_inputGains_" + gains; + toString(descriptor.common.id.uuid) + "_inputGains_" + gains; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -652,7 +652,7 @@ INSTANTIATE_TEST_SUITE_P( std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_limiterConfig_" + + toString(descriptor.common.id.uuid) + "_limiterConfig_" + cfg.toString() + "_engineSetting_" + engineLimiterInUse; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); @@ -726,7 +726,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_" + channelConfig + + toString(descriptor.common.id.uuid) + "_" + channelConfig + "_engineInUse_" + engineInUse; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); @@ -868,7 +868,7 @@ INSTANTIATE_TEST_SUITE_P( std::string stageInUse = std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_bands_" + bands + + toString(descriptor.common.id.uuid) + "_bands_" + bands + "_stageInUse_" + stageInUse; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); @@ -986,7 +986,7 @@ INSTANTIATE_TEST_SUITE_P( std::string stageInUse = std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_bands_" + mbcBands + + toString(descriptor.common.id.uuid) + "_bands_" + mbcBands + "_stageInUse_" + stageInUse; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); diff --git a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp index 765c37739f..f641fa5f37 100644 --- a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp +++ b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp @@ -249,7 +249,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_roomHfLevel" + roomHfLevel; + toString(descriptor.common.id.uuid) + "_roomHfLevel" + roomHfLevel; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -289,7 +289,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_decayTime" + decayTime; + toString(descriptor.common.id.uuid) + "_decayTime" + decayTime; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -329,8 +329,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_decayHfRatio" + - decayHfRatio; + toString(descriptor.common.id.uuid) + "_decayHfRatio" + decayHfRatio; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -370,7 +369,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_level" + level; + toString(descriptor.common.id.uuid) + "_level" + level; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -410,7 +409,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_delay" + delay; + toString(descriptor.common.id.uuid) + "_delay" + delay; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -450,7 +449,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_diffusion" + diffusion; + toString(descriptor.common.id.uuid) + "_diffusion" + diffusion; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -490,7 +489,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_density" + density; + toString(descriptor.common.id.uuid) + "_density" + density; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -527,7 +526,7 @@ INSTANTIATE_TEST_SUITE_P( std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_bypass" + bypass; + toString(descriptor.common.id.uuid) + "_bypass" + bypass; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp index d31211146d..48e59dcce6 100644 --- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp +++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp @@ -225,7 +225,7 @@ INSTANTIATE_TEST_SUITE_P( std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_hapticScaleId" + + toString(descriptor.common.id.uuid) + "_hapticScaleId" + hapticScaleID + "_hapticScaleVibScale" + hapticScaleVibScale + "_resonantFrequency" + resonantFrequency + "_qFactor" + qFactor + "_maxAmplitude" + maxAmplitude; @@ -422,7 +422,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get(info.param).second; std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString(); + toString(descriptor.common.id.uuid); std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; From 7d2ac2be86e20152112d7d975b1991744be987ee Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 2 Apr 2024 14:56:40 -0700 Subject: [PATCH 066/161] Define latest audio control HAL java static default Define latest audio control HAL java static default to avoid manually updating version in Android.bp. Bug: 328829164 Test: build ok Change-Id: I9fe9712a9f865e506e1d92e8ac364feaf15fa270 --- automotive/audiocontrol/aidl/Android.bp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index bedf5e4a96..c3540699fb 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -93,3 +93,10 @@ cc_defaults { latest_android_hardware_automotive_audiocontrol + "-ndk", ], } + +java_defaults { + name: "latest_android_hardware_automotive_audiocontrol_java_static", + static_libs: [ + latest_android_hardware_automotive_audiocontrol + "-java", + ], +} From 1683d88552c301bcecc8ab026485cd05b3f4edc0 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 3 Apr 2024 21:00:51 +0000 Subject: [PATCH 067/161] Update legacy headers in the new directory. Headers were moved in AOSP first, so we need to copy over the internal changes. BYPASS_INCLUSIVE_LANGUAGE_REASON=Importing legacy code. Bug: 271177978 Test: m Change-Id: I873de49dc5e3371865725170ef9409a6df206235 --- .../include/hardware_legacy/rtt.h | 30 +++++++----- .../include/hardware_legacy/wifi_hal.h | 47 +++++++++++++++++-- .../include/hardware_legacy/wifi_twt.h | 10 ++-- 3 files changed, 65 insertions(+), 22 deletions(-) diff --git a/wifi/legacy_headers/include/hardware_legacy/rtt.h b/wifi/legacy_headers/include/hardware_legacy/rtt.h index 63c3325dda..426abe0854 100644 --- a/wifi/legacy_headers/include/hardware_legacy/rtt.h +++ b/wifi/legacy_headers/include/hardware_legacy/rtt.h @@ -121,12 +121,10 @@ typedef struct { /* RTT configuration v3 (11az support)*/ typedef struct { wifi_rtt_config rtt_config; - byte ntb_min_measurement_time_millis; // 11az Non-Trigger-based (non-TB) minimum measurement - // time in milliseconds - byte ntb_max_measurement_time_millis; // 11az Non-Trigger-based (non-TB) maximum measurement - // time in milliseconds - byte tx_ltf_repetition_count; // Multiple transmissions of HE-LTF symbols in an HE - // Ranging NDP. A value of 1 indicates no repetition. + u64 ntb_min_measurement_time; // 11az Non-Trigger-based (non-TB) minimum measurement time in + // units of 100 microseconds + u64 ntb_max_measurement_time; // 11az Non-Trigger-based (non-TB) maximum measurement time in + // units of 10 milliseconds } wifi_rtt_config_v3; /* RTT results */ @@ -184,11 +182,19 @@ typedef struct { /* RTT results v3 (11az support)*/ typedef struct { wifi_rtt_result_v2 rtt_result; - int tx_ltf_repetition_count; // 11az Transmit LTF repetitions used to get this result. - int ntb_min_measurement_time_millis; // Minimum non-trigger based (non-TB) dynamic measurement - // time in milliseconds assigned by the 11az responder. - int ntb_max_measurement_time_millis; // Maximum non-trigger based (non-TB) dynamic measurement - // time in milliseconds assigned by the 11az responder. + byte i2r_tx_ltf_repetition_count;// Multiple transmissions of HE-LTF symbols in an HE (I2R) + // Ranging NDP. An HE-LTF repetition value of 1 indicates no + // repetitions. + byte r2i_tx_ltf_repetition_count;// Multiple transmissions of HE-LTF symbols in an HE (R2I) + // Ranging NDP. An HE-LTF repetition value of 1 indicates no + // repetitions. + u64 ntb_min_measurement_time; // Minimum non-trigger based (non-TB) dynamic measurement time + // in units of 100 microseconds assigned by the 11az responder. + u64 ntb_max_measurement_time; // Maximum non-trigger based (non-TB) dynamic measurement + // time in units of 10 milliseconds assigned by the 11az + // responder. + byte num_tx_sts; // Number of transmit space-time streams used. + byte num_rx_sts; // Number of receive space-time streams used. } wifi_rtt_result_v3; @@ -305,8 +311,6 @@ typedef struct { byte az_bw_support; // bit mask indicates what BW is supported by 11az initiator byte ntb_initiator_supported; // if 11az non-TB initiator is supported byte ntb_responder_supported; // if 11az non-TB responder is supported - byte max_tx_ltf_repetition_count;// maximum HE LTF repetitions the 11az initiator is capable of - // transmitting in the preamble of I2R NDP } wifi_rtt_capabilities_v3; /* RTT capabilities v3 of the device (11az support) */ diff --git a/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h b/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h index 9c82e80b39..e770777aae 100644 --- a/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h +++ b/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h @@ -417,6 +417,24 @@ typedef struct { wifi_iface_combination iface_combinations[MAX_IFACE_COMBINATIONS]; } wifi_iface_concurrency_matrix; +/* Wifi OUI data */ +typedef struct { + /* OUI : 24-bit organizationally unique identifier to identify the Vendor/OEM */ + u32 oui; + /* Length of the data buffer */ + u32 data_len; + /* Vendor-specific data */ + const u8 *data; +} oui_keyed_data; + +/* Wifi Vendor data list */ +typedef struct { + /* Number of OUI Keyed Data objects */ + u32 num_oui_keyed_data; + /* List of OUI Keyed Data */ + oui_keyed_data *oui_data; +} wifi_vendor_data; + /* Initialize/Cleanup */ wifi_error wifi_initialize(wifi_handle *handle); @@ -1007,6 +1025,16 @@ typedef struct { */ wifi_error (*wifi_twt_get_capabilities)(wifi_interface_handle iface, wifi_twt_capabilities* capabilities); + + /** + * Register TWT events before sending any TWT request + * + * @param wifi_interface_handle: + * @param events: TWT events callbacks to register + * @return Synchronous wifi_error + */ + wifi_error (*wifi_twt_register_events)(wifi_interface_handle iface, wifi_twt_events events); + /** * Setup a TWT session. * @@ -1017,11 +1045,10 @@ typedef struct { * @param id Identifier for the command. The value 0 is reserved. * @param iface Wifi interface handle * @param request TWT request parameters - * @param events TWT events * @return Synchronous wifi_error */ wifi_error (*wifi_twt_session_setup)(wifi_request_id id, wifi_interface_handle iface, - wifi_twt_request request, wifi_twt_events events); + wifi_twt_request request); /** * Update a TWT session. * @@ -1098,7 +1125,7 @@ typedef struct { * @param TwtCallbackHandler: callback function pointers * @return Synchronous wifi_error * - * Note: This function is deprecated + * Note: This function is deprecated by wifi_twt_register_events */ wifi_error (*wifi_twt_register_handler)(wifi_interface_handle iface, TwtCallbackHandler handler); @@ -1170,7 +1197,7 @@ typedef struct { * @param config_id: configuration ID of TWT request * @return Synchronous wifi_error * - * Note: This function is deprecated by wifi_twt_session_clear_stats + * Note: This function is deprecated. */ wifi_error (*wifi_twt_clear_stats)(wifi_interface_handle iface, u8 config_id); @@ -1373,6 +1400,18 @@ typedef struct { */ wifi_error (*wifi_set_mlo_mode)(wifi_handle handle, wifi_mlo_mode mode); + /**@brief wifi_virtual_interface_create_with_vendor_data + * Create new virtual interface using vendor data. + * @param handle: global wifi_handle + * @param ifname: name of interface to be created. + * @param iface_type: one of interface types from wifi_interface_type. + * @param vendor_data: vendor data to apply on this interface. + * @return Synchronous wifi_error + */ + wifi_error (*wifi_virtual_interface_create_with_vendor_data) + (wifi_handle handle, const char* ifname, + wifi_interface_type iface_type, wifi_vendor_data* vendor_data); + /* * when adding new functions make sure to add stubs in * wifi_legacy_hal_stubs.cpp::initHalFuncTableWithStubs diff --git a/wifi/legacy_headers/include/hardware_legacy/wifi_twt.h b/wifi/legacy_headers/include/hardware_legacy/wifi_twt.h index 1a787ef05e..cb11c78c0c 100644 --- a/wifi/legacy_headers/include/hardware_legacy/wifi_twt.h +++ b/wifi/legacy_headers/include/hardware_legacy/wifi_twt.h @@ -31,8 +31,8 @@ typedef struct { u8 is_flexible_twt_supported; // 0 for not supporting flexible twt schedules u32 min_wake_duration_micros; // minimum twt wake duration capable in microseconds u32 max_wake_duration_micros; // maximum twt wake duration capable in microseconds - u32 min_wake_interval_micros; // minimum twt wake interval capable in microseconds - u32 max_wake_interval_micros; // maximum twt wake interval capable in microseconds + u64 min_wake_interval_micros; // minimum twt wake interval capable in microseconds + u64 max_wake_interval_micros; // maximum twt wake interval capable in microseconds } wifi_twt_capabilities; /* TWT request parameters to setup or update a TWT session */ @@ -41,8 +41,8 @@ typedef struct { // Otherwise UNSPECIFIED. u32 min_wake_duration_micros; // minimum twt wake duration in microseconds u32 max_wake_duration_micros; // maximum twt wake duration in microseconds - u32 min_wake_interval_micros; // minimum twt wake interval in microseconds - u32 max_wake_interval_micros; // maximum twt wake interval in microseconds + u64 min_wake_interval_micros; // minimum twt wake interval in microseconds + u64 max_wake_interval_micros; // maximum twt wake interval in microseconds } wifi_twt_request; /* TWT negotiation types */ @@ -56,7 +56,7 @@ typedef struct { u32 session_id; // a unique identifier for the session s8 mlo_link_id; // link id in case of MLO connection. Otherwise UNSPECIFIED. u32 wake_duration_micros; // TWT service period in microseconds - u32 wake_interval_micros; // TWT wake interval for this session in microseconds + u64 wake_interval_micros; // TWT wake interval for this session in microseconds wifi_twt_negotiation_type negotiation_type; // TWT negotiation type u8 is_trigger_enabled; // 0 if this TWT session is not trigger enabled u8 is_announced; // 0 if this TWT session is not announced From b46f53270ad5630f3ec9e55ff3cc993ac801a54b Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 3 Apr 2024 16:07:19 +0000 Subject: [PATCH 068/161] Handle additional WifiBand cases in convertAidlWifiBandToLegacy. Several cases related to 6 Ghz are not currently handled. CL is adapted from aosp/3015819 which was developed for HIDL. Bug: 331453855 Test: m Change-Id: Ide86ef46eb6fbe3c4dd8648230ad5bf8a8112203 --- wifi/aidl/default/aidl_struct_util.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index d9e023c80e..d82450e348 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -525,6 +525,7 @@ bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilit return true; } +// Only use to prepare parameters for Gscan. legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band) { switch (band) { case WifiBand::BAND_UNSPECIFIED: @@ -541,6 +542,15 @@ legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band) { return legacy_hal::WIFI_BAND_ABG; case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: return legacy_hal::WIFI_BAND_ABG_WITH_DFS; + case WifiBand::BAND_6GHZ: + case WifiBand::BAND_60GHZ: + case WifiBand::BAND_5GHZ_6GHZ: + case WifiBand::BAND_24GHZ_5GHZ_6GHZ: + case WifiBand::BAND_24GHZ_5GHZ_6GHZ_60GHZ: + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ_60GHZ: + LOG(INFO) << "WifiBand mapping may be incorrect, since 6GHz is not supported by legacy"; + return legacy_hal::WIFI_BAND_UNSPECIFIED; default: CHECK(false); return {}; From f687f7f7b8d31d573fe1ed0eeb06562679f5458b Mon Sep 17 00:00:00 2001 From: Manali Bhutiyani Date: Mon, 25 Mar 2024 22:07:25 +0000 Subject: [PATCH 069/161] [vts] Fix VTS batched-command tests Fix VTS tests per comments in b/304976052. Removing redundant tests, as existing CreateLayer, DestroyLayer, CreateLayer_BadDisplay and DestroyLayer_BadDisplay already provide the needed coverage. Bug: 304976052 Test: atest VtsHalGraphicsComposer3_TargetTest atest PerInstance/GraphicsComposerAidlBatchedCommandTest Change-Id: I34cb6a69aad6d8f86772a82833b8f15e465fe8d3 --- .../VtsHalGraphicsComposer3_TargetTest.cpp | 64 ++++++------------- 1 file changed, 21 insertions(+), 43 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index f72cf55300..cef552c411 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -3002,14 +3002,10 @@ TEST_P(GraphicsComposerAidlCommandV3Test, CreateBatchedCommand) { GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation"; return; } - auto& writer = getWriter(getPrimaryDisplayId()); - int64_t layer = 5; - writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, - LayerLifecycleBatchCommandType::CREATE); - writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, - VtsComposerClient::kNoFrameIntervalNs); + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer); + EXPECT_TRUE(status.isOk()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -3019,15 +3015,13 @@ TEST_P(GraphicsComposerAidlCommandV3Test, CreateBatchedCommand_BadDisplay) { GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation"; return; } - - auto& writer = getWriter(getPrimaryDisplayId()); + auto& writer = getWriter(getInvalidDisplayId()); int64_t layer = 5; writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer, LayerLifecycleBatchCommandType::CREATE); - writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, - VtsComposerClient::kNoFrameIntervalNs); + writer.setNewBufferSlotCount(getInvalidDisplayId(), layer, 1); execute(); + const auto errors = mReader.takeErrors(); ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_DISPLAY); } @@ -3037,26 +3031,15 @@ TEST_P(GraphicsComposerAidlCommandV3Test, DestroyBatchedCommand) { GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation"; return; } - auto& writer = getWriter(getPrimaryDisplayId()); - int64_t layer = 5; - writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, - LayerLifecycleBatchCommandType::CREATE); - writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, - VtsComposerClient::kNoFrameIntervalNs); + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer); + EXPECT_TRUE(status.isOk()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, - LayerLifecycleBatchCommandType::DESTROY); - layer++; - writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, - LayerLifecycleBatchCommandType::CREATE); - writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); - + EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer, &writer).isOk()); execute(); - const auto errors = mReader.takeErrors(); - ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_DISPLAY); + ASSERT_TRUE(mReader.takeErrors().empty()); } TEST_P(GraphicsComposerAidlCommandV3Test, DestroyBatchedCommand_BadDisplay) { @@ -3064,25 +3047,20 @@ TEST_P(GraphicsComposerAidlCommandV3Test, DestroyBatchedCommand_BadDisplay) { GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation"; return; } - auto& writer = getWriter(getPrimaryDisplayId()); - int64_t layer = 5; - writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer, - LayerLifecycleBatchCommandType::CREATE); - writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); - writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp, - VtsComposerClient::kNoFrameIntervalNs); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer, - LayerLifecycleBatchCommandType::DESTROY); - layer++; - writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer, - LayerLifecycleBatchCommandType::CREATE); - writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1); + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer); + EXPECT_TRUE(status.isOk()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); + + auto& invalid_writer = getWriter(getInvalidDisplayId()); + invalid_writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer, + LayerLifecycleBatchCommandType::DESTROY); + execute(); + const auto errors = mReader.takeErrors(); + ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_DISPLAY); } TEST_P(GraphicsComposerAidlCommandV3Test, NoCreateDestroyBatchedCommandIncorrectLayer) { From 3ba7334dba52a344d4aca95572743c76cf60ddaf Mon Sep 17 00:00:00 2001 From: ramindani Date: Mon, 1 Apr 2024 11:42:33 -0700 Subject: [PATCH 070/161] [Composer-VTS] Check minFrameIntervalNs to check if rate is changing With different VRR modes we may have 2 modes with exactly the same minFrameIntervalNs, and in this case we can't differentiate between 2 modes. Test: atest VtsHalGraphicsComposer3_TargetTest BUG: 328350178 Change-Id: I5cddfee8b789ed6ce1b223ec345175f19a0db091 --- .../composer/aidl/vts/VtsComposerClient.h | 21 ++++++++++++--- .../VtsHalGraphicsComposer3_TargetTest.cpp | 26 +++++++++++-------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index fabc82a7a6..d3842c55c6 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -258,13 +258,13 @@ class VtsDisplay { struct DisplayConfig { DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_, - std::optional vrrConfig_ = {}) + std::optional vrrConfigOpt_ = {}) : vsyncPeriod(vsyncPeriod_), configGroup(configGroup_), - vrrConfig(std::move(vrrConfig_)) {} + vrrConfigOpt(std::move(vrrConfigOpt_)) {} int32_t vsyncPeriod; int32_t configGroup; - std::optional vrrConfig; + std::optional vrrConfigOpt; }; void addDisplayConfig(int32_t config, DisplayConfig displayConfig) { @@ -273,6 +273,21 @@ class VtsDisplay { DisplayConfig getDisplayConfig(int32_t config) { return mDisplayConfigs.find(config)->second; } + bool isRateSameBetweenConfigs(int config1, int config2) { + const auto displayConfig1 = getDisplayConfig(config1); + const auto displayConfig2 = getDisplayConfig(config2); + const auto vrrConfigOpt1 = displayConfig1.vrrConfigOpt; + const auto vrrConfigOpt2 = displayConfig2.vrrConfigOpt; + + if (vrrConfigOpt1 && vrrConfigOpt2 && + vrrConfigOpt1->minFrameIntervalNs == vrrConfigOpt2->minFrameIntervalNs) { + return true; + } else if (displayConfig1.vsyncPeriod == displayConfig2.vsyncPeriod) { + return true; + } + return false; + } + std::unordered_map getDisplayConfigs() { return mDisplayConfigs; } private: diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index f72cf55300..bf073ae99b 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1603,18 +1603,24 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk()); sendRefreshFrame(display, nullptr); - const auto displayConfigGroup1 = display.getDisplayConfig(config1); - int32_t vsyncPeriod1 = displayConfigGroup1.vsyncPeriod; - int32_t configGroup1 = displayConfigGroup1.configGroup; + const auto displayConfig1 = display.getDisplayConfig(config1); + int32_t vsyncPeriod1 = displayConfig1.vsyncPeriod; + int32_t configGroup1 = displayConfig1.configGroup; - const auto displayConfigGroup2 = display.getDisplayConfig(config2); - int32_t vsyncPeriod2 = displayConfigGroup2.vsyncPeriod; - int32_t configGroup2 = displayConfigGroup2.configGroup; + const auto displayConfig2 = display.getDisplayConfig(config2); + int32_t vsyncPeriod2 = displayConfig2.vsyncPeriod; + int32_t configGroup2 = displayConfig2.configGroup; if (vsyncPeriod1 == vsyncPeriod2) { return; // continue } + if ((!displayConfig1.vrrConfigOpt && displayConfig2.vrrConfigOpt) || + (displayConfig1.vrrConfigOpt && !displayConfig2.vrrConfigOpt)) { + // switching between vrr to non-vrr modes + return; // continue + } + // We don't allow delayed change when changing config groups if (params.delayForChange > 0 && configGroup1 != configGroup2) { return; // continue @@ -2738,7 +2744,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Ena const auto displayFilter = [&](auto refreshRateChangedDebugData) { bool nonVrrRateMatching = true; if (std::optional vrrConfigOpt = - display.getDisplayConfig(configId).vrrConfig; + display.getDisplayConfig(configId).vrrConfigOpt; getInterfaceVersion() >= 3 && !vrrConfigOpt) { nonVrrRateMatching = refreshRateChangedDebugData.refreshPeriodNanos == refreshRateChangedDebugData.vsyncPeriodNanos; @@ -2836,10 +2842,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test, .isOk()); forEachTwoConfigs(displayId, [&](int32_t config1, int32_t config2) { - const int32_t vsyncPeriod1 = display.getDisplayConfig(config1).vsyncPeriod; - const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod; - - if (vsyncPeriod1 == vsyncPeriod2) { + if (display.isRateSameBetweenConfigs(config1, config2)) { return; // continue } @@ -2854,6 +2857,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test, sendRefreshFrame(display, &timeline); } + const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod; const auto callbackFilter = [displayId, vsyncPeriod2](auto refreshRateChangedDebugData) { constexpr int kVsyncThreshold = 1000; From 4db4b7b602de2968223dd2aff061ba72d75d269a Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Fri, 5 Apr 2024 14:03:15 -0700 Subject: [PATCH 071/161] Fix wrong integer type in AIDL bcradio utils lib Bug: 310029333 Test: atest broadcastradio_utils_aidl_test Change-Id: I929049c0991a557f518853ecebd5ba67973e4274 --- .../vts/src/VtsHalBroadcastradioAidlTargetTest.cpp | 11 ++++++----- .../include/broadcastradio-utils-aidl/Utils.h | 2 +- broadcastradio/common/utilsaidl/src/Utils.cpp | 4 ++-- .../common/utilsaidl/test/BroadcastRadioUtilsTest.cpp | 11 ++++++++++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp index 9633ebb5ae..ee0c63988d 100644 --- a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp +++ b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp @@ -193,7 +193,7 @@ class BroadcastRadioHalTest : public testing::TestWithParam { MATCHER_P(InfoHasId, id, std::string(negation ? "does not contain" : "contains") + " " + id.toString()) { - vector ids = bcutils::getAllIds(arg.selector, id.type); + vector ids = bcutils::getAllIds(arg.selector, id.type); return ids.end() != find(ids.begin(), ids.end(), id.value); } @@ -697,7 +697,7 @@ TEST_P(BroadcastRadioHalTest, FmTune) { LOG(DEBUG) << "Current program info: " << infoCb.toString(); // it should tune exactly to what was requested - vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::AMFM_FREQUENCY_KHZ); + vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::AMFM_FREQUENCY_KHZ); EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq)) << "FM freq " << freq << " kHz is not sent back by callback."; } @@ -829,7 +829,7 @@ TEST_P(BroadcastRadioHalTest, DabTune) { LOG(DEBUG) << "Current program info: " << infoCb.toString(); // it should tune exactly to what was requested - vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY_KHZ); + vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY_KHZ); EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq)) << "DAB freq " << freq << " kHz is not sent back by callback."; } @@ -1152,7 +1152,7 @@ TEST_P(BroadcastRadioHalTest, GetProgramListFromAmFmFilter) { int expectedResultSize = 0; uint64_t expectedFreq = 0; for (const auto& program : *completeList) { - vector amfmIds = + vector amfmIds = bcutils::getAllIds(program.selector, IdentifierType::AMFM_FREQUENCY_KHZ); EXPECT_LE(amfmIds.size(), 1u); if (amfmIds.size() == 0) { @@ -1238,7 +1238,8 @@ TEST_P(BroadcastRadioHalTest, HdRadioStationNameId) { } for (const auto& program : *list) { - vector nameIds = bcutils::getAllIds(program.selector, IdentifierType::HD_STATION_NAME); + vector nameIds = + bcutils::getAllIds(program.selector, IdentifierType::HD_STATION_NAME); EXPECT_LE(nameIds.size(), 1u); if (nameIds.size() == 0) { continue; diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h index 25c96d075f..a34ee10507 100644 --- a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h @@ -121,7 +121,7 @@ int64_t getId(const ProgramSelector& sel, const IdentifierType& type, int64_t de /** * Returns all IDs of a given type. */ -std::vector getAllIds(const ProgramSelector& sel, const IdentifierType& type); +std::vector getAllIds(const ProgramSelector& sel, const IdentifierType& type); /** * Checks, if a given selector is supported by the radio module. diff --git a/broadcastradio/common/utilsaidl/src/Utils.cpp b/broadcastradio/common/utilsaidl/src/Utils.cpp index 4ab04d2a52..3de18660eb 100644 --- a/broadcastradio/common/utilsaidl/src/Utils.cpp +++ b/broadcastradio/common/utilsaidl/src/Utils.cpp @@ -178,8 +178,8 @@ int64_t getId(const ProgramSelector& sel, const IdentifierType& type, int64_t de return getId(sel, type); } -vector getAllIds(const ProgramSelector& sel, const IdentifierType& type) { - vector ret; +vector getAllIds(const ProgramSelector& sel, const IdentifierType& type) { + vector ret; // iterate through primaryId and secondaryIds for (auto it = begin(sel); it != end(sel); it++) { diff --git a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp index b633ff0af2..81f94706a8 100644 --- a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp +++ b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp @@ -237,13 +237,22 @@ TEST(BroadcastRadioUtilsTest, GetAllIdsWithAvailableIds) { sel.secondaryIds.push_back( utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, secondaryFrequencyKHz)); - std::vector allIds = utils::getAllIds(sel, IdentifierType::AMFM_FREQUENCY_KHZ); + std::vector allIds = utils::getAllIds(sel, IdentifierType::AMFM_FREQUENCY_KHZ); ASSERT_EQ(allIds.size(), 2u); EXPECT_NE(std::find(allIds.begin(), allIds.end(), kFmFrequencyKHz), allIds.end()); EXPECT_NE(std::find(allIds.begin(), allIds.end(), secondaryFrequencyKHz), allIds.end()); } +TEST(BroadcastRadioUtilsTest, GetAllIdsWithIdLongerThan32Bit) { + ProgramSelector sel = utils::makeSelectorDab(kDabSidExt, kDabEnsemble, kDabFrequencyKhz); + + std::vector allIds = utils::getAllIds(sel, IdentifierType::DAB_SID_EXT); + + ASSERT_EQ(allIds.size(), 1u); + EXPECT_NE(std::find(allIds.begin(), allIds.end(), kDabSidExt), allIds.end()); +} + TEST(BroadcastRadioUtilsTest, GetAllIdsWithIdNotFound) { ProgramSelector sel = utils::makeSelectorDab(kDabSidExt, kDabEnsemble, kDabFrequencyKhz); From af790073c74564b30fc88224adc37fa5c7400c0c Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 8 Apr 2024 21:30:33 +0000 Subject: [PATCH 072/161] Updated _LOCK properties HAL docs with explanation of property values Excluding MIRROR_LOCK, will address in later CL Bug: 316945499 Bug: 316945779 Test: presubmit Change-Id: I973553144956a6b5225562418912e1116ce2359c --- .../android.hardware.automotive.vehicle-types-meta.json | 4 ++-- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index fc2d78ee59..135f30a2b2 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -853,9 +853,9 @@ "description": "Window Move\nThe maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers between minInt32Value and maxInt32Value must be supported.\nThe maxInt32Value indicates the window is opening in plane\/closing in the out of plane direction at the fastest speed. The minInt32Value indicates the window is closing in plane\/opening in the out of plane direction at the fastest speed.\nLarger absolute values, either positive or negative, indicate a faster movement speed. Once the window reaches the positional limit, the value must reset to 0. If WINDOW_MOVE's value is currently 0, then that means there is no movement currently occurring.\nThis property is not in any particular unit but in a specified range of relative movement speeds.\nFor a window that may open out of plane (i.e. vent mode of sunroof) this parameter will work as follows:\nIf sunroof is open: Max = open the sunroof further, automatically stop when fully open. Min = close the sunroof, automatically stop when sunroof is closed.\nIf vent is open: Max = close the vent, automatically stop when vent is closed. Min = open the vent further, automatically stop when vent is fully open.\nIf sunroof is in the closed position: Max = open the sunroof, automatically stop when sunroof is fully open. Min = open the vent, automatically stop when vent is fully open.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { - "name": "Window Lock", + "name": "Window Child Lock", "value": 320867268, - "description": "Window Lock\nTrue indicates windows are locked and can't be moved.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." + "description": "Window Child Lock\nTrue indicates the window is child-locked.\nThis property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to implement it as VehiclePropertyAccess.READ only." }, { "name": "WINDSHIELD_WIPERS_PERIOD", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2681f6cc7f..ab8023dd2f 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3286,9 +3286,9 @@ enum VehicleProperty { WINDOW_MOVE = 0x0BC1 + 0x10000000 + 0x03000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 /** - * Window Lock + * Window Child Lock * - * True indicates windows are locked and can't be moved. + * True indicates the window is child-locked. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. From c689ba5ed225af43962150c8445a4722ff1d0328 Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Wed, 10 Apr 2024 11:07:11 +0100 Subject: [PATCH 073/161] Fix flaky VTS for vibration completion callback Update assertions on vibration completion callback to use a fixed timeout of 100ms. Tests are flaky on cuttlefish, which indicates it's not hardware latency causing it. Fix: 333639794 Test: atest VtsHalVibratorTargetTest Change-Id: I986cdd8087895fc0694d689e70feef0a9fe4140e --- .../aidl/vts/VtsHalVibratorTargetTest.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp index 6c6846f636..db474d6920 100644 --- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp +++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp @@ -41,6 +41,8 @@ using android::hardware::vibrator::IVibratorManager; using android::hardware::vibrator::PrimitivePwle; using std::chrono::high_resolution_clock; +using namespace ::std::chrono_literals; + const std::vector kEffects{android::enum_range().begin(), android::enum_range().end()}; const std::vector kEffectStrengths{android::enum_range().begin(), @@ -71,6 +73,9 @@ const std::vector kInvalidPrimitives = { static_cast(static_cast(kCompositePrimitives.back()) + 1), }; +// Timeout to wait for vibration callback completion. +static constexpr auto VIBRATION_CALLBACK_TIMEOUT = 100ms; + class CompletionCallback : public BnVibratorCallback { public: CompletionCallback(const std::function &callback) : mCallback(callback) {} @@ -221,7 +226,7 @@ TEST_P(VibratorAidl, OnWithCallback) { sp callback = new CompletionCallback([&completionPromise] { completionPromise.set_value(); }); uint32_t durationMs = 250; - std::chrono::milliseconds timeout{durationMs * 2}; + auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT; EXPECT_TRUE(vibrator->on(durationMs, callback).isOk()); EXPECT_EQ(completionFuture.wait_for(timeout), std::future_status::ready); EXPECT_TRUE(vibrator->off().isOk()); @@ -288,10 +293,10 @@ TEST_P(VibratorAidl, ValidateEffectWithCallback) { if (!status.isOk()) continue; - //TODO(b/187207798): revert back to conservative timeout values once - //latencies have been fixed - std::chrono::milliseconds timeout{lengthMs * 8}; + auto timeout = std::chrono::milliseconds(lengthMs) + VIBRATION_CALLBACK_TIMEOUT; EXPECT_EQ(completionFuture.wait_for(timeout), std::future_status::ready); + + EXPECT_TRUE(vibrator->off().isOk()); } } } @@ -619,9 +624,7 @@ TEST_P(VibratorAidl, ComposeCallback) { EXPECT_EQ(Status::EX_NONE, vibrator->compose(composite, callback).exceptionCode()) << toString(primitive); - // TODO(b/261130361): Investigate why latency from driver and hardware will cause test - // to fail when wait duration is ~40ms or less. - EXPECT_EQ(completionFuture.wait_for(duration + std::chrono::milliseconds(50)), + EXPECT_EQ(completionFuture.wait_for(duration + VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready) << toString(primitive); end = high_resolution_clock::now(); @@ -782,9 +785,7 @@ TEST_P(VibratorAidl, ComposeValidPwleWithCallback) { int32_t segmentDurationMaxMs; vibrator->getPwlePrimitiveDurationMax(&segmentDurationMaxMs); uint32_t durationMs = segmentDurationMaxMs * 2 + 100; // Sum of 2 active and 1 braking below - //TODO(b/187207798): revert back to conservative timeout values once - //latencies have been fixed - std::chrono::milliseconds timeout{durationMs * 4}; + auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT; ActivePwle active = composeValidActivePwle(vibrator, capabilities); From 0cea523ba3776a6dc0b9527c73bc23c9283510c2 Mon Sep 17 00:00:00 2001 From: Rucha Katakwar Date: Wed, 10 Apr 2024 14:28:08 -0700 Subject: [PATCH 074/161] Camera: Close session after validating flash keys Bug: 333353956 Test: Tested on a pixel device Change-Id: Ic48ec93cc579579fa7a39b66d0dc4cf0a7c11531 --- .../provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 6e3ddc9094..368e9540d6 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -177,6 +177,9 @@ TEST_P(CameraAidlTest, validateManualFlashStrengthControlKeys) { const camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); verifyManualFlashStrengthControlCharacteristics(staticMeta); + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); } } else { ALOGI("validateManualFlashStrengthControlKeys: Test skipped.\n"); From c2f76afc4c7a6a63a5e4a8b240d1f0d5752e5264 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 10 Apr 2024 18:51:04 +0000 Subject: [PATCH 075/161] Add biometric virtual HAL tests to presubmit Bug: 333743980 Test: atest --test-mapping Change-Id: I4efc51473194ee431ee8ca4bb2c8a5dfb629ad87 --- biometrics/common/TEST_MAPPING | 10 ++++++++++ biometrics/face/aidl/TEST_MAPPING | 13 +++++++++++++ biometrics/fingerprint/aidl/TEST_MAPPING | 22 ++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 biometrics/common/TEST_MAPPING create mode 100644 biometrics/face/aidl/TEST_MAPPING create mode 100644 biometrics/fingerprint/aidl/TEST_MAPPING diff --git a/biometrics/common/TEST_MAPPING b/biometrics/common/TEST_MAPPING new file mode 100644 index 0000000000..06e9c5378f --- /dev/null +++ b/biometrics/common/TEST_MAPPING @@ -0,0 +1,10 @@ +{ + "postsubmit": [ + { + "name": "android.hardware.biometrics.common.ConfigTest" + }, + { + "name": "android.hardware.biometrics.common.WorkerThreadTest" + } + ] +} diff --git a/biometrics/face/aidl/TEST_MAPPING b/biometrics/face/aidl/TEST_MAPPING new file mode 100644 index 0000000000..817fd010f8 --- /dev/null +++ b/biometrics/face/aidl/TEST_MAPPING @@ -0,0 +1,13 @@ +{ + "postsubmit": [ + { + "name": "android.hardware.biometrics.face.FakeFaceEngineTest" + }, + { + "name": "android.hardware.biometrics.face.FakeLockoutTrackerTest" + }, + { + "name": "VtsHalBiometricsFaceTargetTest" + } + ] +} diff --git a/biometrics/fingerprint/aidl/TEST_MAPPING b/biometrics/fingerprint/aidl/TEST_MAPPING new file mode 100644 index 0000000000..84cca2fcf1 --- /dev/null +++ b/biometrics/fingerprint/aidl/TEST_MAPPING @@ -0,0 +1,22 @@ +{ + "postsubmit": [ + { + "name": "android.hardware.biometrics.fingerprint.FakeFingerprintEngineTest" + }, + { + "name": "android.hardware.biometrics.fingerprint.FakeFingerprintEngineUdfpsTest" + }, + { + "name": "android.hardware.biometrics.fingerprint.FakeLockoutTrackerTest" + }, + { + "name": "android.hardware.biometrics.fingerprint.SessionTest" + }, + { + "name": "android.hardware.biometrics.fingerprint.VirtualHalTest" + }, + { + "name": "VtsHalBiometricsFingerprintTargetTest" + } + ] +} From c0355fdb39ae90cb43adda19b369fae899e72160 Mon Sep 17 00:00:00 2001 From: Rucha Katakwar Date: Wed, 10 Apr 2024 15:16:23 -0700 Subject: [PATCH 076/161] Camera:Update condition to validate flash keys. Bug: 332613252 Test: Tested locally on a pixel device. Change-Id: Ic95dd58288cd8e93e29ebb2259c1f783a589898f --- camera/provider/aidl/vts/camera_aidl_test.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index aef50d46be..1d6f013f52 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -1204,18 +1204,21 @@ void CameraAidlTest::verifyManualFlashStrengthControlCharacteristics( int torchDefRetCode = find_camera_metadata_ro_entry(staticMeta, ANDROID_FLASH_TORCH_STRENGTH_DEFAULT_LEVEL, &torchDefEntry); if (torch_supported) { + int expectedEntryCount; if(singleMaxRetCode == 0 && singleDefRetCode == 0 && torchMaxRetCode == 0 && torchDefRetCode == 0) { singleMaxLevel = *singleMaxEntry.data.i32; singleDefLevel = *singleDefEntry.data.i32; torchMaxLevel = *torchMaxEntry.data.i32; torchDefLevel = *torchDefEntry.data.i32; - ASSERT_TRUE((singleMaxEntry.count == singleDefEntry.count == torchMaxEntry.count - == torchDefEntry.count == 1)); + expectedEntryCount = 1; } else { - ASSERT_TRUE((singleMaxEntry.count == singleDefEntry.count == torchMaxEntry.count - == torchDefEntry.count == 0)); + expectedEntryCount = 0; } + ASSERT_EQ(singleMaxEntry.count, expectedEntryCount); + ASSERT_EQ(singleDefEntry.count, expectedEntryCount); + ASSERT_EQ(torchMaxEntry.count, expectedEntryCount); + ASSERT_EQ(torchDefEntry.count, expectedEntryCount); // if the device supports this feature default levels should be greater than 0 if (singleMaxLevel > 1) { ASSERT_GT(torchMaxLevel, 1); From f137ba4d927342cc03f72cbb75aad7da8ad3a9ea Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 11 Apr 2024 17:11:03 +0000 Subject: [PATCH 077/161] DynamicsProcessing VTS: remove stageInUse testing As we relaxed the requirement of stageInUse to setParam Bug: 328012516 Test: atest VtsHalDynamicsProcessingTargetTest Change-Id: I62e7d07c54133a0e3aed1952f80010faba783a20 --- .../aidl/vts/VtsHalDynamicsProcessingTest.cpp | 91 ++++++------------- 1 file changed, 29 insertions(+), 62 deletions(-) diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp index 3ed9ed20f2..12b17970c3 100644 --- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp +++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp @@ -453,12 +453,11 @@ enum EngineArchitectureTestParamName { ENGINE_TEST_INSTANCE_NAME, ENGINE_TEST_RESOLUTION_PREFERENCE, ENGINE_TEST_PREFERRED_DURATION, - ENGINE_TEST_STAGE_ENABLEMENT, - ENGINE_TEST_LIMITER_IN_USE + ENGINE_TEST_STAGE_ENABLEMENT }; using EngineArchitectureTestParams = std::tuple, Descriptor>, DynamicsProcessing::ResolutionPreference, float, - DynamicsProcessing::StageEnablement, bool>; + DynamicsProcessing::StageEnablement>; void fillEngineArchConfig(DynamicsProcessing::EngineArchitecture& cfg, const EngineArchitectureTestParams& params) { @@ -466,7 +465,7 @@ void fillEngineArchConfig(DynamicsProcessing::EngineArchitecture& cfg, cfg.preferredProcessingDurationMs = std::get(params); cfg.preEqStage = cfg.postEqStage = cfg.mbcStage = std::get(params); - cfg.limiterInUse = std::get(params); + cfg.limiterInUse = true; } class DynamicsProcessingTestEngineArchitecture @@ -501,8 +500,8 @@ INSTANTIATE_TEST_SUITE_P( static_cast(-1)), // variant testing::Values(-10.f, 0.f, 10.f), // processing duration testing::ValuesIn( - DynamicsProcessingTestHelper::kStageEnablementTestSet), // preEQ/postEQ/mbc - testing::Bool()), // limiter enable + DynamicsProcessingTestHelper::kStageEnablementTestSet) // preEQ/postEQ/mbc + ), [](const auto& info) { auto descriptor = std::get(info.param).second; DynamicsProcessing::EngineArchitecture cfg; @@ -568,7 +567,6 @@ enum LimiterConfigTestParamName { LIMITER_CHANNEL, LIMITER_ENABLE, LIMITER_LINK_GROUP, - LIMITER_ENGINE_IN_USE, LIMITER_ADDITIONAL, }; enum LimiterConfigTestAdditionalParam { @@ -587,9 +585,8 @@ static constexpr std::array kLimiterConfigTestAd {1, -60, 2.5, -2, 3.14}, {1, 60, 2.5, -2, 3.14}}}; -using LimiterConfigTestParams = - std::tuple, Descriptor>, int32_t, bool, int32_t, bool, - LimiterConfigTestAdditional>; +using LimiterConfigTestParams = std::tuple, Descriptor>, + int32_t, bool, int32_t, LimiterConfigTestAdditional>; void fillLimiterConfig(DynamicsProcessing::LimiterConfig& cfg, const LimiterConfigTestParams& params) { @@ -609,8 +606,7 @@ class DynamicsProcessingTestLimiterConfig public DynamicsProcessingTestHelper { public: DynamicsProcessingTestLimiterConfig() - : DynamicsProcessingTestHelper(std::get(GetParam())), - mLimiterInUseEngine(std::get(GetParam())) { + : DynamicsProcessingTestHelper(std::get(GetParam())) { fillLimiterConfig(mCfg, GetParam()); } @@ -619,11 +615,9 @@ class DynamicsProcessingTestLimiterConfig void TearDown() override { TearDownDynamicsProcessingEffect(); } DynamicsProcessing::LimiterConfig mCfg; - bool mLimiterInUseEngine; }; TEST_P(DynamicsProcessingTestLimiterConfig, SetAndGetLimiterConfig) { - mEngineConfigPreset.limiterInUse = mLimiterInUseEngine; EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); EXPECT_NO_FATAL_FAILURE(addLimiterConfig({mCfg})); SetAndGetDynamicsProcessingParameters(); @@ -633,21 +627,18 @@ INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestLimiterConfig, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), - testing::Values(-1, 0, 1, 2), // channel count - testing::Bool(), // enable - testing::Values(3), // link group - testing::Bool(), // engine limiter enable + testing::Values(-1, 0, 1, 2), // channel count + testing::Bool(), // enable + testing::Values(3), // link group testing::ValuesIn(kLimiterConfigTestAdditionalParam)), // Additional [](const auto& info) { auto descriptor = std::get(info.param).second; DynamicsProcessing::LimiterConfig cfg; fillLimiterConfig(cfg, info.param); - std::string engineLimiterInUse = - std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + toString(descriptor.common.id.uuid) + "_limiterConfig_" + - cfg.toString() + "_engineSetting_" + engineLimiterInUse; + cfg.toString(); std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -659,11 +650,10 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DynamicsProcessingTestLimiterConfi */ enum ChannelConfigTestParamName { BAND_CHANNEL_TEST_INSTANCE_NAME, - BAND_CHANNEL_TEST_CHANNEL_CONFIG, - BAND_CHANNEL_TEST_ENGINE_IN_USE + BAND_CHANNEL_TEST_CHANNEL_CONFIG }; using ChannelConfigTestParams = std::tuple, Descriptor>, - std::vector, bool>; + std::vector>; class DynamicsProcessingTestChannelConfig : public ::testing::TestWithParam, @@ -671,33 +661,28 @@ class DynamicsProcessingTestChannelConfig public: DynamicsProcessingTestChannelConfig() : DynamicsProcessingTestHelper(std::get(GetParam())), - mCfg(std::get(GetParam())), - mInUseEngine(std::get(GetParam())) {} + mCfg(std::get(GetParam())) {} void SetUp() override { SetUpDynamicsProcessingEffect(); } void TearDown() override { TearDownDynamicsProcessingEffect(); } std::vector mCfg; - const bool mInUseEngine; }; TEST_P(DynamicsProcessingTestChannelConfig, SetAndGetPreEqChannelConfig) { - mEngineConfigPreset.preEqStage.inUse = mInUseEngine; EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); EXPECT_NO_FATAL_FAILURE(addPreEqChannelConfig(mCfg)); SetAndGetDynamicsProcessingParameters(); } TEST_P(DynamicsProcessingTestChannelConfig, SetAndGetPostEqChannelConfig) { - mEngineConfigPreset.postEqStage.inUse = mInUseEngine; EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); EXPECT_NO_FATAL_FAILURE(addPostEqChannelConfig(mCfg)); SetAndGetDynamicsProcessingParameters(); } TEST_P(DynamicsProcessingTestChannelConfig, SetAndGetMbcChannelConfig) { - mEngineConfigPreset.mbcStage.inUse = mInUseEngine; EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); EXPECT_NO_FATAL_FAILURE(addMbcChannelConfig(mCfg)); SetAndGetDynamicsProcessingParameters(); @@ -709,19 +694,15 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::ValuesIn( - DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel config - testing::Bool()), // Engine inUse + DynamicsProcessingTestHelper::kChannelConfigTestSet)), // channel config [](const auto& info) { auto descriptor = std::get(info.param).second; - std::string engineInUse = - std::to_string(std::get(info.param)); std::string channelConfig = ::android::internal::ToString( std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - toString(descriptor.common.id.uuid) + "_" + channelConfig + - "_engineInUse_" + engineInUse; + toString(descriptor.common.id.uuid) + "_" + channelConfig; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -736,11 +717,10 @@ enum EqBandConfigTestParamName { EQ_BAND_CHANNEL, EQ_BAND_ENABLE, EQ_BAND_CUT_OFF_FREQ, - EQ_BAND_GAIN, - EQ_BAND_STAGE_IN_USE + EQ_BAND_GAIN }; using EqBandConfigTestParams = std::tuple, Descriptor>, int32_t, - bool, std::vector>, float, bool>; + bool, std::vector>, float>; void fillEqBandConfig(std::vector& cfgs, const EqBandConfigTestParams& params) { @@ -760,8 +740,7 @@ class DynamicsProcessingTestEqBandConfig : public ::testing::TestWithParam(GetParam())), - mStageInUse(std::get(GetParam())) { + : DynamicsProcessingTestHelper(std::get(GetParam())) { fillEqBandConfig(mCfgs, GetParam()); } @@ -770,11 +749,9 @@ class DynamicsProcessingTestEqBandConfig : public ::testing::TestWithParam mCfgs; - const bool mStageInUse; }; TEST_P(DynamicsProcessingTestEqBandConfig, SetAndGetPreEqBandConfig) { - mEngineConfigPreset.preEqStage.inUse = mStageInUse; mEngineConfigPreset.preEqStage.bandCount = mCfgs.size(); EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); std::vector cfgs(mChannelCount); @@ -788,7 +765,6 @@ TEST_P(DynamicsProcessingTestEqBandConfig, SetAndGetPreEqBandConfig) { } TEST_P(DynamicsProcessingTestEqBandConfig, SetAndGetPostEqBandConfig) { - mEngineConfigPreset.postEqStage.inUse = mStageInUse; mEngineConfigPreset.postEqStage.bandCount = mCfgs.size(); EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); std::vector cfgs(mChannelCount); @@ -849,21 +825,19 @@ INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestEqBandConfig, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), - testing::Values(-1, 0, 10), // channel ID - testing::Bool(), // band enable - testing::ValuesIn(kBands), // cut off frequencies - testing::Values(-3.14f, 3.14f), // gain - testing::Values(true)), // stage in use + testing::Values(-1, 0, 10), // channel ID + testing::Bool(), // band enable + testing::ValuesIn(kBands), // cut off frequencies + testing::Values(-3.14f, 3.14f) // gain + ), [](const auto& info) { auto descriptor = std::get(info.param).second; std::vector cfgs; fillEqBandConfig(cfgs, info.param); std::string bands = ::android::internal::ToString(cfgs); - std::string stageInUse = std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - toString(descriptor.common.id.uuid) + "_bands_" + bands + - "_stageInUse_" + stageInUse; + toString(descriptor.common.id.uuid) + "_bands_" + bands; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; @@ -879,7 +853,6 @@ enum MbcBandConfigParamName { MBC_BAND_CHANNEL, MBC_BAND_ENABLE, MBC_BAND_CUTOFF_FREQ, - MBC_BAND_STAGE_IN_USE, MBC_BAND_ADDITIONAL }; enum MbcBandConfigAdditional { @@ -905,7 +878,7 @@ static constexpr std::array kMbcBandConfig using TestParamsMbcBandConfig = std::tuple, Descriptor>, int32_t, bool, - std::vector>, bool, TestParamsMbcBandConfigAdditional>; + std::vector>, TestParamsMbcBandConfigAdditional>; void fillMbcBandConfig(std::vector& cfgs, const TestParamsMbcBandConfig& params) { @@ -936,8 +909,7 @@ class DynamicsProcessingTestMbcBandConfig public DynamicsProcessingTestHelper { public: DynamicsProcessingTestMbcBandConfig() - : DynamicsProcessingTestHelper(std::get(GetParam())), - mStageInUse(std::get(GetParam())) { + : DynamicsProcessingTestHelper(std::get(GetParam())) { fillMbcBandConfig(mCfgs, GetParam()); } @@ -946,11 +918,9 @@ class DynamicsProcessingTestMbcBandConfig void TearDown() override { TearDownDynamicsProcessingEffect(); } std::vector mCfgs; - const bool mStageInUse; }; TEST_P(DynamicsProcessingTestMbcBandConfig, SetAndGetMbcBandConfig) { - mEngineConfigPreset.mbcStage.inUse = mStageInUse; mEngineConfigPreset.mbcStage.bandCount = mCfgs.size(); EXPECT_NO_FATAL_FAILURE(addEngineConfig(mEngineConfigPreset)); std::vector cfgs(mChannelCount); @@ -970,18 +940,15 @@ INSTANTIATE_TEST_SUITE_P( testing::Values(-1, 0, 10), // channel count testing::Bool(), // enable testing::ValuesIn(kBands), // cut off frequencies - testing::Bool(), // stage in use testing::ValuesIn(kMbcBandConfigAdditionalParam)), // Additional [](const auto& info) { auto descriptor = std::get(info.param).second; std::vector cfgs; fillMbcBandConfig(cfgs, info.param); std::string mbcBands = ::android::internal::ToString(cfgs); - std::string stageInUse = std::to_string(std::get(info.param)); std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + descriptor.common.name + "_UUID_" + - toString(descriptor.common.id.uuid) + "_bands_" + mbcBands + - "_stageInUse_" + stageInUse; + toString(descriptor.common.id.uuid) + "_bands_" + mbcBands; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; From 3f4c7fca29db4b82d597bb56478f40a75cef618c Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 12 Apr 2024 12:29:02 -0700 Subject: [PATCH 078/161] audio: Align bluetooth start behavior When staring data transfer, if resuming of BT session fails, the legacy implementation does not indicate an error, thus causing an automatic retry on next transfer. The AIDL implementation was switching the stream into an error state instead. This could cause audio mute when the BT stack is slow on resuming. This CL aligns AIDL with legacy behavior. Bug: 333307789 Test: repro steps in the bug Change-Id: I5080a7275671287f188930f041c5ff2215ed2e1e --- audio/aidl/default/bluetooth/StreamBluetooth.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/audio/aidl/default/bluetooth/StreamBluetooth.cpp b/audio/aidl/default/bluetooth/StreamBluetooth.cpp index f22b7a97d6..efab4708e3 100644 --- a/audio/aidl/default/bluetooth/StreamBluetooth.cpp +++ b/audio/aidl/default/bluetooth/StreamBluetooth.cpp @@ -93,17 +93,18 @@ StreamBluetooth::StreamBluetooth(StreamContext* context, const Metadata& metadat ::android::status_t StreamBluetooth::transfer(void* buffer, size_t frameCount, size_t* actualFrameCount, int32_t* latencyMs) { std::lock_guard guard(mLock); + *actualFrameCount = 0; + *latencyMs = StreamDescriptor::LATENCY_UNKNOWN; if (mBtDeviceProxy == nullptr || mBtDeviceProxy->getState() == BluetoothStreamState::DISABLED) { - *actualFrameCount = 0; - *latencyMs = StreamDescriptor::LATENCY_UNKNOWN; + // The BT session is turned down, silently ignore write. return ::android::OK; } - *actualFrameCount = 0; - *latencyMs = 0; if (!mBtDeviceProxy->start()) { - LOG(ERROR) << __func__ << ": state= " << mBtDeviceProxy->getState() << " failed to start"; - return -EIO; + LOG(WARNING) << __func__ << ": state= " << mBtDeviceProxy->getState() + << " failed to start, will retry"; + return ::android::OK; } + *latencyMs = 0; const size_t bytesToTransfer = frameCount * mFrameSizeBytes; const size_t bytesTransferred = mIsInput ? mBtDeviceProxy->readData(buffer, bytesToTransfer) : mBtDeviceProxy->writeData(buffer, bytesToTransfer); From 5eb4c7375b8631b4e7510d8bb2e01c0b2391d0cb Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Fri, 12 Apr 2024 17:38:09 -0700 Subject: [PATCH 079/161] Skip test if the device is not a handheld device Bug: 302018405 Test: atest Thermal/ThermalAidlTest#SkinTemperatureThresholdsTest/0_android_hardware_thermal_IThermal_default Change-Id: I74415621848412a9bfc4d3ae8cfc20f611d7ab8c --- thermal/aidl/vts/VtsHalThermalTargetTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp index 4208d093f8..d36d9869ce 100644 --- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp +++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp @@ -25,6 +25,7 @@ #define LOG_TAG "thermal_aidl_hal_test" +#include #include #include #include @@ -70,6 +71,16 @@ static const CoolingDevice kCoolingDevice = { .timeWindowMs = 7000, }; +static const std::string FEATURE_WATCH = "android.hardware.type.watch"; +static const std::string FEATURE_TELEVISION = "android.hardware.type.television"; +static const std::string FEATURE_LEANBACK = "android.software.leanback"; +static const std::string FEATURE_AUTOMOTIVE = "android.hardware.type.automotive"; +static const std::string FEATURE_PC = "android.hardware.type.pc"; +static const std::string FEATURE_EMBEDDED = "android.hardware.type.embedded"; +static const std::string kNonHandheldFeatures[] = {FEATURE_AUTOMOTIVE, FEATURE_LEANBACK, + FEATURE_PC, FEATURE_TELEVISION, + FEATURE_WATCH, FEATURE_EMBEDDED}; + // Callback class for receiving thermal event notifications from main class class ThermalCallback : public BnThermalChangedCallback { public: @@ -344,6 +355,11 @@ TEST_P(ThermalAidlTest, SkinTemperatureThresholdsTest) { if (apiLevel < 35) { GTEST_SKIP() << "Skipping test as the vendor level is below 35: " << apiLevel; } + for (const auto& feature : kNonHandheldFeatures) { + if (::testing::deviceSupportsFeature(feature.c_str())) { + GTEST_SKIP() << "Skipping test as the device has feature: " << feature; + } + } std::vector temperatures; ::ndk::ScopedAStatus status = mThermal->getTemperaturesWithType(TemperatureType::SKIN, &temperatures); From eda68e4ffec3101afb1aacebdab9ab99c2e3cd32 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 10 Apr 2024 15:47:59 -0400 Subject: [PATCH 080/161] Dump fingerprint configurations on CLI dumpsys command Bug: 326227403 Test: adb shell dumpsys android.hardware.biometrics.fingerprint.IFingerprint/virtual Change-Id: I75e11b7baef3566411588ea5231f6336d271dc77 --- biometrics/common/config/Config.cpp | 1 + biometrics/fingerprint/aidl/default/Fingerprint.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/biometrics/common/config/Config.cpp b/biometrics/common/config/Config.cpp index a13bdf0941..49f7cc8551 100644 --- a/biometrics/common/config/Config.cpp +++ b/biometrics/common/config/Config.cpp @@ -132,6 +132,7 @@ ConfigValue Config::getDefault(const std::string& name) { } bool Config::setInternal(const std::string& name, const ConfigValue& val) { + LOG(INFO) << "Config::set " << name << " to " << toString(val); bool res = false; auto& data = mMap[name]; diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index e407f17232..3055da1329 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -125,6 +125,8 @@ binder_status_t Fingerprint::dump(int fd, const char** /*args*/, uint32_t numArg } ::android::base::WriteStringToFd(mEngine->toString(), fd); + ::android::base::WriteStringToFd(Fingerprint::cfg().toString(), fd); + fsync(fd); return STATUS_OK; } From 9dcc9eff81039ebaee46557758b032af6baf262e Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Mon, 15 Apr 2024 18:31:03 -0700 Subject: [PATCH 081/161] ExternalCameraHAL: Pad AllocatedFrame by DCTSIZE jpeglib expects height and width of Y component to be an integral multiple of 2*DCTSIZE, and heights and widths of Cb and Cr components to be an integral multiple of DCTSIZE. If the image size does not meet this requirement, libjpeg expects its input to be padded to meet the constraints. The current implementation of AllocatedFrame::allocate did not consider this padding when allocating buffers. This could lead to crashes when attempting to call libjpeg functions on images with dimensions that are _not_ an exact multiple of 2*DCTSIZE (=16), for example: 424x240. This CL ensures that the allocated buffer is padded such that libjpeg never attempts to access unallocated buffer. Bug: 333961771 Test: Verified that the HAL no longer crashes for certain resolutions. Change-Id: I05b5f3390385ad005481141312a2e3e281433f7a --- .../3.4/default/ExternalCameraUtils.cpp | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/camera/device/3.4/default/ExternalCameraUtils.cpp b/camera/device/3.4/default/ExternalCameraUtils.cpp index 8f4626c56d..d9610c2d28 100644 --- a/camera/device/3.4/default/ExternalCameraUtils.cpp +++ b/camera/device/3.4/default/ExternalCameraUtils.cpp @@ -108,9 +108,38 @@ int AllocatedFrame::allocate(YCbCrLayout* out) { return -EINVAL; } - uint32_t dataSize = mWidth * mHeight * 3 / 2; // YUV420 - if (mData.size() != dataSize) { - mData.resize(dataSize); + // This frame might be sent to jpeglib to be encoded. Since AllocatedFrame only contains YUV420, + // jpeglib expects height and width of Y component to be an integral multiple of 2*DCTSIZE, + // and heights and widths of Cb and Cr components to be an integral multiple of DCTSIZE. If the + // image size does not meet this requirement, libjpeg expects its input to be padded to meet the + // constraints. This padding is removed from the final encoded image so the content in the + // padding doesn't matter. What matters is that the memory is accessible to jpeglib at the time + // of encoding. + // For example, if the image size is 1500x844 and DCTSIZE is 8, jpeglib expects a YUV 420 + // frame with components of following sizes: + // Y: 1504x848 because 1504 and 848 are the next smallest multiples of 2*8 + // Cb/Cr: 752x424 which are the next smallest multiples of 8 + + // jpeglib takes an array of row pointers which makes vertical padding trivial when setting up + // the pointers. Padding horizontally is a bit more complicated. AllocatedFrame holds the data + // in a flattened buffer, which means memory accesses past a row will flow into the next logical + // row. For any row of a component, we can consider the first few bytes of the next row as + // padding for the current one. This is true for Y and Cb components and all but last row of the + // Cr component. Reading past the last row of Cr component will lead to undefined behavior as + // libjpeg attempts to read memory past the allocated buffer. To prevent undefined behavior, + // the buffer allocated here is padded such that libjpeg never accesses unallocated memory when + // reading the last row. Effectively, we only need to ensure that the last row of Cr component + // has width that is an integral multiple of DCTSIZE. + + size_t dataSize = mWidth * mHeight * 3 / 2; // YUV420 + + size_t cbWidth = mWidth / 2; + size_t requiredCbWidth = DCTSIZE * ((cbWidth + DCTSIZE - 1) / DCTSIZE); + size_t padding = requiredCbWidth - cbWidth; + size_t finalSize = dataSize + padding; + + if (mData.size() != finalSize) { + mData.resize(finalSize); } if (out != nullptr) { From adfb7d8c736263b0d00716a5c02327467e167035 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 17 Apr 2024 01:27:02 +0800 Subject: [PATCH 082/161] add kDumpFromAudioServerArgument Bug: 275135031 Test: mm Change-Id: I147fbe5eecae8cf0f318b1d77bb9a5faffb934be --- audio/aidl/common/include/Utils.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h index ef312d501c..f8011e57e5 100644 --- a/audio/aidl/common/include/Utils.h +++ b/audio/aidl/common/include/Utils.h @@ -47,6 +47,9 @@ inline std::string errorToString(const ScopedAStatus& s) { namespace aidl::android::hardware::audio::common { +// TODO: b/275135031 - move this string to AIDL interfaces. +static constexpr char kDumpFromAudioServerArgument[] = "dump_from_audioserver"; + // Some values are reserved for use by the system code only. // HALs must not accept or emit values outside from the provided list. constexpr std::array<::aidl::android::media::audio::common::AudioMode, 5> kValidAudioModes = { From c2a83d449c6fc240ef3a1b2bf4bb1cedcd1f9ee0 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Wed, 17 Apr 2024 14:40:29 -0400 Subject: [PATCH 083/161] DisplayDecoration test: destroy layers per display This appears to have been broken with Ic3c0415612b1387671ab8efa0ec95ed727f6bf68, which attempts to destroy layers for all displays using a single writer. The display command that destroys a layer must be in the writer for that display, in order for the displays to run independently. Do so in the test itself, rather than relying on TearDown to destroy all of them. Bug: 333974982 Test: atest VtsHalGraphicsComposer3_TargetTest Flag: TEST_ONLY Change-Id: Ib6807c85bc6cb32c56cc72126a9fa68363365912 --- .../vts/VtsHalGraphicsComposer3_TargetTest.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index f72cf55300..e686358cd6 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2197,13 +2197,13 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCompositionType) { TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { for (VtsDisplay& display : mDisplays) { - auto& writer = getWriter(display.getDisplayId()); + const auto displayId = display.getDisplayId(); + auto& writer = getWriter(displayId); const auto [layerStatus, layer] = - mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount, &writer); - EXPECT_TRUE(layerStatus.isOk()); + mComposerClient->createLayer(displayId, kBufferSlotCount, &writer); + ASSERT_TRUE(layerStatus.isOk()); - const auto [error, support] = - mComposerClient->getDisplayDecorationSupport(display.getDisplayId()); + const auto [error, support] = mComposerClient->getDisplayDecorationSupport(displayId); const auto format = (error.isOk() && support) ? support->format : aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888; @@ -2223,9 +2223,9 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(), display.getCrop()); - writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, + writer.setLayerBuffer(displayId, layer, /*slot*/ 0, decorBuffer->handle, /*acquireFence*/ -1); - writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp, + writer.validateDisplay(displayId, ComposerClientWriter::kNoTimestamp, VtsComposerClient::kNoFrameIntervalNs); execute(); if (support) { @@ -2235,6 +2235,7 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { ASSERT_EQ(1, errors.size()); EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errors[0].errorCode); } + EXPECT_TRUE(mComposerClient->destroyLayer(displayId, layer, &writer).isOk()); } } From 31b3f65325492298a308c3224ffe7f34d6482666 Mon Sep 17 00:00:00 2001 From: Doug Ferraz Date: Fri, 22 Mar 2024 19:54:26 -0400 Subject: [PATCH 084/161] Bluetooth HCI: Add VTS requirement for HCI 4.2 Bug: 285456310 Test: atest VtsHalBluetoothTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:83b2267b785037bcb54a904e4eecea1ddb3b0f22) Merged-In: I056b924543ac349beb9b0eddaf039b0aa9187821 Change-Id: I056b924543ac349beb9b0eddaf039b0aa9187821 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../aidl/vts/VtsHalBluetoothTargetTest.cpp | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp index 24eb4d0871..4d32ab2fbc 100644 --- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp +++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp @@ -118,6 +118,10 @@ static bool isTv() { testing::deviceSupportsFeature("android.hardware.type.television"); } +static bool isHandheld() { + return testing::deviceSupportsFeature("android.hardware.type.handheld"); +} + class ThroughputLogger { public: explicit ThroughputLogger(std::string task) @@ -1039,6 +1043,47 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { ASSERT_GE(num_resolving_list, kMinLeResolvingListForBt5); } +/** + * Requirements + * + * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension. + * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE). + */ +TEST_P(BluetoothAidlTest, Vsr_Bluetooth4_2Requirements) { + // test only applies to handheld devices + if (!isHandheld()) { + return; + } + + std::vector version_event; + send_and_wait_for_cmd_complete(ReadLocalVersionInformationBuilder::Create(), + version_event); + auto version_view = ReadLocalVersionInformationCompleteView::Create( + CommandCompleteView::Create(EventView::Create(PacketView( + std::make_shared>(version_event))))); + ASSERT_TRUE(version_view.IsValid()); + ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, version_view.GetStatus()); + auto version = version_view.GetLocalVersionInformation(); + // Starting with Android 15, Fails when HCI version is lower than 4.2. + ASSERT_GE(static_cast(version.hci_version_), + static_cast(::bluetooth::hci::HciVersion::V_4_2)); + ASSERT_GE(static_cast(version.lmp_version_), + static_cast(::bluetooth::hci::LmpVersion::V_4_2)); + + std::vector le_features_event; + send_and_wait_for_cmd_complete(LeReadLocalSupportedFeaturesBuilder::Create(), + le_features_event); + auto le_features_view = LeReadLocalSupportedFeaturesCompleteView::Create( + CommandCompleteView::Create(EventView::Create(PacketView( + std::make_shared>(le_features_event))))); + ASSERT_TRUE(le_features_view.IsValid()); + ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, le_features_view.GetStatus()); + auto le_features = le_features_view.GetLeFeatures(); + ASSERT_TRUE(le_features & + static_cast(LLFeaturesBits::LE_EXTENDED_ADVERTISING)); + +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BluetoothAidlTest); INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames( From 29db72ac65f730aec9507aefb5d8cf9ab3fd6be5 Mon Sep 17 00:00:00 2001 From: Doug Ferraz Date: Mon, 25 Mar 2024 13:03:10 -0400 Subject: [PATCH 085/161] Bluetooth HCI: Add VTS requirement for HCI 4.2 - HIDL version Bug: 285456310 Test: atest VtsHalBluetoothV1_1TargetTest (cherry picked from https://android-review.googlesource.com/q/commit:2984a7509693a85f4ff74f57f672e42cb581b0fe) Merged-In: I0af583e35428f8ec8c9c360d9e28c1c909ad9001 Change-Id: I0af583e35428f8ec8c9c360d9e28c1c909ad9001 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../VtsHalBluetoothV1_0TargetTest.cpp | 77 +++++++++++++++++-- .../VtsHalBluetoothV1_1TargetTest.cpp | 67 +++++++++++++++- 2 files changed, 135 insertions(+), 9 deletions(-) diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp index 945108796a..63d04c2047 100644 --- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp +++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp @@ -43,6 +43,8 @@ using ::android::hardware::bluetooth::V1_0::Status; #define HCI_MINIMUM_HCI_VERSION 5 // Bluetooth Core Specification 3.0 + HS #define HCI_MINIMUM_LMP_VERSION 5 // Bluetooth Core Specification 3.0 + HS +#define HCI_BLUETOOTH4_2_HCI_VERSION 8 // Bluetooth 4.2 +#define HCI_BLUETOOTH4_2_LMP_VERSION 8 // Bluetooth 4.2 #define NUM_HCI_COMMANDS_BANDWIDTH 1000 #define NUM_SCO_PACKETS_BANDWIDTH 1000 #define NUM_ACL_PACKETS_BANDWIDTH 1000 @@ -52,6 +54,7 @@ using ::android::hardware::bluetooth::V1_0::Status; #define WAIT_FOR_ACL_DATA_TIMEOUT std::chrono::milliseconds(1000) #define INTERFACE_CLOSE_DELAY_MS std::chrono::milliseconds(600) +// { OCF, OGF << 2, Length of command parameters} #define COMMAND_HCI_SHOULD_BE_UNKNOWN \ { 0xff, 0x3B, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 } #define COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION \ @@ -64,6 +67,10 @@ using ::android::hardware::bluetooth::V1_0::Status; { 0x03, 0x0c, 0x00 } #define COMMAND_HCI_WRITE_LOCAL_NAME \ { 0x13, 0x0c, 0xf8 } +#define COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES \ + { 0x03, 0x04 << 2, 0x00 } // OGF=0x04, OCF=0x0003 / 7.4 INFORMATIONAL PARAMETERS +#define COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES \ + { 0x03, 0x08 << 2, 0x00 } // OGF=0x08, OCF=0x0003 / 7.8 LE CONTROLLER COMMANDS #define HCI_STATUS_SUCCESS 0x00 #define HCI_STATUS_UNKNOWN_HCI_COMMAND 0x01 @@ -85,6 +92,30 @@ using ::android::hardware::bluetooth::V1_0::Status; #define EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE 6 #define EVENT_LOCAL_HCI_VERSION_BYTE EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE #define EVENT_LOCAL_LMP_VERSION_BYTE EVENT_LOCAL_HCI_VERSION_BYTE + 3 +/** + * See Bluetooth Spec 5.4, Vol 2, Part C + * Link Manager Protocol, 3.3 Feature Mask Definition + * + * No | Supported Feature | Byte | Bit | Page + * ... + * 38 | LE Supported (Controller) | 4 | 6 | 0 + * ... + */ +#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE \ + (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x04) +#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK (0x01 << 6) +/** + * See Bluetooth Spec 5.4, Vol 6, Part B + * 4.6 Feature Support + * + * Bit | Link Layer Feature + * ... + * 5 | LE Data Packet Length Extension + * ... + */ +#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE \ + (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x00) +#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK (0x01 << 5) #define EVENT_CONNECTION_COMPLETE_PARAM_LENGTH 11 #define EVENT_CONNECTION_COMPLETE_TYPE 11 @@ -209,7 +240,7 @@ class BluetoothHidlTest : public ::testing::TestWithParam { std::vector& acl_handles); void handle_no_ops(); void wait_for_event(bool timeout_is_error); - void wait_for_command_complete_event(hidl_vec cmd); + hidl_vec wait_for_command_complete_event(hidl_vec cmd); int wait_for_completed_packets_event(uint16_t handle); class BluetoothHciDeathRecipient : public hidl_death_recipient { @@ -338,17 +369,19 @@ void BluetoothHidlTest::wait_for_event(bool timeout_is_error = true) { } // Wait until a COMMAND_COMPLETE is received. -void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec cmd) { +hidl_vec BluetoothHidlTest::wait_for_command_complete_event(hidl_vec cmd) { wait_for_event(); hidl_vec event = event_queue.front(); event_queue.pop(); - ASSERT_GT(event.size(), + EXPECT_GT(event.size(), static_cast(EVENT_COMMAND_COMPLETE_STATUS_BYTE)); - ASSERT_EQ(EVENT_COMMAND_COMPLETE, event[EVENT_CODE_BYTE]); - ASSERT_EQ(cmd[0], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE]); - ASSERT_EQ(cmd[1], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE + 1]); - ASSERT_EQ(HCI_STATUS_SUCCESS, event[EVENT_COMMAND_COMPLETE_STATUS_BYTE]); + EXPECT_EQ(EVENT_COMMAND_COMPLETE, event[EVENT_CODE_BYTE]); + EXPECT_EQ(cmd[0], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE]); + EXPECT_EQ(cmd[1], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE + 1]); + EXPECT_EQ(HCI_STATUS_SUCCESS, event[EVENT_COMMAND_COMPLETE_STATUS_BYTE]); + + return event; } // Send the command to read the controller's buffer sizes. @@ -623,6 +656,36 @@ TEST_P(BluetoothHidlTest, HciVersionTest) { ASSERT_LE(HCI_MINIMUM_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]); } +/** + * Requirements + * + * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension. + * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE). + */ +TEST_P(BluetoothHidlTest, Bluetooth4_2) { + // Bluetooth 4.2+ + hidl_vec cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION; + bluetooth->sendHciCommand(cmd); + auto event = wait_for_command_complete_event(cmd); + + EXPECT_LE(HCI_BLUETOOTH4_2_HCI_VERSION, event[EVENT_LOCAL_HCI_VERSION_BYTE]); + EXPECT_LE(HCI_BLUETOOTH4_2_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]); + + // BLE + cmd = COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES; + bluetooth->sendHciCommand(cmd); + event = wait_for_command_complete_event(cmd); + EXPECT_TRUE(event[EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE] & + EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK); + + // BLE Data Length Extension + cmd = COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES; + bluetooth->sendHciCommand(cmd); + event = wait_for_command_complete_event(cmd); + EXPECT_TRUE(event[EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE] & + EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK); +} + // Send an unknown HCI command and wait for the error message. TEST_P(BluetoothHidlTest, HciUnknownCommand) { hidl_vec cmd = COMMAND_HCI_SHOULD_BE_UNKNOWN; diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp index 28ac6034cf..5a455bf9f9 100644 --- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp +++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp @@ -43,6 +43,8 @@ using ::android::hardware::bluetooth::V1_1::IBluetoothHciCallbacks; #define HCI_MINIMUM_HCI_VERSION 5 // Bluetooth Core Specification 3.0 + HS #define HCI_MINIMUM_LMP_VERSION 5 // Bluetooth Core Specification 3.0 + HS +#define HCI_BLUETOOTH4_2_HCI_VERSION 8 // Bluetooth 4.2 +#define HCI_BLUETOOTH4_2_LMP_VERSION 8 // Bluetooth 4.2 #define NUM_HCI_COMMANDS_BANDWIDTH 1000 #define NUM_SCO_PACKETS_BANDWIDTH 1000 #define NUM_ACL_PACKETS_BANDWIDTH 1000 @@ -52,6 +54,7 @@ using ::android::hardware::bluetooth::V1_1::IBluetoothHciCallbacks; #define WAIT_FOR_ACL_DATA_TIMEOUT std::chrono::milliseconds(1000) #define INTERFACE_CLOSE_DELAY_MS std::chrono::milliseconds(200) +// { OCF, OGF << 2, Length of bytes of command parameters } #define COMMAND_HCI_SHOULD_BE_UNKNOWN \ { 0xff, 0x3B, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 } #define COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION \ @@ -64,6 +67,10 @@ using ::android::hardware::bluetooth::V1_1::IBluetoothHciCallbacks; { 0x03, 0x0c, 0x00 } #define COMMAND_HCI_WRITE_LOCAL_NAME \ { 0x13, 0x0c, 0xf8 } +#define COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES \ + { 0x03, 0x04 << 2, 0x00 } // OGF=0x04, OCF=0x0003 / 7.4 INFORMATIONAL PARAMETERS +#define COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES \ + { 0x03, 0x08 << 2, 0x00 } // OGF=0x08, OCF=0x0003 / 7.8 LE CONTROLLER COMMANDS #define HCI_STATUS_SUCCESS 0x00 #define HCI_STATUS_UNKNOWN_HCI_COMMAND 0x01 @@ -85,6 +92,30 @@ using ::android::hardware::bluetooth::V1_1::IBluetoothHciCallbacks; #define EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE 6 #define EVENT_LOCAL_HCI_VERSION_BYTE EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE #define EVENT_LOCAL_LMP_VERSION_BYTE EVENT_LOCAL_HCI_VERSION_BYTE + 3 +/** + * See Bluetooth Spec 5.4, Vol 2, Part C + * Link Manager Protocol, 3.3 Feature Mask Definition + * + * No | Supported Feature | Byte | Bit | Page + * ... + * 38 | LE Supported (Controller) | 4 | 6 | 0 + * ... + */ +#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE \ + (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x04) +#define EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK (0x01 << 6) +/** + * See Bluetooth Spec 5.4, Vol 6, Part B + * 4.6 Feature Support + * + * Bit | Link Layer Feature + * ... + * 5 | LE Data Packet Length Extension + * ... + */ +#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE \ + (EVENT_COMMAND_COMPLETE_FIRST_PARAM_BYTE + 0x00) +#define EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK (0x01 << 5) #define EVENT_CONNECTION_COMPLETE_PARAM_LENGTH 11 #define EVENT_CONNECTION_COMPLETE_TYPE 11 @@ -211,7 +242,7 @@ class BluetoothHidlTest : public ::testing::TestWithParam { std::vector* acl_handles); void handle_no_ops(); void wait_for_event(bool timeout_is_error); - void wait_for_command_complete_event(hidl_vec cmd); + hidl_vec wait_for_command_complete_event(hidl_vec cmd); int wait_for_completed_packets_event(uint16_t handle); class BluetoothHciDeathRecipient : public hidl_death_recipient { @@ -350,7 +381,7 @@ void BluetoothHidlTest::wait_for_event(bool timeout_is_error = true) { } // Wait until a COMMAND_COMPLETE is received. -void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec cmd) { +hidl_vec BluetoothHidlTest::wait_for_command_complete_event(hidl_vec cmd) { wait_for_event(); hidl_vec event = event_queue.front(); event_queue.pop(); @@ -361,6 +392,8 @@ void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec cmd) { EXPECT_EQ(cmd[0], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE]); EXPECT_EQ(cmd[1], event[EVENT_COMMAND_COMPLETE_OPCODE_LSBYTE + 1]); EXPECT_EQ(HCI_STATUS_SUCCESS, event[EVENT_COMMAND_COMPLETE_STATUS_BYTE]); + + return event; } // Send the command to read the controller's buffer sizes. @@ -646,6 +679,36 @@ TEST_P(BluetoothHidlTest, HciVersionTest) { EXPECT_LE(HCI_MINIMUM_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]); } +/** + * Requirements + * + * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension. + * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE). + */ +TEST_P(BluetoothHidlTest, Bluetooth4_2) { + // Bluetooth 4.2+ + hidl_vec cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION; + bluetooth->sendHciCommand(cmd); + auto event = wait_for_command_complete_event(cmd); + + EXPECT_LE(HCI_BLUETOOTH4_2_HCI_VERSION, event[EVENT_LOCAL_HCI_VERSION_BYTE]); + EXPECT_LE(HCI_BLUETOOTH4_2_LMP_VERSION, event[EVENT_LOCAL_LMP_VERSION_BYTE]); + + // BLE + cmd = COMMAND_HCI_READ_LOCAL_SUPPORTED_FEATURES; + bluetooth->sendHciCommand(cmd); + event = wait_for_command_complete_event(cmd); + EXPECT_TRUE(event[EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BYTE] & + EVENT_LOCAL_SUPPORTED_FEATURES_LE_SUPPORTED_BITMASK); + + // BLE Data Length Extension + cmd = COMMAND_HCI_LE_READ_LOCAL_SUPPORTED_FEATURES; + bluetooth->sendHciCommand(cmd); + event = wait_for_command_complete_event(cmd); + EXPECT_TRUE(event[EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_EXTENSION_BYTE] & + EVENT_LOCAL_LE_SUPPORTED_FEATURES_DATA_LENGTH_BITMASK); +} + // Send an unknown HCI command and wait for the error message. TEST_P(BluetoothHidlTest, HciUnknownCommand) { hidl_vec cmd = COMMAND_HCI_SHOULD_BE_UNKNOWN; From 84569ab39f82f9d00770d6e3bd1de48a0fa0a033 Mon Sep 17 00:00:00 2001 From: Doug Ferraz Date: Mon, 25 Mar 2024 20:04:19 -0400 Subject: [PATCH 086/161] Bluetooth HCI: Add VTS requirement for HCI 4.2 - Annotations Bug: <285456310> Test: atest VtsHalBluetoothV1_1TargetTest Test: atest VtsHalBluetoothV1_0TargetTest Test: atest VtsHalBluetoothTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:eff7b9102fa5353d96822b5e7b401b033bdd4513) Merged-In: I5a910d2a7d778b2e64a524d0a389b911c080e189 Change-Id: I5a910d2a7d778b2e64a524d0a389b911c080e189 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp | 4 ++-- .../1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp | 4 ++-- bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp index 63d04c2047..82dda61fbf 100644 --- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp +++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp @@ -657,11 +657,11 @@ TEST_P(BluetoothHidlTest, HciVersionTest) { } /** - * Requirements - * * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension. * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE). */ +// @VsrTest = 5.3.14-007 +// @VsrTest = 5.3.14-008 TEST_P(BluetoothHidlTest, Bluetooth4_2) { // Bluetooth 4.2+ hidl_vec cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION; diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp index 5a455bf9f9..687765f113 100644 --- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp +++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp @@ -680,11 +680,11 @@ TEST_P(BluetoothHidlTest, HciVersionTest) { } /** - * Requirements - * * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension. * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE). */ +// @VsrTest = 5.3.14-007 +// @VsrTest = 5.3.14-008 TEST_P(BluetoothHidlTest, Bluetooth4_2) { // Bluetooth 4.2+ hidl_vec cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION; diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp index 4d32ab2fbc..87f0f112a9 100644 --- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp +++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp @@ -1044,11 +1044,11 @@ TEST_P(BluetoothAidlTest, Vsr_Bluetooth5Requirements) { } /** - * Requirements - * * VSR-5.3.14-007 MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension. * VSR-5.3.14-008 MUST support Bluetooth Low Energy (BLE). */ +// @VsrTest = 5.3.14-007 +// @VsrTest = 5.3.14-008 TEST_P(BluetoothAidlTest, Vsr_Bluetooth4_2Requirements) { // test only applies to handheld devices if (!isHandheld()) { From 3e6625c793348c7faba5f9d4ff883184a434ccd9 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 16 Apr 2024 15:41:26 -0700 Subject: [PATCH 087/161] Add latest version bcradio HAL defaults Bug: 335304370 Test: atest VtsHalBroadcastradioAidlTargetTest Test: broadcastradio_utils_aidl_test Change-Id: Iaefbb6bdb032cd6ee47f5eb733ea2abaf7ab4b47 --- broadcastradio/aidl/Android.bp | 17 +++++++++++++++++ broadcastradio/aidl/default/Android.bp | 9 ++++++--- broadcastradio/aidl/vts/Android.bp | 6 +++--- broadcastradio/common/utilsaidl/Android.bp | 15 +++++++++++++-- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp index 187f2830eb..1540944b80 100644 --- a/broadcastradio/aidl/Android.bp +++ b/broadcastradio/aidl/Android.bp @@ -51,3 +51,20 @@ aidl_interface { frozen: true, } + +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_broadcastradio = "android.hardware.broadcastradio-V2" + +cc_defaults { + name: "latest_android_hardware_broadcastradio_ndk_static", + static_libs: [ + latest_android_hardware_broadcastradio + "-ndk", + ], +} + +java_defaults { + name: "latest_android_hardware_broadcastradio_java_static", + static_libs: [ + latest_android_hardware_broadcastradio + "-java", + ], +} diff --git a/broadcastradio/aidl/default/Android.bp b/broadcastradio/aidl/default/Android.bp index d7bb7514b8..b620a5956b 100644 --- a/broadcastradio/aidl/default/Android.bp +++ b/broadcastradio/aidl/default/Android.bp @@ -20,14 +20,17 @@ package { // all of the 'license_kinds' from "hardware_interfaces_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 + default_team: "trendy_team_aaos_framework", default_applicable_licenses: ["hardware_interfaces_license"], } cc_defaults { name: "BroadcastRadioHalDefaults", + defaults: [ + "latest_android_hardware_broadcastradio_ndk_static", + ], static_libs: [ - "android.hardware.broadcastradio-V2-ndk", - "android.hardware.broadcastradio@common-utils-aidl-lib-V2", + "android.hardware.broadcastradio@common-utils-aidl-lib-latest", "android.hardware.broadcastradio@common-utils-lib", ], shared_libs: [ @@ -79,12 +82,12 @@ cc_fuzz { // TODO(b/307611931): avoid fuzzing on vendor until hermiticity issue is fixed // vendor: true, defaults: [ + "latest_android_hardware_broadcastradio_ndk_static", "BroadcastRadioHalDefaults", "service_fuzzer_defaults", ], static_libs: [ "DefaultBroadcastRadioHal", - "android.hardware.broadcastradio-V2-ndk", ], srcs: [ "fuzzer.cpp", diff --git a/broadcastradio/aidl/vts/Android.bp b/broadcastradio/aidl/vts/Android.bp index 87e48a9ebe..78c377d74a 100644 --- a/broadcastradio/aidl/vts/Android.bp +++ b/broadcastradio/aidl/vts/Android.bp @@ -18,6 +18,7 @@ package { // all of the 'license_kinds' from "hardware_interfaces_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 + default_team: "trendy_team_aaos_framework", default_applicable_licenses: ["hardware_interfaces_license"], } @@ -25,6 +26,7 @@ cc_test { name: "VtsHalBroadcastradioAidlTargetTest", defaults: [ "VtsHalTargetTestDefaults", + "latest_android_hardware_broadcastradio_ndk_static", "use_libaidlvintf_gtest_helper_static", ], tidy_timeout_srcs: ["src/*.cpp"], @@ -35,9 +37,7 @@ cc_test { "libxml2", ], static_libs: [ - "android.hardware.broadcastradio-V2-ndk", - "android.hardware.broadcastradio@common-utils-aidl-lib-V2", - "android.hardware.broadcastradio@vts-utils-lib", + "android.hardware.broadcastradio@common-utils-aidl-lib-latest", "libgmock", ], test_suites: [ diff --git a/broadcastradio/common/utilsaidl/Android.bp b/broadcastradio/common/utilsaidl/Android.bp index e3bdfdda22..d88081fae1 100644 --- a/broadcastradio/common/utilsaidl/Android.bp +++ b/broadcastradio/common/utilsaidl/Android.bp @@ -47,17 +47,28 @@ cc_library_static { ], } +cc_library_static { + name: "android.hardware.broadcastradio@common-utils-aidl-lib-latest", + defaults: [ + "BroadcastRadioUtilsDefaults", + "latest_android_hardware_broadcastradio_ndk_static", + ], + srcs: [ + "src/UtilsV2.cpp", + ], +} + cc_test { name: "broadcastradio_utils_aidl_test", defaults: [ "BroadcastRadioUtilsDefaults", + "latest_android_hardware_broadcastradio_ndk_static", ], srcs: [ "test/*.cpp", ], static_libs: [ - "android.hardware.broadcastradio@common-utils-aidl-lib-V2", - "android.hardware.broadcastradio-V2-ndk", + "android.hardware.broadcastradio@common-utils-aidl-lib-latest", ], test_suites: ["general-tests"], } From def7a3cf59fa17ba7faa9af14a24f4161bc276bd Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 9 Apr 2024 21:50:41 +0000 Subject: [PATCH 088/161] Keep track of DeathMonitor cookies This change keeps track of the objects that the cookies points to so the serviceDied callback knows when it can use the cookie. Test: atest neuralnetworks_utils_hal_aidl_test Tets: atest NeuralNetworksTest_static Bug: 319210610 Change-Id: I418cbc6baa19aa702d9fd2e7d8096fe1a02b7794 --- .../include/nnapi/hal/aidl/ProtectCallback.h | 11 ++++ .../aidl/utils/src/ProtectCallback.cpp | 56 ++++++++++++++++--- neuralnetworks/aidl/utils/test/DeviceTest.cpp | 9 ++- 3 files changed, 66 insertions(+), 10 deletions(-) diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h index 92ed1cda5d..9a7fe5e1c7 100644 --- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h +++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h @@ -56,6 +56,8 @@ class IProtectedCallback { // Thread safe class class DeathMonitor final { public: + explicit DeathMonitor(uintptr_t cookieKey) : kCookieKey(cookieKey) {} + static void serviceDied(void* cookie); void serviceDied(); // Precondition: `killable` must be non-null. @@ -63,9 +65,18 @@ class DeathMonitor final { // Precondition: `killable` must be non-null. void remove(IProtectedCallback* killable) const; + uintptr_t getCookieKey() const { return kCookieKey; } + + ~DeathMonitor(); + DeathMonitor(const DeathMonitor&) = delete; + DeathMonitor(DeathMonitor&&) noexcept = delete; + DeathMonitor& operator=(const DeathMonitor&) = delete; + DeathMonitor& operator=(DeathMonitor&&) noexcept = delete; + private: mutable std::mutex mMutex; mutable std::vector mObjects GUARDED_BY(mMutex); + const uintptr_t kCookieKey; }; class DeathHandler final { diff --git a/neuralnetworks/aidl/utils/src/ProtectCallback.cpp b/neuralnetworks/aidl/utils/src/ProtectCallback.cpp index 54a673caf5..4a7ac08895 100644 --- a/neuralnetworks/aidl/utils/src/ProtectCallback.cpp +++ b/neuralnetworks/aidl/utils/src/ProtectCallback.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,16 @@ namespace aidl::android::hardware::neuralnetworks::utils { +namespace { + +// Only dereference the cookie if it's valid (if it's in this set) +// Only used with ndk +std::mutex sCookiesMutex; +uintptr_t sCookieKeyCounter GUARDED_BY(sCookiesMutex) = 0; +std::map> sCookies GUARDED_BY(sCookiesMutex); + +} // namespace + void DeathMonitor::serviceDied() { std::lock_guard guard(mMutex); std::for_each(mObjects.begin(), mObjects.end(), @@ -40,8 +51,24 @@ void DeathMonitor::serviceDied() { } void DeathMonitor::serviceDied(void* cookie) { - auto deathMonitor = static_cast(cookie); - deathMonitor->serviceDied(); + std::shared_ptr monitor; + { + std::lock_guard guard(sCookiesMutex); + if (auto it = sCookies.find(reinterpret_cast(cookie)); it != sCookies.end()) { + monitor = it->second.lock(); + sCookies.erase(it); + } else { + LOG(INFO) + << "Service died, but cookie is no longer valid so there is nothing to notify."; + return; + } + } + if (monitor) { + LOG(INFO) << "Notifying DeathMonitor from serviceDied."; + monitor->serviceDied(); + } else { + LOG(INFO) << "Tried to notify DeathMonitor from serviceDied but could not promote."; + } } void DeathMonitor::add(IProtectedCallback* killable) const { @@ -57,12 +84,25 @@ void DeathMonitor::remove(IProtectedCallback* killable) const { mObjects.erase(removedIter); } +DeathMonitor::~DeathMonitor() { + // lock must be taken so object is not used in OnBinderDied" + std::lock_guard guard(sCookiesMutex); + sCookies.erase(kCookieKey); +} + nn::GeneralResult DeathHandler::create(std::shared_ptr object) { if (object == nullptr) { return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "utils::DeathHandler::create must have non-null object"; } - auto deathMonitor = std::make_shared(); + + std::shared_ptr deathMonitor; + { + std::lock_guard guard(sCookiesMutex); + deathMonitor = std::make_shared(sCookieKeyCounter++); + sCookies[deathMonitor->getCookieKey()] = deathMonitor; + } + auto deathRecipient = ndk::ScopedAIBinder_DeathRecipient( AIBinder_DeathRecipient_new(DeathMonitor::serviceDied)); @@ -70,8 +110,9 @@ nn::GeneralResult DeathHandler::create(std::shared_ptrisRemote()) { - const auto ret = ndk::ScopedAStatus::fromStatus(AIBinder_linkToDeath( - object->asBinder().get(), deathRecipient.get(), deathMonitor.get())); + const auto ret = ndk::ScopedAStatus::fromStatus( + AIBinder_linkToDeath(object->asBinder().get(), deathRecipient.get(), + reinterpret_cast(deathMonitor->getCookieKey()))); HANDLE_ASTATUS(ret) << "AIBinder_linkToDeath failed"; } @@ -91,8 +132,9 @@ DeathHandler::DeathHandler(std::shared_ptr object, DeathHandler::~DeathHandler() { if (kObject != nullptr && kDeathRecipient.get() != nullptr && kDeathMonitor != nullptr) { - const auto ret = ndk::ScopedAStatus::fromStatus(AIBinder_unlinkToDeath( - kObject->asBinder().get(), kDeathRecipient.get(), kDeathMonitor.get())); + const auto ret = ndk::ScopedAStatus::fromStatus( + AIBinder_unlinkToDeath(kObject->asBinder().get(), kDeathRecipient.get(), + reinterpret_cast(kDeathMonitor->getCookieKey()))); const auto maybeSuccess = handleTransportError(ret); if (!maybeSuccess.ok()) { LOG(ERROR) << maybeSuccess.error().message; diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp index 73727b3974..ffd3b8e5f1 100644 --- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp +++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp @@ -697,7 +697,8 @@ TEST_P(DeviceTest, prepareModelAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) @@ -846,7 +847,8 @@ TEST_P(DeviceTest, prepareModelWithConfigAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModelWithConfig(_, _, _)) @@ -970,7 +972,8 @@ TEST_P(DeviceTest, prepareModelFromCacheAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) From 3016dfbf01836a2b8638a0690fa243c056e38e60 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 18 Apr 2024 04:38:17 +0000 Subject: [PATCH 089/161] Use customized event flag for data FMQ not_empty to avoid conflict also update VTS data path test skipping for offload effects Bug: 335547630 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: Ie92f04091658e210dccb7a2d60ebbab14c49fb58 --- audio/aidl/default/EffectImpl.cpp | 57 +++++++++++-------- .../default/include/effect-impl/EffectImpl.h | 10 ++++ audio/aidl/vts/EffectHelper.h | 12 +++- audio/aidl/vts/TestUtils.h | 2 +- .../aidl/vts/VtsHalAudioEffectTargetTest.cpp | 27 ++++----- .../vts/VtsHalLoudnessEnhancerTargetTest.cpp | 5 +- 6 files changed, 70 insertions(+), 43 deletions(-) diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp index 03de74f43c..7192d97c37 100644 --- a/audio/aidl/default/EffectImpl.cpp +++ b/audio/aidl/default/EffectImpl.cpp @@ -23,6 +23,9 @@ #include "include/effect-impl/EffectTypes.h" using aidl::android::hardware::audio::effect::IEffect; +using aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty; +using aidl::android::hardware::audio::effect::kEventFlagNotEmpty; +using aidl::android::hardware::audio::effect::kReopenSupportedVersion; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::PcmType; using ::android::hardware::EventFlag; @@ -43,7 +46,6 @@ namespace aidl::android::hardware::audio::effect { ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common, const std::optional& specific, OpenEffectReturn* ret) { - LOG(DEBUG) << getEffectName() << __func__; // effect only support 32bits float RETURN_IF(common.input.base.format.pcm != common.output.base.format.pcm || common.input.base.format.pcm != PcmType::FLOAT_32_BIT, @@ -54,11 +56,12 @@ ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common, mImplContext = createContext(common); RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext"); - int version = 0; - RETURN_IF(!getInterfaceVersion(&version).isOk(), EX_UNSUPPORTED_OPERATION, + RETURN_IF(!getInterfaceVersion(&mVersion).isOk(), EX_UNSUPPORTED_OPERATION, "FailedToGetInterfaceVersion"); - mImplContext->setVersion(version); + mImplContext->setVersion(mVersion); mEventFlag = mImplContext->getStatusEventFlag(); + mDataMqNotEmptyEf = + mVersion >= kReopenSupportedVersion ? kEventFlagDataMqNotEmpty : kEventFlagNotEmpty; if (specific.has_value()) { RETURN_IF_ASTATUS_NOT_OK(setParameterSpecific(specific.value()), "setSpecParamErr"); @@ -66,8 +69,9 @@ ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common, mState = State::IDLE; mImplContext->dupeFmq(ret); - RETURN_IF(createThread(getEffectName()) != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION, - "FailedToCreateWorker"); + RETURN_IF(createThread(getEffectNameWithVersion()) != RetCode::SUCCESS, + EX_UNSUPPORTED_OPERATION, "FailedToCreateWorker"); + LOG(INFO) << getEffectNameWithVersion() << __func__; return ndk::ScopedAStatus::ok(); } @@ -89,7 +93,7 @@ ndk::ScopedAStatus EffectImpl::close() { mState = State::INIT; } - RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, + RETURN_IF(notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagNotEmptyFailed"); // stop the worker thread, ignore the return code RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION, @@ -101,13 +105,13 @@ ndk::ScopedAStatus EffectImpl::close() { mImplContext.reset(); } - LOG(DEBUG) << getEffectName() << __func__; + LOG(INFO) << getEffectNameWithVersion() << __func__; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) { std::lock_guard lg(mImplMutex); - LOG(VERBOSE) << getEffectName() << __func__ << " with: " << param.toString(); + LOG(VERBOSE) << getEffectNameWithVersion() << __func__ << " with: " << param.toString(); const auto& tag = param.getTag(); switch (tag) { @@ -122,7 +126,7 @@ ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) { return setParameterSpecific(param.get()); } default: { - LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag " + LOG(ERROR) << getEffectNameWithVersion() << __func__ << " unsupportedParameterTag " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "ParameterNotSupported"); @@ -147,7 +151,7 @@ ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter* break; } } - LOG(VERBOSE) << getEffectName() << __func__ << id.toString() << param->toString(); + LOG(VERBOSE) << getEffectNameWithVersion() << __func__ << id.toString() << param->toString(); return ndk::ScopedAStatus::ok(); } @@ -180,7 +184,7 @@ ndk::ScopedAStatus EffectImpl::setParameterCommon(const Parameter& param) { EX_ILLEGAL_ARGUMENT, "setVolumeStereoFailed"); break; default: { - LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag " + LOG(ERROR) << getEffectNameWithVersion() << __func__ << " unsupportedParameterTag " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "commonParamNotSupported"); @@ -214,7 +218,8 @@ ndk::ScopedAStatus EffectImpl::getParameterCommon(const Parameter::Tag& tag, Par break; } default: { - LOG(DEBUG) << getEffectName() << __func__ << " unsupported tag " << toString(tag); + LOG(DEBUG) << getEffectNameWithVersion() << __func__ << " unsupported tag " + << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "tagNotSupported"); } @@ -236,7 +241,7 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_OK_IF(mState == State::PROCESSING); RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); mState = State::PROCESSING; - RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, + RETURN_IF(notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagNotEmptyFailed"); startThread(); break; @@ -244,17 +249,18 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { case CommandId::RESET: RETURN_OK_IF(mState == State::IDLE); mState = State::IDLE; - RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE, + RETURN_IF(notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS, EX_ILLEGAL_STATE, "notifyEventFlagNotEmptyFailed"); stopThread(); RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed"); break; default: - LOG(ERROR) << getEffectName() << __func__ << " instance still processing"; + LOG(ERROR) << getEffectNameWithVersion() << __func__ << " instance still processing"; return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "CommandIdNotSupported"); } - LOG(VERBOSE) << getEffectName() << __func__ << " transfer to state: " << toString(mState); + LOG(VERBOSE) << getEffectNameWithVersion() << __func__ + << " transfer to state: " << toString(mState); return ndk::ScopedAStatus::ok(); } @@ -284,14 +290,14 @@ void EffectImpl::cleanUp() { RetCode EffectImpl::notifyEventFlag(uint32_t flag) { if (!mEventFlag) { - LOG(ERROR) << getEffectName() << __func__ << ": StatusEventFlag invalid"; + LOG(ERROR) << getEffectNameWithVersion() << __func__ << ": StatusEventFlag invalid"; return RetCode::ERROR_EVENT_FLAG_ERROR; } if (const auto ret = mEventFlag->wake(flag); ret != ::android::OK) { - LOG(ERROR) << getEffectName() << __func__ << ": wake failure with ret " << ret; + LOG(ERROR) << getEffectNameWithVersion() << __func__ << ": wake failure with ret " << ret; return RetCode::ERROR_EVENT_FLAG_ERROR; } - LOG(VERBOSE) << getEffectName() << __func__ << ": " << std::hex << mEventFlag; + LOG(VERBOSE) << getEffectNameWithVersion() << __func__ << ": " << std::hex << mEventFlag; return RetCode::SUCCESS; } @@ -304,17 +310,17 @@ IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size } void EffectImpl::process() { - ATRACE_NAME(getEffectName().c_str()); + ATRACE_NAME(getEffectNameWithVersion().c_str()); /** * wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change * in the life cycle of workerThread (threadLoop). */ uint32_t efState = 0; if (!mEventFlag || - ::android::OK != mEventFlag->wait(kEventFlagNotEmpty, &efState, 0 /* no timeout */, + ::android::OK != mEventFlag->wait(mDataMqNotEmptyEf, &efState, 0 /* no timeout */, true /* retry */) || - !(efState & kEventFlagNotEmpty)) { - LOG(ERROR) << getEffectName() << __func__ << ": StatusEventFlag - " << mEventFlag + !(efState & mDataMqNotEmptyEf)) { + LOG(ERROR) << getEffectNameWithVersion() << __func__ << ": StatusEventFlag - " << mEventFlag << " efState - " << std::hex << efState; return; } @@ -322,7 +328,8 @@ void EffectImpl::process() { { std::lock_guard lg(mImplMutex); if (mState != State::PROCESSING) { - LOG(DEBUG) << getEffectName() << " skip process in state: " << toString(mState); + LOG(DEBUG) << getEffectNameWithVersion() + << " skip process in state: " << toString(mState); return; } RETURN_VALUE_IF(!mImplContext, void(), "nullContext"); diff --git a/audio/aidl/default/include/effect-impl/EffectImpl.h b/audio/aidl/default/include/effect-impl/EffectImpl.h index 21f6502385..d3bb7f4ccf 100644 --- a/audio/aidl/default/include/effect-impl/EffectImpl.h +++ b/audio/aidl/default/include/effect-impl/EffectImpl.h @@ -89,6 +89,11 @@ class EffectImpl : public BnEffect, public EffectThread { void process() override; protected: + // current Hal version + int mVersion = 0; + // Use kEventFlagNotEmpty for V1 HAL, kEventFlagDataMqNotEmpty for V2 and above + int mDataMqNotEmptyEf = aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty; + State mState GUARDED_BY(mImplMutex) = State::INIT; IEffect::Status status(binder_status_t status, size_t consumed, size_t produced); @@ -107,6 +112,11 @@ class EffectImpl : public BnEffect, public EffectThread { virtual ndk::ScopedAStatus commandImpl(CommandId id) REQUIRES(mImplMutex); RetCode notifyEventFlag(uint32_t flag); + + std::string getEffectNameWithVersion() { + return getEffectName() + "V" + std::to_string(mVersion); + } + ::android::hardware::EventFlag* mEventFlag; }; } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h index 82a07fdc10..9c6fed4c83 100644 --- a/audio/aidl/vts/EffectHelper.h +++ b/audio/aidl/vts/EffectHelper.h @@ -43,8 +43,10 @@ using namespace android; using aidl::android::hardware::audio::effect::CommandId; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::IEffect; +using aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty; using aidl::android::hardware::audio::effect::kEventFlagDataMqUpdate; using aidl::android::hardware::audio::effect::kEventFlagNotEmpty; +using aidl::android::hardware::audio::effect::kReopenSupportedVersion; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::Range; using aidl::android::hardware::audio::effect::State; @@ -158,7 +160,7 @@ class EffectHelper { std::fill(buffer.begin(), buffer.end(), 0x5a); } static void writeToFmq(std::unique_ptr& statusMq, std::unique_ptr& dataMq, - const std::vector& buffer) { + const std::vector& buffer, int version) { const size_t available = dataMq->availableToWrite(); ASSERT_NE(0Ul, available); auto bufferFloats = buffer.size(); @@ -169,7 +171,8 @@ class EffectHelper { ASSERT_EQ(::android::OK, EventFlag::createEventFlag(statusMq->getEventFlagWord(), &efGroup)); ASSERT_NE(nullptr, efGroup); - efGroup->wake(kEventFlagNotEmpty); + efGroup->wake(version >= kReopenSupportedVersion ? kEventFlagDataMqNotEmpty + : kEventFlagNotEmpty); ASSERT_EQ(::android::OK, EventFlag::deleteEventFlag(&efGroup)); } static void readFromFmq(std::unique_ptr& statusMq, size_t statusNum, @@ -320,7 +323,10 @@ class EffectHelper { ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING)); // Write from buffer to message queues and calling process - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, inputBuffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, inputBuffer, [&]() { + int version = 0; + return (mEffect && mEffect->getInterfaceVersion(&version).isOk()) ? version : 0; + }())); // Read the updated message queues into buffer EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 1, outputMQ, diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h index 0a5addc84c..3a6c137da6 100644 --- a/audio/aidl/vts/TestUtils.h +++ b/audio/aidl/vts/TestUtils.h @@ -108,7 +108,7 @@ inline ::testing::AssertionResult assertResultOrUnknownTransaction( ({ \ if ((flags).hwAcceleratorMode == \ aidl::android::hardware::audio::effect::Flags::HardwareAccelerator::TUNNEL || \ - (flags).bypass) { \ + (flags).bypass || (flags).offloadIndication) { \ GTEST_SKIP() << "Skip data path for offload"; \ } \ }) diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp index 4693f102cb..5b83d73dfd 100644 --- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp @@ -42,7 +42,6 @@ using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::Flags; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kReopenSupportedVersion; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioDeviceDescription; @@ -58,6 +57,7 @@ class AudioEffectTest : public testing::TestWithParam, public E public: AudioEffectTest() { std::tie(mFactory, mDescriptor) = std::get(GetParam()); + mVersion = EffectFactoryHelper::getHalVersion(mFactory); } void SetUp() override {} @@ -76,6 +76,7 @@ class AudioEffectTest : public testing::TestWithParam, public E std::shared_ptr mFactory; std::shared_ptr mEffect; Descriptor mDescriptor; + int mVersion = 0; void setAndGetParameter(Parameter::Id id, const Parameter& set) { Parameter get; @@ -682,7 +683,7 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataInProcessingState) { std::vector buffer; EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); @@ -722,7 +723,7 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataAfterRestart) { ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING)); EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); @@ -759,7 +760,7 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataAfterReopen) { ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START)); ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING)); EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); @@ -779,7 +780,7 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataAfterReopen) { // verify data consume again EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); @@ -810,7 +811,7 @@ TEST_P(AudioEffectDataPathTest, SendDataAtIdleAndConsumeDataInProcessing) { std::vector buffer; EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START)); ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING)); @@ -844,7 +845,7 @@ TEST_P(AudioEffectDataPathTest, ProcessDataMultipleTimes) { std::vector buffer; EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 0, outputMQ, 0, buffer)); ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START)); @@ -853,7 +854,7 @@ TEST_P(AudioEffectDataPathTest, ProcessDataMultipleTimes) { EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); @@ -886,13 +887,13 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataAndRestart) { ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING)); std::vector buffer; EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer)); ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::STOP)); ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::IDLE)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 0, outputMQ, 0, buffer)); ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START)); @@ -928,7 +929,7 @@ TEST_P(AudioEffectDataPathTest, NotConsumeDataByClosedEffect) { std::vector buffer; EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion)); EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 0, outputMQ, 0, buffer)); ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect)); @@ -964,7 +965,7 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataMultipleEffects) { std::vector buffer1, buffer2; EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common1, inputMQ1, buffer1)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ1, inputMQ1, buffer1)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ1, inputMQ1, buffer1, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ1, 1, outputMQ1, buffer1.size(), buffer1)); @@ -975,7 +976,7 @@ TEST_P(AudioEffectDataPathTest, ConsumeDataMultipleEffects) { auto outputMQ2 = std::make_unique(ret2.outputDataMQ); ASSERT_TRUE(outputMQ2->isValid()); EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common2, inputMQ2, buffer2)); - EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ2, inputMQ2, buffer2)); + EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ2, inputMQ2, buffer2, mVersion)); EXPECT_NO_FATAL_FAILURE( EffectHelper::readFromFmq(statusMQ2, 1, outputMQ2, buffer2.size(), buffer2)); diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp index a075423f62..7a53502129 100644 --- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp @@ -53,6 +53,7 @@ class LoudnessEnhancerEffectHelper : public EffectHelper { kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */); ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE)); ASSERT_NE(nullptr, mEffect); + mVersion = EffectFactoryHelper::getHalVersion(mFactory); } void TearDownLoudnessEnhancer() { @@ -114,6 +115,7 @@ class LoudnessEnhancerEffectHelper : public EffectHelper { std::shared_ptr mFactory; std::shared_ptr mEffect; Descriptor mDescriptor; + int mVersion = 0; }; /** @@ -190,7 +192,8 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam Date: Tue, 2 Apr 2024 22:31:12 +0000 Subject: [PATCH 090/161] Add examples to area access documentation Also add VTS checks to ensure WRITE_ONLY configs don't exist along with READ_ONLY and READ_WRITE configs Bug: 332598311 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ie3d38fc2fd582d8949736739e83d277d75d69e62 --- .../automotive/vehicle/VehicleAreaConfig.aidl | 6 +++- .../automotive/vehicle/VehiclePropConfig.aidl | 30 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 8 ++++- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index 726d4191b9..9387965df3 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -62,7 +62,9 @@ parcelable VehicleAreaConfig { * For example, if a property is defined as READ_WRITE, but the OEM wants to specify certain * area Ids as READ-only, the corresponding areaIds should have an access set to READ, while the * others must be set to READ_WRITE. We do not support setting specific area Ids to WRITE-only - * when the property is READ-WRITE. + * when the property is READ-WRITE. If any one area config has access + * VehiclePropertyAccess::WRITE, then all VehicleAreaConfig.access values and + * VehiclePropConfig.access must be set to WRITE for the property. * * VehiclePropConfig.access should be equal the maximal subset of the accesses set in * VehiclePropConfig.areaConfigs, excluding those with access == VehiclePropertyAccess.NONE. For @@ -73,6 +75,8 @@ parcelable VehicleAreaConfig { * In the scenario where the OEM actually wants to set VehicleAreaConfig.access = * VehiclePropertyAccess.NONE, the maximal subset rule should apply with this area config * included, making the VehiclePropConfig.access = VehiclePropertyAccess.NONE. + * + * See VehiclePropConfig.access for more information. */ VehiclePropertyAccess access = VehiclePropertyAccess.NONE; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index 31096219f4..d8304f6fb3 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -44,6 +44,36 @@ parcelable VehiclePropConfig { * VehiclePropertyAccess.NONE for a particular area config, the maximal subset rule should apply * with this area config included, making the VehiclePropConfig.access = * VehiclePropertyAccess.NONE. + * + * Currently we do not support scenarios where some areaIds are WRITE while others are + * READ_WRITE. See the documentation for VehicleAreaConfig.access for more details. + * + * Examples: + * Suppose we have a property with two areaIds which we will call "LEFT" and "RIGHT". Here + * are some scenarios that can describe what the VehiclePropConfig.access value should be for + * this property. + * 1. LEFT is READ and RIGHT is READ_WRITE. VehiclePropConfig.access must be READ as that is + * the maximal common access across all areaIds. + * 2. LEFT is READ_WRITE and RIGHT is READ_WRITE. VehiclePropConfig.access must be READ_WRITE + * as that is the maximal common access across all areaIds. + * 3. LEFT is WRITE and RIGHT is WRITE. VehiclePropConfig.access must be WRITE as that is the + * maximal common access across all areaIds. + * 4. LEFT is READ_WRITE and RIGHT is not set (i.e. defaults to NONE)/is set to NONE, with the + * expectation that RIGHT should be populated with the default access mode of the property. + * VehiclePropConfig.access can be set to READ or READ_WRITE, whatever the OEM feels is the + * appropriate default access for the property. + * 5. LEFT is READ and RIGHT is not set (i.e. defaults to NONE)/is set to NONE, with the + * expectation that RIGHT should be populated with the default access mode of the property. + * VehiclePropConfig.access must be set to READ because setting to READ_WRITE breaks the + * rule of having the global access being the maximal subset of the area config accesses. + * If the OEM wants RIGHT to be READ_WRITE in this scenario, the config should be rewritten + * such that LEFT is not set/is set to NONE and RIGHT is set to READ_WRITE with + * VehiclePropConfig.access set to READ. + * 6. LEFT is READ_WRITE and RIGHT is set to NONE with the intention of RIGHT to specifically + * have no access. VehiclePropConfig.access must be NONE to support RIGHT maintaining its + * NONE access. + * 7. LEFT is READ_WRITE and RIGHT is WRITE. This is unsupported behaviour and the config + * should not be defined this way. */ VehiclePropertyAccess access = VehiclePropertyAccess.NONE; diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 4ea6dfe5f2..30661a2bb2 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -752,9 +752,15 @@ void VtsHalAutomotiveVehicleTargetTest::verifyGlobalAccessIsMaximalAreaAccessSub } } - if (readOnlyPresent && !writeOnlyPresent) { + if (readOnlyPresent) { + ASSERT_FALSE(writeOnlyPresent) << StringPrintf( + "Found both READ_ONLY and WRITE_ONLY access modes in area configs, which is not " + "supported"); maximalAreaAccessSubset = toInt(VehiclePropertyAccess::READ); } else if (writeOnlyPresent) { + ASSERT_FALSE(readWritePresent) << StringPrintf( + "Found both WRITE_ONLY and READ_WRITE access modes in area configs, which is not " + "supported"); maximalAreaAccessSubset = toInt(VehiclePropertyAccess::WRITE); } else if (readWritePresent) { maximalAreaAccessSubset = toInt(VehiclePropertyAccess::READ_WRITE); From 74d3ac25fbf35a5adaadc9ecc01999517951bfa2 Mon Sep 17 00:00:00 2001 From: Matt Buckley Date: Mon, 22 Apr 2024 21:35:59 +0000 Subject: [PATCH 091/161] Update PowerHAL documentation to clarify Session ID size restriction Test: n/a Bug: 315894228 Change-Id: I69ee157bc79e26578bd13a907662ac8756d7ce47 --- power/aidl/android/hardware/power/SessionConfig.aidl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/power/aidl/android/hardware/power/SessionConfig.aidl b/power/aidl/android/hardware/power/SessionConfig.aidl index 93dc9a278e..ca89183e16 100644 --- a/power/aidl/android/hardware/power/SessionConfig.aidl +++ b/power/aidl/android/hardware/power/SessionConfig.aidl @@ -25,6 +25,9 @@ parcelable SessionConfig { /** * The session's unique ID, used to identify the session for debugging and * for multiplexing on the per-process FMQ channel. + * + * Values that fit in the 32-bit int range value must be provided when using + * the FMQ API, as the FMQ messages can only accept 32-bit Session IDs. */ long id; } From bb7e7ae36c82dbdd6e4188ce01e2748e002d1377 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 22 Apr 2024 17:33:17 -0700 Subject: [PATCH 092/161] Fix Vts VUR test case. It is not guaranteed that VHAL will send the initial value event if VUR is on. In fact, car property service explicitly calls getValue to generate the initial value event. Hence, if VUR is on, our test case should allow situation where no event is generated. Test: atest VtsHalAutomotiveVehicle_TargetTest Bug: 334803613 Change-Id: Id924fdd2a407b1a076102c4dd57efc6043cde359 --- .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 4ea6dfe5f2..80b069a5e3 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -603,6 +603,7 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribe_enableVurIfSupported) { << "skip testing"; } + // Subscribe to PERF_VEHICLE_SPEED using the max sample rate. auto client = mVhalClient->getSubscriptionClient(mCallback); ASSERT_NE(client, nullptr) << "Failed to get subscription client"; SubscribeOptionsBuilder builder(propId); @@ -616,18 +617,17 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribe_enableVurIfSupported) { ", error: %s", propId, result.error().message().c_str()); - ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, 1, std::chrono::seconds(2))) - << "Must get at least 1 events within 2 seconds after subscription for rate: " - << maxSampleRate; - // Sleep for 1 seconds to wait for more possible events to arrive. std::this_thread::sleep_for(std::chrono::seconds(1)); client->unsubscribe({propId}); auto events = mCallback->getEvents(propId); - if (events.size() == 1) { - // We only received one event, the value is not changing so nothing to check here. + if (events.size() <= 1) { + // We received 0 or 1 event, the value is not changing so nothing to check here. + // If all VHAL clients are subscribing to PERF_VEHICLE_SPEED with VUR on, then we + // will receive 0 event. If there are other VHAL clients subscribing to PERF_VEHICLE_SPEED + // with VUR off, then we will receive 1 event which is the initial value. return; } From 27068fb3831bee2c98bf88adffb571a43b7cfeb1 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 22 Apr 2024 19:47:26 -0700 Subject: [PATCH 093/161] Fix flaky TestWakeupClientServiceImplUnitTest. This CL fixed two possible issues: 1. mServerStarted is not reset to false for each test case. 2. pollOnce should be used instead of pollAll since pollAll might swallow wake. Test: atest --host TestWakeupClientServerHostUnitTest Bug: 333673876 Change-Id: Id705d6257c54a2e2711aff6018abf2ea65b0f691 --- .../test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp | 3 ++- .../impl/test/TestWakeupClientServiceImplUnitTest.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 5d33fcb632..515dc98ceb 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -169,7 +169,8 @@ void ServiceImpl::loop() { Looper::setForThread(mLooper); while (true) { - mLooper->pollAll(/*timeoutMillis=*/-1); + // Don't use pollAll since it might swallow wake. + mLooper->pollOnce(/*timeoutMillis=*/-1); if (mServerStopped) { return; } diff --git a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp index dd08e325cb..a7927f5b1c 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp @@ -53,6 +53,9 @@ class TestWakeupClientServiceImplUnitTest : public ::testing::Test { public: virtual void SetUp() override { int selectedPort = 0; + mServerStarted = false; + mService.reset(); + mServer.reset(); mServerThread = std::thread([this, &selectedPort] { mService = std::make_unique(); ServerBuilder builder; From 53ece58051984073ba4aa09c3974eb898ffd7f7c Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Tue, 23 Apr 2024 20:21:33 +0000 Subject: [PATCH 094/161] Update owners. Change-Id: Ib3bc7197161de63e8b202f0935d66826104fb3ed Fix: 335274653 Test: N/A --- biometrics/OWNERS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/biometrics/OWNERS b/biometrics/OWNERS index 58998c1026..a0a5e51846 100644 --- a/biometrics/OWNERS +++ b/biometrics/OWNERS @@ -1,8 +1,10 @@ -ilyamaty@google.com +# Bug component: 879035 + +include platform/frameworks/base:/services/core/java/com/android/server/biometrics/OWNERS + jeffpu@google.com jbolinger@google.com joshmccloskey@google.com diyab@google.com austindelgado@google.com spdonghao@google.com -wenhuiy@google.com From e82a5c75660cd7ec70f7373ee041e3b47be2cba0 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Fri, 19 Apr 2024 14:54:50 -0700 Subject: [PATCH 095/161] Fix various issues in video stream emulation - Return early from EvsCamera::stopVideoStream() method when current video stream is already being stopped. - Reconfigure the media codec and try again when it fails to start decoding a media file. - Send the STREAM_STOPPED event after closing a video stream. - Rewind the media extractor when it reaches the end of current source media file, to be able to playback repeatedly. Bug: 335901181 Test: Run a test described in the associated bug. Change-Id: If952a63700402885f794a7ef544f393314101606 --- .../default/include/EvsVideoEmulatedCamera.h | 2 + .../evs/aidl/impl/default/src/EvsCamera.cpp | 9 ++++- .../default/src/EvsVideoEmulatedCamera.cpp | 40 ++++++++++++++++--- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h b/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h index a850d6598b..9d1610a928 100644 --- a/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h +++ b/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h @@ -93,6 +93,8 @@ class EvsVideoEmulatedCamera : public EvsCamera { bool initialize(); + bool initializeMediaCodec(); + void generateFrames(); void renderOneFrame(); diff --git a/automotive/evs/aidl/impl/default/src/EvsCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsCamera.cpp index bc3bfdd367..005c71f9e5 100644 --- a/automotive/evs/aidl/impl/default/src/EvsCamera.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsCamera.cpp @@ -198,9 +198,14 @@ ndk::ScopedAStatus EvsCamera::stopVideoStream() { auto status = ndk::ScopedAStatus::ok(); { std::unique_lock lck(mMutex); + if (mStreamState != StreamState::RUNNING) { + // We're already in the middle of the procedure to stop current data + // stream. + return status; + } + if ((!preVideoStreamStop_locked(status, lck) || !stopVideoStreamImpl_locked(status, lck) || - !postVideoStreamStop_locked(status, lck)) && - !status.isOk()) { + !postVideoStreamStop_locked(status, lck)) && !status.isOk()) { needShutdown = true; } } diff --git a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp index e3f7b5e125..480c28d6a8 100644 --- a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp @@ -81,6 +81,10 @@ bool EvsVideoEmulatedCamera::initialize() { } } + return initializeMediaCodec(); +} + +bool EvsVideoEmulatedCamera::initializeMediaCodec() { // Initialize Media Codec and file format. std::unique_ptr format; const char* mime; @@ -304,6 +308,13 @@ void EvsVideoEmulatedCamera::renderOneFrame() { LOG(ERROR) << __func__ << ": Received error in releasing output buffer. Error code: " << release_status; } + + if ((info.flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) != 0) { + LOG(INFO) << "Start video playback from the beginning."; + AMediaExtractor_seekTo(mVideoExtractor.get(), /* seekPosUs= */ 0, + AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC); + AMediaCodec_flush(mVideoCodec.get()); + } } void EvsVideoEmulatedCamera::initializeParameters() { @@ -337,11 +348,24 @@ bool EvsVideoEmulatedCamera::startVideoStreamImpl_locked( std::unique_lock& /* lck */) { mStream = receiver; - const media_status_t status = AMediaCodec_start(mVideoCodec.get()); - if (status != AMEDIA_OK) { - LOG(ERROR) << __func__ << ": Received error in starting decoder. Error code: " << status - << "."; - return false; + if (auto status = AMediaCodec_start(mVideoCodec.get()); status != AMEDIA_OK) { + LOG(INFO) << __func__ << ": Received error in starting decoder. " + << "Trying again after resetting this emulated device."; + + if (!initializeMediaCodec()) { + LOG(ERROR) << __func__ << ": Failed to re-configure the media codec."; + return false; + } + + AMediaExtractor_seekTo(mVideoExtractor.get(), /* seekPosUs= */ 0, + AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC); + AMediaCodec_flush(mVideoCodec.get()); + + if(auto status = AMediaCodec_start(mVideoCodec.get()); status != AMEDIA_OK) { + LOG(ERROR) << __func__ << ": Received error again in starting decoder. " + << "Error code: " << status; + return false; + } } mCaptureThread = std::thread([this]() { generateFrames(); }); @@ -364,6 +388,12 @@ bool EvsVideoEmulatedCamera::postVideoStreamStop_locked(ndk::ScopedAStatus& stat if (!Base::postVideoStreamStop_locked(status, lck)) { return false; } + + EvsEventDesc event = { .aType = EvsEventType::STREAM_STOPPED, }; + if (auto result = mStream->notify(event); !result.isOk()) { + LOG(WARNING) << "Failed to notify the end of the stream."; + } + mStream = nullptr; return true; } From 0410a1139b3b7237298a054d38446ed39f40f1b8 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 28 Mar 2024 15:15:44 -0700 Subject: [PATCH 096/161] audio: Fix some VTS issues on real devices 1. Skip testing of stream I/O on certain types of mix ports. 2. Skip testing of connection of BT SCO device. Bug: 300735639 Bug: 326888356 Bug: 328010709 Bug: 331516432 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:69d60aa02ccb1fd744750eaa929264b7b433956e) Merged-In: I9b8bbf2014e223375c8f8400ff2af32268803706 Change-Id: I9b8bbf2014e223375c8f8400ff2af32268803706 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- audio/aidl/common/include/Utils.h | 6 +++++ .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 22 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h index f8011e57e5..b431340c5a 100644 --- a/audio/aidl/common/include/Utils.h +++ b/audio/aidl/common/include/Utils.h @@ -177,6 +177,12 @@ constexpr U makeBitPositionFlagMask(std::initializer_list flags) { return result; } +template , + typename = std::enable_if_t::value>> +constexpr bool isAnyBitPositionFlagSet(U mask, std::initializer_list flags) { + return (mask & makeBitPositionFlagMask(flags)) != 0; +} + constexpr int32_t frameCountFromDurationUs(long durationUs, int32_t sampleRateHz) { return (static_cast(durationUs) * sampleRateHz) / 1000000LL; } diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 7373073cff..4a7bfbde2b 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -56,6 +56,7 @@ using namespace android; using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::getChannelCount; +using aidl::android::hardware::audio::common::isAnyBitPositionFlagSet; using aidl::android::hardware::audio::common::isBitPositionFlagSet; using aidl::android::hardware::audio::common::isTelephonyDeviceType; using aidl::android::hardware::audio::common::isValidAudioMode; @@ -85,6 +86,7 @@ using aidl::android::media::audio::common::AudioDeviceDescription; using aidl::android::media::audio::common::AudioDeviceType; using aidl::android::media::audio::common::AudioDualMonoMode; using aidl::android::media::audio::common::AudioFormatType; +using aidl::android::media::audio::common::AudioInputFlags; using aidl::android::media::audio::common::AudioIoFlags; using aidl::android::media::audio::common::AudioLatencyMode; using aidl::android::media::audio::common::AudioMMapPolicy; @@ -1749,8 +1751,13 @@ TEST_P(AudioCoreModule, TryConnectMissingDevice) { for (const auto& port : ports) { // Virtual devices may not require external hardware and thus can always be connected. if (port.ext.get().device.type.connection == - AudioDeviceDescription::CONNECTION_VIRTUAL) + AudioDeviceDescription::CONNECTION_VIRTUAL || + // SCO devices are handled at low level by DSP, may not be able to check actual + // connection. + port.ext.get().device.type.connection == + AudioDeviceDescription::CONNECTION_BT_SCO) { continue; + } AudioPort portWithData = GenerateUniqueDeviceAddress(port), connectedPort; ScopedAStatus status = module->connectExternalDevice(portWithData, &connectedPort); EXPECT_STATUS(EX_ILLEGAL_STATE, status) << "static port " << portWithData.toString(); @@ -3780,6 +3787,19 @@ class AudioStreamIo : public AudioCoreModuleBase, } for (const auto& portConfig : allPortConfigs) { SCOPED_TRACE(portConfig.toString()); + // Certain types of ports can not be used without special preconditions. + if ((IOTraits::is_input && + isAnyBitPositionFlagSet( + portConfig.flags.value().template get(), + {AudioInputFlags::MMAP_NOIRQ, AudioInputFlags::VOIP_TX, + AudioInputFlags::HW_HOTWORD})) || + (!IOTraits::is_input && + isAnyBitPositionFlagSet( + portConfig.flags.value().template get(), + {AudioOutputFlags::MMAP_NOIRQ, AudioOutputFlags::VOIP_RX, + AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC}))) { + continue; + } const bool isNonBlocking = IOTraits::is_input ? false From b8368f3c9b3cc0c24836ec0e2d7cef10b76ea1d3 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 10 Apr 2024 14:22:13 -0700 Subject: [PATCH 097/161] audio: Use allow list for device connection types in TryConnectMissingDevice Limit the connection types to test to the following: - HDMI* - IP_V4 - USB Only these connection types can be easily checked by the HAL for presence of an external device. Bug: 326888643 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:7b9b9e03e5c82e95b017222089b3915817095cef) Merged-In: I659e14a150b3043ead8d844cd89a2c4700d57efd Change-Id: I659e14a150b3043ead8d844cd89a2c4700d57efd 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 4a7bfbde2b..8b08945e89 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -1740,6 +1740,11 @@ TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortConfigId) { } TEST_P(AudioCoreModule, TryConnectMissingDevice) { + // Limit checks to connection types that are known to be detectable by HAL implementations. + static const std::set kCheckedConnectionTypes{ + AudioDeviceDescription::CONNECTION_HDMI, AudioDeviceDescription::CONNECTION_HDMI_ARC, + AudioDeviceDescription::CONNECTION_HDMI_EARC, AudioDeviceDescription::CONNECTION_IP_V4, + AudioDeviceDescription::CONNECTION_USB}; ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); std::vector ports = moduleConfig->getExternalDevicePorts(); if (ports.empty()) { @@ -1748,14 +1753,10 @@ TEST_P(AudioCoreModule, TryConnectMissingDevice) { WithDebugFlags doNotSimulateConnections = WithDebugFlags::createNested(*debug); doNotSimulateConnections.flags().simulateDeviceConnections = false; ASSERT_NO_FATAL_FAILURE(doNotSimulateConnections.SetUp(module.get())); + bool hasAtLeastOneCheckedConnection = false; for (const auto& port : ports) { - // Virtual devices may not require external hardware and thus can always be connected. - if (port.ext.get().device.type.connection == - AudioDeviceDescription::CONNECTION_VIRTUAL || - // SCO devices are handled at low level by DSP, may not be able to check actual - // connection. - port.ext.get().device.type.connection == - AudioDeviceDescription::CONNECTION_BT_SCO) { + if (kCheckedConnectionTypes.count( + port.ext.get().device.type.connection) == 0) { continue; } AudioPort portWithData = GenerateUniqueDeviceAddress(port), connectedPort; @@ -1768,6 +1769,10 @@ TEST_P(AudioCoreModule, TryConnectMissingDevice) { EXPECT_IS_OK(module->disconnectExternalDevice(connectedPort.id)) << "when disconnecting device port ID " << connectedPort.id; } + hasAtLeastOneCheckedConnection = true; + } + if (!hasAtLeastOneCheckedConnection) { + GTEST_SKIP() << "No external devices with connection types that can be checked."; } } From 15942b293b28e6f5d74712d54f570dfa1e8f8def Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 17 Apr 2024 14:33:59 -0700 Subject: [PATCH 098/161] audio: Fix IStreamIn.getActiveMicrophones test Since "active" means "used by the stream for acquiring data," it was unreasonable to expect the list of active microphones to be non-empty prior to actually starting data acquisition. This change adds running of 'burst' commands before calling 'getActiveMicrophones'. To reuse existing code some refactorings have been made. Added 'AudioInputFlags::HOTWORD_TAP' to the list of port config flags for which I/O testing is not performed. Bug: 328010709 Bug: 328362233 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:eee5499ba8381b50a29a541c2077b040a642fa18) Merged-In: I876c0b6d7365e104ec9ed8cf5033a83f822006b6 Change-Id: I876c0b6d7365e104ec9ed8cf5033a83f822006b6 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 338 ++++++++++-------- 1 file changed, 198 insertions(+), 140 deletions(-) diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 8b08945e89..039695b360 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -2883,6 +2883,177 @@ class StreamFixture { std::unique_ptr> mStream; }; +class StreamLogicDefaultDriver : public StreamLogicDriver { + public: + StreamLogicDefaultDriver(std::shared_ptr commands, size_t frameSizeBytes) + : mCommands(commands), mFrameSizeBytes(frameSizeBytes) { + mCommands->rewind(); + } + + // The three methods below is intended to be called after the worker + // thread has joined, thus no extra synchronization is needed. + bool hasObservablePositionIncrease() const { return mObservablePositionIncrease; } + bool hasRetrogradeObservablePosition() const { return mRetrogradeObservablePosition; } + std::string getUnexpectedStateTransition() const { return mUnexpectedTransition; } + + bool done() override { return mCommands->done(); } + TransitionTrigger getNextTrigger(int maxDataSize, int* actualSize) override { + auto trigger = mCommands->getTrigger(); + if (StreamDescriptor::Command* command = std::get_if(&trigger); + command != nullptr) { + if (command->getTag() == StreamDescriptor::Command::Tag::burst) { + if (actualSize != nullptr) { + // In the output scenario, reduce slightly the fmqByteCount to verify + // that the HAL module always consumes all data from the MQ. + if (maxDataSize > static_cast(mFrameSizeBytes)) { + LOG(DEBUG) << __func__ << ": reducing data size by " << mFrameSizeBytes; + maxDataSize -= mFrameSizeBytes; + } + *actualSize = maxDataSize; + } + command->set(maxDataSize); + } else { + if (actualSize != nullptr) *actualSize = 0; + } + } + return trigger; + } + bool interceptRawReply(const StreamDescriptor::Reply&) override { return false; } + bool processValidReply(const StreamDescriptor::Reply& reply) override { + if (reply.observable.frames != StreamDescriptor::Position::UNKNOWN) { + if (mPreviousFrames.has_value()) { + if (reply.observable.frames > mPreviousFrames.value()) { + mObservablePositionIncrease = true; + } else if (reply.observable.frames < mPreviousFrames.value()) { + mRetrogradeObservablePosition = true; + } + } + mPreviousFrames = reply.observable.frames; + } + + auto expected = mCommands->getExpectedStates(); + if (expected.count(reply.state) == 0) { + std::string s = + std::string("Unexpected transition from the state ") + .append(mPreviousState.has_value() ? toString(mPreviousState.value()) + : "") + .append(" to ") + .append(toString(reply.state)) + .append(" (expected one of ") + .append(::android::internal::ToString(expected)) + .append(") caused by the ") + .append(toString(mCommands->getTrigger())); + LOG(ERROR) << __func__ << ": " << s; + mUnexpectedTransition = std::move(s); + return false; + } + mCommands->advance(reply.state); + mPreviousState = reply.state; + return true; + } + + protected: + std::shared_ptr mCommands; + const size_t mFrameSizeBytes; + std::optional mPreviousState; + std::optional mPreviousFrames; + bool mObservablePositionIncrease = false; + bool mRetrogradeObservablePosition = false; + std::string mUnexpectedTransition; +}; + +// Defined later together with state transition sequences. +std::shared_ptr makeBurstCommands(bool isSync); + +// Certain types of ports can not be used without special preconditions. +static bool skipStreamIoTestForMixPortConfig(const AudioPortConfig& portConfig) { + return (portConfig.flags.value().getTag() == AudioIoFlags::input && + isAnyBitPositionFlagSet(portConfig.flags.value().template get(), + {AudioInputFlags::MMAP_NOIRQ, AudioInputFlags::VOIP_TX, + AudioInputFlags::HW_HOTWORD, AudioInputFlags::HOTWORD_TAP})) || + (portConfig.flags.value().getTag() == AudioIoFlags::output && + isAnyBitPositionFlagSet( + portConfig.flags.value().template get(), + {AudioOutputFlags::MMAP_NOIRQ, AudioOutputFlags::VOIP_RX, + AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC})); +} + +template +class StreamFixtureWithWorker { + public: + explicit StreamFixtureWithWorker(bool isSync) : mIsSync(isSync) {} + + void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& devicePort) { + mStream = std::make_unique>(); + ASSERT_NO_FATAL_FAILURE( + mStream->SetUpStreamForDevicePort(module, moduleConfig, devicePort)); + MaybeSetSkipTestReason(); + } + + void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& mixPort, + const AudioPort& devicePort) { + mStream = std::make_unique>(); + ASSERT_NO_FATAL_FAILURE( + mStream->SetUpStreamForPortsPair(module, moduleConfig, mixPort, devicePort)); + MaybeSetSkipTestReason(); + } + + void SendBurstCommands(bool validatePosition = true) { + ASSERT_NO_FATAL_FAILURE(StartWorkerToSendBurstCommands()); + ASSERT_NO_FATAL_FAILURE(JoinWorkerAfterBurstCommands(validatePosition)); + } + + void StartWorkerToSendBurstCommands() { + const StreamContext* context = mStream->getStreamContext(); + mWorkerDriver = std::make_unique(makeBurstCommands(mIsSync), + context->getFrameSizeBytes()); + mWorker = std::make_unique::Worker>( + *context, mWorkerDriver.get(), mStream->getStreamEventReceiver()); + LOG(DEBUG) << __func__ << ": starting " << IOTraits::directionStr << " worker..."; + ASSERT_TRUE(mWorker->start()); + } + + void JoinWorkerAfterBurstCommands(bool validatePosition = true) { + // Must call 'prepareToClose' before attempting to join because the stream may be stuck. + std::shared_ptr common; + ASSERT_IS_OK(mStream->getStream()->getStreamCommon(&common)); + ASSERT_IS_OK(common->prepareToClose()); + LOG(DEBUG) << __func__ << ": joining " << IOTraits::directionStr << " worker..."; + mWorker->join(); + EXPECT_FALSE(mWorker->hasError()) << mWorker->getError(); + EXPECT_EQ("", mWorkerDriver->getUnexpectedStateTransition()); + if (validatePosition) { + if (IOTraits::is_input) { + EXPECT_TRUE(mWorkerDriver->hasObservablePositionIncrease()); + } + EXPECT_FALSE(mWorkerDriver->hasRetrogradeObservablePosition()); + } + mWorker.reset(); + mWorkerDriver.reset(); + } + + void TeardownPatch() { mStream->TeardownPatch(); } + + const AudioDevice& getDevice() const { return mStream->getDevice(); } + Stream* getStream() const { return mStream->getStream(); } + std::string skipTestReason() const { + return !mSkipTestReason.empty() ? mSkipTestReason : mStream->skipTestReason(); + } + + private: + void MaybeSetSkipTestReason() { + if (skipStreamIoTestForMixPortConfig(mStream->getPortConfig())) { + mSkipTestReason = "Mix port config is not supported for stream I/O tests"; + } + } + + const bool mIsSync; + std::string mSkipTestReason; + std::unique_ptr> mStream; + std::unique_ptr mWorkerDriver; + std::unique_ptr::Worker> mWorker; +}; + template class AudioStream : public AudioCoreModule { public: @@ -3288,10 +3459,12 @@ TEST_P(AudioStreamIn, ActiveMicrophones) { if (micDevicePorts.empty()) continue; atLeastOnePort = true; SCOPED_TRACE(port.toString()); - StreamFixture stream; - ASSERT_NO_FATAL_FAILURE(stream.SetUpStreamForPortsPair(module.get(), moduleConfig.get(), - port, micDevicePorts[0])); + StreamFixtureWithWorker stream(true /*isSync*/); + ASSERT_NO_FATAL_FAILURE( + stream.SetUp(module.get(), moduleConfig.get(), port, micDevicePorts[0])); if (!stream.skipTestReason().empty()) continue; + + ASSERT_NO_FATAL_FAILURE(stream.SendBurstCommands(false /*validatePosition*/)); std::vector activeMics; EXPECT_IS_OK(stream.getStream()->getActiveMicrophones(&activeMics)); EXPECT_FALSE(activeMics.empty()); @@ -3305,6 +3478,7 @@ TEST_P(AudioStreamIn, ActiveMicrophones) { EXPECT_NE(0UL, mic.channelMapping.size()) << "No channels specified for the microphone \"" << mic.id << "\""; } + stream.TeardownPatch(); // Now the port of the stream is not connected, check that there are no active microphones. std::vector emptyMics; @@ -3682,85 +3856,6 @@ TEST_P(AudioStreamOut, UpdateOffloadMetadata) { } } -class StreamLogicDefaultDriver : public StreamLogicDriver { - public: - StreamLogicDefaultDriver(std::shared_ptr commands, size_t frameSizeBytes) - : mCommands(commands), mFrameSizeBytes(frameSizeBytes) { - mCommands->rewind(); - } - - // The three methods below is intended to be called after the worker - // thread has joined, thus no extra synchronization is needed. - bool hasObservablePositionIncrease() const { return mObservablePositionIncrease; } - bool hasRetrogradeObservablePosition() const { return mRetrogradeObservablePosition; } - std::string getUnexpectedStateTransition() const { return mUnexpectedTransition; } - - bool done() override { return mCommands->done(); } - TransitionTrigger getNextTrigger(int maxDataSize, int* actualSize) override { - auto trigger = mCommands->getTrigger(); - if (StreamDescriptor::Command* command = std::get_if(&trigger); - command != nullptr) { - if (command->getTag() == StreamDescriptor::Command::Tag::burst) { - if (actualSize != nullptr) { - // In the output scenario, reduce slightly the fmqByteCount to verify - // that the HAL module always consumes all data from the MQ. - if (maxDataSize > static_cast(mFrameSizeBytes)) { - LOG(DEBUG) << __func__ << ": reducing data size by " << mFrameSizeBytes; - maxDataSize -= mFrameSizeBytes; - } - *actualSize = maxDataSize; - } - command->set(maxDataSize); - } else { - if (actualSize != nullptr) *actualSize = 0; - } - } - return trigger; - } - bool interceptRawReply(const StreamDescriptor::Reply&) override { return false; } - bool processValidReply(const StreamDescriptor::Reply& reply) override { - if (reply.observable.frames != StreamDescriptor::Position::UNKNOWN) { - if (mPreviousFrames.has_value()) { - if (reply.observable.frames > mPreviousFrames.value()) { - mObservablePositionIncrease = true; - } else if (reply.observable.frames < mPreviousFrames.value()) { - mRetrogradeObservablePosition = true; - } - } - mPreviousFrames = reply.observable.frames; - } - - auto expected = mCommands->getExpectedStates(); - if (expected.count(reply.state) == 0) { - std::string s = - std::string("Unexpected transition from the state ") - .append(mPreviousState.has_value() ? toString(mPreviousState.value()) - : "") - .append(" to ") - .append(toString(reply.state)) - .append(" (expected one of ") - .append(::android::internal::ToString(expected)) - .append(") caused by the ") - .append(toString(mCommands->getTrigger())); - LOG(ERROR) << __func__ << ": " << s; - mUnexpectedTransition = std::move(s); - return false; - } - mCommands->advance(reply.state); - mPreviousState = reply.state; - return true; - } - - protected: - std::shared_ptr mCommands; - const size_t mFrameSizeBytes; - std::optional mPreviousState; - std::optional mPreviousFrames; - bool mObservablePositionIncrease = false; - bool mRetrogradeObservablePosition = false; - std::string mUnexpectedTransition; -}; - enum { NAMED_CMD_NAME, NAMED_CMD_DELAY_MS, @@ -3792,19 +3887,7 @@ class AudioStreamIo : public AudioCoreModuleBase, } for (const auto& portConfig : allPortConfigs) { SCOPED_TRACE(portConfig.toString()); - // Certain types of ports can not be used without special preconditions. - if ((IOTraits::is_input && - isAnyBitPositionFlagSet( - portConfig.flags.value().template get(), - {AudioInputFlags::MMAP_NOIRQ, AudioInputFlags::VOIP_TX, - AudioInputFlags::HW_HOTWORD})) || - (!IOTraits::is_input && - isAnyBitPositionFlagSet( - portConfig.flags.value().template get(), - {AudioOutputFlags::MMAP_NOIRQ, AudioOutputFlags::VOIP_RX, - AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC}))) { - continue; - } + if (skipStreamIoTestForMixPortConfig(portConfig)) continue; const bool isNonBlocking = IOTraits::is_input ? false @@ -4616,8 +4699,9 @@ static std::vector getRemoteSubmixModuleInstance() { template class WithRemoteSubmix { public: - WithRemoteSubmix() = default; - explicit WithRemoteSubmix(AudioDeviceAddress address) : mAddress(address) {} + WithRemoteSubmix() : mStream(true /*isSync*/) {} + explicit WithRemoteSubmix(AudioDeviceAddress address) + : mStream(true /*isSync*/), mAddress(address) {} WithRemoteSubmix(const WithRemoteSubmix&) = delete; WithRemoteSubmix& operator=(const WithRemoteSubmix&) = delete; @@ -4637,57 +4721,31 @@ class WithRemoteSubmix { void SetUp(IModule* module, ModuleConfig* moduleConfig) { auto devicePort = getRemoteSubmixAudioPort(moduleConfig, mAddress); ASSERT_TRUE(devicePort.has_value()) << "Device port for remote submix device not found"; - ASSERT_NO_FATAL_FAILURE(SetUp(module, moduleConfig, *devicePort)); + ASSERT_NO_FATAL_FAILURE(mStream.SetUp(module, moduleConfig, *devicePort)); + mAddress = mStream.getDevice().address; } - void SendBurstCommandsStartWorker() { - const StreamContext* context = mStream->getStreamContext(); - mWorkerDriver = std::make_unique(makeBurstCommands(true), - context->getFrameSizeBytes()); - mWorker = std::make_unique::Worker>( - *context, mWorkerDriver.get(), mStream->getStreamEventReceiver()); - LOG(DEBUG) << __func__ << ": starting " << IOTraits::directionStr << " worker..."; - ASSERT_TRUE(mWorker->start()); + void StartWorkerToSendBurstCommands() { + ASSERT_NO_FATAL_FAILURE(mStream.StartWorkerToSendBurstCommands()); } - void SendBurstCommandsJoinWorker() { - // Must call 'prepareToClose' before attempting to join because the stream may be - // stuck due to absence of activity from the other side of the remote submix pipe. - std::shared_ptr common; - ASSERT_IS_OK(mStream->getStream()->getStreamCommon(&common)); - ASSERT_IS_OK(common->prepareToClose()); - LOG(DEBUG) << __func__ << ": joining " << IOTraits::directionStr << " worker..."; - mWorker->join(); - EXPECT_FALSE(mWorker->hasError()) << mWorker->getError(); - EXPECT_EQ("", mWorkerDriver->getUnexpectedStateTransition()); - if (IOTraits::is_input) { - EXPECT_TRUE(mWorkerDriver->hasObservablePositionIncrease()); - } - EXPECT_FALSE(mWorkerDriver->hasRetrogradeObservablePosition()); - mWorker.reset(); - mWorkerDriver.reset(); + void JoinWorkerAfterBurstCommands() { + ASSERT_NO_FATAL_FAILURE(mStream.JoinWorkerAfterBurstCommands()); } void SendBurstCommands() { - ASSERT_NO_FATAL_FAILURE(SendBurstCommandsStartWorker()); - ASSERT_NO_FATAL_FAILURE(SendBurstCommandsJoinWorker()); + ASSERT_NO_FATAL_FAILURE(mStream.StartWorkerToSendBurstCommands()); + ASSERT_NO_FATAL_FAILURE(mStream.JoinWorkerAfterBurstCommands()); } std::optional getAudioDeviceAddress() const { return mAddress; } - std::string skipTestReason() const { return mStream->skipTestReason(); } + std::string skipTestReason() const { return mStream.skipTestReason(); } private: - void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& devicePort) { - mStream = std::make_unique>(); - ASSERT_NO_FATAL_FAILURE( - mStream->SetUpStreamForDevicePort(module, moduleConfig, devicePort)); - mAddress = mStream->getDevice().address; - } + void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& devicePort) {} + StreamFixtureWithWorker mStream; std::optional mAddress; - std::unique_ptr> mStream; - std::unique_ptr mWorkerDriver; - std::unique_ptr::Worker> mWorker; }; class AudioModuleRemoteSubmix : public AudioCoreModule { @@ -4737,10 +4795,10 @@ TEST_P(AudioModuleRemoteSubmix, OutputAndInput) { ASSERT_EQ("", streamIn.skipTestReason()); // Start writing into the output stream. - ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsStartWorker()); + ASSERT_NO_FATAL_FAILURE(streamOut.StartWorkerToSendBurstCommands()); // Simultaneously, read from the input stream. ASSERT_NO_FATAL_FAILURE(streamIn.SendBurstCommands()); - ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsJoinWorker()); + ASSERT_NO_FATAL_FAILURE(streamOut.JoinWorkerAfterBurstCommands()); } TEST_P(AudioModuleRemoteSubmix, OpenInputMultipleTimes) { @@ -4758,15 +4816,15 @@ TEST_P(AudioModuleRemoteSubmix, OpenInputMultipleTimes) { ASSERT_EQ("", streamIns[i]->skipTestReason()); } // Start writing into the output stream. - ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsStartWorker()); + ASSERT_NO_FATAL_FAILURE(streamOut.StartWorkerToSendBurstCommands()); // Simultaneously, read from input streams. for (size_t i = 0; i < streamInCount; i++) { - ASSERT_NO_FATAL_FAILURE(streamIns[i]->SendBurstCommandsStartWorker()); + ASSERT_NO_FATAL_FAILURE(streamIns[i]->StartWorkerToSendBurstCommands()); } for (size_t i = 0; i < streamInCount; i++) { - ASSERT_NO_FATAL_FAILURE(streamIns[i]->SendBurstCommandsJoinWorker()); + ASSERT_NO_FATAL_FAILURE(streamIns[i]->JoinWorkerAfterBurstCommands()); } - ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsJoinWorker()); + ASSERT_NO_FATAL_FAILURE(streamOut.JoinWorkerAfterBurstCommands()); // Clean up input streams in the reverse order because the device connection is owned // by the first one. for (size_t i = streamInCount; i != 0; --i) { From f821367c75466b157485b0276875f05b4bbc0587 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 18 Apr 2024 14:17:47 -0700 Subject: [PATCH 099/161] audio: Update 'PauseSync' scenario in AudioStreamIoOutTest According to the definition of the 'PAUSED' state in StreamDescriptor.aidl, s/w (the client) stops writing once the buffer is filled up. That means, it is allowed for an output stream not to consume data from the MQ while in the paused state, so allow that in the test. Also, update the state transition sequence in the test to flush any data after making a burst while in the 'PAUSED' state. Bug: 328010709 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:22e17d43bd9a56785b9c56a65500c6b6f1e56494) Merged-In: Icb5fd02ca4ede63d7ae33613ab66cb96f3e6df29 Change-Id: Icb5fd02ca4ede63d7ae33613ab66cb96f3e6df29 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 039695b360..e26b81ba0b 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -1040,7 +1040,9 @@ class StreamWriterLogic : public StreamCommonLogic { << ": received invalid byte count in the reply: " << reply.fmqByteCount; return Status::ABORT; } - if (getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) { + // It is OK for the implementation to leave data in the MQ when the stream is paused. + if (reply.state != StreamDescriptor::State::PAUSED && + getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) { LOG(ERROR) << __func__ << ": the HAL module did not consume all data from the data MQ: " << "available to write " << getDataMQ()->availableToWrite() << ", total size: " << getDataMQ()->getQuantumCount(); @@ -4550,9 +4552,8 @@ std::shared_ptr makePauseCommands(bool isInput, bool isSync) { std::make_pair(State::PAUSED, kStartCommand), std::make_pair(State::ACTIVE, kPauseCommand), std::make_pair(State::PAUSED, kBurstCommand), - std::make_pair(State::PAUSED, kStartCommand), - std::make_pair(State::ACTIVE, kPauseCommand)}, - State::PAUSED); + std::make_pair(State::PAUSED, kFlushCommand)}, + State::IDLE); if (!isSync) { idle.children().push_back( d->makeNodes({std::make_pair(State::TRANSFERRING, kPauseCommand), From d2c99594b960863f5a130398c3e87fdf9daa569b Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 17 Apr 2024 17:10:31 -0700 Subject: [PATCH 100/161] audio: Skip stream I/O test for "echo reference" input device This is aligned with the HIDL implementation VTS. The echo reference device can't provide any input until certain preconditions are met, and modeling these preconditions in the test is not trivial. Also, add the information into the mix port into the trace scope for easier identification on test failure. Bug: 328010709 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:a62c5df181b37bb7a066cbd154cb13a59a596345) Merged-In: I737479d8ef1961791ac3bd82aeb779453d2e49f4 Change-Id: I737479d8ef1961791ac3bd82aeb779453d2e49f4 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- audio/aidl/vts/ModuleConfig.cpp | 5 +++++ audio/aidl/vts/ModuleConfig.h | 2 ++ audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp index 2b86271361..d24c4c843e 100644 --- a/audio/aidl/vts/ModuleConfig.cpp +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -551,6 +551,11 @@ std::vector ModuleConfig::generateAudioDevicePortConfigs( return result; } +std::optional ModuleConfig::getPort(int32_t portId) { + auto portsIt = findById(mPorts, portId); + return portsIt != mPorts.end() ? std::optional(*portsIt) : std::nullopt; +} + ndk::ScopedAStatus ModuleConfig::onExternalDeviceConnected(IModule* module, const AudioPort& port) { RETURN_STATUS_IF_ERROR(module->getAudioPorts(&mPorts)); RETURN_STATUS_IF_ERROR(module->getAudioRoutes(&mRoutes)); diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h index 4a87f8cbd2..27286e5da7 100644 --- a/audio/aidl/vts/ModuleConfig.h +++ b/audio/aidl/vts/ModuleConfig.h @@ -166,6 +166,8 @@ class ModuleConfig { return *config.begin(); } + std::optional getPort(int32_t portId); + ndk::ScopedAStatus onExternalDeviceConnected( aidl::android::hardware::audio::core::IModule* module, const aidl::android::media::audio::common::AudioPort& port); diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index e26b81ba0b..c677e1bd89 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -2980,6 +2980,11 @@ static bool skipStreamIoTestForMixPortConfig(const AudioPortConfig& portConfig) AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC})); } +// Certain types of devices can not be used without special preconditions. +static bool skipStreamIoTestForDevice(const AudioDevice& device) { + return device.type.type == AudioDeviceType::IN_ECHO_REFERENCE; +} + template class StreamFixtureWithWorker { public: @@ -3888,6 +3893,9 @@ class AudioStreamIo : public AudioCoreModuleBase, GTEST_SKIP() << "No mix ports have attached devices"; } for (const auto& portConfig : allPortConfigs) { + auto port = moduleConfig->getPort(portConfig.portId); + ASSERT_TRUE(port.has_value()); + SCOPED_TRACE(port->toString()); SCOPED_TRACE(portConfig.toString()); if (skipStreamIoTestForMixPortConfig(portConfig)) continue; const bool isNonBlocking = @@ -3970,6 +3978,7 @@ class AudioStreamIo : public AudioCoreModuleBase, StreamFixture stream; ASSERT_NO_FATAL_FAILURE( stream.SetUpStreamForMixPortConfig(module.get(), moduleConfig.get(), portConfig)); + if (skipStreamIoTestForDevice(stream.getDevice())) return; ASSERT_EQ("", stream.skipTestReason()); StreamLogicDefaultDriver driver(commandsAndStates, stream.getStreamContext()->getFrameSizeBytes()); @@ -3998,6 +4007,7 @@ class AudioStreamIo : public AudioCoreModuleBase, StreamFixture stream; ASSERT_NO_FATAL_FAILURE( stream.SetUpPatchForMixPortConfig(module.get(), moduleConfig.get(), portConfig)); + if (skipStreamIoTestForDevice(stream.getDevice())) return; ASSERT_EQ("", stream.skipTestReason()); ASSERT_NO_FATAL_FAILURE(stream.TeardownPatchSetUpStream(module.get())); StreamLogicDefaultDriver driver(commandsAndStates, From 368b157b50135da4c1fa6c2ba0710a57b0cc5e1d Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 18 Apr 2024 13:18:09 -0700 Subject: [PATCH 101/161] audio: Fix AudioPatchTest/AudioModulePatch#UpdateInvalidPatchId VTS test The test was using '0' as an "invalid" patch ID value, however this value is valid in the context of 'IModule.setAudioPatch' method and means "create a new patch and allocate and ID for it". Bug: 328010709 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:8dd96d4c417f309824ac006cedc15118fd7a1363) Merged-In: Icd33f3cbd1602ec5aa162fa72fc3ddd59ccffbef Change-Id: Icd33f3cbd1602ec5aa162fa72fc3ddd59ccffbef 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index c677e1bd89..c26c0c896c 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -133,13 +133,23 @@ auto findAny(const std::vector& v, const std::set& ids) { } template -std::vector GetNonExistentIds(const C& allIds) { +std::vector GetNonExistentIds(const C& allIds, bool includeZero = true) { if (allIds.empty()) { - return std::vector{-1, 0, 1}; + return includeZero ? std::vector{-1, 0, 1} : std::vector{-1, 1}; } std::vector nonExistentIds; - nonExistentIds.push_back(*std::min_element(allIds.begin(), allIds.end()) - 1); - nonExistentIds.push_back(*std::max_element(allIds.begin(), allIds.end()) + 1); + if (auto value = *std::min_element(allIds.begin(), allIds.end()) - 1; + includeZero || value != 0) { + nonExistentIds.push_back(value); + } else { + nonExistentIds.push_back(value - 1); + } + if (auto value = *std::max_element(allIds.begin(), allIds.end()) + 1; + includeZero || value != 0) { + nonExistentIds.push_back(value); + } else { + nonExistentIds.push_back(value + 1); + } return nonExistentIds; } @@ -4206,7 +4216,7 @@ class AudioModulePatch : public AudioCoreModule { // Then use the same patch setting, except for having an invalid ID. std::set patchIds; ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds)); - for (const auto patchId : GetNonExistentIds(patchIds)) { + for (const auto patchId : GetNonExistentIds(patchIds, false /*includeZero*/)) { AudioPatch patchWithNonExistendId = patch.get(); patchWithNonExistendId.id = patchId; EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, From 940c84b49bc244e4dd7099a0f46184aecfb96f09 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 19 Apr 2024 14:30:58 -0700 Subject: [PATCH 102/161] audio: Use more bursts in audio I/O VTS tests Some audio outputs use A/V sync and requre mode bursts in order to start reporting the presentation position. Bug: 300735639 Bug: 328010709 Test: atest VtsHalAudioCoreTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:a2a9fa50039d69643527020ab6706b319f0e6c62) Merged-In: Icad0942f2ba1dcd6f030a7dc4f37e22fdbd6dd71 Change-Id: Icad0942f2ba1dcd6f030a7dc4f37e22fdbd6dd71 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev. --- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index c26c0c896c..d576c7c826 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -791,6 +791,13 @@ struct StateDag : public Dag { }; return helper(v.begin(), helper); } + Node makeNodes(StreamDescriptor::State s, TransitionTrigger t, size_t count, Node last) { + auto helper = [&](size_t c, auto&& h) -> Node { + if (c == 0) return last; + return makeNode(s, t, h(--c, h)); + }; + return helper(count, helper); + } Node makeNodes(const std::vector& v, StreamDescriptor::State f) { return makeNodes(v, makeFinalNode(f)); } @@ -4399,17 +4406,22 @@ std::shared_ptr makeBurstCommands(bool isSync) { using State = StreamDescriptor::State; auto d = std::make_unique(); StateDag::Node last = d->makeFinalNode(State::ACTIVE); - // Use a couple of bursts to ensure that the driver starts reporting the position. - StateDag::Node active2 = d->makeNode(State::ACTIVE, kBurstCommand, last); - StateDag::Node active = d->makeNode(State::ACTIVE, kBurstCommand, active2); - StateDag::Node idle = d->makeNode(State::IDLE, kBurstCommand, active); - if (!isSync) { + if (isSync) { + StateDag::Node idle = d->makeNode( + State::IDLE, kBurstCommand, + // Use several bursts to ensure that the driver starts reporting the position. + d->makeNodes(State::ACTIVE, kBurstCommand, 10, last)); + d->makeNode(State::STANDBY, kStartCommand, idle); + } else { + StateDag::Node active2 = d->makeNode(State::ACTIVE, kBurstCommand, last); + StateDag::Node active = d->makeNode(State::ACTIVE, kBurstCommand, active2); + StateDag::Node idle = d->makeNode(State::IDLE, kBurstCommand, active); // Allow optional routing via the TRANSFERRING state on bursts. active2.children().push_back(d->makeNode(State::TRANSFERRING, kTransferReadyEvent, last)); active.children().push_back(d->makeNode(State::TRANSFERRING, kTransferReadyEvent, active2)); idle.children().push_back(d->makeNode(State::TRANSFERRING, kTransferReadyEvent, active)); + d->makeNode(State::STANDBY, kStartCommand, idle); } - d->makeNode(State::STANDBY, kStartCommand, idle); return std::make_shared(std::move(d)); } static const NamedCommandSequence kReadSeq = From c6a95c2fd5746d14ec27e6e053d607fff478a97a Mon Sep 17 00:00:00 2001 From: Sai Date: Tue, 23 Apr 2024 16:21:18 -0700 Subject: [PATCH 103/161] Update vts test to support automotive devices Includes LENS_POSE_AUTOMOTIVE as a valid lens_pose_reference value for vts tests. Bug: 315076224 Test: atest VtsHalCameraProvider Change-Id: Iafb7963cb828e1b40308fddd6ab417f8bc0c2115 --- .../2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp | 2 +- camera/provider/aidl/vts/camera_aidl_test.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index c8e683c290..82666ae3df 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -8140,7 +8140,7 @@ void CameraHidlTest::verifyCameraCharacteristics(Status status, const CameraMeta ANDROID_LENS_POSE_REFERENCE, &entry); if (0 == retcode && entry.count > 0) { uint8_t poseReference = entry.data.u8[0]; - ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_UNDEFINED && + ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE && poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA); } diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index 1d6f013f52..a01fb04dc5 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -694,8 +694,8 @@ void CameraAidlTest::verifyCameraCharacteristics(const CameraMetadata& chars) { retcode = find_camera_metadata_ro_entry(metadata, ANDROID_LENS_POSE_REFERENCE, &entry); if (0 == retcode && entry.count > 0) { uint8_t poseReference = entry.data.u8[0]; - ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_UNDEFINED && - poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA); + ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE && + poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA); } retcode = From 86c4b11979ea5ac14af7900e4e525e03487cfd1e Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Fri, 26 Apr 2024 01:33:09 +0000 Subject: [PATCH 104/161] Only run TestSvStatusIntervals on V+ Bug: 336656335 Test: atest VtsHalGnssTargetTest Change-Id: Iee77147227ab848b67b12aaa9496cf18b60b0f00 --- gnss/aidl/vts/gnss_hal_test_cases.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 9381a0a12e..430918720b 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1714,7 +1714,8 @@ TEST_P(GnssHalTest, TestAccumulatedDeltaRange) { * 2. verify the SvStatus are received at expected interval */ TEST_P(GnssHalTest, TestSvStatusIntervals) { - if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { + // Only runs on devices launched in Android 15+ + if (aidl_gnss_hal_->getInterfaceVersion() <= 3) { return; } ALOGD("TestSvStatusIntervals"); From 6d71e46f31339fd49842561e64f38fbd9629dcba Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 16 Apr 2024 16:26:45 -0700 Subject: [PATCH 105/161] Create a skeleton Rust broadcast radio HAL This is to prove that rust broadcast radio HAL can be built and can run. The skeleton Rust broadcast radio HAL will return UNKNOWN_ERROR for all APIs. Bug: 335514024 Test: m android.hardware.broadcastradio-rust-service Change-Id: I763175b984c130d75cdc9506ba92c8c1b44338b5 --- broadcastradio/aidl/Android.bp | 10 ++ broadcastradio/aidl/rust_impl/Android.bp | 31 +++++ broadcastradio/aidl/rust_impl/README.md | 13 +++ .../rust_impl/broadcastradio-rust-service.rc | 5 + .../rust_impl/broadcastradio-rust-service.xml | 23 ++++ .../src/default_broadcastradio_hal.rs | 107 ++++++++++++++++++ broadcastradio/aidl/rust_impl/src/main.rs | 33 ++++++ 7 files changed, 222 insertions(+) create mode 100644 broadcastradio/aidl/rust_impl/Android.bp create mode 100644 broadcastradio/aidl/rust_impl/README.md create mode 100644 broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc create mode 100644 broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml create mode 100644 broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs create mode 100644 broadcastradio/aidl/rust_impl/src/main.rs diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp index 1540944b80..82ee9495ab 100644 --- a/broadcastradio/aidl/Android.bp +++ b/broadcastradio/aidl/Android.bp @@ -36,6 +36,9 @@ aidl_interface { sdk_version: "module_current", min_sdk_version: "Tiramisu", }, + rust: { + enabled: true, + }, }, versions_with_info: [ { @@ -68,3 +71,10 @@ java_defaults { latest_android_hardware_broadcastradio + "-java", ], } + +rust_defaults { + name: "latest_android_hardware_broadcastradio_rust", + rustlibs: [ + latest_android_hardware_broadcastradio + "-rust", + ], +} diff --git a/broadcastradio/aidl/rust_impl/Android.bp b/broadcastradio/aidl/rust_impl/Android.bp new file mode 100644 index 0000000000..d6f984eb33 --- /dev/null +++ b/broadcastradio/aidl/rust_impl/Android.bp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2024 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. + */ + +rust_binary { + name: "android.hardware.broadcastradio-rust-service", + relative_install_path: "hw", + vendor: true, + srcs: ["src/*.rs"], + crate_root: "src/main.rs", + defaults: [ + "latest_android_hardware_broadcastradio_rust", + ], + vintf_fragments: ["broadcastradio-rust-service.xml"], + init_rc: ["broadcastradio-rust-service.rc"], + rustlibs: [ + "libbinder_rs", + ], +} diff --git a/broadcastradio/aidl/rust_impl/README.md b/broadcastradio/aidl/rust_impl/README.md new file mode 100644 index 0000000000..17e0c18ae9 --- /dev/null +++ b/broadcastradio/aidl/rust_impl/README.md @@ -0,0 +1,13 @@ +# Rust Skeleton BroadcastRadio HAL implementation. + +WARNING: This is not a reference BroadcastRadio HAL implementation and does +not contain any actual implementation. + +This folder contains a skeleton broadcast radio HAL implementation in Rust to +demonstrate how vendor may implement a Rust broadcast radio HAL. To run this +broadcast radio HAL, include `android.hardware.broadcastradio-rust-service` +in your image. + +This implementation returns `StatusCode::UNKNOWN_ERROR` for all operations +and does not pass VTS/CTS. Vendor must replace the logic in +`default_broadcastradio_hal.rs` with the actual implementation \ No newline at end of file diff --git a/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc new file mode 100644 index 0000000000..4dad6165e1 --- /dev/null +++ b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc @@ -0,0 +1,5 @@ +service vendor.broadcastradio-default /vendor/bin/hw/android.hardware.broadcastradio-service.default + interface aidl android.hardware.broadcastradio.IBroadcastRadio/amfm + class hal + user audioserver + group audio diff --git a/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml new file mode 100644 index 0000000000..ced2d78c16 --- /dev/null +++ b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml @@ -0,0 +1,23 @@ + + + + + android.hardware.broadcastradio + 2 + IBroadcastRadio/amfm + + diff --git a/broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs b/broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs new file mode 100644 index 0000000000..ea2f9d3b6b --- /dev/null +++ b/broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2024 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. + */ +use android_hardware_broadcastradio::aidl::android::hardware::broadcastradio::{ + AmFmRegionConfig::AmFmRegionConfig, + AnnouncementType::AnnouncementType, + ConfigFlag::ConfigFlag, + DabTableEntry::DabTableEntry, + IAnnouncementListener::IAnnouncementListener, + IBroadcastRadio::IBroadcastRadio, + ICloseHandle::ICloseHandle, + ITunerCallback::ITunerCallback, + ProgramFilter::ProgramFilter, + ProgramSelector::ProgramSelector, + Properties::Properties, + VendorKeyValue::VendorKeyValue, +}; +use binder::{Interface, Result as BinderResult, StatusCode, Strong}; +use std::vec::Vec; + +/// This struct is defined to implement IBroadcastRadio AIDL interface. +pub struct DefaultBroadcastRadioHal; + +impl Interface for DefaultBroadcastRadioHal {} + +impl IBroadcastRadio for DefaultBroadcastRadioHal { + fn getAmFmRegionConfig(&self, _full : bool) -> BinderResult { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn getDabRegionConfig(&self) -> BinderResult> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn getProperties(&self) -> BinderResult { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn getImage(&self, _id : i32) -> BinderResult> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setTunerCallback(&self, _callback : &Strong) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn unsetTunerCallback(&self) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn tune(&self, _program : &ProgramSelector) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn seek(&self, _direction_up : bool, _skip_sub_channel : bool) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn step(&self, _direction_up : bool) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn cancel(&self) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn startProgramListUpdates(&self, _filter : &ProgramFilter) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn stopProgramListUpdates(&self) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn isConfigFlagSet(&self, _flag : ConfigFlag) -> BinderResult { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setConfigFlag(&self, _flag : ConfigFlag, _value : bool) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setParameters(&self, _parameters : &[VendorKeyValue]) -> BinderResult> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn getParameters(&self, _parameters : &[String]) -> BinderResult> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn registerAnnouncementListener(&self, _listener : &Strong, + _enabled : &[AnnouncementType]) -> BinderResult> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } +} diff --git a/broadcastradio/aidl/rust_impl/src/main.rs b/broadcastradio/aidl/rust_impl/src/main.rs new file mode 100644 index 0000000000..c0bc0559da --- /dev/null +++ b/broadcastradio/aidl/rust_impl/src/main.rs @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 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. + */ + mod default_broadcastradio_hal; + +use android_hardware_broadcastradio::aidl::android::hardware::broadcastradio::IBroadcastRadio::BnBroadcastRadio; +use crate::default_broadcastradio_hal::DefaultBroadcastRadioHal; + +fn main() { + binder::ProcessState::start_thread_pool(); + let my_service = DefaultBroadcastRadioHal; + let service_name = "android.hardware.broadcastradio.IBroadcastRadio/amfm"; + let my_service_binder = BnBroadcastRadio::new_binder( + my_service, + binder::BinderFeatures::default(), + ); + binder::add_service(service_name, my_service_binder.as_binder()) + .expect(format!("Failed to register {}?", service_name).as_str()); + // Does not return. + binder::ProcessState::join_thread_pool() +} From 72594ce8fa009ad3cae228af1af4017cf8695c56 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 26 Apr 2024 14:49:04 -0700 Subject: [PATCH 106/161] Create version specific dir for generated libs. Need to create version specific directory so that a client/VHAL implementation can link against a previously released property interface. Otherwise we force all the current clients/servers that use the generated libs to use the latest property interface library. Test: Presubmit Bug: 337328290 Change-Id: I07ee8d0c2c6fa5c1c21f93a54d8b7455a2fad6d7 --- automotive/vehicle/aidl/aidl_test/Android.bp | 2 +- .../{ => 3}/cpp/AccessForVehicleProperty.h | 0 .../aidl/generated_lib/{ => 3}/cpp/Android.bp | 8 +++++ .../cpp/ChangeModeForVehicleProperty.h | 0 .../{ => 3}/cpp/VersionForVehicleProperty.h | 0 .../java/AccessForVehicleProperty.java | 0 .../generated_lib/{ => 3}/java/Android.bp | 7 +++++ .../java/ChangeModeForVehicleProperty.java | 0 .../{ => 3}/java/EnumForVehicleProperty.java | 0 .../{ => 3}/java/UnitsForVehicleProperty.java | 0 .../JsonConfigLoader/Android.bp | 6 ++-- .../aidl/impl/default_config/test/Android.bp | 4 +-- automotive/vehicle/aidl/impl/vhal/Android.bp | 2 +- .../tools/generate_annotation_enums.py | 30 +++++++++---------- automotive/vehicle/vts/Android.bp | 2 +- 15 files changed, 37 insertions(+), 24 deletions(-) rename automotive/vehicle/aidl/generated_lib/{ => 3}/cpp/AccessForVehicleProperty.h (100%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/cpp/Android.bp (81%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/cpp/ChangeModeForVehicleProperty.h (100%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/cpp/VersionForVehicleProperty.h (100%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/java/AccessForVehicleProperty.java (100%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/java/Android.bp (89%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/java/ChangeModeForVehicleProperty.java (100%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/java/EnumForVehicleProperty.java (100%) rename automotive/vehicle/aidl/generated_lib/{ => 3}/java/UnitsForVehicleProperty.java (100%) diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp index 2dc9ee183d..ea6a710031 100644 --- a/automotive/vehicle/aidl/aidl_test/Android.bp +++ b/automotive/vehicle/aidl/aidl_test/Android.bp @@ -49,7 +49,7 @@ android_test { name: "VehiclePropertyAnnotationJavaTest", srcs: [ "VehiclePropertyAnnotationJavaTest.java", - ":IVehicleGeneratedJavaFiles", + ":IVehicleGeneratedJavaFiles-V3", ], static_libs: [ "android.hardware.automotive.vehicle-V3-java", diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/3/cpp/AccessForVehicleProperty.h similarity index 100% rename from automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h rename to automotive/vehicle/aidl/generated_lib/3/cpp/AccessForVehicleProperty.h diff --git a/automotive/vehicle/aidl/generated_lib/cpp/Android.bp b/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp similarity index 81% rename from automotive/vehicle/aidl/generated_lib/cpp/Android.bp rename to automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp index 11d3693b50..58ffa45288 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/Android.bp +++ b/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp @@ -25,3 +25,11 @@ cc_library_headers { export_include_dirs: ["."], defaults: ["VehicleHalInterfaceDefaults"], } + +cc_library_headers { + name: "IVehicleGeneratedHeaders-V3", + vendor_available: true, + local_include_dirs: ["."], + export_include_dirs: ["."], + defaults: ["VehicleHalInterfaceDefaults"], +} diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/3/cpp/ChangeModeForVehicleProperty.h similarity index 100% rename from automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h rename to automotive/vehicle/aidl/generated_lib/3/cpp/ChangeModeForVehicleProperty.h diff --git a/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/3/cpp/VersionForVehicleProperty.h similarity index 100% rename from automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h rename to automotive/vehicle/aidl/generated_lib/3/cpp/VersionForVehicleProperty.h diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/3/java/AccessForVehicleProperty.java similarity index 100% rename from automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java rename to automotive/vehicle/aidl/generated_lib/3/java/AccessForVehicleProperty.java diff --git a/automotive/vehicle/aidl/generated_lib/java/Android.bp b/automotive/vehicle/aidl/generated_lib/3/java/Android.bp similarity index 89% rename from automotive/vehicle/aidl/generated_lib/java/Android.bp rename to automotive/vehicle/aidl/generated_lib/3/java/Android.bp index 1d612e8292..4e35f19c19 100644 --- a/automotive/vehicle/aidl/generated_lib/java/Android.bp +++ b/automotive/vehicle/aidl/generated_lib/3/java/Android.bp @@ -24,3 +24,10 @@ filegroup { "*.java", ], } + +filegroup { + name: "IVehicleGeneratedJavaFiles-V3", + srcs: [ + "*.java", + ], +} diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/3/java/ChangeModeForVehicleProperty.java similarity index 100% rename from automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java rename to automotive/vehicle/aidl/generated_lib/3/java/ChangeModeForVehicleProperty.java diff --git a/automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/3/java/EnumForVehicleProperty.java similarity index 100% rename from automotive/vehicle/aidl/generated_lib/java/EnumForVehicleProperty.java rename to automotive/vehicle/aidl/generated_lib/3/java/EnumForVehicleProperty.java diff --git a/automotive/vehicle/aidl/generated_lib/java/UnitsForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/3/java/UnitsForVehicleProperty.java similarity index 100% rename from automotive/vehicle/aidl/generated_lib/java/UnitsForVehicleProperty.java rename to automotive/vehicle/aidl/generated_lib/3/java/UnitsForVehicleProperty.java diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp index 75a3541cdd..0a33e5b85d 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp @@ -27,7 +27,7 @@ cc_library { defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], header_libs: [ - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", ], shared_libs: ["libjsoncpp"], } @@ -44,7 +44,7 @@ cc_library { defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], header_libs: [ - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", "libbinder_headers", ], cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], @@ -59,7 +59,7 @@ cc_library_headers { defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], header_libs: [ - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", ], shared_libs: ["libjsoncpp"], } diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp index 651ed903af..70933bee50 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp @@ -31,7 +31,7 @@ cc_test { "libgtest", ], header_libs: [ - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", ], shared_libs: [ "libjsoncpp", @@ -57,7 +57,7 @@ cc_test { "-DENABLE_VEHICLE_HAL_TEST_PROPERTIES", ], header_libs: [ - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", ], shared_libs: [ "libjsoncpp", diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp index ae1102f6d2..5cc071d1ae 100644 --- a/automotive/vehicle/aidl/impl/vhal/Android.bp +++ b/automotive/vehicle/aidl/impl/vhal/Android.bp @@ -66,7 +66,7 @@ cc_library { ], header_libs: [ "IVehicleHardware", - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", ], shared_libs: [ "libbinder_ndk", diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py index f2797678ab..512e945510 100755 --- a/automotive/vehicle/tools/generate_annotation_enums.py +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -17,9 +17,9 @@ """A script to generate Java files and CPP header files based on annotations in VehicleProperty.aidl Need ANDROID_BUILD_TOP environmental variable to be set. This script will update - ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/cpp and + ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/version/cpp and ChangeModeForVehicleProperty.java, AccessForVehicleProperty.java, EnumForVehicleProperty.java - UnitsForVehicleProperty.java under generated_lib/java. + UnitsForVehicleProperty.java under generated_lib/version/java. Usage: $ python generate_annotation_enums.py @@ -31,22 +31,20 @@ import re import sys import tempfile +# Keep this updated with the latest in-development property version. +PROPERTY_VERSION = '3' + PROP_AIDL_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/' + 'automotive/vehicle/VehicleProperty.aidl') -CHANGE_MODE_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + - 'ChangeModeForVehicleProperty.h') -ACCESS_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + - 'AccessForVehicleProperty.h') -CHANGE_MODE_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + - 'ChangeModeForVehicleProperty.java') -ACCESS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + - 'AccessForVehicleProperty.java') -ENUM_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + - 'EnumForVehicleProperty.java') -UNITS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + - 'UnitsForVehicleProperty.java') -VERSION_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + - 'VersionForVehicleProperty.h') +GENERATED_LIB = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/' + PROPERTY_VERSION + + '/') +CHANGE_MODE_CPP_FILE_PATH = GENERATED_LIB + '/cpp/ChangeModeForVehicleProperty.h' +ACCESS_CPP_FILE_PATH = GENERATED_LIB + '/cpp/AccessForVehicleProperty.h' +CHANGE_MODE_JAVA_FILE_PATH = GENERATED_LIB + '/java/ChangeModeForVehicleProperty.java' +ACCESS_JAVA_FILE_PATH = GENERATED_LIB + '/java/AccessForVehicleProperty.java' +ENUM_JAVA_FILE_PATH = GENERATED_LIB + '/java/EnumForVehicleProperty.java' +UNITS_JAVA_FILE_PATH = GENERATED_LIB + '/java/UnitsForVehicleProperty.java' +VERSION_CPP_FILE_PATH = GENERATED_LIB + '/cpp/VersionForVehicleProperty.h' SCRIPT_PATH = 'hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py' TAB = ' ' diff --git a/automotive/vehicle/vts/Android.bp b/automotive/vehicle/vts/Android.bp index 67d0d344d4..40aec59402 100644 --- a/automotive/vehicle/vts/Android.bp +++ b/automotive/vehicle/vts/Android.bp @@ -43,7 +43,7 @@ cc_test { "vhalclient_defaults", ], header_libs: [ - "IVehicleGeneratedHeaders", + "IVehicleGeneratedHeaders-V3", ], test_suites: [ "general-tests", From c746fc87bd7c80a59d422afa98ca7e0190011c52 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 26 Apr 2024 15:47:26 -0700 Subject: [PATCH 107/161] Create V4 generated_lib. Currently this is the same as v3. Test: Presubmit Bug: 337328290 Change-Id: Ic3aa820d71e6082642639a5cc6aeb0065817c382 --- .../aidl/generated_lib/3/cpp/Android.bp | 8 - .../aidl/generated_lib/3/java/Android.bp | 7 - .../4/cpp/AccessForVehicleProperty.h | 311 ++++++++++++++++++ .../aidl/generated_lib/4/cpp/Android.bp | 35 ++ .../4/cpp/ChangeModeForVehicleProperty.h | 311 ++++++++++++++++++ .../4/cpp/VersionForVehicleProperty.h | 310 +++++++++++++++++ .../4/java/AccessForVehicleProperty.java | 300 +++++++++++++++++ .../aidl/generated_lib/4/java/Android.bp | 33 ++ .../4/java/ChangeModeForVehicleProperty.java | 300 +++++++++++++++++ .../4/java/EnumForVehicleProperty.java | 111 +++++++ .../4/java/UnitsForVehicleProperty.java | 65 ++++ .../tools/generate_annotation_enums.py | 2 +- 12 files changed, 1777 insertions(+), 16 deletions(-) create mode 100644 automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h create mode 100644 automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp create mode 100644 automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h create mode 100644 automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h create mode 100644 automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java create mode 100644 automotive/vehicle/aidl/generated_lib/4/java/Android.bp create mode 100644 automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java create mode 100644 automotive/vehicle/aidl/generated_lib/4/java/EnumForVehicleProperty.java create mode 100644 automotive/vehicle/aidl/generated_lib/4/java/UnitsForVehicleProperty.java diff --git a/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp b/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp index 58ffa45288..83043e58d9 100644 --- a/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp +++ b/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp @@ -18,14 +18,6 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } -cc_library_headers { - name: "IVehicleGeneratedHeaders", - vendor_available: true, - local_include_dirs: ["."], - export_include_dirs: ["."], - defaults: ["VehicleHalInterfaceDefaults"], -} - cc_library_headers { name: "IVehicleGeneratedHeaders-V3", vendor_available: true, diff --git a/automotive/vehicle/aidl/generated_lib/3/java/Android.bp b/automotive/vehicle/aidl/generated_lib/3/java/Android.bp index 4e35f19c19..b98fcbdeee 100644 --- a/automotive/vehicle/aidl/generated_lib/3/java/Android.bp +++ b/automotive/vehicle/aidl/generated_lib/3/java/Android.bp @@ -18,13 +18,6 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } -filegroup { - name: "IVehicleGeneratedJavaFiles", - srcs: [ - "*.java", - ], -} - filegroup { name: "IVehicleGeneratedJavaFiles-V3", srcs: [ diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h new file mode 100644 index 0000000000..51a3025740 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +#pragma once + +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map AccessForVehicleProperty = { + {VehicleProperty::INFO_VIN, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MAKE, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MODEL, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MODEL_YEAR, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_FUEL_CAPACITY, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_FUEL_TYPE, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EV_BATTERY_CAPACITY, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EV_CONNECTOR_TYPE, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_FUEL_DOOR_LOCATION, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EV_PORT_LOCATION, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_DRIVER_SEAT, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_ODOMETER, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_VEHICLE_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_STEERING_ANGLE, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_REAR_STEERING_ANGLE, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_COOLANT_TEMP, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_OIL_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_OIL_TEMP, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_RPM, VehiclePropertyAccess::READ}, + {VehicleProperty::WHEEL_TICK, VehiclePropertyAccess::READ}, + {VehicleProperty::FUEL_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess::READ}, + {VehicleProperty::RANGE_REMAINING, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyAccess::READ}, + {VehicleProperty::TIRE_PRESSURE, VehiclePropertyAccess::READ}, + {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::IMPACT_DETECTED, VehiclePropertyAccess::READ}, + {VehicleProperty::GEAR_SELECTION, VehiclePropertyAccess::READ}, + {VehicleProperty::CURRENT_GEAR, VehiclePropertyAccess::READ}, + {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyAccess::READ}, + {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyAccess::READ}, + {VehicleProperty::NIGHT_MODE, VehiclePropertyAccess::READ}, + {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::IGNITION_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::ABS_ACTIVE, VehiclePropertyAccess::READ}, + {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_DEFROSTER, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_AC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_MAX_AC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_MAX_DEFROST_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_RECIRC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_DUAL_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_AUTO_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_SEAT_TEMPERATURE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_POWER_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_AUTO_RECIRC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_SEAT_VENTILATION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DISTANCE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EXTERNAL_CAR_TIME, VehiclePropertyAccess::READ}, + {VehicleProperty::ANDROID_EPOCH_TIME, VehiclePropertyAccess::WRITE}, + {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, VehiclePropertyAccess::READ}, + {VehicleProperty::AP_POWER_STATE_REQ, VehiclePropertyAccess::READ}, + {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ}, + {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::VALET_MODE_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HEAD_UP_DISPLAY_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::DOOR_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DOOR_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DOOR_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Z_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Y_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_FOLD, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyAccess::WRITE}, + {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyAccess::WRITE}, + {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BELT_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_TILT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_TILT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, VehiclePropertyAccess::READ}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyAccess::READ}, + {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, + {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ}, + {VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_POSITION, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyAccess::READ}, + {VehicleProperty::ULTRASONICS_SENSOR_MEASURED_DISTANCE, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyAccess::WRITE}, + {VehicleProperty::HEADLIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::FOG_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HAZARD_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HEADLIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HAZARD_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CABIN_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess::READ}, + {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess::READ}, + {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SWITCH_USER, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CREATE_USER, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::REMOVE_USER, VehiclePropertyAccess::WRITE}, + {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyAccess::READ}, + {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyAccess::READ}, + {VehicleProperty::POWER_POLICY_GROUP_REQ, VehiclePropertyAccess::READ}, + {VehicleProperty::CURRENT_POWER_POLICY, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WATCHDOG_ALIVE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VHAL_HEARTBEAT, VehiclePropertyAccess::READ}, + {VehicleProperty::CLUSTER_SWITCH_UI, VehiclePropertyAccess::READ}, + {VehicleProperty::CLUSTER_DISPLAY_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CLUSTER_REPORT_STATE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CLUSTER_REQUEST_DISPLAY, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CLUSTER_NAVIGATION_STATE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyAccess::READ}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyAccess::READ}, + {VehicleProperty::FRONT_FOG_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::REAR_FOG_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_CHARGE_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_TIME_REMAINING, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::TRAILER_PRESENT, VehiclePropertyAccess::READ}, + {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyAccess::READ}, + {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ}, + {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, + {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE}, + {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess::READ}, + {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DISTRACTION_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess::READ}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp b/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp new file mode 100644 index 0000000000..6ece865d2e --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2022 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_headers { + name: "IVehicleGeneratedHeaders", + vendor_available: true, + local_include_dirs: ["."], + export_include_dirs: ["."], + defaults: ["VehicleHalInterfaceDefaults"], +} + +cc_library_headers { + name: "IVehicleGeneratedHeaders-V4", + vendor_available: true, + local_include_dirs: ["."], + export_include_dirs: ["."], + defaults: ["VehicleHalInterfaceDefaults"], +} diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h new file mode 100644 index 0000000000..60e9a72138 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +#pragma once + +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map ChangeModeForVehicleProperty = { + {VehicleProperty::INFO_VIN, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MAKE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MODEL, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MODEL_YEAR, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_FUEL_CAPACITY, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_FUEL_TYPE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EV_BATTERY_CAPACITY, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EV_CONNECTOR_TYPE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_FUEL_DOOR_LOCATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EV_PORT_LOCATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_DRIVER_SEAT, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::PERF_ODOMETER, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_VEHICLE_SPEED, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_STEERING_ANGLE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_REAR_STEERING_ANGLE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::ENGINE_COOLANT_TEMP, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::ENGINE_OIL_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ENGINE_OIL_TEMP, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::ENGINE_RPM, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::WHEEL_TICK, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::FUEL_LEVEL, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::RANGE_REMAINING, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::TIRE_PRESSURE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::IMPACT_DETECTED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::GEAR_SELECTION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CURRENT_GEAR, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::NIGHT_MODE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::IGNITION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ABS_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_DEFROSTER, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_AC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_MAX_AC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_MAX_DEFROST_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_RECIRC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_DUAL_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_AUTO_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_SEAT_TEMPERATURE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_POWER_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::HVAC_AUTO_RECIRC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_SEAT_VENTILATION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DISTANCE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EXTERNAL_CAR_TIME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ANDROID_EPOCH_TIME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::AP_POWER_STATE_REQ, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VALET_MODE_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HEAD_UP_DISPLAY_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Z_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Y_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_FOLD, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_TILT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_TILT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_POSITION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ULTRASONICS_SENSOR_MEASURED_DISTANCE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HEADLIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HAZARD_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HEADLIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HAZARD_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CABIN_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SWITCH_USER, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CREATE_USER, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::REMOVE_USER, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::POWER_POLICY_GROUP_REQ, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CURRENT_POWER_POLICY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WATCHDOG_ALIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VHAL_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_SWITCH_UI, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_DISPLAY_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_REPORT_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_REQUEST_DISPLAY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_NAVIGATION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FRONT_FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::REAR_FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_TIME_REMAINING, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TRAILER_PRESENT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h new file mode 100644 index 0000000000..0e80bd85b2 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h @@ -0,0 +1,310 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +#pragma once + +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map VersionForVehicleProperty = { + {VehicleProperty::INFO_VIN, 2}, + {VehicleProperty::INFO_MAKE, 2}, + {VehicleProperty::INFO_MODEL, 2}, + {VehicleProperty::INFO_MODEL_YEAR, 2}, + {VehicleProperty::INFO_FUEL_CAPACITY, 2}, + {VehicleProperty::INFO_FUEL_TYPE, 2}, + {VehicleProperty::INFO_EV_BATTERY_CAPACITY, 2}, + {VehicleProperty::INFO_EV_CONNECTOR_TYPE, 2}, + {VehicleProperty::INFO_FUEL_DOOR_LOCATION, 2}, + {VehicleProperty::INFO_EV_PORT_LOCATION, 2}, + {VehicleProperty::INFO_DRIVER_SEAT, 2}, + {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, 2}, + {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, 2}, + {VehicleProperty::PERF_ODOMETER, 2}, + {VehicleProperty::PERF_VEHICLE_SPEED, 2}, + {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, 2}, + {VehicleProperty::PERF_STEERING_ANGLE, 2}, + {VehicleProperty::PERF_REAR_STEERING_ANGLE, 2}, + {VehicleProperty::ENGINE_COOLANT_TEMP, 2}, + {VehicleProperty::ENGINE_OIL_LEVEL, 2}, + {VehicleProperty::ENGINE_OIL_TEMP, 2}, + {VehicleProperty::ENGINE_RPM, 2}, + {VehicleProperty::WHEEL_TICK, 2}, + {VehicleProperty::FUEL_LEVEL, 2}, + {VehicleProperty::FUEL_DOOR_OPEN, 2}, + {VehicleProperty::EV_BATTERY_LEVEL, 2}, + {VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, 2}, + {VehicleProperty::EV_CHARGE_PORT_OPEN, 2}, + {VehicleProperty::EV_CHARGE_PORT_CONNECTED, 2}, + {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, 2}, + {VehicleProperty::RANGE_REMAINING, 2}, + {VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, 3}, + {VehicleProperty::TIRE_PRESSURE, 2}, + {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, 2}, + {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, 2}, + {VehicleProperty::IMPACT_DETECTED, 3}, + {VehicleProperty::GEAR_SELECTION, 2}, + {VehicleProperty::CURRENT_GEAR, 2}, + {VehicleProperty::PARKING_BRAKE_ON, 2}, + {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, 2}, + {VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, 2}, + {VehicleProperty::FUEL_LEVEL_LOW, 2}, + {VehicleProperty::NIGHT_MODE, 2}, + {VehicleProperty::TURN_SIGNAL_STATE, 2}, + {VehicleProperty::IGNITION_STATE, 2}, + {VehicleProperty::ABS_ACTIVE, 2}, + {VehicleProperty::TRACTION_CONTROL_ACTIVE, 2}, + {VehicleProperty::EV_STOPPING_MODE, 2}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, 3}, + {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, 3}, + {VehicleProperty::HVAC_FAN_SPEED, 2}, + {VehicleProperty::HVAC_FAN_DIRECTION, 2}, + {VehicleProperty::HVAC_TEMPERATURE_CURRENT, 2}, + {VehicleProperty::HVAC_TEMPERATURE_SET, 2}, + {VehicleProperty::HVAC_DEFROSTER, 2}, + {VehicleProperty::HVAC_AC_ON, 2}, + {VehicleProperty::HVAC_MAX_AC_ON, 2}, + {VehicleProperty::HVAC_MAX_DEFROST_ON, 2}, + {VehicleProperty::HVAC_RECIRC_ON, 2}, + {VehicleProperty::HVAC_DUAL_ON, 2}, + {VehicleProperty::HVAC_AUTO_ON, 2}, + {VehicleProperty::HVAC_SEAT_TEMPERATURE, 2}, + {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, 2}, + {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, 2}, + {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, 2}, + {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, 2}, + {VehicleProperty::HVAC_POWER_ON, 2}, + {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, 2}, + {VehicleProperty::HVAC_AUTO_RECIRC_ON, 2}, + {VehicleProperty::HVAC_SEAT_VENTILATION, 2}, + {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, 2}, + {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, 2}, + {VehicleProperty::DISTANCE_DISPLAY_UNITS, 2}, + {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, 2}, + {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, 2}, + {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, 2}, + {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, 2}, + {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, 2}, + {VehicleProperty::EXTERNAL_CAR_TIME, 2}, + {VehicleProperty::ANDROID_EPOCH_TIME, 2}, + {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, 2}, + {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, 2}, + {VehicleProperty::AP_POWER_STATE_REQ, 2}, + {VehicleProperty::AP_POWER_STATE_REPORT, 2}, + {VehicleProperty::AP_POWER_BOOTUP_REASON, 2}, + {VehicleProperty::DISPLAY_BRIGHTNESS, 2}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, 2}, + {VehicleProperty::VALET_MODE_ENABLED, 3}, + {VehicleProperty::HEAD_UP_DISPLAY_ENABLED, 3}, + {VehicleProperty::HW_KEY_INPUT, 2}, + {VehicleProperty::HW_KEY_INPUT_V2, 2}, + {VehicleProperty::HW_MOTION_INPUT, 2}, + {VehicleProperty::HW_ROTARY_INPUT, 2}, + {VehicleProperty::HW_CUSTOM_INPUT, 2}, + {VehicleProperty::DOOR_POS, 2}, + {VehicleProperty::DOOR_MOVE, 2}, + {VehicleProperty::DOOR_LOCK, 2}, + {VehicleProperty::DOOR_CHILD_LOCK_ENABLED, 2}, + {VehicleProperty::MIRROR_Z_POS, 2}, + {VehicleProperty::MIRROR_Z_MOVE, 2}, + {VehicleProperty::MIRROR_Y_POS, 2}, + {VehicleProperty::MIRROR_Y_MOVE, 2}, + {VehicleProperty::MIRROR_LOCK, 2}, + {VehicleProperty::MIRROR_FOLD, 2}, + {VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, 2}, + {VehicleProperty::MIRROR_AUTO_TILT_ENABLED, 2}, + {VehicleProperty::SEAT_MEMORY_SELECT, 2}, + {VehicleProperty::SEAT_MEMORY_SET, 2}, + {VehicleProperty::SEAT_BELT_BUCKLED, 2}, + {VehicleProperty::SEAT_BELT_HEIGHT_POS, 2}, + {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, 2}, + {VehicleProperty::SEAT_FORE_AFT_POS, 2}, + {VehicleProperty::SEAT_FORE_AFT_MOVE, 2}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, 2}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, 2}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, 2}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, 2}, + {VehicleProperty::SEAT_HEIGHT_POS, 2}, + {VehicleProperty::SEAT_HEIGHT_MOVE, 2}, + {VehicleProperty::SEAT_DEPTH_POS, 2}, + {VehicleProperty::SEAT_DEPTH_MOVE, 2}, + {VehicleProperty::SEAT_TILT_POS, 2}, + {VehicleProperty::SEAT_TILT_MOVE, 2}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, 2}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, 2}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, 2}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, 2}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, 2}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, 2}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, 2}, + {VehicleProperty::SEAT_HEADREST_ANGLE_POS, 2}, + {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, 2}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, 2}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, 2}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, 2}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, 2}, + {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, 2}, + {VehicleProperty::SEAT_AIRBAG_ENABLED, 2}, + {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, 3}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, 2}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, 2}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, 2}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, 2}, + {VehicleProperty::SEAT_WALK_IN_POS, 2}, + {VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, 3}, + {VehicleProperty::SEAT_OCCUPANCY, 2}, + {VehicleProperty::WINDOW_POS, 2}, + {VehicleProperty::WINDOW_MOVE, 2}, + {VehicleProperty::WINDOW_LOCK, 2}, + {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, 2}, + {VehicleProperty::WINDSHIELD_WIPERS_STATE, 2}, + {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, 2}, + {VehicleProperty::STEERING_WHEEL_DEPTH_POS, 2}, + {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, 2}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, 2}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, 2}, + {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, 2}, + {VehicleProperty::STEERING_WHEEL_LOCKED, 2}, + {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, 2}, + {VehicleProperty::GLOVE_BOX_DOOR_POS, 2}, + {VehicleProperty::GLOVE_BOX_LOCKED, 2}, + {VehicleProperty::VEHICLE_MAP_SERVICE, 2}, + {VehicleProperty::LOCATION_CHARACTERIZATION, 2}, + {VehicleProperty::ULTRASONICS_SENSOR_POSITION, 3}, + {VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, 3}, + {VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, 3}, + {VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, 3}, + {VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, 3}, + {VehicleProperty::ULTRASONICS_SENSOR_MEASURED_DISTANCE, 3}, + {VehicleProperty::OBD2_LIVE_FRAME, 2}, + {VehicleProperty::OBD2_FREEZE_FRAME, 2}, + {VehicleProperty::OBD2_FREEZE_FRAME_INFO, 2}, + {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, 2}, + {VehicleProperty::HEADLIGHTS_STATE, 2}, + {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, 2}, + {VehicleProperty::FOG_LIGHTS_STATE, 2}, + {VehicleProperty::HAZARD_LIGHTS_STATE, 2}, + {VehicleProperty::HEADLIGHTS_SWITCH, 2}, + {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, 2}, + {VehicleProperty::FOG_LIGHTS_SWITCH, 2}, + {VehicleProperty::HAZARD_LIGHTS_SWITCH, 2}, + {VehicleProperty::CABIN_LIGHTS_STATE, 2}, + {VehicleProperty::CABIN_LIGHTS_SWITCH, 2}, + {VehicleProperty::READING_LIGHTS_STATE, 2}, + {VehicleProperty::READING_LIGHTS_SWITCH, 2}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, 2}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, 2}, + {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, 2}, + {VehicleProperty::DISABLED_OPTIONAL_FEATURES, 2}, + {VehicleProperty::INITIAL_USER_INFO, 2}, + {VehicleProperty::SWITCH_USER, 2}, + {VehicleProperty::CREATE_USER, 2}, + {VehicleProperty::REMOVE_USER, 2}, + {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, 2}, + {VehicleProperty::EVS_SERVICE_REQUEST, 2}, + {VehicleProperty::POWER_POLICY_REQ, 2}, + {VehicleProperty::POWER_POLICY_GROUP_REQ, 2}, + {VehicleProperty::CURRENT_POWER_POLICY, 2}, + {VehicleProperty::WATCHDOG_ALIVE, 2}, + {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, 2}, + {VehicleProperty::VHAL_HEARTBEAT, 2}, + {VehicleProperty::CLUSTER_SWITCH_UI, 2}, + {VehicleProperty::CLUSTER_DISPLAY_STATE, 2}, + {VehicleProperty::CLUSTER_REPORT_STATE, 2}, + {VehicleProperty::CLUSTER_REQUEST_DISPLAY, 2}, + {VehicleProperty::CLUSTER_NAVIGATION_STATE, 2}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, 2}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, 2}, + {VehicleProperty::FRONT_FOG_LIGHTS_STATE, 2}, + {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, 2}, + {VehicleProperty::REAR_FOG_LIGHTS_STATE, 2}, + {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, 2}, + {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, 2}, + {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, 2}, + {VehicleProperty::EV_CHARGE_STATE, 2}, + {VehicleProperty::EV_CHARGE_SWITCH, 2}, + {VehicleProperty::EV_CHARGE_TIME_REMAINING, 2}, + {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, 2}, + {VehicleProperty::TRAILER_PRESENT, 2}, + {VehicleProperty::VEHICLE_CURB_WEIGHT, 2}, + {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, 2}, + {VehicleProperty::SUPPORTED_PROPERTY_IDS, 2}, + {VehicleProperty::SHUTDOWN_REQUEST, 2}, + {VehicleProperty::VEHICLE_IN_USE, 2}, + {VehicleProperty::CLUSTER_HEARTBEAT, 3}, + {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, 3}, + {VehicleProperty::CAMERA_SERVICE_CURRENT_STATE, 3}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, 2}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, 2}, + {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, 2}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, 2}, + {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, 2}, + {VehicleProperty::BLIND_SPOT_WARNING_STATE, 2}, + {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, 2}, + {VehicleProperty::LANE_DEPARTURE_WARNING_STATE, 2}, + {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, 2}, + {VehicleProperty::LANE_KEEP_ASSIST_STATE, 2}, + {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, 2}, + {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, 2}, + {VehicleProperty::LANE_CENTERING_ASSIST_STATE, 2}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, 2}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, 2}, + {VehicleProperty::CRUISE_CONTROL_ENABLED, 2}, + {VehicleProperty::CRUISE_CONTROL_TYPE, 2}, + {VehicleProperty::CRUISE_CONTROL_STATE, 2}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, 2}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, 2}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, 2}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, 2}, + {VehicleProperty::HANDS_ON_DETECTION_ENABLED, 2}, + {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, 2}, + {VehicleProperty::HANDS_ON_DETECTION_WARNING, 2}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, 3}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, 3}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, 3}, + {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, 3}, + {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, 3}, + {VehicleProperty::DRIVER_DISTRACTION_STATE, 3}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, 3}, + {VehicleProperty::DRIVER_DISTRACTION_WARNING, 3}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, 3}, + {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, 3}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, 3}, + {VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, 3}, + {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, 3}, + {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, 3}, +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl diff --git a/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java new file mode 100644 index 0000000000..afb6cab547 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class AccessForVehicleProperty { + + public static final Map values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_VIN, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MAKE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MODEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_FUEL_TYPE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_DRIVER_SEAT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_ODOMETER, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_RPM, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WHEEL_TICK, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.IMPACT_DETECTED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_DEFROSTER, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_AC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_MAX_AC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_MAX_DEFROST_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_RECIRC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_DUAL_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_AUTO_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_SEAT_TEMPERATURE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_SIDE_MIRROR_HEAT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_STEERING_WHEEL_HEAT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_POWER_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_AUTO_RECIRC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_SEAT_VENTILATION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.AP_POWER_STATE_REQ, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.VALET_MODE_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HEAD_UP_DISPLAY_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_TILT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_TILT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_AIRBAGS_DEPLOYED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_WALK_IN_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_POSITION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_MEASURED_DISTANCE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.HEADLIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FOG_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.POWER_POLICY_GROUP_REQ, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CURRENT_POWER_POLICY, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WATCHDOG_ALIVE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.WATCHDOG_TERMINATED_PROCESS, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VHAL_HEARTBEAT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CLUSTER_SWITCH_UI, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CLUSTER_DISPLAY_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CLUSTER_REPORT_STATE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CLUSTER_REQUEST_DISPLAY, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CLUSTER_NAVIGATION_STATE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_PERCENT_LIMIT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_CHARGE_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ) + ); + +} diff --git a/automotive/vehicle/aidl/generated_lib/4/java/Android.bp b/automotive/vehicle/aidl/generated_lib/4/java/Android.bp new file mode 100644 index 0000000000..f3c96f5e96 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/java/Android.bp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +filegroup { + name: "IVehicleGeneratedJavaFiles", + srcs: [ + "*.java", + ], +} + +filegroup { + name: "IVehicleGeneratedJavaFiles-V4", + srcs: [ + "*.java", + ], +} diff --git a/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java new file mode 100644 index 0000000000..12aff40b34 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class ChangeModeForVehicleProperty { + + public static final Map values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_VIN, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MAKE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MODEL, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_FUEL_TYPE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_DRIVER_SEAT, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.PERF_ODOMETER, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.ENGINE_RPM, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.WHEEL_TICK, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.IMPACT_DETECTED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_DEFROSTER, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_AC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_MAX_AC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_MAX_DEFROST_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_RECIRC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_DUAL_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_AUTO_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_SEAT_TEMPERATURE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_SIDE_MIRROR_HEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_STEERING_WHEEL_HEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_POWER_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.HVAC_AUTO_RECIRC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_SEAT_VENTILATION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.AP_POWER_STATE_REQ, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VALET_MODE_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HEAD_UP_DISPLAY_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_CHILD_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_AUTO_TILT_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_TILT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_TILT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_AIRBAGS_DEPLOYED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_WALK_IN_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_PRETENSIONER_DEPLOYED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_POSITION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_FIELD_OF_VIEW, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_DETECTION_RANGE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_SUPPORTED_RANGES, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ULTRASONICS_SENSOR_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HEADLIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.POWER_POLICY_GROUP_REQ, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CURRENT_POWER_POLICY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WATCHDOG_ALIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WATCHDOG_TERMINATED_PROCESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VHAL_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_SWITCH_UI, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_DISPLAY_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_REPORT_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_REQUEST_DISPLAY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_NAVIGATION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_PERCENT_LIMIT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_SYSTEM_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE) + ); + +} diff --git a/automotive/vehicle/aidl/generated_lib/4/java/EnumForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/4/java/EnumForVehicleProperty.java new file mode 100644 index 0000000000..0f86bfa14d --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/java/EnumForVehicleProperty.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +package android.hardware.automotive.vehicle; + +import java.util.List; +import java.util.Map; + +public final class EnumForVehicleProperty { + + public static final Map>> values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_FUEL_TYPE, List.of(FuelType.class)), + Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, List.of(EvConnectorType.class)), + Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, List.of(PortLocationType.class)), + Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, List.of(PortLocationType.class)), + Map.entry(VehicleProperty.INFO_DRIVER_SEAT, List.of(VehicleAreaSeat.class)), + Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, List.of(PortLocationType.class)), + Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, List.of(VehicleOilLevel.class)), + Map.entry(VehicleProperty.IMPACT_DETECTED, List.of(ImpactSensorLocation.class)), + Map.entry(VehicleProperty.GEAR_SELECTION, List.of(VehicleGear.class)), + Map.entry(VehicleProperty.CURRENT_GEAR, List.of(VehicleGear.class)), + Map.entry(VehicleProperty.TURN_SIGNAL_STATE, List.of(VehicleTurnSignal.class)), + Map.entry(VehicleProperty.IGNITION_STATE, List.of(VehicleIgnitionState.class)), + Map.entry(VehicleProperty.EV_STOPPING_MODE, List.of(EvStoppingMode.class)), + Map.entry(VehicleProperty.ELECTRONIC_STABILITY_CONTROL_STATE, List.of(ElectronicStabilityControlState.class, ErrorState.class)), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, List.of(VehicleHvacFanDirection.class)), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, List.of(VehicleHvacFanDirection.class)), + Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, List.of(VehicleUnit.class)), + Map.entry(VehicleProperty.HW_ROTARY_INPUT, List.of(RotaryInputType.class)), + Map.entry(VehicleProperty.HW_CUSTOM_INPUT, List.of(CustomInputType.class)), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.SEAT_AIRBAGS_DEPLOYED, List.of(VehicleAirbagLocation.class)), + Map.entry(VehicleProperty.SEAT_OCCUPANCY, List.of(VehicleSeatOccupancyState.class)), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, List.of(WindshieldWipersState.class)), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, List.of(WindshieldWipersSwitch.class)), + Map.entry(VehicleProperty.HEADLIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.FOG_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.READING_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, List.of(ElectronicTollCollectionCardType.class)), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, List.of(ElectronicTollCollectionCardStatus.class)), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, List.of(VehicleLightState.class)), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, List.of(VehicleLightSwitch.class)), + Map.entry(VehicleProperty.EV_CHARGE_STATE, List.of(EvChargeState.class)), + Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, List.of(EvRegenerativeBrakingState.class)), + Map.entry(VehicleProperty.TRAILER_PRESENT, List.of(TrailerState.class)), + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, List.of(GsrComplianceRequirementType.class)), + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, List.of(VehicleApPowerStateShutdownParam.class)), + Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, List.of(VehicleAutonomousState.class)), + Map.entry(VehicleProperty.CAMERA_SERVICE_CURRENT_STATE, List.of(CameraServiceState.class)), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, List.of(AutomaticEmergencyBrakingState.class, ErrorState.class)), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, List.of(ForwardCollisionWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, List.of(BlindSpotWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_STATE, List.of(LaneDepartureWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, List.of(LaneKeepAssistState.class, ErrorState.class)), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, List.of(LaneCenteringAssistCommand.class)), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, List.of(LaneCenteringAssistState.class, ErrorState.class)), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, List.of(EmergencyLaneKeepAssistState.class, ErrorState.class)), + Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, List.of(CruiseControlType.class, ErrorState.class)), + Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, List.of(CruiseControlState.class, ErrorState.class)), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, List.of(CruiseControlCommand.class)), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, List.of(HandsOnDetectionDriverState.class, ErrorState.class)), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, List.of(HandsOnDetectionWarning.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_STATE, List.of(DriverDrowsinessAttentionState.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DROWSINESS_ATTENTION_WARNING, List.of(DriverDrowsinessAttentionWarning.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_STATE, List.of(DriverDistractionState.class, ErrorState.class)), + Map.entry(VehicleProperty.DRIVER_DISTRACTION_WARNING, List.of(DriverDistractionWarning.class, ErrorState.class)), + Map.entry(VehicleProperty.LOW_SPEED_COLLISION_WARNING_STATE, List.of(LowSpeedCollisionWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.CROSS_TRAFFIC_MONITORING_WARNING_STATE, List.of(CrossTrafficMonitoringWarningState.class, ErrorState.class)), + Map.entry(VehicleProperty.LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, List.of(LowSpeedAutomaticEmergencyBrakingState.class, ErrorState.class)) + ); + +} diff --git a/automotive/vehicle/aidl/generated_lib/4/java/UnitsForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/4/java/UnitsForVehicleProperty.java new file mode 100644 index 0000000000..b30c8e6103 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/4/java/UnitsForVehicleProperty.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2023 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +// clang-format off + +package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class UnitsForVehicleProperty { + + public static final Map values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehicleUnit.YEAR), + Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehicleUnit.MILLILITER), + Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehicleUnit.WATT_HOUR), + Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehicleUnit.MILLIMETER), + Map.entry(VehicleProperty.PERF_ODOMETER, VehicleUnit.KILOMETER), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehicleUnit.METER_PER_SEC), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehicleUnit.METER_PER_SEC), + Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehicleUnit.DEGREES), + Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehicleUnit.DEGREES), + Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehicleUnit.CELSIUS), + Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehicleUnit.CELSIUS), + Map.entry(VehicleProperty.ENGINE_RPM, VehicleUnit.RPM), + Map.entry(VehicleProperty.FUEL_LEVEL, VehicleUnit.MILLILITER), + Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehicleUnit.WATT_HOUR), + Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehicleUnit.WATT_HOUR), + Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehicleUnit.MILLIWATTS), + Map.entry(VehicleProperty.RANGE_REMAINING, VehicleUnit.METER), + Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehicleUnit.CELSIUS), + Map.entry(VehicleProperty.TIRE_PRESSURE, VehicleUnit.KILOPASCAL), + Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehicleUnit.KILOPASCAL), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehicleUnit.CELSIUS), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehicleUnit.CELSIUS), + Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehicleUnit.MILLI_SECS), + Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehicleUnit.MILLI_SECS), + Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehicleUnit.CELSIUS), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehicleUnit.MILLI_SECS), + Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehicleUnit.AMPERE), + Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehicleUnit.SECS), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehicleUnit.METER_PER_SEC), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehicleUnit.MILLI_SECS), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehicleUnit.MILLIMETER) + ); + +} diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py index 512e945510..460e9f92c7 100755 --- a/automotive/vehicle/tools/generate_annotation_enums.py +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -32,7 +32,7 @@ import sys import tempfile # Keep this updated with the latest in-development property version. -PROPERTY_VERSION = '3' +PROPERTY_VERSION = '4' PROP_AIDL_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/' + 'automotive/vehicle/VehicleProperty.aidl') From c6589f9ea8cdcafc14336d242ec69c7f2c3d6321 Mon Sep 17 00:00:00 2001 From: Golden Hsu Date: Thu, 25 Apr 2024 19:13:18 +0800 Subject: [PATCH 108/161] getSessionCharacteristic bug fix close session in the end of for loop Bug: 337711677 Test: Vendor testing Change-Id: Ie82622af10079fe7e882cabd4eccdcc1e59a5464 --- .../provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 368e9540d6..31e8014a84 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -341,6 +341,10 @@ TEST_P(CameraAidlTest, getSessionCharacteristics) { ret = device->getSessionCharacteristics(config, &session_chars); ASSERT_TRUE(ret.isOk()); verifySessionCharacteristics(session_chars, camera_chars); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); } } else { ALOGI("getSessionCharacteristics: Test skipped.\n"); From 3bc1f0667f38b8bd188a715dfdcf5d9e541ec707 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Fri, 19 Apr 2024 19:37:45 +0000 Subject: [PATCH 109/161] Added more methods in IVirtualHal interface Bug: 326227403 Test: atest android.hardware.biometrics.fingerprint.* -c Change-Id: If5cdd5e5cfea96ef941852ea286f865a99ef8ba8 --- .../AcquiredInfoAndVendorCode.aidl | 40 +++++++++++ .../fingerprint/EnrollmentProgressStep.aidl | 40 +++++++++++ .../biometrics/fingerprint/IVirtualHal.aidl | 6 +- .../fingerprint/NextEnrollment.aidl | 41 +++++++++++ .../AcquiredInfoAndVendorCode.aidl | 35 ++++++++++ .../fingerprint/EnrollmentProgressStep.aidl | 36 ++++++++++ .../biometrics/fingerprint/IVirtualHal.aidl | 22 +++++- .../fingerprint/NextEnrollment.aidl | 40 +++++++++++ .../fingerprint/aidl/default/VirtualHal.cpp | 69 +++++++++++++++++-- .../aidl/default/include/VirtualHal.h | 9 ++- .../aidl/default/tests/VirtualHalTest.cpp | 31 ++++++++- 11 files changed, 356 insertions(+), 13 deletions(-) create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl new file mode 100644 index 0000000000..c1dc51c21d --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +union AcquiredInfoAndVendorCode { + android.hardware.biometrics.fingerprint.AcquiredInfo acquiredInfo = android.hardware.biometrics.fingerprint.AcquiredInfo.UNKNOWN; + int vendorCode; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl new file mode 100644 index 0000000000..173ac1706d --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable EnrollmentProgressStep { + int durationMs; + android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquiredInfoAndVendorCodes; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl index 2c7e1a0037..33ae83c340 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl @@ -37,24 +37,26 @@ package android.hardware.biometrics.fingerprint; interface IVirtualHal { oneway void setEnrollments(in int[] id); oneway void setEnrollmentHit(in int hit_id); + oneway void setNextEnrollment(in android.hardware.biometrics.fingerprint.NextEnrollment next_enrollment); oneway void setAuthenticatorId(in long id); oneway void setChallenge(in long challenge); oneway void setOperationAuthenticateFails(in boolean fail); oneway void setOperationAuthenticateLatency(in int[] latencyMs); oneway void setOperationAuthenticateDuration(in int durationMs); oneway void setOperationAuthenticateError(in int error); - oneway void setOperationAuthenticateAcquired(in int[] acquired); + oneway void setOperationAuthenticateAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquired); oneway void setOperationEnrollError(in int error); oneway void setOperationEnrollLatency(in int[] latencyMs); oneway void setOperationDetectInteractionLatency(in int[] latencyMs); oneway void setOperationDetectInteractionError(in int error); oneway void setOperationDetectInteractionDuration(in int durationMs); - oneway void setOperationDetectInteractionAcquired(in int[] acquired); + oneway void setOperationDetectInteractionAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquired); oneway void setLockout(in boolean lockout); oneway void setLockoutEnable(in boolean enable); oneway void setLockoutTimedThreshold(in int threshold); oneway void setLockoutTimedDuration(in int durationMs); oneway void setLockoutPermanentThreshold(in int threshold); + oneway void resetConfigurations(); oneway void setType(in android.hardware.biometrics.fingerprint.FingerprintSensorType type); oneway void setSensorId(in int id); oneway void setSensorStrength(in android.hardware.biometrics.common.SensorStrength strength); diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl new file mode 100644 index 0000000000..75ed0700be --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable NextEnrollment { + int id; + android.hardware.biometrics.fingerprint.EnrollmentProgressStep[] progressSteps; + boolean result = true; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl new file mode 100644 index 0000000000..c7be950b8b --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 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. + */ + +package android.hardware.biometrics.fingerprint; + +import android.hardware.biometrics.fingerprint.AcquiredInfo; + +/** + * @hide + */ +@VintfStability +union AcquiredInfoAndVendorCode { + /** + * Acquired info as specified in AcqauiredInfo.aidl + */ + AcquiredInfo acquiredInfo = AcquiredInfo.UNKNOWN; + + /** + * Vendor specific code + */ + int vendorCode; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl new file mode 100644 index 0000000000..bf038f6fb6 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2024 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. + */ + +package android.hardware.biometrics.fingerprint; + +import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode; + +/** + * @hide + */ +@VintfStability +parcelable EnrollmentProgressStep { + /** + * The duration of the enrollment step in milli-seconds + */ + int durationMs; + + /** + * The sequence of acquired info and vendor code to be issued by HAL during the step. + * The codes are evenly spreaded over the duration + */ + AcquiredInfoAndVendorCode[] acquiredInfoAndVendorCodes; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl index 1599394724..cb9135e6ab 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl @@ -17,7 +17,9 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.common.SensorStrength; +import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode; import android.hardware.biometrics.fingerprint.FingerprintSensorType; +import android.hardware.biometrics.fingerprint.NextEnrollment; import android.hardware.biometrics.fingerprint.SensorLocation; /** @@ -53,6 +55,15 @@ oneway interface IVirtualHal { */ void setEnrollmentHit(in int hit_id); + /** + * setNextEnrollment + * + * Set the next enrollment behavior + * + * @param next_enrollment specifies enrollment id, progress stages and final result + */ + void setNextEnrollment(in NextEnrollment next_enrollment); + /** * setAuthenticatorId * @@ -137,7 +148,7 @@ oneway interface IVirtualHal { * * @param acquired[], one or more acquired info codes */ - void setOperationAuthenticateAcquired(in int[] acquired); + void setOperationAuthenticateAcquired(in AcquiredInfoAndVendorCode[] acquired); /** * setOperationEnrollError @@ -226,7 +237,7 @@ oneway interface IVirtualHal { * * @param acquired[], one or more acquired info codes */ - void setOperationDetectInteractionAcquired(in int[] acquired); + void setOperationDetectInteractionAcquired(in AcquiredInfoAndVendorCode[] acquired); /** * setLockout @@ -284,6 +295,13 @@ oneway interface IVirtualHal { */ void setLockoutPermanentThreshold(in int threshold); + /** + * resetConfigurations + * + * Reset all virtual hal configurations to default values + */ + void resetConfigurations(); + /** * The following functions are used to configure Fingerprint Virtual HAL sensor properties * refer to SensorProps.aidl and CommonProps.aidl for details of each property diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl new file mode 100644 index 0000000000..4b50850696 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 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. + */ + +package android.hardware.biometrics.fingerprint; + +/** + * @hide + */ +@VintfStability +parcelable NextEnrollment { + /** + * Identifier of the next enrollment if successful + */ + int id; + + /** + * Specification of the progress steps of the next enrollment, each step consists of duration + * and sequence of acquired info codes to be generated by HAL. + * See EnrollmentProgressStep.aidl for more details + */ + android.hardware.biometrics.fingerprint.EnrollmentProgressStep[] progressSteps; + + /** + * Success or failure of the next enrollment + */ + boolean result = true; +} diff --git a/biometrics/fingerprint/aidl/default/VirtualHal.cpp b/biometrics/fingerprint/aidl/default/VirtualHal.cpp index d2baaf5256..e107d2f7ed 100644 --- a/biometrics/fingerprint/aidl/default/VirtualHal.cpp +++ b/biometrics/fingerprint/aidl/default/VirtualHal.cpp @@ -27,6 +27,8 @@ namespace aidl::android::hardware::biometrics::fingerprint { +using Tag = AcquiredInfoAndVendorCode::Tag; + ::ndk::ScopedAStatus VirtualHal::setEnrollments(const std::vector& enrollments) { Fingerprint::cfg().sourcedFromAidl(); Fingerprint::cfg().setopt("enrollments", intVec2OptIntVec(enrollments)); @@ -39,6 +41,42 @@ namespace aidl::android::hardware::biometrics::fingerprint { return ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus VirtualHal::setNextEnrollment( + const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment& next_enrollment) { + Fingerprint::cfg().sourcedFromAidl(); + std::ostringstream os; + os << next_enrollment.id << ":"; + + int stepSize = next_enrollment.progressSteps.size(); + for (int i = 0; i < stepSize; i++) { + auto& step = next_enrollment.progressSteps[i]; + os << step.durationMs; + int acSize = step.acquiredInfoAndVendorCodes.size(); + for (int j = 0; j < acSize; j++) { + if (j == 0) os << "-["; + auto& acquiredInfoAndVendorCode = step.acquiredInfoAndVendorCodes[j]; + if (acquiredInfoAndVendorCode.getTag() == AcquiredInfoAndVendorCode::vendorCode) + os << acquiredInfoAndVendorCode.get(); + else if (acquiredInfoAndVendorCode.getTag() == AcquiredInfoAndVendorCode::acquiredInfo) + os << (int)acquiredInfoAndVendorCode.get(); + else + LOG(FATAL) << "ERROR: wrong AcquiredInfoAndVendorCode union tag"; + if (j == acSize - 1) + os << "]"; + else + os << ","; + } + if (i == stepSize - 1) + os << ":"; + else + os << ","; + } + + os << (next_enrollment.result ? "true" : "false"); + Fingerprint::cfg().set("next_enrollment", os.str()); + return ndk::ScopedAStatus::ok(); +} + ::ndk::ScopedAStatus VirtualHal::setAuthenticatorId(int64_t in_id) { Fingerprint::cfg().sourcedFromAidl(); Fingerprint::cfg().set("authenticator_id", in_id); @@ -87,10 +125,10 @@ namespace aidl::android::hardware::biometrics::fingerprint { } ::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateAcquired( - const std::vector& in_acquired) { + const std::vector& in_acquired) { Fingerprint::cfg().sourcedFromAidl(); Fingerprint::cfg().setopt("operation_authenticate_acquired", - intVec2OptIntVec(in_acquired)); + acquiredInfoVec2OptIntVec(in_acquired)); return ndk::ScopedAStatus::ok(); } @@ -139,10 +177,10 @@ namespace aidl::android::hardware::biometrics::fingerprint { } ::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionAcquired( - const std::vector& in_acquired) { + const std::vector& in_acquired) { Fingerprint::cfg().sourcedFromAidl(); Fingerprint::cfg().setopt("operation_detect_interaction_acquired", - intVec2OptIntVec(in_acquired)); + acquiredInfoVec2OptIntVec(in_acquired)); return ndk::ScopedAStatus::ok(); } @@ -188,6 +226,12 @@ namespace aidl::android::hardware::biometrics::fingerprint { return ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus VirtualHal::resetConfigurations() { + Fingerprint::cfg().sourcedFromAidl(); + Fingerprint::cfg().init(); + return ndk::ScopedAStatus::ok(); +} + ::ndk::ScopedAStatus VirtualHal::setType( ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType in_type) { Fingerprint::cfg().sourcedFromAidl(); @@ -254,6 +298,23 @@ OptIntVec VirtualHal::intVec2OptIntVec(const std::vector& in_vec) { return optIntVec; } +OptIntVec VirtualHal::acquiredInfoVec2OptIntVec( + const std::vector& in_vec) { + OptIntVec optIntVec; + std::transform(in_vec.begin(), in_vec.end(), std::back_inserter(optIntVec), + [](AcquiredInfoAndVendorCode ac) { + int value; + if (ac.getTag() == AcquiredInfoAndVendorCode::acquiredInfo) + value = (int)ac.get(); + else if (ac.getTag() == AcquiredInfoAndVendorCode::vendorCode) + value = ac.get(); + else + LOG(FATAL) << "ERROR: wrong AcquiredInfoAndVendorCode tag"; + return std::optional(value); + }); + return optIntVec; +} + ::ndk::ScopedAStatus VirtualHal::sanityCheckLatency(const std::vector& in_latency) { if (in_latency.size() == 0 || in_latency.size() > 2) { return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( diff --git a/biometrics/fingerprint/aidl/default/include/VirtualHal.h b/biometrics/fingerprint/aidl/default/include/VirtualHal.h index 6cc4b669fb..e5f62fc1c0 100644 --- a/biometrics/fingerprint/aidl/default/include/VirtualHal.h +++ b/biometrics/fingerprint/aidl/default/include/VirtualHal.h @@ -28,6 +28,9 @@ class VirtualHal : public BnVirtualHal { ::ndk::ScopedAStatus setEnrollments(const std::vector& in_id) override; ::ndk::ScopedAStatus setEnrollmentHit(int32_t in_hit_id) override; + ::ndk::ScopedAStatus setNextEnrollment( + const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment& + in_next_enrollment) override; ::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override; ::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override; ::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override; @@ -36,7 +39,7 @@ class VirtualHal : public BnVirtualHal { ::ndk::ScopedAStatus setOperationAuthenticateDuration(int32_t in_duration) override; ::ndk::ScopedAStatus setOperationAuthenticateError(int32_t in_error) override; ::ndk::ScopedAStatus setOperationAuthenticateAcquired( - const std::vector& in_acquired) override; + const std::vector& in_acquired) override; ::ndk::ScopedAStatus setOperationEnrollError(int32_t in_error) override; ::ndk::ScopedAStatus setOperationEnrollLatency(const std::vector& in_latency) override; ::ndk::ScopedAStatus setOperationDetectInteractionLatency( @@ -44,12 +47,13 @@ class VirtualHal : public BnVirtualHal { ::ndk::ScopedAStatus setOperationDetectInteractionError(int32_t in_error) override; ::ndk::ScopedAStatus setOperationDetectInteractionDuration(int32_t in_duration) override; ::ndk::ScopedAStatus setOperationDetectInteractionAcquired( - const std::vector& in_acquired) override; + const std::vector& in_acquired) override; ::ndk::ScopedAStatus setLockout(bool in_lockout) override; ::ndk::ScopedAStatus setLockoutEnable(bool in_enable) override; ::ndk::ScopedAStatus setLockoutTimedThreshold(int32_t in_threshold) override; ::ndk::ScopedAStatus setLockoutTimedDuration(int32_t in_duration) override; ::ndk::ScopedAStatus setLockoutPermanentThreshold(int32_t in_threshold) override; + ::ndk::ScopedAStatus resetConfigurations() override; ::ndk::ScopedAStatus setType( ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType in_type) override; @@ -66,6 +70,7 @@ class VirtualHal : public BnVirtualHal { private: OptIntVec intVec2OptIntVec(const std::vector& intVec); + OptIntVec acquiredInfoVec2OptIntVec(const std::vector& intVec); ::ndk::ScopedAStatus sanityCheckLatency(const std::vector& in_latency); Fingerprint* mFp; }; diff --git a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp index d8495d1638..3fe0b2a33e 100644 --- a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp @@ -100,6 +100,27 @@ TEST_F(VirtualHalTest, enrollment_hit_int32) { ASSERT_TRUE(Fingerprint::cfg().get("enrollment_hit") == 11); } +TEST_F(VirtualHalTest, next_enrollment) { + struct { + std::string nextEnrollmentStr; + fingerprint::NextEnrollment nextEnrollment; + } testData[] = { + {"1:20:true", {1, {{20}}, true}}, + {"1:50,60,70:true", {1, {{50}, {60}, {70}}, true}}, + {"2:50-[8],60,70-[2,1002,1]:false", + {2, + {{50, {{AcquiredInfo::START}}}, + {60}, + {70, {{AcquiredInfo::PARTIAL}, {1002}, {AcquiredInfo::GOOD}}}}, + false}}, + }; + + for (auto& d : testData) { + mVhal->setNextEnrollment(d.nextEnrollment); + ASSERT_TRUE(Fingerprint::cfg().get("next_enrollment") == d.nextEnrollmentStr); + } +} + TEST_F(VirtualHalTest, authenticator_id_int64) { mVhal->setAuthenticatorId(12345678900); ASSERT_TRUE(Fingerprint::cfg().get("authenticator_id") == 12345678900); @@ -111,12 +132,16 @@ TEST_F(VirtualHalTest, opeationAuthenticateFails_bool) { } TEST_F(VirtualHalTest, operationAuthenticateAcquired_int32_vector) { - std::vector ac{1, 2, 3, 4, 5, 6, 7}; + using Tag = AcquiredInfoAndVendorCode::Tag; + std::vector ac{ + {AcquiredInfo::START}, {AcquiredInfo::PARTIAL}, {1023}}; mVhal->setOperationAuthenticateAcquired(ac); OptIntVec ac_get = Fingerprint::cfg().getopt("operation_authenticate_acquired"); ASSERT_TRUE(ac_get.size() == ac.size()); for (int i = 0; i < ac.size(); i++) { - ASSERT_TRUE(ac[i] == ac_get[i]); + int acCode = (ac[i].getTag() == Tag::acquiredInfo) ? (int)ac[i].get() + : ac[i].get(); + ASSERT_TRUE(acCode == ac_get[i]); } } @@ -212,7 +237,7 @@ TEST_F(VirtualHalTest, setOthers) { mVhal->setOperationEnrollError(5); mVhal->setOperationEnrollLatency({4, 5}); mVhal->setOperationDetectInteractionError(6); - mVhal->setOperationDetectInteractionAcquired({4, 3, 2}); + mVhal->setOperationDetectInteractionAcquired({{AcquiredInfo::START}, {AcquiredInfo::GOOD}}); mVhal->setLockout(false); mVhal->setLockoutEnable(false); mVhal->setSensorId(5); From 843abc563ce176e18ef8a5679d8883d86a30184d Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 16 Apr 2024 14:36:12 -0700 Subject: [PATCH 110/161] Add Rust backend to audio common AIDL Bug: 319474244 Test: build ok Flag: EXEMPT HAL interface change Change-Id: I2de2cd7ad0b2cc2d038af8c6bf510fa67aa69705 --- audio/aidl/Android.bp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 8bb8cd5612..b67b9d2cde 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -64,6 +64,9 @@ aidl_interface { ], min_sdk_version: "31", }, + rust: { + enabled: true, + }, }, versions_with_info: [ { @@ -112,6 +115,13 @@ cc_defaults { ], } +rust_defaults { + name: "latest_android_hardware_audio_common_rust", + rustlibs: [ + latest_android_hardware_audio_common + "-rust", + ], +} + aidl_interface_defaults { name: "latest_android_hardware_audio_common_import_interface", imports: [ From 90af84e4d62812d8511b283729f77189d9b1c82c Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 16 Apr 2024 11:56:00 -0700 Subject: [PATCH 111/161] Create a skeleton Rust audio control HAL This is to prove that rust audio control HAL can be built and can run. The skeleton Rust audio control HAL will return UNKNOWN_ERROR for all APIs. Bug: 319474244 Flag: EXEMPT HAL interface change Test: m android.hardware.automotive.audiocontrol-V4-rust-service Change-Id: I64916b3eaa8410e0b137b5b34578710899f91324 --- automotive/audiocontrol/aidl/Android.bp | 10 +++ .../audiocontrol/aidl/rust_impl/Android.bp | 32 +++++++ .../audiocontrol/aidl/rust_impl/README.md | 13 +++ .../rust_impl/audiocontrol-rust-service.rc | 4 + .../rust_impl/audiocontrol-rust-service.xml | 23 +++++ .../src/default_audio_control_hal.rs | 84 +++++++++++++++++++ .../audiocontrol/aidl/rust_impl/src/main.rs | 33 ++++++++ 7 files changed, 199 insertions(+) create mode 100644 automotive/audiocontrol/aidl/rust_impl/Android.bp create mode 100644 automotive/audiocontrol/aidl/rust_impl/README.md create mode 100644 automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.rc create mode 100644 automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.xml create mode 100644 automotive/audiocontrol/aidl/rust_impl/src/default_audio_control_hal.rs create mode 100644 automotive/audiocontrol/aidl/rust_impl/src/main.rs diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index c3540699fb..0eb17fe324 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -27,6 +27,9 @@ aidl_interface { "com.android.car.framework", ], }, + rust: { + enabled: true, + }, }, versions_with_info: [ { @@ -100,3 +103,10 @@ java_defaults { latest_android_hardware_automotive_audiocontrol + "-java", ], } + +rust_defaults { + name: "latest_android_hardware_automotive_audiocontrol_rust", + rustlibs: [ + latest_android_hardware_automotive_audiocontrol + "-rust", + ], +} diff --git a/automotive/audiocontrol/aidl/rust_impl/Android.bp b/automotive/audiocontrol/aidl/rust_impl/Android.bp new file mode 100644 index 0000000000..062d989bab --- /dev/null +++ b/automotive/audiocontrol/aidl/rust_impl/Android.bp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024 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. + */ + +rust_binary { + name: "android.hardware.automotive.audiocontrol-V4-rust-service", + relative_install_path: "hw", + vendor: true, + srcs: ["src/*.rs"], + crate_root: "src/main.rs", + defaults: [ + "latest_android_hardware_automotive_audiocontrol_rust", + "latest_android_hardware_audio_common_rust", + ], + vintf_fragments: ["audiocontrol-rust-service.xml"], + init_rc: ["audiocontrol-rust-service.rc"], + rustlibs: [ + "libbinder_rs", + ], +} diff --git a/automotive/audiocontrol/aidl/rust_impl/README.md b/automotive/audiocontrol/aidl/rust_impl/README.md new file mode 100644 index 0000000000..ed22356920 --- /dev/null +++ b/automotive/audiocontrol/aidl/rust_impl/README.md @@ -0,0 +1,13 @@ +# Rust Skeleton Audio Control HAL implementation. + +WARNING: This is not a reference audio control HAl implementation and does +not contain any actual implementation. + +This folder contains a skeleton audio control HAL implementation in Rust to +demonstrate how vendor may implement a Rust audio control HAL. To run this +audio control HAL, include +`android.hardware.automotive.audiocontrol-V4-rust-service` in your image. + +This implementation returns `StatusCode::UNKNOWN_ERROR` for all operations +and does not pass VTS/CTS. Vendor must replace the logic in +`default_audio_control_hal.rs` with the actual implementation. diff --git a/automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.rc b/automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.rc new file mode 100644 index 0000000000..88d180dbd1 --- /dev/null +++ b/automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.rc @@ -0,0 +1,4 @@ +service vendor.audiocontrol-default /vendor/bin/hw/android.hardware.automotive.audiocontrol-service.example + class hal + user audioserver + group system diff --git a/automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.xml b/automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.xml new file mode 100644 index 0000000000..e54c1d332d --- /dev/null +++ b/automotive/audiocontrol/aidl/rust_impl/audiocontrol-rust-service.xml @@ -0,0 +1,23 @@ + + + + + android.hardware.automotive.audiocontrol + 4 + IAudioControl/default + + diff --git a/automotive/audiocontrol/aidl/rust_impl/src/default_audio_control_hal.rs b/automotive/audiocontrol/aidl/rust_impl/src/default_audio_control_hal.rs new file mode 100644 index 0000000000..ba0ca238f4 --- /dev/null +++ b/automotive/audiocontrol/aidl/rust_impl/src/default_audio_control_hal.rs @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2024 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. + */ +use android_hardware_automotive_audiocontrol::aidl::android::hardware::automotive::audiocontrol::{ + AudioFocusChange::AudioFocusChange, + AudioGainConfigInfo::AudioGainConfigInfo, + DuckingInfo::DuckingInfo, + IAudioControl::IAudioControl, + IAudioGainCallback::IAudioGainCallback, + IFocusListener::IFocusListener, + IModuleChangeCallback::IModuleChangeCallback, + MutingInfo::MutingInfo, + Reasons::Reasons, +}; +use android_hardware_audio_common::aidl::android::hardware::audio::common::PlaybackTrackMetadata::PlaybackTrackMetadata; +use binder::{Interface, Result as BinderResult, StatusCode, Strong}; + +/// This struct is defined to implement IAudioControl AIDL interface. +pub struct DefaultAudioControlHal; + +impl Interface for DefaultAudioControlHal {} + +impl IAudioControl for DefaultAudioControlHal { + fn onAudioFocusChange(&self, _usage : &str, _zone_id : i32, _focus_change : AudioFocusChange + ) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn onDevicesToDuckChange(&self, _ducking_infos : &[DuckingInfo]) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn onDevicesToMuteChange(&self, _muting_infos : &[MutingInfo]) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn registerFocusListener(&self, _listener : &Strong) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setBalanceTowardRight(&self, _value : f32) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setFadeTowardFront(&self, _value : f32) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn onAudioFocusChangeWithMetaData(&self, _playback_metadata : &PlaybackTrackMetadata, + _zone_id : i32, _focus_change : AudioFocusChange) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setAudioDeviceGainsChanged(&self, _reasons : &[Reasons], _gains : &[AudioGainConfigInfo] + ) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn registerGainCallback(&self, _callback : &Strong + ) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn setModuleChangeCallback(&self, _callback : &Strong + ) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } + + fn clearModuleChangeCallback(&self) -> BinderResult<()> { + Err(StatusCode::UNKNOWN_ERROR.into()) + } +} diff --git a/automotive/audiocontrol/aidl/rust_impl/src/main.rs b/automotive/audiocontrol/aidl/rust_impl/src/main.rs new file mode 100644 index 0000000000..2ed4810f9c --- /dev/null +++ b/automotive/audiocontrol/aidl/rust_impl/src/main.rs @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 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. + */ +mod default_audio_control_hal; + +use android_hardware_automotive_audiocontrol::aidl::android::hardware::automotive::audiocontrol::IAudioControl::BnAudioControl; +use crate::default_audio_control_hal::DefaultAudioControlHal; + +fn main() { + binder::ProcessState::start_thread_pool(); + let my_service = DefaultAudioControlHal; + let service_name = "android.hardware.automotive.audiocontrol.IAudioControl/default"; + let my_service_binder = BnAudioControl::new_binder( + my_service, + binder::BinderFeatures::default(), + ); + binder::add_service(service_name, my_service_binder.as_binder()) + .expect(format!("Failed to register {}?", service_name).as_str()); + // Does not return. + binder::ProcessState::join_thread_pool() +} From 1e1627a5da86782960a157a059aec816be5c82b1 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 19 Jan 2024 22:22:01 +0000 Subject: [PATCH 112/161] Use onUnlinked in health HAL It's possible to get an onBinderDied callback after a call to AIBinder_unlinkToDeath() so we can't delete the objects in callbacks_ until we are done using the void* cookie. Handling the cleanup in onBinderUnlinked will handle the case where we manually unlink it as well as the case where it's unlinked due to death. Test: atest VtsHalHealthTargetTest Bug: 319210610 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e5e95bf5759a736f3debc6eb583fb1c82b38d847) Merged-In: Iee4783217cc88134af6de0fe66128684ca984dba Change-Id: Iee4783217cc88134af6de0fe66128684ca984dba --- health/aidl/default/Health.cpp | 55 ++++++++++++++----- health/aidl/default/LinkedCallback.cpp | 28 ++++------ health/aidl/default/LinkedCallback.h | 18 ++---- .../aidl/default/include/health-impl/Health.h | 3 +- 4 files changed, 59 insertions(+), 45 deletions(-) diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp index d41d01a450..3558e0a268 100644 --- a/health/aidl/default/Health.cpp +++ b/health/aidl/default/Health.cpp @@ -36,6 +36,11 @@ void OnCallbackDiedWrapped(void* cookie) { LinkedCallback* linked = reinterpret_cast(cookie); linked->OnCallbackDied(); } +// Delete the owned cookie. +void onCallbackUnlinked(void* cookie) { + LinkedCallback* linked = reinterpret_cast(cookie); + delete linked; +} } // namespace /* @@ -57,6 +62,7 @@ Health::Health(std::string_view instance_name, std::unique_ptr lock(callbacks_lock_); - callbacks_.emplace_back(LinkedCallback::Make(ref(), callback)); + LinkedCallback* linked_callback_result = LinkedCallback::Make(ref(), callback); + if (!linked_callback_result) { + return ndk::ScopedAStatus::fromStatus(STATUS_UNEXPECTED_NULL); + } + callbacks_[linked_callback_result] = callback; // unlock } @@ -257,12 +267,24 @@ ndk::ScopedAStatus Health::unregisterCallback( std::lock_guard lock(callbacks_lock_); - auto matches = [callback](const auto& linked) { - return linked->callback()->asBinder() == callback->asBinder(); // compares binder object + auto matches = [callback](const auto& cb) { + return cb->asBinder() == callback->asBinder(); // compares binder object }; - auto it = std::remove_if(callbacks_.begin(), callbacks_.end(), matches); - bool removed = (it != callbacks_.end()); - callbacks_.erase(it, callbacks_.end()); // calls unlinkToDeath on deleted callbacks. + bool removed = false; + for (auto it = callbacks_.begin(); it != callbacks_.end();) { + if (it->second->asBinder() == callback->asBinder()) { + auto status = AIBinder_unlinkToDeath(callback->asBinder().get(), death_recipient_.get(), + reinterpret_cast(it->first)); + if (status != STATUS_OK && status != STATUS_DEAD_OBJECT) { + LOG(WARNING) << __func__ + << "Cannot unlink to death: " << ::android::statusToString(status); + } + it = callbacks_.erase(it); + removed = true; + } else { + it++; + } + } return removed ? ndk::ScopedAStatus::ok() : ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -290,13 +312,20 @@ ndk::ScopedAStatus Health::update() { void Health::OnHealthInfoChanged(const HealthInfo& health_info) { // Notify all callbacks std::unique_lock lock(callbacks_lock_); - // is_dead notifies a callback and return true if it is dead. - auto is_dead = [&](const auto& linked) { - auto res = linked->callback()->healthInfoChanged(health_info); - return IsDeadObjectLogged(res); - }; - auto it = std::remove_if(callbacks_.begin(), callbacks_.end(), is_dead); - callbacks_.erase(it, callbacks_.end()); // calls unlinkToDeath on deleted callbacks. + for (auto it = callbacks_.begin(); it != callbacks_.end();) { + auto res = it->second->healthInfoChanged(health_info); + if (IsDeadObjectLogged(res)) { + // if it's dead, remove it + it = callbacks_.erase(it); + } else { + it++; + if (!res.isOk()) { + LOG(DEBUG) + << "Cannot call healthInfoChanged:" << res.getDescription() + << ". Do nothing here if callback is dead as it will be cleaned up later."; + } + } + } lock.unlock(); // Let HalHealthLoop::OnHealthInfoChanged() adjusts uevent / wakealarm periods diff --git a/health/aidl/default/LinkedCallback.cpp b/health/aidl/default/LinkedCallback.cpp index 2985ffe959..12a8df3926 100644 --- a/health/aidl/default/LinkedCallback.cpp +++ b/health/aidl/default/LinkedCallback.cpp @@ -24,35 +24,24 @@ namespace aidl::android::hardware::health { -std::unique_ptr LinkedCallback::Make( - std::shared_ptr service, std::shared_ptr callback) { - std::unique_ptr ret(new LinkedCallback()); +LinkedCallback* LinkedCallback::Make(std::shared_ptr service, + std::shared_ptr callback) { + LinkedCallback* ret(new LinkedCallback()); + // pass ownership of this object to the death recipient binder_status_t linkRet = AIBinder_linkToDeath(callback->asBinder().get(), service->death_recipient_.get(), - reinterpret_cast(ret.get())); + reinterpret_cast(ret)); if (linkRet != ::STATUS_OK) { LOG(WARNING) << __func__ << "Cannot link to death: " << linkRet; return nullptr; } ret->service_ = service; - ret->callback_ = std::move(callback); + ret->callback_ = callback; return ret; } LinkedCallback::LinkedCallback() = default; -LinkedCallback::~LinkedCallback() { - if (callback_ == nullptr) { - return; - } - auto status = - AIBinder_unlinkToDeath(callback_->asBinder().get(), service()->death_recipient_.get(), - reinterpret_cast(this)); - if (status != STATUS_OK && status != STATUS_DEAD_OBJECT) { - LOG(WARNING) << __func__ << "Cannot unlink to death: " << ::android::statusToString(status); - } -} - std::shared_ptr LinkedCallback::service() { auto service_sp = service_.lock(); CHECK_NE(nullptr, service_sp); @@ -60,7 +49,10 @@ std::shared_ptr LinkedCallback::service() { } void LinkedCallback::OnCallbackDied() { - service()->unregisterCallback(callback_); + auto sCb = callback_.lock(); + if (sCb) { + service()->unregisterCallback(sCb); + } } } // namespace aidl::android::hardware::health diff --git a/health/aidl/default/LinkedCallback.h b/health/aidl/default/LinkedCallback.h index 82490a7015..0494921d0c 100644 --- a/health/aidl/default/LinkedCallback.h +++ b/health/aidl/default/LinkedCallback.h @@ -31,18 +31,10 @@ namespace aidl::android::hardware::health { class LinkedCallback { public: // Automatically linkToDeath upon construction with the returned object as the cookie. - // service->death_reciepient() should be from CreateDeathRecipient(). - // Not using a strong reference to |service| to avoid circular reference. The lifetime - // of |service| must be longer than this LinkedCallback object. - static std::unique_ptr Make(std::shared_ptr service, - std::shared_ptr callback); - - // Automatically unlinkToDeath upon destruction. So, it is always safe to reinterpret_cast - // the cookie back to the LinkedCallback object. - ~LinkedCallback(); - - // The wrapped IHealthInfoCallback object. - const std::shared_ptr& callback() const { return callback_; } + // The deathRecipient owns the LinkedCallback object and will delete it with + // cookie when it's unlinked. + static LinkedCallback* Make(std::shared_ptr service, + std::shared_ptr callback); // On callback died, unreigster it from the service. void OnCallbackDied(); @@ -54,7 +46,7 @@ class LinkedCallback { std::shared_ptr service(); std::weak_ptr service_; - std::shared_ptr callback_; + std::weak_ptr callback_; }; } // namespace aidl::android::hardware::health diff --git a/health/aidl/default/include/health-impl/Health.h b/health/aidl/default/include/health-impl/Health.h index 6bd49465d6..4fc4953044 100644 --- a/health/aidl/default/include/health-impl/Health.h +++ b/health/aidl/default/include/health-impl/Health.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include @@ -108,7 +109,7 @@ class Health : public BnHealth, public HalHealthLoopCallback { ndk::ScopedAIBinder_DeathRecipient death_recipient_; int binder_fd_ = -1; std::mutex callbacks_lock_; - std::vector> callbacks_; + std::map> callbacks_; }; } // namespace aidl::android::hardware::health From 522ae3ecdfd74e8135b5fb02a0adca8548b96460 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Fri, 15 Mar 2024 00:38:18 +0000 Subject: [PATCH 113/161] Camera: Trim required stream combination queries Based on social media app usage, trim required stream combination queries. Test: Build Bug: 314229449 Change-Id: I3c48988c7a8598c1d3a091cf32e00360e6609156 --- .../hardware/camera/device/ICameraDevice.aidl | 65 ++----------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl index 440c2b3728..5da515bb61 100644 --- a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl @@ -372,66 +372,13 @@ interface ICameraDevice { * the particular StreamConfiguration is supported, the camera HAL must take all * the keys in sessionParameters into consideration. * - * 2. For version 3 of this interface, the camera compliance test will verify that + * 2. For version 3 of this interface, the camera compliance tests will verify that * isStreamCombinationWithSettingsSupported behaves properly for all combinations of - * below features. This function must return true for all supported combinations, - * and return false for non-supported feature combinations. The list of features - * required may grow in future versions. The additional metadata entries in - * StreamConfiguration::sessionParameters are {CONTROL_AE_TARGET_FPS_RANGE, - * CONTROL_VIDEO_STABILIZATION_MODE}. - * - * - Stream Combinations (a subset of LEGACY device mandatory stream combinations): - * { - * // 4:3 16:9 - * // S1440P: 1920 x 1440 2560 x 1440 - * // S1080P: 1440 x 1080 1920 x 1080 - * // S720P: 960 x 720 1280 x 720 - * - * // Simple preview, GPU video processing, or no-preview video recording - * {PRIV, MAXIMUM}, - * {PRIV, PREVIEW}, - * {PRIV, S1440P}, - * {PRIV, S1080P}, - * {PRIV, S720P}, - * // In-application video/image processing - * {YUV, MAXIMUM}, - * {YUV, PREVIEW}, - * {YUV, S1440P}, - * {YUV, S1080P}, - * {YUV, S720P}, - * // Standard still imaging. - * {PRIV, PREVIEW, JPEG, MAXIMUM}, - * {PRIV, S1440P, JPEG, MAXIMUM}, - * {PRIV, S1080P, JPEG, MAXIMUM}, - * {PRIV, S720P, JPEG, MAXIMUM}, - * {PRIV, S1440P, JPEG, S1440P}, - * {PRIV, S1080P, JPEG, S1080P}, - * {PRIV, S720P, JPEG, S1080P}, - * // In-app processing plus still capture. - * {YUV, PREVIEW, JPEG, MAXIMUM}, - * {YUV, S1440P, JPEG, MAXIMUM}, - * {YUV, S1080P, JPEG, MAXIMUM}, - * {YUV, S720P, JPEG, MAXIMUM}, - * // Standard recording. - * {PRIV, PREVIEW, PRIV, PREVIEW}, - * {PRIV, S1440P, PRIV, S1440P}, - * {PRIV, S1080P, PRIV, S1080P}, - * {PRIV, S720P, PRIV, S720P}, - * // Preview plus in-app processing. - * {PRIV, PREVIEW, YUV, PREVIEW}, - * {PRIV, S1440P, YUV, S1440P}, - * {PRIV, S1080P, YUV, S1080P}, - * {PRIV, S720P, YUV, S720P}, - * } - * - VIDEO_STABILIZATION_MODES: {OFF, PREVIEW} - * - AE_TARGET_FPS_RANGE: {{*, 30}, {*, 60}} - * - DYNAMIC_RANGE_PROFILE: {STANDARD, HLG10} - * - * Note: If a combination contains a S1440P, S1080P, or S720P stream, - * both 4:3 and 16:9 aspect ratio will be considered. For example, for the - * stream combination of {PRIV, S1440P, JPEG, MAXIMUM}, and if MAXIMUM == - * 4032 x 3024, the camera compliance test will verify both - * {PRIV, 1920 x 1440, JPEG, 4032 x 3024} and {PRIV, 2560 x 1440, JPEG, 4032 x 2268}. + * features described in the android.info.sessionConfigurationQueryVersion section of + * /system/media/camera/docs/docs.html. This function must + * return true for all supported combinations, and return false for non-supported + * feature combinations. The list of feature combinations required may grow in future + * HAL versions. * * @param streams The StreamConfiguration to be tested, with optional CaptureRequest parameters. * From 49859a3b5542270363efe42a56b9145142bbfa60 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 9 Apr 2024 21:50:41 +0000 Subject: [PATCH 114/161] Keep track of DeathMonitor cookies This change keeps track of the objects that the cookies points to so the serviceDied callback knows when it can use the cookie. Test: atest neuralnetworks_utils_hal_aidl_test Tets: atest NeuralNetworksTest_static Bug: 319210610 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:def7a3cf59fa17ba7faa9af14a24f4161bc276bd) Merged-In: I418cbc6baa19aa702d9fd2e7d8096fe1a02b7794 Change-Id: I418cbc6baa19aa702d9fd2e7d8096fe1a02b7794 --- .../include/nnapi/hal/aidl/ProtectCallback.h | 11 ++++ .../aidl/utils/src/ProtectCallback.cpp | 56 ++++++++++++++++--- neuralnetworks/aidl/utils/test/DeviceTest.cpp | 9 ++- 3 files changed, 66 insertions(+), 10 deletions(-) diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h index 92ed1cda5d..9a7fe5e1c7 100644 --- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h +++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h @@ -56,6 +56,8 @@ class IProtectedCallback { // Thread safe class class DeathMonitor final { public: + explicit DeathMonitor(uintptr_t cookieKey) : kCookieKey(cookieKey) {} + static void serviceDied(void* cookie); void serviceDied(); // Precondition: `killable` must be non-null. @@ -63,9 +65,18 @@ class DeathMonitor final { // Precondition: `killable` must be non-null. void remove(IProtectedCallback* killable) const; + uintptr_t getCookieKey() const { return kCookieKey; } + + ~DeathMonitor(); + DeathMonitor(const DeathMonitor&) = delete; + DeathMonitor(DeathMonitor&&) noexcept = delete; + DeathMonitor& operator=(const DeathMonitor&) = delete; + DeathMonitor& operator=(DeathMonitor&&) noexcept = delete; + private: mutable std::mutex mMutex; mutable std::vector mObjects GUARDED_BY(mMutex); + const uintptr_t kCookieKey; }; class DeathHandler final { diff --git a/neuralnetworks/aidl/utils/src/ProtectCallback.cpp b/neuralnetworks/aidl/utils/src/ProtectCallback.cpp index 54a673caf5..4a7ac08895 100644 --- a/neuralnetworks/aidl/utils/src/ProtectCallback.cpp +++ b/neuralnetworks/aidl/utils/src/ProtectCallback.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,16 @@ namespace aidl::android::hardware::neuralnetworks::utils { +namespace { + +// Only dereference the cookie if it's valid (if it's in this set) +// Only used with ndk +std::mutex sCookiesMutex; +uintptr_t sCookieKeyCounter GUARDED_BY(sCookiesMutex) = 0; +std::map> sCookies GUARDED_BY(sCookiesMutex); + +} // namespace + void DeathMonitor::serviceDied() { std::lock_guard guard(mMutex); std::for_each(mObjects.begin(), mObjects.end(), @@ -40,8 +51,24 @@ void DeathMonitor::serviceDied() { } void DeathMonitor::serviceDied(void* cookie) { - auto deathMonitor = static_cast(cookie); - deathMonitor->serviceDied(); + std::shared_ptr monitor; + { + std::lock_guard guard(sCookiesMutex); + if (auto it = sCookies.find(reinterpret_cast(cookie)); it != sCookies.end()) { + monitor = it->second.lock(); + sCookies.erase(it); + } else { + LOG(INFO) + << "Service died, but cookie is no longer valid so there is nothing to notify."; + return; + } + } + if (monitor) { + LOG(INFO) << "Notifying DeathMonitor from serviceDied."; + monitor->serviceDied(); + } else { + LOG(INFO) << "Tried to notify DeathMonitor from serviceDied but could not promote."; + } } void DeathMonitor::add(IProtectedCallback* killable) const { @@ -57,12 +84,25 @@ void DeathMonitor::remove(IProtectedCallback* killable) const { mObjects.erase(removedIter); } +DeathMonitor::~DeathMonitor() { + // lock must be taken so object is not used in OnBinderDied" + std::lock_guard guard(sCookiesMutex); + sCookies.erase(kCookieKey); +} + nn::GeneralResult DeathHandler::create(std::shared_ptr object) { if (object == nullptr) { return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "utils::DeathHandler::create must have non-null object"; } - auto deathMonitor = std::make_shared(); + + std::shared_ptr deathMonitor; + { + std::lock_guard guard(sCookiesMutex); + deathMonitor = std::make_shared(sCookieKeyCounter++); + sCookies[deathMonitor->getCookieKey()] = deathMonitor; + } + auto deathRecipient = ndk::ScopedAIBinder_DeathRecipient( AIBinder_DeathRecipient_new(DeathMonitor::serviceDied)); @@ -70,8 +110,9 @@ nn::GeneralResult DeathHandler::create(std::shared_ptrisRemote()) { - const auto ret = ndk::ScopedAStatus::fromStatus(AIBinder_linkToDeath( - object->asBinder().get(), deathRecipient.get(), deathMonitor.get())); + const auto ret = ndk::ScopedAStatus::fromStatus( + AIBinder_linkToDeath(object->asBinder().get(), deathRecipient.get(), + reinterpret_cast(deathMonitor->getCookieKey()))); HANDLE_ASTATUS(ret) << "AIBinder_linkToDeath failed"; } @@ -91,8 +132,9 @@ DeathHandler::DeathHandler(std::shared_ptr object, DeathHandler::~DeathHandler() { if (kObject != nullptr && kDeathRecipient.get() != nullptr && kDeathMonitor != nullptr) { - const auto ret = ndk::ScopedAStatus::fromStatus(AIBinder_unlinkToDeath( - kObject->asBinder().get(), kDeathRecipient.get(), kDeathMonitor.get())); + const auto ret = ndk::ScopedAStatus::fromStatus( + AIBinder_unlinkToDeath(kObject->asBinder().get(), kDeathRecipient.get(), + reinterpret_cast(kDeathMonitor->getCookieKey()))); const auto maybeSuccess = handleTransportError(ret); if (!maybeSuccess.ok()) { LOG(ERROR) << maybeSuccess.error().message; diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp index 73727b3974..ffd3b8e5f1 100644 --- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp +++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp @@ -697,7 +697,8 @@ TEST_P(DeviceTest, prepareModelAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) @@ -846,7 +847,8 @@ TEST_P(DeviceTest, prepareModelWithConfigAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModelWithConfig(_, _, _)) @@ -970,7 +972,8 @@ TEST_P(DeviceTest, prepareModelFromCacheAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) From 37c395758d0c495d2122be19e1d4dbba93342ec2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 9 Apr 2024 21:50:41 +0000 Subject: [PATCH 115/161] Keep track of DeathMonitor cookies This change keeps track of the objects that the cookies points to so the serviceDied callback knows when it can use the cookie. Test: atest neuralnetworks_utils_hal_aidl_test Tets: atest NeuralNetworksTest_static Bug: 319210610 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:def7a3cf59fa17ba7faa9af14a24f4161bc276bd) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d6f965fab9739d35f69fd042a95e783dc1859f32) Merged-In: I418cbc6baa19aa702d9fd2e7d8096fe1a02b7794 Change-Id: I418cbc6baa19aa702d9fd2e7d8096fe1a02b7794 --- .../include/nnapi/hal/aidl/ProtectCallback.h | 11 ++++ .../aidl/utils/src/ProtectCallback.cpp | 56 ++++++++++++++++--- neuralnetworks/aidl/utils/test/DeviceTest.cpp | 6 +- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h index ab1108c182..558212d716 100644 --- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h +++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ProtectCallback.h @@ -37,6 +37,8 @@ namespace aidl::android::hardware::neuralnetworks::utils { // Thread safe class class DeathMonitor final { public: + explicit DeathMonitor(uintptr_t cookieKey) : kCookieKey(cookieKey) {} + static void serviceDied(void* cookie); void serviceDied(); // Precondition: `killable` must be non-null. @@ -44,9 +46,18 @@ class DeathMonitor final { // Precondition: `killable` must be non-null. void remove(hal::utils::IProtectedCallback* killable) const; + uintptr_t getCookieKey() const { return kCookieKey; } + + ~DeathMonitor(); + DeathMonitor(const DeathMonitor&) = delete; + DeathMonitor(DeathMonitor&&) noexcept = delete; + DeathMonitor& operator=(const DeathMonitor&) = delete; + DeathMonitor& operator=(DeathMonitor&&) noexcept = delete; + private: mutable std::mutex mMutex; mutable std::vector mObjects GUARDED_BY(mMutex); + const uintptr_t kCookieKey; }; class DeathHandler final { diff --git a/neuralnetworks/aidl/utils/src/ProtectCallback.cpp b/neuralnetworks/aidl/utils/src/ProtectCallback.cpp index 124641cbb8..b68e9755c7 100644 --- a/neuralnetworks/aidl/utils/src/ProtectCallback.cpp +++ b/neuralnetworks/aidl/utils/src/ProtectCallback.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -34,6 +35,16 @@ namespace aidl::android::hardware::neuralnetworks::utils { +namespace { + +// Only dereference the cookie if it's valid (if it's in this set) +// Only used with ndk +std::mutex sCookiesMutex; +uintptr_t sCookieKeyCounter GUARDED_BY(sCookiesMutex) = 0; +std::map> sCookies GUARDED_BY(sCookiesMutex); + +} // namespace + void DeathMonitor::serviceDied() { std::lock_guard guard(mMutex); std::for_each(mObjects.begin(), mObjects.end(), @@ -41,8 +52,24 @@ void DeathMonitor::serviceDied() { } void DeathMonitor::serviceDied(void* cookie) { - auto deathMonitor = static_cast(cookie); - deathMonitor->serviceDied(); + std::shared_ptr monitor; + { + std::lock_guard guard(sCookiesMutex); + if (auto it = sCookies.find(reinterpret_cast(cookie)); it != sCookies.end()) { + monitor = it->second.lock(); + sCookies.erase(it); + } else { + LOG(INFO) + << "Service died, but cookie is no longer valid so there is nothing to notify."; + return; + } + } + if (monitor) { + LOG(INFO) << "Notifying DeathMonitor from serviceDied."; + monitor->serviceDied(); + } else { + LOG(INFO) << "Tried to notify DeathMonitor from serviceDied but could not promote."; + } } void DeathMonitor::add(hal::utils::IProtectedCallback* killable) const { @@ -58,12 +85,25 @@ void DeathMonitor::remove(hal::utils::IProtectedCallback* killable) const { mObjects.erase(removedIter); } +DeathMonitor::~DeathMonitor() { + // lock must be taken so object is not used in OnBinderDied" + std::lock_guard guard(sCookiesMutex); + sCookies.erase(kCookieKey); +} + nn::GeneralResult DeathHandler::create(std::shared_ptr object) { if (object == nullptr) { return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "utils::DeathHandler::create must have non-null object"; } - auto deathMonitor = std::make_shared(); + + std::shared_ptr deathMonitor; + { + std::lock_guard guard(sCookiesMutex); + deathMonitor = std::make_shared(sCookieKeyCounter++); + sCookies[deathMonitor->getCookieKey()] = deathMonitor; + } + auto deathRecipient = ndk::ScopedAIBinder_DeathRecipient( AIBinder_DeathRecipient_new(DeathMonitor::serviceDied)); @@ -71,8 +111,9 @@ nn::GeneralResult DeathHandler::create(std::shared_ptrisRemote()) { - const auto ret = ndk::ScopedAStatus::fromStatus(AIBinder_linkToDeath( - object->asBinder().get(), deathRecipient.get(), deathMonitor.get())); + const auto ret = ndk::ScopedAStatus::fromStatus( + AIBinder_linkToDeath(object->asBinder().get(), deathRecipient.get(), + reinterpret_cast(deathMonitor->getCookieKey()))); HANDLE_ASTATUS(ret) << "AIBinder_linkToDeath failed"; } @@ -92,8 +133,9 @@ DeathHandler::DeathHandler(std::shared_ptr object, DeathHandler::~DeathHandler() { if (kObject != nullptr && kDeathRecipient.get() != nullptr && kDeathMonitor != nullptr) { - const auto ret = ndk::ScopedAStatus::fromStatus(AIBinder_unlinkToDeath( - kObject->asBinder().get(), kDeathRecipient.get(), kDeathMonitor.get())); + const auto ret = ndk::ScopedAStatus::fromStatus( + AIBinder_unlinkToDeath(kObject->asBinder().get(), kDeathRecipient.get(), + reinterpret_cast(kDeathMonitor->getCookieKey()))); const auto maybeSuccess = handleTransportError(ret); if (!maybeSuccess.ok()) { LOG(ERROR) << maybeSuccess.error().message; diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp index f121acaf7b..059f452540 100644 --- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp +++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp @@ -669,7 +669,8 @@ TEST(DeviceTest, prepareModelAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) @@ -792,7 +793,8 @@ TEST(DeviceTest, prepareModelFromCacheAsyncCrash) { const auto mockDevice = createMockDevice(); const auto device = Device::create(kName, mockDevice).value(); const auto ret = [&device]() { - DeathMonitor::serviceDied(device->getDeathMonitor()); + DeathMonitor::serviceDied( + reinterpret_cast(device->getDeathMonitor()->getCookieKey())); return ndk::ScopedAStatus::ok(); }; EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) From b3cefe3a5115e14e81d2badc622e483ab620bb51 Mon Sep 17 00:00:00 2001 From: Brian Duddie Date: Wed, 1 May 2024 14:21:01 -0700 Subject: [PATCH 116/161] Prevent event flag use after delete in example HAL Fixes: 323085916 Test: presubmit Change-Id: Ia455d7f83ff2b0056593eabf9f91359b97f9fc0b --- sensors/aidl/default/include/sensors-impl/Sensors.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sensors/aidl/default/include/sensors-impl/Sensors.h b/sensors/aidl/default/include/sensors-impl/Sensors.h index e270d9682e..2adbc9dfb4 100644 --- a/sensors/aidl/default/include/sensors-impl/Sensors.h +++ b/sensors/aidl/default/include/sensors-impl/Sensors.h @@ -119,6 +119,8 @@ class Sensors : public BnSensors, public ISensorsEventCallback { // Utility function to delete the Event Flag void deleteEventFlag() { + // Hold the lock to ensure we don't delete the flag while it's being used in postEvents() + std::lock_guard lock(mWriteLock); if (mEventQueueFlag != nullptr) { status_t status = EventFlag::deleteEventFlag(&mEventQueueFlag); if (status != OK) { From 9cb6bcfa65fdd52d1fc74f095c6480f6e64709d4 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 1 May 2024 16:23:02 -0700 Subject: [PATCH 117/161] Update documentation for display brightness. PowerHalService relies on VHAL to use property change event to communicate the display brightness. This CL updates the doc to be explicit about this requirement. Furthermore, getting PER_DISPLAY_BRIGHTNESS without specifying which port to get is confusing, so this CL also updates the doc. Test: None, no code change Bug: 336831738 Change-Id: Id4d0e7ff5fc065a53a38e831810470469563c3e6 --- ...oid.hardware.automotive.vehicle-types-meta.json | 4 ++-- .../automotive/vehicle/VehicleProperty.aidl | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 135f30a2b2..0dea16bddc 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -516,12 +516,12 @@ { "name": "DISPLAY_BRIGHTNESS", "value": 289409539, - "description": "Property to represent brightness of the display.\nSome cars have single control for the brightness of all displays and this property is to share change in that control. In cars which have displays whose brightness is controlled separately, they must use PER_DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nIf this is writable, android side can set this value when user changes display brightness from Settings. If this is read only, user may still change display brightness from Settings, but that must not be reflected to other displays." + "description": "Property to represent brightness of the display.\nSome cars have single control for the brightness of all displays and this property is to share change in that control. In cars which have displays whose brightness is controlled separately, they must use PER_DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nIf this is writable, android side can set this value when user changes display brightness from Settings. If this is read only, user may still change display brightness from Settings, but that must not be reflected to other displays.\nIf this is writable, writing this property must cause an on property change event even if the new display brightness is the same as the current value." }, { "name": "PER_DISPLAY_BRIGHTNESS", "value": 289475076, - "description": "Property to represent brightness of the displays which are controlled separately.\nSome cars have one or more displays whose brightness is controlled separately and this property is to inform the brightness of each passenger display. In cars where all displays' brightness is controlled together, they must use DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nThe display port uniquely identifies a physical connector on the device for display output, ranging from 0 to 255.\nint32Values[0] : display port int32Values[1] : brightness" + "description": "Property to represent brightness of the displays which are controlled separately.\nSome cars have one or more displays whose brightness is controlled separately and this property is to inform the brightness of each passenger display. In cars where all displays' brightness is controlled together, they must use DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nThe display port uniquely identifies a physical connector on the device for display output, ranging from 0 to 255.\nWriting this property must cause an on property change event that contains the same [display port, brightness] tuple even if the new display brightness is the same as the current value.\nTo get the display brightness for a specific display port, the GetValueRequest must contain a VehiclePropValue, which contains one int32Value: displayPort. Getting this property without specifying the the display port is undefined behavior.\nint32Values[0] : display port int32Values[1] : brightness" }, { "name": "Valet mode enabled", diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index ab8023dd2f..e54c179954 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1734,8 +1734,13 @@ enum VehicleProperty { * change display brightness from Settings, but that must not be reflected * to other displays. * + * If this is writable, writing this property must cause an on property + * change event even if the new display brightness is the same as the + * current value. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE + * @access VehiclePropertyAccess.READ * @version 2 */ DISPLAY_BRIGHTNESS = 0x0A03 + 0x10000000 + 0x01000000 @@ -1755,6 +1760,15 @@ enum VehicleProperty { * The display port uniquely identifies a physical connector on the device * for display output, ranging from 0 to 255. * + * Writing this property must cause an on property change event that + * contains the same [display port, brightness] tuple even if the new + * display brightness is the same as the current value. + * + * To get the display brightness for a specific display port, the + * GetValueRequest must contain a VehiclePropValue, which contains one + * int32Value: displayPort. Getting this property without specifying the + * the display port is undefined behavior. + * * int32Values[0] : display port * int32Values[1] : brightness * From 6b36415306977fc0938570c7922efb7c27d1fa54 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 2 May 2024 17:43:06 -0400 Subject: [PATCH 118/161] Remove unneccessary restriction Fixes: 338432622 Test: n/a doc only change Change-Id: Icf075be3b258793d3006ced2925ff32d34c90e40 --- .../aidl/android/hardware/graphics/common/PixelFormat.aidl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl index 2985212ed5..1117504c43 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl @@ -161,8 +161,7 @@ enum PixelFormat { * * The allocator should examine the usage bits passed in when allocating a * buffer with this format, and it should derive the pixel format from - * those usage flags. This format must never be used with any of the - * BufferUsage::CPU_* usage flags. + * those usage flags. * * Even when the internally chosen format has an alpha component, the * clients must assume the alpha vlaue to be 1.0. From e2ee7edefb1ac3550986e30a323f0ef3449de229 Mon Sep 17 00:00:00 2001 From: Eric Jeong Date: Mon, 6 May 2024 10:56:07 -0700 Subject: [PATCH 119/161] Bump up android.frameworks.automotive.powerpolicy version to 3 Flag: EXCEPT aidl version up Bug: 328846007 Test: build okay Change-Id: I8cc92969447445f114b7b44679cc3b49cd10d7bb --- automotive/audiocontrol/aidl/default/Android.bp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp index a48d22893e..fd7e167545 100644 --- a/automotive/audiocontrol/aidl/default/Android.bp +++ b/automotive/audiocontrol/aidl/default/Android.bp @@ -30,15 +30,14 @@ cc_binary { defaults: [ "latest_android_hardware_audio_common_ndk_shared", "latest_android_hardware_automotive_audiocontrol_ndk_shared", + "powerpolicyclient_defaults", ], shared_libs: [ "android.hardware.audio.common@7.0-enums", - "android.frameworks.automotive.powerpolicy-V2-ndk", "libbase", "libbinder_ndk", "libcutils", "liblog", - "libpowerpolicyclient", ], srcs: [ "AudioControl.cpp", From ced09a50dc8ab78e93571e85b111ff010edf106e Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Tue, 7 May 2024 10:15:01 -0700 Subject: [PATCH 120/161] Camera: VTS: Skip session characterstics test for older HAL getSessionCharacteristics test needs to be gated by HAL version. Bug: 339233213 Test: vendor testing Change-Id: Ib611ec64089eecab99f3b82c6c7c2826cfdb62c5 --- .../aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 31e8014a84..7447d124e9 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -299,6 +299,15 @@ TEST_P(CameraAidlTest, getSessionCharacteristics) { ASSERT_TRUE(ret.isOk()); ASSERT_NE(device, nullptr); + int32_t interfaceVersion = -1; + ret = device->getInterfaceVersion(&interfaceVersion); + ASSERT_TRUE(ret.isOk()); + bool supportSessionCharacteristics = + (interfaceVersion >= CAMERA_DEVICE_API_MINOR_VERSION_3); + if (!supportSessionCharacteristics) { + continue; + } + CameraMetadata meta; openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, &device /*out*/); From df7692133547c051389a7eda5a134f8e82dfa163 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 8 May 2024 17:37:42 +0000 Subject: [PATCH 121/161] Fix test of triggerEmergencyNetworkScan triggerEmergencyNetworkScan needs to be triggered after setEmergencyMode. Bug: 336706719 Test: atest VtsHalRadioTargetTest:PerInstance/RadioNetworkTest#triggerEmergencyNetworkScan/0_android_hardware_radio_network_IRadioNetwork_slot1 -- --abi arm64-v8a Change-Id: If32d594525bea3a4a4562e2b1070ef646744513f --- radio/aidl/vts/radio_network_test.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index fd8512f6a2..a98c0bfe3c 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -2195,6 +2195,18 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { serial = GetRandomSerialNumber(); + radio_network->setEmergencyMode(serial, EmergencyMode::EMERGENCY_WWAN); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + + serial = GetRandomSerialNumber(); + EmergencyNetworkScanTrigger scanRequest; scanRequest.accessNetwork = {AccessNetwork::EUTRAN}; scanRequest.scanType = EmergencyScanType::NO_PREFERENCE; @@ -2208,6 +2220,19 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + + // exit emergency mode for other tests + serial = GetRandomSerialNumber(); + + radio_network->exitEmergencyMode(serial); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); } /* From 82f23a89181442edf9973b7d01d24884a01f8641 Mon Sep 17 00:00:00 2001 From: Fangqiu Su Date: Fri, 10 May 2024 19:06:09 +0000 Subject: [PATCH 122/161] Update the imports to androidx.test.filters.* Bug: 316941721 Test: mmma . Change-Id: I668a01ef44cc5e6fca79498ad6885d3574046f58 --- automotive/vehicle/tools/translate_aidl_enums.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/tools/translate_aidl_enums.py b/automotive/vehicle/tools/translate_aidl_enums.py index d224f6fcc1..a7c1808250 100644 --- a/automotive/vehicle/tools/translate_aidl_enums.py +++ b/automotive/vehicle/tools/translate_aidl_enums.py @@ -110,7 +110,7 @@ import java.lang.annotation.RetentionPolicy; import static com.google.common.truth.Truth.assertWithMessage; -import android.test.suitebuilder.annotation.SmallTest; +import androidx.test.filters.SmallTest; import org.junit.Test; import org.junit.runner.RunWith; @@ -228,4 +228,4 @@ def main(): f.write("".join(parser.outputMsgCtsTest)) if __name__ == "__main__": - main() \ No newline at end of file + main() From 2af21312b1c7cf79df7abd188efd0bd7cbf9c574 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 13 May 2024 06:44:28 +0000 Subject: [PATCH 123/161] Added documentation for code explainability in SubscriptionManager VHAL Bug: 326314500 Test: presubmit Change-Id: If23c308ac8c3b50a4ec7b686b0cc860b29d8e8bb --- automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp index f1106eea54..b27c26a847 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp @@ -433,6 +433,9 @@ SubscriptionManager::getSubscribedClients(std::vector&& update } for (const auto& [client, callback] : mClientsByPropIdAreaId[propIdAreaId]) { + // if propId is on-change, propIdAreaId will not exist in mContSubConfigsByPropIdArea, + // returning an empty ContSubConfigs value for subConfigs i.e. with resolution = 0 and + // enableVur = false. auto& subConfigs = mContSubConfigsByPropIdArea[propIdAreaId]; // Clients must be sent different VehiclePropValues with different levels of granularity // as requested by the client using resolution. From 19e90fa289cbf8671dfa9650c0665d46d53d3065 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 13 May 2024 17:09:25 +0000 Subject: [PATCH 124/161] Make RenderEngine render to the same format as the readback buffer. Some device's readback buffers do not support alpha, so rendering golden images should also not use alpha. Bug: 335805098 Test: VtsHalGraphicsComposer3_ReadbackTest Change-Id: I153ea1707b9fd8113529b8c18fa90711acfad04e --- .../aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index d4ce3ba2b6..3d9253f917 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -59,10 +59,12 @@ class GraphicsCompositionTestBase : public ::testing::Test { EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + const auto format = getHasReadbackBuffer() ? mPixelFormat : common::PixelFormat::RGBA_8888; + ASSERT_NO_FATAL_FAILURE( mTestRenderEngine = std::unique_ptr(new TestRenderEngine( ::android::renderengine::RenderEngineCreationArgs::Builder() - .setPixelFormat(static_cast(common::PixelFormat::RGBA_8888)) + .setPixelFormat(static_cast(format)) .setImageCacheSize(TestRenderEngine::sMaxFrameBufferAcquireBuffers) .setEnableProtectedContext(false) .setPrecacheToneMapperShaderOnly(false) From 2c83e2a79957a53262ef1e81c8b35ccea3db4f19 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 15 May 2024 13:56:37 -0700 Subject: [PATCH 125/161] Initialize mAddExtraTestVendorConfigs to false. If we do not init, the initial value is undefined. Test: Local run Bug: 340947823 Flag: EXEMPT bugfix Change-Id: I18a3688a446dd969545e1fc2cb5f63210c3c02cd --- .../aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 644d1cd025..cd39df1168 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -184,7 +184,7 @@ class FakeVehicleHardware : public IVehicleHardware { std::unordered_set hvacPowerDependentProps; const bool mForceOverride; - bool mAddExtraTestVendorConfigs; + bool mAddExtraTestVendorConfigs = false; // Only used during initialization. JsonConfigLoader mLoader; From af54782a2ad701b7f7554f5fa3a472f759e5e3e6 Mon Sep 17 00:00:00 2001 From: Ying Wei Date: Fri, 17 May 2024 16:31:12 +0000 Subject: [PATCH 126/161] Improve log message. Add more information to the failure message: now it looks something like `Failed to get a callback for Display 0 switching from {Config 38: vsyncPeriod 4166666, minFrameIntervalNs 16666667} to {Config 37: vsyncPeriod 8333333, minFrameIntervalNs 8333333}` instead of `failed to get a callback for the display 0 with config 37` Test: atest VtsHalGraphicsComposer3_TargetTest:PerInstance/GraphicsComposerAidlCommandV2Test#SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints/0_android_hardware_graphics_composer3_IComposer_default Bug: 340971724 Change-Id: Id2a1030a9b12e86bda8f6031e79a8374227f4061 --- graphics/composer/aidl/vts/VtsComposerClient.h | 14 ++++++++++++++ .../vts/VtsHalGraphicsComposer3_TargetTest.cpp | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index d3842c55c6..da6116f7b1 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -288,6 +288,20 @@ class VtsDisplay { return false; } + std::string printConfig(int config) { + const auto displayConfig = getDisplayConfig(config); + const auto vrrConfigOpt = displayConfig.vrrConfigOpt; + std::stringstream ss; + if (displayConfig.vrrConfigOpt) { + ss << "{Config " << config << ": vsyncPeriod " << displayConfig.vsyncPeriod + << ", minFrameIntervalNs " << vrrConfigOpt->minFrameIntervalNs << "}"; + } + else { + ss << "{Config " << config << ": vsyncPeriod " << displayConfig.vsyncPeriod << "}"; + } + return ss.str(); + } + std::unordered_map getDisplayConfigs() { return mDisplayConfigs; } private: diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 0227e39aa4..ba15421ebd 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2877,8 +2877,9 @@ TEST_P(GraphicsComposerAidlCommandV2Test, } while (--retryCount > 0); if (retryCount == 0) { - GTEST_FAIL() << "failed to get a callback for the display " << displayId - << " with config " << config2; + GTEST_FAIL() << "Failed to get a callback for Display " << displayId + << " switching from " << display.printConfig(config1) + << " to " << display.printConfig(config2); } }); From 9d3513882ae42d50c7243e131916a03ef203840f Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 15 May 2024 10:49:20 -0700 Subject: [PATCH 127/161] Add host_supported to VHAL libs. We need to build a FakeVehicleHardware impl on host, thus we need to add the host_supported option. Test: Local build on host. Bug: 328316981 Change-Id: Ia21d26640c465846423cab1a0ff8a283c798b92a --- automotive/vehicle/aidl/Android.bp | 2 +- .../aidl/generated_lib/3/cpp/Android.bp | 1 + .../aidl/generated_lib/4/cpp/Android.bp | 2 + .../JsonConfigLoader/Android.bp | 1 + .../impl/fake_impl/GeneratorHub/Android.bp | 1 + .../aidl/impl/fake_impl/hardware/Android.bp | 1 + .../hardware/include/FakeVehicleHardware.h | 2 +- .../hardware/src/FakeVehicleHardware.cpp | 52 +++++++++++-------- .../aidl/impl/fake_impl/obd2frame/Android.bp | 1 + .../aidl/impl/fake_impl/userhal/Android.bp | 1 + automotive/vehicle/aidl/impl/grpc/Android.bp | 1 + .../utils/proto_message_converter/Android.bp | 1 + .../vehicle/aidl/impl/hardware/Android.bp | 1 + .../vehicle/aidl/impl/utils/common/Android.bp | 2 + .../utils/common/src/VehiclePropertyStore.cpp | 4 +- automotive/vehicle/aidl_property/Android.bp | 1 + 16 files changed, 48 insertions(+), 26 deletions(-) diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp index ed18ebcb4b..ce9e7a1b35 100644 --- a/automotive/vehicle/aidl/Android.bp +++ b/automotive/vehicle/aidl/Android.bp @@ -60,5 +60,5 @@ aidl_interface { }, ], - + host_supported: true, } diff --git a/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp b/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp index 83043e58d9..7ff27a4660 100644 --- a/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp +++ b/automotive/vehicle/aidl/generated_lib/3/cpp/Android.bp @@ -24,4 +24,5 @@ cc_library_headers { local_include_dirs: ["."], export_include_dirs: ["."], defaults: ["VehicleHalInterfaceDefaults"], + host_supported: true, } diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp b/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp index 6ece865d2e..5bee849c11 100644 --- a/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/Android.bp @@ -24,6 +24,7 @@ cc_library_headers { local_include_dirs: ["."], export_include_dirs: ["."], defaults: ["VehicleHalInterfaceDefaults"], + host_supported: true, } cc_library_headers { @@ -32,4 +33,5 @@ cc_library_headers { local_include_dirs: ["."], export_include_dirs: ["."], defaults: ["VehicleHalInterfaceDefaults"], + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp index 0a33e5b85d..28c95cef85 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp @@ -49,6 +49,7 @@ cc_library { ], cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], shared_libs: ["libjsoncpp"], + host_supported: true, } cc_library_headers { diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp index ab223d3f94..a250a4774b 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp @@ -32,4 +32,5 @@ cc_library { shared_libs: [ "libjsoncpp", ], + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp index 5fc07c947a..6030e158ab 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp @@ -37,6 +37,7 @@ cc_library { whole_static_libs: [ "wakeup_client_protos", ], + host_supported: true, } cc_defaults { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index cd39df1168..583e40b369 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -206,7 +206,7 @@ class FakeVehicleHardware : public IVehicleHardware { EXCLUDES(mLock); // Load the config files in format '*.json' from the directory and parse the config files // into a map from property ID to ConfigDeclarations. - void loadPropConfigsFromDir(const std::string& dirPath, + bool loadPropConfigsFromDir(const std::string& dirPath, std::unordered_map* configs); // Function to be called when a value change event comes from vehicle bus. In our fake // implementation, this function is only called during "--inject-event" dump command. diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index c4bcdb39ab..9b880cd8ad 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -363,7 +363,12 @@ bool FakeVehicleHardware::UseOverrideConfigDir() { std::unordered_map FakeVehicleHardware::loadConfigDeclarations() { std::unordered_map configsByPropId; - loadPropConfigsFromDir(mDefaultConfigDir, &configsByPropId); + bool defaultConfigLoaded = loadPropConfigsFromDir(mDefaultConfigDir, &configsByPropId); + if (!defaultConfigLoaded) { + // This cannot work without a valid default config. + ALOGE("Failed to load default config, exiting"); + exit(1); + } if (UseOverrideConfigDir()) { loadPropConfigsFromDir(mOverrideConfigDir, &configsByPropId); } @@ -2378,30 +2383,35 @@ void FakeVehicleHardware::onValuesChangeCallback(std::vector v (*mOnPropertyChangeCallback)(std::move(subscribedUpdatedValues)); } -void FakeVehicleHardware::loadPropConfigsFromDir( +bool FakeVehicleHardware::loadPropConfigsFromDir( const std::string& dirPath, std::unordered_map* configsByPropId) { ALOGI("loading properties from %s", dirPath.c_str()); - if (auto dir = opendir(dirPath.c_str()); dir != NULL) { - std::regex regJson(".*[.]json", std::regex::icase); - while (auto f = readdir(dir)) { - if (!std::regex_match(f->d_name, regJson)) { - continue; - } - std::string filePath = dirPath + "/" + std::string(f->d_name); - ALOGI("loading properties from %s", filePath.c_str()); - auto result = mLoader.loadPropConfig(filePath); - if (!result.ok()) { - ALOGE("failed to load config file: %s, error: %s", filePath.c_str(), - result.error().message().c_str()); - continue; - } - for (auto& [propId, configDeclaration] : result.value()) { - (*configsByPropId)[propId] = std::move(configDeclaration); - } - } - closedir(dir); + auto dir = opendir(dirPath.c_str()); + if (dir == nullptr) { + ALOGE("Failed to open config directory: %s", dirPath.c_str()); + return false; } + + std::regex regJson(".*[.]json", std::regex::icase); + while (auto f = readdir(dir)) { + if (!std::regex_match(f->d_name, regJson)) { + continue; + } + std::string filePath = dirPath + "/" + std::string(f->d_name); + ALOGI("loading properties from %s", filePath.c_str()); + auto result = mLoader.loadPropConfig(filePath); + if (!result.ok()) { + ALOGE("failed to load config file: %s, error: %s", filePath.c_str(), + result.error().message().c_str()); + continue; + } + for (auto& [propId, configDeclaration] : result.value()) { + (*configsByPropId)[propId] = std::move(configDeclaration); + } + } + closedir(dir); + return true; } Result FakeVehicleHardware::safelyParseFloat(int index, const std::string& s) { diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp index c1cee84e63..8fc7341fb8 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp @@ -29,4 +29,5 @@ cc_library { "VehicleHalUtils", ], export_static_lib_headers: ["VehicleHalUtils"], + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp index 2e955315cd..181fd10de5 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp @@ -29,4 +29,5 @@ cc_library { "VehicleHalUtils", ], export_static_lib_headers: ["VehicleHalUtils"], + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/grpc/Android.bp b/automotive/vehicle/aidl/impl/grpc/Android.bp index e5106f8da3..fd1d1ca75a 100644 --- a/automotive/vehicle/aidl/impl/grpc/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/Android.bp @@ -127,4 +127,5 @@ cc_library_static { cflags: [ "-Wno-unused-parameter", ], + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp index 52ef7beefb..d10aa3e67f 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp @@ -39,6 +39,7 @@ cc_library { ], defaults: ["VehicleHalDefaults"], export_static_lib_headers: ["VehicleHalUtils"], + host_supported: true, } cc_test { diff --git a/automotive/vehicle/aidl/impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/hardware/Android.bp index edb0f29862..52fd5e43df 100644 --- a/automotive/vehicle/aidl/impl/hardware/Android.bp +++ b/automotive/vehicle/aidl/impl/hardware/Android.bp @@ -30,4 +30,5 @@ cc_library_headers { export_header_lib_headers: [ "VehicleHalUtilHeaders", ], + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/utils/common/Android.bp b/automotive/vehicle/aidl/impl/utils/common/Android.bp index e5d9346da4..5cd07b4417 100644 --- a/automotive/vehicle/aidl/impl/utils/common/Android.bp +++ b/automotive/vehicle/aidl/impl/utils/common/Android.bp @@ -25,10 +25,12 @@ cc_library { local_include_dirs: ["include"], export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], + host_supported: true, } cc_library_headers { name: "VehicleHalUtilHeaders", export_include_dirs: ["include"], vendor: true, + host_supported: true, } diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp index 97efdf6927..a7caeb112e 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp @@ -172,9 +172,7 @@ VhalResult VehiclePropertyStore::writeValue(VehiclePropValuePool::Recyclab } if (onValuesChangeCallback == nullptr && onValueChangeCallback == nullptr) { - ALOGW("No callback registered, ignoring property update for propId: %" PRId32 - ", area ID: %" PRId32, - propId, areaId); + // No callback registered. return {}; } diff --git a/automotive/vehicle/aidl_property/Android.bp b/automotive/vehicle/aidl_property/Android.bp index bce22846af..2aaf6b6b96 100644 --- a/automotive/vehicle/aidl_property/Android.bp +++ b/automotive/vehicle/aidl_property/Android.bp @@ -61,6 +61,7 @@ aidl_interface { }, ], + host_supported: true, } filegroup { From f1a869055fcd6ea980e329e86d71ace715427d30 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 16 May 2024 15:39:51 -0700 Subject: [PATCH 128/161] Add subscribe to VHAL proto. The latest IVehicleHardware adds Subscribe/Unsubscribe function to replace the existing updateSampleRate. This CL adds the Subscribe function to protobuf definition and implements it. Test: atest GRPCVehicleHardwareUnitTest GRPCVehicleProxyServerUnitTest Flag: EXEMPT hal change Bug: 328316981 Change-Id: I4f02885b77f21a215a8b282be583f76118e400ba --- automotive/vehicle/TEST_MAPPING | 5 + automotive/vehicle/aidl/impl/grpc/Android.bp | 3 +- .../aidl/impl/grpc/GRPCVehicleHardware.cpp | 25 ++++ .../aidl/impl/grpc/GRPCVehicleHardware.h | 7 +- .../aidl/impl/grpc/GRPCVehicleProxyServer.cpp | 11 ++ .../aidl/impl/grpc/GRPCVehicleProxyServer.h | 3 + .../aidl/impl/grpc/proto/VehicleServer.proto | 3 + .../grpc/test/GRPCVehicleHardwareUnitTest.cpp | 90 +++++++++++++++ .../test/GRPCVehicleProxyServerUnitTest.cpp | 109 +++++++++++++++--- .../utils/proto_message_converter/Android.bp | 8 +- .../include/ProtoMessageConverter.h | 7 ++ .../src/ProtoMessageConverter.cpp | 18 +++ .../test/proto_message_converter_test.cpp | 16 +++ automotive/vehicle/aidl/impl/proto/Android.bp | 4 + .../automotive/vehicle/SubscribeOptions.proto | 27 +++++ .../automotive/vehicle/SubscribeRequest.proto | 25 ++++ 16 files changed, 337 insertions(+), 24 deletions(-) create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeOptions.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeRequest.proto diff --git a/automotive/vehicle/TEST_MAPPING b/automotive/vehicle/TEST_MAPPING index 7306b47fa8..77629a9d07 100644 --- a/automotive/vehicle/TEST_MAPPING +++ b/automotive/vehicle/TEST_MAPPING @@ -55,5 +55,10 @@ { "name": "VehicleHalProtoMessageConverterTest" } + ], + "postsubmit": [ + { + "name": "VehicleHalProtoMessageConverterTest" + } ] } diff --git a/automotive/vehicle/aidl/impl/grpc/Android.bp b/automotive/vehicle/aidl/impl/grpc/Android.bp index fd1d1ca75a..7a8da59074 100644 --- a/automotive/vehicle/aidl/impl/grpc/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/Android.bp @@ -22,7 +22,7 @@ genrule { "aprotoc", "protoc-gen-grpc-cpp-plugin", ], - cmd: "$(location aprotoc) -I$$(dirname $(location proto/VehicleServer.proto)) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/VehicleServer.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)", + cmd: "$(location aprotoc) -I$$(dirname $(location proto/VehicleServer.proto)) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/VehicleServer.proto) --grpc_opt=generate_mock_code=true --grpc_out=$(genDir) --cpp_out=$(genDir)", srcs: [ "proto/VehicleServer.proto", ":libprotobuf-internal-protos", @@ -31,6 +31,7 @@ genrule { out: [ "VehicleServer.pb.h", "VehicleServer.grpc.pb.h", + "VehicleServer_mock.grpc.pb.h", ], visibility: ["//visibility:private"], } diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp index 07422835d2..2e5d2e46c3 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp @@ -39,6 +39,13 @@ GRPCVehicleHardware::GRPCVehicleHardware(std::string service_addr) mGrpcStub(proto::VehicleServer::NewStub(mGrpcChannel)), mValuePollingThread([this] { ValuePollingLoop(); }) {} +// Only used for unit testing. +GRPCVehicleHardware::GRPCVehicleHardware(std::unique_ptr stub) + : mServiceAddr(""), + mGrpcChannel(nullptr), + mGrpcStub(std::move(stub)), + mValuePollingThread([] {}) {} + GRPCVehicleHardware::~GRPCVehicleHardware() { { std::lock_guard lck(mShutdownMutex); @@ -181,6 +188,24 @@ aidlvhal::StatusCode GRPCVehicleHardware::checkHealth() { return static_cast(protoStatus.status_code()); } +aidlvhal::StatusCode GRPCVehicleHardware::subscribe(aidlvhal::SubscribeOptions options) { + proto::SubscribeRequest request; + ::grpc::ClientContext context; + proto::VehicleHalCallStatus protoStatus; + proto_msg_converter::aidlToProto(options, request.mutable_options()); + auto grpc_status = mGrpcStub->Subscribe(&context, request, &protoStatus); + if (!grpc_status.ok()) { + if (grpc_status.error_code() == ::grpc::StatusCode::UNIMPLEMENTED) { + // This is a legacy sever. It should handle updateSampleRate. + LOG(INFO) << __func__ << ": GRPC Subscribe is not supported by the server"; + return aidlvhal::StatusCode::OK; + } + LOG(ERROR) << __func__ << ": GRPC Subscribe Failed: " << grpc_status.error_message(); + return aidlvhal::StatusCode::INTERNAL_ERROR; + } + return static_cast(protoStatus.status_code()); +} + aidlvhal::StatusCode GRPCVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) { ::grpc::ClientContext context; diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h index ddd620ea2e..bec957cc97 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h @@ -43,6 +43,9 @@ class GRPCVehicleHardware : public IVehicleHardware { public: explicit GRPCVehicleHardware(std::string service_addr); + // Only used for unit testing. + explicit GRPCVehicleHardware(std::unique_ptr stub); + ~GRPCVehicleHardware(); // Get all the property configs. @@ -80,6 +83,8 @@ class GRPCVehicleHardware : public IVehicleHardware { aidlvhal::StatusCode updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) override; + aidlvhal::StatusCode subscribe(aidlvhal::SubscribeOptions options) override; + bool waitForConnected(std::chrono::milliseconds waitTime); protected: @@ -91,7 +96,7 @@ class GRPCVehicleHardware : public IVehicleHardware { std::string mServiceAddr; std::shared_ptr<::grpc::Channel> mGrpcChannel; - std::unique_ptr mGrpcStub; + std::unique_ptr mGrpcStub; std::thread mValuePollingThread; std::unique_ptr mOnSetErr; diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp index af3dd595a1..558ab2f250 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp @@ -164,6 +164,17 @@ GrpcVehicleProxyServer::GrpcVehicleProxyServer(std::string serverAddr, return ::grpc::Status::OK; } +::grpc::Status GrpcVehicleProxyServer::Subscribe(::grpc::ServerContext* context, + const proto::SubscribeRequest* request, + proto::VehicleHalCallStatus* status) { + const auto& protoSubscribeOptions = request->options(); + aidlvhal::SubscribeOptions aidlSubscribeOptions = {}; + proto_msg_converter::protoToAidl(protoSubscribeOptions, &aidlSubscribeOptions); + const auto status_code = mHardware->subscribe(aidlSubscribeOptions); + status->set_status_code(static_cast(status_code)); + return ::grpc::Status::OK; +} + ::grpc::Status GrpcVehicleProxyServer::CheckHealth(::grpc::ServerContext* context, const ::google::protobuf::Empty*, proto::VehicleHalCallStatus* status) { diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h index 3596354539..4f0c1e4bcb 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h @@ -57,6 +57,9 @@ class GrpcVehicleProxyServer : public proto::VehicleServer::Service { const proto::UpdateSampleRateRequest* request, proto::VehicleHalCallStatus* status) override; + ::grpc::Status Subscribe(::grpc::ServerContext* context, const proto::SubscribeRequest* request, + proto::VehicleHalCallStatus* status) override; + ::grpc::Status CheckHealth(::grpc::ServerContext* context, const ::google::protobuf::Empty*, proto::VehicleHalCallStatus* status) override; diff --git a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto index 22b11d8c87..d4b5642c06 100644 --- a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto +++ b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto @@ -20,6 +20,7 @@ package android.hardware.automotive.vehicle.proto; import "android/hardware/automotive/vehicle/DumpOptions.proto"; import "android/hardware/automotive/vehicle/DumpResult.proto"; +import "android/hardware/automotive/vehicle/SubscribeRequest.proto"; import "android/hardware/automotive/vehicle/StatusCode.proto"; import "android/hardware/automotive/vehicle/VehiclePropConfig.proto"; import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; @@ -40,4 +41,6 @@ service VehicleServer { rpc Dump(DumpOptions) returns (DumpResult) {} rpc StartPropertyValuesStream(google.protobuf.Empty) returns (stream VehiclePropValues) {} + + rpc Subscribe(SubscribeRequest) returns (VehicleHalCallStatus) {} } diff --git a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp index f578021f1b..24f078e524 100644 --- a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp @@ -15,6 +15,7 @@ #include "GRPCVehicleHardware.h" #include "VehicleServer.grpc.pb.h" #include "VehicleServer.pb.h" +#include "VehicleServer_mock.grpc.pb.h" #include #include @@ -26,6 +27,17 @@ namespace android::hardware::automotive::vehicle::virtualization { +namespace aidlvhal = ::aidl::android::hardware::automotive::vehicle; + +using ::testing::_; +using ::testing::DoAll; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::SaveArg; +using ::testing::SetArgPointee; + +using proto::MockVehicleServerStub; + const std::string kFakeServerAddr = "0.0.0.0:54321"; class FakeVehicleServer : public proto::VehicleServer::Service { @@ -91,4 +103,82 @@ TEST(GRPCVehicleHardwareUnitTest, Reconnect) { } } +class GRPCVehicleHardwareMockServerUnitTest : public ::testing::Test { + protected: + NiceMock* mGrpcStub; + std::unique_ptr mHardware; + + void SetUp() override { + auto stub = std::make_unique>(); + ; + mGrpcStub = stub.get(); + mHardware = std::make_unique(std::move(stub)); + } + + void TearDown() override { mHardware.reset(); } +}; + +MATCHER_P(RepeatedInt32Eq, expected_values, "") { + return std::vector(arg.begin(), arg.end()) == expected_values; +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, Subscribe) { + proto::VehicleHalCallStatus protoStatus; + protoStatus.set_status_code(proto::StatusCode::OK); + proto::SubscribeRequest actualRequest; + + EXPECT_CALL(*mGrpcStub, Subscribe(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&actualRequest), SetArgPointee<2>(protoStatus), + Return(::grpc::Status::OK))); + + aidlvhal::SubscribeOptions options = {.propId = 1, + .areaIds = {1, 2, 3, 4}, + .sampleRate = 1.234, + .resolution = 0.01, + .enableVariableUpdateRate = true}; + auto status = mHardware->subscribe(options); + + EXPECT_EQ(status, aidlvhal::StatusCode::OK); + const auto& protoOptions = actualRequest.options(); + EXPECT_EQ(protoOptions.prop_id(), 1); + EXPECT_THAT(protoOptions.area_ids(), RepeatedInt32Eq(std::vector({1, 2, 3, 4}))); + EXPECT_FLOAT_EQ(protoOptions.sample_rate(), 1.234); + EXPECT_FLOAT_EQ(protoOptions.resolution(), 0.01); + EXPECT_EQ(protoOptions.enable_variable_update_rate(), true); +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, SubscribeLegacyServer) { + EXPECT_CALL(*mGrpcStub, Subscribe(_, _, _)) + .WillOnce(Return(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""))); + + aidlvhal::SubscribeOptions options; // Your options here (consider adding sample data) + auto status = mHardware->subscribe(options); + + EXPECT_EQ(status, aidlvhal::StatusCode::OK); +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, SubscribeGrpcFailure) { + EXPECT_CALL(*mGrpcStub, Subscribe(_, _, _)) + .WillOnce(Return(::grpc::Status(::grpc::StatusCode::INTERNAL, "GRPC Error"))); + + aidlvhal::SubscribeOptions options; + auto status = mHardware->subscribe(options); + + EXPECT_EQ(status, aidlvhal::StatusCode::INTERNAL_ERROR); +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, SubscribeProtoFailure) { + proto::VehicleHalCallStatus protoStatus; + protoStatus.set_status_code(proto::StatusCode::NOT_AVAILABLE_SPEED_LOW); + + EXPECT_CALL(*mGrpcStub, Subscribe(_, _, _)) + .WillOnce(DoAll(SetArgPointee<2>(protoStatus), // Set the output status + Return(::grpc::Status::OK))); + + aidlvhal::SubscribeOptions options; + auto status = mHardware->subscribe(options); + + EXPECT_EQ(status, aidlvhal::StatusCode::NOT_AVAILABLE_SPEED_LOW); +} + } // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp index 49e6fc9d21..61dabb9ed2 100644 --- a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp @@ -30,6 +30,13 @@ namespace android::hardware::automotive::vehicle::virtualization { +namespace aidlvhal = ::aidl::android::hardware::automotive::vehicle; + +using ::testing::_; +using ::testing::DoAll; +using ::testing::Return; +using ::testing::SaveArg; + const std::string kFakeServerAddr = "0.0.0.0:54321"; class VehicleHardwareForTest : public IVehicleHardware { @@ -39,38 +46,30 @@ class VehicleHardwareForTest : public IVehicleHardware { mOnProp = std::move(callback); } - void onPropertyEvent( - std::vector values) { + void onPropertyEvent(std::vector values) { if (mOnProp) { (*mOnProp)(std::move(values)); } } // Functions that we do not care. - std::vector - getAllPropertyConfigs() const override { - return {}; - } + std::vector getAllPropertyConfigs() const override { return {}; } - aidl::android::hardware::automotive::vehicle::StatusCode setValues( + aidlvhal::StatusCode setValues( std::shared_ptr callback, - const std::vector& - requests) override { - return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + const std::vector& requests) override { + return aidlvhal::StatusCode::OK; } - aidl::android::hardware::automotive::vehicle::StatusCode getValues( + aidlvhal::StatusCode getValues( std::shared_ptr callback, - const std::vector& - requests) const override { - return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + const std::vector& requests) const override { + return aidlvhal::StatusCode::OK; } DumpResult dump(const std::vector& options) override { return {}; } - aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override { - return aidl::android::hardware::automotive::vehicle::StatusCode::OK; - } + aidlvhal::StatusCode checkHealth() override { return aidlvhal::StatusCode::OK; } void registerOnPropertySetErrorEvent( std::unique_ptr callback) override {} @@ -79,6 +78,35 @@ class VehicleHardwareForTest : public IVehicleHardware { std::unique_ptr mOnProp; }; +class MockVehicleHardware : public IVehicleHardware { + public: + // Mock methods from IVehicleHardware + MOCK_METHOD(std::vector, getAllPropertyConfigs, (), + (const, override)); + + MOCK_METHOD((aidlvhal::StatusCode), setValues, + (std::shared_ptr callback, + const std::vector& requests), + (override)); + + MOCK_METHOD((aidlvhal::StatusCode), getValues, + (std::shared_ptr callback, + const std::vector& requests), + (const, override)); + + MOCK_METHOD(DumpResult, dump, (const std::vector& options), (override)); + MOCK_METHOD(aidlvhal::StatusCode, checkHealth, (), (override)); + MOCK_METHOD(void, registerOnPropertyChangeEvent, + (std::unique_ptr callback), (override)); + MOCK_METHOD(void, registerOnPropertySetErrorEvent, + (std::unique_ptr callback), (override)); + MOCK_METHOD(std::chrono::nanoseconds, getPropertyOnChangeEventBatchingWindow, (), (override)); + MOCK_METHOD(aidlvhal::StatusCode, subscribe, (aidlvhal::SubscribeOptions options), (override)); + MOCK_METHOD(aidlvhal::StatusCode, unsubscribe, (int32_t propId, int32_t areaId), (override)); + MOCK_METHOD(aidlvhal::StatusCode, updateSampleRate, + (int32_t propId, int32_t areaId, float sampleRate), (override)); +}; + TEST(GRPCVehicleProxyServerUnitTest, ClientConnectDisconnect) { auto testHardware = std::make_unique(); // HACK: manipulate the underlying hardware via raw pointer for testing. @@ -144,4 +172,51 @@ TEST(GRPCVehicleProxyServerUnitTest, ClientConnectDisconnect) { vehicleServer->Shutdown().Wait(); } +TEST(GRPCVehicleProxyServerUnitTest, Subscribe) { + auto mockHardware = std::make_unique(); + // We make sure this is alive inside the function scope. + MockVehicleHardware* mockHardwarePtr = mockHardware.get(); + GrpcVehicleProxyServer server = GrpcVehicleProxyServer("", std::move(mockHardware)); + ::grpc::ServerContext context; + proto::SubscribeRequest request; + proto::VehicleHalCallStatus returnStatus; + aidlvhal::SubscribeOptions aidlOptions; + request.mutable_options()->set_prop_id(1); + request.mutable_options()->add_area_ids(2); + request.mutable_options()->set_sample_rate(1.234); + request.mutable_options()->set_resolution(0.01); + request.mutable_options()->set_enable_variable_update_rate(true); + + EXPECT_CALL(*mockHardwarePtr, subscribe(_)) + .WillOnce(DoAll(SaveArg<0>(&aidlOptions), Return(aidlvhal::StatusCode::OK))); + + auto grpcStatus = server.Subscribe(&context, &request, &returnStatus); + + EXPECT_TRUE(grpcStatus.ok()); + EXPECT_EQ(returnStatus.status_code(), proto::StatusCode::OK); + EXPECT_EQ(aidlOptions.propId, 1); + EXPECT_EQ(aidlOptions.areaIds, std::vector{2}); + EXPECT_FLOAT_EQ(aidlOptions.sampleRate, 1.234); + EXPECT_FLOAT_EQ(aidlOptions.resolution, 0.01); + EXPECT_TRUE(aidlOptions.enableVariableUpdateRate); +} + +TEST(GRPCVehicleProxyServerUnitTest, SubscribeNotAvailable) { + auto mockHardware = std::make_unique(); + // We make sure this is alive inside the function scope. + MockVehicleHardware* mockHardwarePtr = mockHardware.get(); + GrpcVehicleProxyServer server = GrpcVehicleProxyServer("", std::move(mockHardware)); + ::grpc::ServerContext context; + proto::SubscribeRequest request; + proto::VehicleHalCallStatus returnStatus; + + EXPECT_CALL(*mockHardwarePtr, subscribe(_)) + .WillOnce(Return(aidlvhal::StatusCode::NOT_AVAILABLE)); + + auto grpcStatus = server.Subscribe(&context, &request, &returnStatus); + + EXPECT_TRUE(grpcStatus.ok()); + EXPECT_EQ(returnStatus.status_code(), proto::StatusCode::NOT_AVAILABLE); +} + } // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp index d10aa3e67f..94c09aa149 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp @@ -42,23 +42,21 @@ cc_library { host_supported: true, } -cc_test { +cc_test_host { name: "VehicleHalProtoMessageConverterTest", srcs: [ "test/*.cpp", ], vendor: true, defaults: ["VehicleHalDefaults"], - shared_libs: [ - "libprotobuf-cpp-full", - "libjsoncpp", - ], static_libs: [ "VehicleHalJsonConfigLoaderEnableTestProperties", "VehicleHalProtoMessageConverter", "VehicleHalProtos", "VehicleHalUtils", "libgtest", + "libprotobuf-cpp-full", + "libjsoncpp", ], data: [ ":VehicleHalDefaultProperties_JSON", diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h index 1c26fe868b..25c07ef2ca 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h @@ -18,6 +18,7 @@ #define android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ #include +#include #include #include #include @@ -46,6 +47,12 @@ void aidlToProto(const ::aidl::android::hardware::automotive::vehicle::VehiclePr void protoToAidl( const ::android::hardware::automotive::vehicle::proto::VehiclePropValue& inProtoVal, ::aidl::android::hardware::automotive::vehicle::VehiclePropValue* outAidlVal); +// Convert AIDL SubscribeOptions to Protobuf SubscribeOptions. +void aidlToProto(const ::aidl::android::hardware::automotive::vehicle::SubscribeOptions& in, + ::android::hardware::automotive::vehicle::proto::SubscribeOptions* out); +// Convert Protobuf SubscribeOptions to AIDL SubscribeOptions. +void protoToAidl(const ::android::hardware::automotive::vehicle::proto::SubscribeOptions& in, + ::aidl::android::hardware::automotive::vehicle::SubscribeOptions* out); } // namespace proto_msg_converter } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp index 1ea0df4716..c40004a096 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp @@ -152,6 +152,24 @@ void protoToAidl(const proto::VehiclePropValue& in, aidl_vehicle::VehiclePropVal COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, float_values, out, value.floatValues); } +void aidlToProto(const aidl_vehicle::SubscribeOptions& in, proto::SubscribeOptions* out) { + out->set_prop_id(in.propId); + for (int areaId : in.areaIds) { + out->add_area_ids(areaId); + } + out->set_sample_rate(in.sampleRate); + out->set_resolution(in.resolution); + out->set_enable_variable_update_rate(in.enableVariableUpdateRate); +} + +void protoToAidl(const proto::SubscribeOptions& in, aidl_vehicle::SubscribeOptions* out) { + out->propId = in.prop_id(); + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, area_ids, out, areaIds); + out->sampleRate = in.sample_rate(); + out->resolution = in.resolution(); + out->enableVariableUpdateRate = in.enable_variable_update_rate(); +} + #undef COPY_PROTOBUF_VEC_TO_VHAL_TYPE #undef CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp index 308be4601a..2efda5b69a 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,21 @@ INSTANTIATE_TEST_SUITE_P(TestValues, PropValueConversionTest, return ::fmt::format("property_{:d}", info.param.prop); }); +TEST_F(PropValueConversionTest, testConvertSubscribeOption) { + proto::SubscribeOptions protoOptions; + aidl_vehicle::SubscribeOptions aidlOptions = {.propId = 1, + .areaIds = {1, 2}, + .sampleRate = 1.234, + .resolution = 0.01, + .enableVariableUpdateRate = true}; + aidl_vehicle::SubscribeOptions outputOptions; + + aidlToProto(aidlOptions, &protoOptions); + protoToAidl(protoOptions, &outputOptions); + + EXPECT_EQ(aidlOptions, outputOptions); +} + } // namespace proto_msg_converter } // namespace vehicle } // namespace automotive diff --git a/automotive/vehicle/aidl/impl/proto/Android.bp b/automotive/vehicle/aidl/impl/proto/Android.bp index 56fad7ed91..c636bb98d8 100644 --- a/automotive/vehicle/aidl/impl/proto/Android.bp +++ b/automotive/vehicle/aidl/impl/proto/Android.bp @@ -50,6 +50,8 @@ genrule { "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.h", "android/hardware/automotive/vehicle/VehiclePropValue.pb.h", "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.h", + "android/hardware/automotive/vehicle/SubscribeOptions.pb.h", + "android/hardware/automotive/vehicle/SubscribeRequest.pb.h", ], } @@ -74,6 +76,8 @@ genrule { "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.cc", "android/hardware/automotive/vehicle/VehiclePropValue.pb.cc", "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.cc", + "android/hardware/automotive/vehicle/SubscribeOptions.pb.cc", + "android/hardware/automotive/vehicle/SubscribeRequest.pb.cc", ], } diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeOptions.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeOptions.proto new file mode 100644 index 0000000000..3fc6581fcb --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeOptions.proto @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +message SubscribeOptions { + int32 prop_id = 1; + repeated int32 area_ids = 2; + float sample_rate = 3; + float resolution = 4; + bool enable_variable_update_rate = 5; +} \ No newline at end of file diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeRequest.proto new file mode 100644 index 0000000000..4ce63359e7 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/SubscribeRequest.proto @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2024 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/SubscribeOptions.proto"; + +message SubscribeRequest { + SubscribeOptions options = 1; +} \ No newline at end of file From 57e19cdcd89450a33d4f547c8494226e7354a099 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 25 Apr 2024 16:49:21 -0700 Subject: [PATCH 129/161] Add PER_DISPLAY_MAX_BRIGHTNESS VHAL property. Test: m -j android.hardware.automotive.vehicle.property-update-api Bug: 336831738 Change-Id: I16b874a0bad9ab446c4e000b1c3680363548849a --- automotive/vehicle/aidl/aidl_test/Android.bp | 2 +- ...ardware.automotive.vehicle-types-meta.json | 7 ++++- .../4/cpp/AccessForVehicleProperty.h | 1 + .../4/cpp/ChangeModeForVehicleProperty.h | 1 + .../4/cpp/VersionForVehicleProperty.h | 1 + .../4/java/AccessForVehicleProperty.java | 1 + .../4/java/ChangeModeForVehicleProperty.java | 1 + automotive/vehicle/aidl_property/Android.bp | 2 +- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 27 +++++++++++++++++++ .../compatibility_matrix.202504.xml | 2 +- 11 files changed, 42 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp index ea6a710031..f517df8018 100644 --- a/automotive/vehicle/aidl/aidl_test/Android.bp +++ b/automotive/vehicle/aidl/aidl_test/Android.bp @@ -40,7 +40,7 @@ cc_test { cc_test { name: "VehiclePropertyAnnotationCppTest", srcs: ["VehiclePropertyAnnotationCppTest.cpp"], - header_libs: ["IVehicleGeneratedHeaders"], + header_libs: ["IVehicleGeneratedHeaders-V3"], defaults: ["VehicleHalInterfaceDefaults"], test_suites: ["general-tests"], } diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json index 0dea16bddc..de0e3985c4 100644 --- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json @@ -521,7 +521,7 @@ { "name": "PER_DISPLAY_BRIGHTNESS", "value": 289475076, - "description": "Property to represent brightness of the displays which are controlled separately.\nSome cars have one or more displays whose brightness is controlled separately and this property is to inform the brightness of each passenger display. In cars where all displays' brightness is controlled together, they must use DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nThe display port uniquely identifies a physical connector on the device for display output, ranging from 0 to 255.\nWriting this property must cause an on property change event that contains the same [display port, brightness] tuple even if the new display brightness is the same as the current value.\nTo get the display brightness for a specific display port, the GetValueRequest must contain a VehiclePropValue, which contains one int32Value: displayPort. Getting this property without specifying the the display port is undefined behavior.\nint32Values[0] : display port int32Values[1] : brightness" + "description": "Property to represent brightness of the displays which are controlled separately.\nSome cars have one or more displays whose brightness is controlled separately and this property is to inform the brightness of each passenger display. In cars where all displays' brightness is controlled together, they must use DISPLAY_BRIGHTNESS.\nOnly one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by AAOS.\nIf this is supported, PER_DISPLAY_MAX_BRIGHTNESS must be supported to represent the max display brightness for each display. Otherwise, the max display brightness is by default 1. The VehicleAreaConfig.maxInt32Value must not be used to represent max display brightness, because maxInt32Value is defined to be the max value for all the elements inside the integer value, which includes display port and brightness. So it is not meaningful.\nThe display port uniquely identifies a physical connector on the device for display output, ranging from 0 to 255.\nWriting this property must cause an on property change event that contains the same [display port, brightness] tuple even if the new display brightness is the same as the current value.\nTo get the display brightness for a specific display port, the GetValueRequest must contain a VehiclePropValue, which contains one int32Value: displayPort. Getting this property without specifying the the display port is undefined behavior.\nint32Values[0] : display port int32Values[1] : brightness" }, { "name": "Valet mode enabled", @@ -1363,6 +1363,11 @@ "data_enum": "CameraServiceState", "description": "Reports current state of CarEvsService types.\nInforms other components of current state of each CarEvsService service type with values defined in CameraServiceState. CarEvsService will update this property whenever a service type transitions into a new state.\nint32[0]: Current state of REARVIEW service type. int32[1]: Current state of SURROUNDVIEW service type. int32[2]: Current state of FRONTVIEW service type. int32[3]: Current state of LEFTVIEW service type. int32[4]: Current state of RIGHTVIEW service type. int32[5]: Current state of DRIVERVIEW service type. int32[6]: Current state of FRONT_PASSENGERVIEW service type. int32[7]: Current state of REAR_PASSENGERVIEW service type." }, + { + "name": "PER_DISPLAY_MAX_BRIGHTNESS", + "value": 289476430, + "description": "Property to represent max brightness of the displays which are controlled separately.\nThis is only used if PER_DISPLAY_BRIGHTNESS is supported.\nThe display port uniquely identifies a physical connector on the device for display output, ranging from 0 to 255.\nint32Values[0] : display port number int32Values[1] : max brightness for display port number specified at int32Values[0] int32Values[2] : display port number int32Values[3] : max brightness for display port number specified at int32Values[2] ..." + }, { "name": "AUTOMATIC_EMERGENCY_BRAKING_ENABLED", "value": 287313920, diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h index 51a3025740..6d07fe5c00 100644 --- a/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/AccessForVehicleProperty.h @@ -263,6 +263,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyAccess::WRITE}, {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess::READ}, {VehicleProperty::CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::PER_DISPLAY_MAX_BRIGHTNESS, VehiclePropertyAccess::READ}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h index 60e9a72138..5ecee95708 100644 --- a/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/ChangeModeForVehicleProperty.h @@ -263,6 +263,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CLUSTER_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PER_DISPLAY_MAX_BRIGHTNESS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h index 0e80bd85b2..8b9c1bdf39 100644 --- a/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/4/cpp/VersionForVehicleProperty.h @@ -262,6 +262,7 @@ std::unordered_map VersionForVehicleProperty = { {VehicleProperty::CLUSTER_HEARTBEAT, 3}, {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, 3}, {VehicleProperty::CAMERA_SERVICE_CURRENT_STATE, 3}, + {VehicleProperty::PER_DISPLAY_MAX_BRIGHTNESS, 3}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, 2}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, 2}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, 2}, diff --git a/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java index afb6cab547..e9f35a5e9b 100644 --- a/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/4/java/AccessForVehicleProperty.java @@ -256,6 +256,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.PER_DISPLAY_MAX_BRIGHTNESS, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java index 12aff40b34..3fb52b771e 100644 --- a/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/4/java/ChangeModeForVehicleProperty.java @@ -256,6 +256,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CLUSTER_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CAMERA_SERVICE_CURRENT_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PER_DISPLAY_MAX_BRIGHTNESS, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl_property/Android.bp b/automotive/vehicle/aidl_property/Android.bp index 2aaf6b6b96..b8a978ba32 100644 --- a/automotive/vehicle/aidl_property/Android.bp +++ b/automotive/vehicle/aidl_property/Android.bp @@ -28,7 +28,7 @@ aidl_interface { // This HAL was originally part of android.hardware.automotive.vehicle "android/hardware/automotive/vehicle/*.aidl", ], - frozen: true, + frozen: false, stability: "vintf", backend: { cpp: { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index be8d3ac6ab..4c5dad23c8 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -262,6 +262,7 @@ enum VehicleProperty { CLUSTER_HEARTBEAT = (((0x0F4B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 299896651 */, VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL = (((0x0F4C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410892 */, CAMERA_SERVICE_CURRENT_STATE = (((0x0F4D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 289476429 */, + PER_DISPLAY_MAX_BRIGHTNESS = (((0x0F4E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 289476430 */, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313920 */, AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411073 */, FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313922 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index e54c179954..0863adf745 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1757,6 +1757,12 @@ enum VehicleProperty { * implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by * AAOS. * + * If this is supported, PER_DISPLAY_MAX_BRIGHTNESS must be supported to represent the max + * display brightness for each display. Otherwise, the max display brightness is by default 1. + * The VehicleAreaConfig.maxInt32Value must not be used to represent max display brightness, + * because maxInt32Value is defined to be the max value for all the elements inside the integer + * value, which includes display port and brightness. So it is not meaningful. + * * The display port uniquely identifies a physical connector on the device * for display output, ranging from 0 to 255. * @@ -5214,6 +5220,27 @@ enum VehicleProperty { CAMERA_SERVICE_CURRENT_STATE = 0x0F4D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32_VEC, + /** + * Property to represent max brightness of the displays which are controlled separately. + * + * This is only used if PER_DISPLAY_BRIGHTNESS is supported. + * + * The display port uniquely identifies a physical connector on the device + * for display output, ranging from 0 to 255. + * + * int32Values[0] : display port number + * int32Values[1] : max brightness for display port number specified at int32Values[0] + * int32Values[2] : display port number + * int32Values[3] : max brightness for display port number specified at int32Values[2] + * ... + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + * @version 3 + */ + PER_DISPLAY_MAX_BRIGHTNESS = 0x0F4E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + + VehiclePropertyType.INT32_VEC, + /*********************************************************************************************** * Start of ADAS Properties * diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml index 1f51d07968..0e714a4ebc 100644 --- a/compatibility_matrices/compatibility_matrix.202504.xml +++ b/compatibility_matrices/compatibility_matrix.202504.xml @@ -84,7 +84,7 @@ android.hardware.automotive.vehicle - 1-3 + 1-4 IVehicle default From f01c7aec0d7f7db784531a5ce18a87afa9e9c0f1 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 20 May 2024 13:03:41 -0700 Subject: [PATCH 130/161] Add require_root to FakeVehicleHardwareTest. According to b/329690075, vendor tests need root to use vendor lib, otherwise atest will cause link error. Test: atest FakeVehicleHardwareTest on cf_auto Flag: EXEMPT bug Bug: 341762230 Change-Id: I6bab19b20e6fe91dbdb2a6526172a5dd1d092ff5 --- automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp index 664c8775f6..9f002dd7cd 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp @@ -56,6 +56,8 @@ cc_test { defaults: [ "VehicleHalDefaults", ], + // Need root to use vendor lib: libgrpc++. + require_root: true, test_suites: ["device-tests"], } From 1c670114fdc25da7759050f5251e6ca11ebde472 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 17 May 2024 11:30:03 -0700 Subject: [PATCH 131/161] Add host prebuilt for fake VHAL config. Test: Local build Bug: 328316981 Flag: EXEMPT build rule Change-Id: I965e704e29e62cd05540f46ef37d0bfa2a5568db --- .../impl/default_config/config/Android.bp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/Android.bp b/automotive/vehicle/aidl/impl/default_config/config/Android.bp index 8f1c7d1a8e..c4f93c415d 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/config/Android.bp @@ -45,3 +45,24 @@ prebuilt_etc { sub_dir: "automotive/vhalconfig/", vendor: true, } + +prebuilt_etc_host { + name: "Host_Prebuilt_VehicleHalDefaultProperties_JSON", + filename_from_src: true, + src: "DefaultProperties.json", + relative_install_path: "automotive/vhalconfig/", +} + +prebuilt_etc_host { + name: "Host_Prebuilt_VehicleHalTestProperties_JSON", + filename_from_src: true, + src: "TestProperties.json", + relative_install_path: "automotive/vhalconfig/", +} + +prebuilt_etc_host { + name: "Host_Prebuilt_VehicleHalVendorClusterTestProperties_JSON", + filename_from_src: true, + src: "VendorClusterTestProperties.json", + relative_install_path: "automotive/vhalconfig/", +} From cb00b1f816670c291044087db9f88cb76a2a9b3e Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 20 May 2024 17:27:19 -0700 Subject: [PATCH 132/161] Implement Unsubscribe in vhal proxy. Implement the unsubscribe function in IVehicleHardware. This will stop the server from generating property update events for the specified [propId, areaId]. Test: atest GRPCVehicleHardwareUnitTest GRPCVehicleProxyServerUnitTest Flag: EXEMPT hal change Bug: 328316981 Change-Id: I35f4860eead0c8ec9b192657fe51cc0ff4319383 --- .../aidl/impl/grpc/GRPCVehicleHardware.cpp | 19 +++++++ .../aidl/impl/grpc/GRPCVehicleHardware.h | 2 + .../aidl/impl/grpc/GRPCVehicleProxyServer.cpp | 10 ++++ .../aidl/impl/grpc/GRPCVehicleProxyServer.h | 4 ++ .../aidl/impl/grpc/proto/VehicleServer.proto | 3 ++ .../grpc/test/GRPCVehicleHardwareUnitTest.cpp | 51 ++++++++++++++++++- .../test/GRPCVehicleProxyServerUnitTest.cpp | 19 +++++++ automotive/vehicle/aidl/impl/proto/Android.bp | 2 + .../vehicle/UnsubscribeRequest.proto | 24 +++++++++ 9 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/UnsubscribeRequest.proto diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp index 2e5d2e46c3..f44573ac8e 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp @@ -206,6 +206,25 @@ aidlvhal::StatusCode GRPCVehicleHardware::subscribe(aidlvhal::SubscribeOptions o return static_cast(protoStatus.status_code()); } +aidlvhal::StatusCode GRPCVehicleHardware::unsubscribe(int32_t propId, int32_t areaId) { + proto::UnsubscribeRequest request; + ::grpc::ClientContext context; + proto::VehicleHalCallStatus protoStatus; + request.set_prop_id(propId); + request.set_area_id(areaId); + auto grpc_status = mGrpcStub->Unsubscribe(&context, request, &protoStatus); + if (!grpc_status.ok()) { + if (grpc_status.error_code() == ::grpc::StatusCode::UNIMPLEMENTED) { + // This is a legacy sever. Ignore unsubscribe request. + LOG(INFO) << __func__ << ": GRPC Unsubscribe is not supported by the server"; + return aidlvhal::StatusCode::OK; + } + LOG(ERROR) << __func__ << ": GRPC Unsubscribe Failed: " << grpc_status.error_message(); + return aidlvhal::StatusCode::INTERNAL_ERROR; + } + return static_cast(protoStatus.status_code()); +} + aidlvhal::StatusCode GRPCVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) { ::grpc::ClientContext context; diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h index bec957cc97..9750f621e9 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h @@ -85,6 +85,8 @@ class GRPCVehicleHardware : public IVehicleHardware { aidlvhal::StatusCode subscribe(aidlvhal::SubscribeOptions options) override; + aidlvhal::StatusCode unsubscribe(int32_t propId, int32_t areaId) override; + bool waitForConnected(std::chrono::milliseconds waitTime); protected: diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp index 558ab2f250..a6abfa308b 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp @@ -175,6 +175,16 @@ GrpcVehicleProxyServer::GrpcVehicleProxyServer(std::string serverAddr, return ::grpc::Status::OK; } +::grpc::Status GrpcVehicleProxyServer::Unsubscribe(::grpc::ServerContext* context, + const proto::UnsubscribeRequest* request, + proto::VehicleHalCallStatus* status) { + int32_t propId = request->prop_id(); + int32_t areaId = request->area_id(); + const auto status_code = mHardware->unsubscribe(propId, areaId); + status->set_status_code(static_cast(status_code)); + return ::grpc::Status::OK; +} + ::grpc::Status GrpcVehicleProxyServer::CheckHealth(::grpc::ServerContext* context, const ::google::protobuf::Empty*, proto::VehicleHalCallStatus* status) { diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h index 4f0c1e4bcb..dd9e2aad4c 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h @@ -60,6 +60,10 @@ class GrpcVehicleProxyServer : public proto::VehicleServer::Service { ::grpc::Status Subscribe(::grpc::ServerContext* context, const proto::SubscribeRequest* request, proto::VehicleHalCallStatus* status) override; + ::grpc::Status Unsubscribe(::grpc::ServerContext* context, + const proto::UnsubscribeRequest* request, + proto::VehicleHalCallStatus* status) override; + ::grpc::Status CheckHealth(::grpc::ServerContext* context, const ::google::protobuf::Empty*, proto::VehicleHalCallStatus* status) override; diff --git a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto index d4b5642c06..732957f9f1 100644 --- a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto +++ b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto @@ -22,6 +22,7 @@ import "android/hardware/automotive/vehicle/DumpOptions.proto"; import "android/hardware/automotive/vehicle/DumpResult.proto"; import "android/hardware/automotive/vehicle/SubscribeRequest.proto"; import "android/hardware/automotive/vehicle/StatusCode.proto"; +import "android/hardware/automotive/vehicle/UnsubscribeRequest.proto"; import "android/hardware/automotive/vehicle/VehiclePropConfig.proto"; import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; import "android/hardware/automotive/vehicle/VehiclePropValueRequest.proto"; @@ -43,4 +44,6 @@ service VehicleServer { rpc StartPropertyValuesStream(google.protobuf.Empty) returns (stream VehiclePropValues) {} rpc Subscribe(SubscribeRequest) returns (VehicleHalCallStatus) {} + + rpc Unsubscribe(UnsubscribeRequest) returns (VehicleHalCallStatus) {} } diff --git a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp index 24f078e524..3bd7e0e56a 100644 --- a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp @@ -151,7 +151,7 @@ TEST_F(GRPCVehicleHardwareMockServerUnitTest, SubscribeLegacyServer) { EXPECT_CALL(*mGrpcStub, Subscribe(_, _, _)) .WillOnce(Return(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""))); - aidlvhal::SubscribeOptions options; // Your options here (consider adding sample data) + aidlvhal::SubscribeOptions options; auto status = mHardware->subscribe(options); EXPECT_EQ(status, aidlvhal::StatusCode::OK); @@ -181,4 +181,53 @@ TEST_F(GRPCVehicleHardwareMockServerUnitTest, SubscribeProtoFailure) { EXPECT_EQ(status, aidlvhal::StatusCode::NOT_AVAILABLE_SPEED_LOW); } +TEST_F(GRPCVehicleHardwareMockServerUnitTest, Unsubscribe) { + proto::VehicleHalCallStatus protoStatus; + protoStatus.set_status_code(proto::StatusCode::OK); + proto::UnsubscribeRequest actualRequest; + + EXPECT_CALL(*mGrpcStub, Unsubscribe(_, _, _)) + .WillOnce(DoAll(SaveArg<1>(&actualRequest), SetArgPointee<2>(protoStatus), + Return(::grpc::Status::OK))); + + int32_t propId = 1; + int32_t areaId = 2; + auto status = mHardware->unsubscribe(propId, areaId); + + EXPECT_EQ(status, aidlvhal::StatusCode::OK); + EXPECT_EQ(actualRequest.prop_id(), propId); + EXPECT_EQ(actualRequest.area_id(), areaId); +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, UnsubscribeLegacyServer) { + EXPECT_CALL(*mGrpcStub, Unsubscribe(_, _, _)) + .WillOnce(Return(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""))); + + auto status = mHardware->unsubscribe(1, 2); + + EXPECT_EQ(status, aidlvhal::StatusCode::OK); +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, UnsubscribeGrpcFailure) { + EXPECT_CALL(*mGrpcStub, Unsubscribe(_, _, _)) + .WillOnce(Return(::grpc::Status(::grpc::StatusCode::INTERNAL, "GRPC Error"))); + + auto status = mHardware->unsubscribe(1, 2); + + EXPECT_EQ(status, aidlvhal::StatusCode::INTERNAL_ERROR); +} + +TEST_F(GRPCVehicleHardwareMockServerUnitTest, UnsubscribeProtoFailure) { + proto::VehicleHalCallStatus protoStatus; + protoStatus.set_status_code(proto::StatusCode::NOT_AVAILABLE_SPEED_LOW); + + EXPECT_CALL(*mGrpcStub, Unsubscribe(_, _, _)) + .WillOnce(DoAll(SetArgPointee<2>(protoStatus), // Set the output status + Return(::grpc::Status::OK))); + + auto status = mHardware->unsubscribe(1, 2); + + EXPECT_EQ(status, aidlvhal::StatusCode::NOT_AVAILABLE_SPEED_LOW); +} + } // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp index 61dabb9ed2..ca5c2d5a2e 100644 --- a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp @@ -219,4 +219,23 @@ TEST(GRPCVehicleProxyServerUnitTest, SubscribeNotAvailable) { EXPECT_EQ(returnStatus.status_code(), proto::StatusCode::NOT_AVAILABLE); } +TEST(GRPCVehicleProxyServerUnitTest, Unsubscribe) { + auto mockHardware = std::make_unique(); + // We make sure this is alive inside the function scope. + MockVehicleHardware* mockHardwarePtr = mockHardware.get(); + GrpcVehicleProxyServer server = GrpcVehicleProxyServer("", std::move(mockHardware)); + ::grpc::ServerContext context; + proto::UnsubscribeRequest request; + proto::VehicleHalCallStatus returnStatus; + request.set_prop_id(1); + request.set_area_id(2); + + EXPECT_CALL(*mockHardwarePtr, unsubscribe(1, 2)).WillOnce(Return(aidlvhal::StatusCode::OK)); + + auto grpcStatus = server.Unsubscribe(&context, &request, &returnStatus); + + EXPECT_TRUE(grpcStatus.ok()); + EXPECT_EQ(returnStatus.status_code(), proto::StatusCode::OK); +} + } // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/proto/Android.bp b/automotive/vehicle/aidl/impl/proto/Android.bp index c636bb98d8..b2edf753b8 100644 --- a/automotive/vehicle/aidl/impl/proto/Android.bp +++ b/automotive/vehicle/aidl/impl/proto/Android.bp @@ -52,6 +52,7 @@ genrule { "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.h", "android/hardware/automotive/vehicle/SubscribeOptions.pb.h", "android/hardware/automotive/vehicle/SubscribeRequest.pb.h", + "android/hardware/automotive/vehicle/UnsubscribeRequest.pb.h", ], } @@ -78,6 +79,7 @@ genrule { "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.cc", "android/hardware/automotive/vehicle/SubscribeOptions.pb.cc", "android/hardware/automotive/vehicle/SubscribeRequest.pb.cc", + "android/hardware/automotive/vehicle/UnsubscribeRequest.pb.cc", ], } diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/UnsubscribeRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/UnsubscribeRequest.proto new file mode 100644 index 0000000000..314fbf0f65 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/UnsubscribeRequest.proto @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2024 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +message UnsubscribeRequest { + int32 prop_id = 1; + int32 area_id = 2; +} \ No newline at end of file From 8e84edaa582b7f7d692b10d5afd8ba3f6ce1c005 Mon Sep 17 00:00:00 2001 From: Alan Rosenthal Date: Tue, 21 May 2024 17:24:22 +0000 Subject: [PATCH 133/161] ComposerCommandBuffer.h: fix compiler warning ``` warning: format specifies type 'unsigned int' but the argument has type 'IComposerClient::Command' [-Wformat] ``` Change-Id: I9a585330ef1edd7675e6406318bd966b03c8a209 --- .../composer-command-buffer/2.1/ComposerCommandBuffer.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h index 336d15dc6c..6a4598727a 100644 --- a/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h +++ b/graphics/composer/2.1/utils/command-buffer/include/composer-command-buffer/2.1/ComposerCommandBuffer.h @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -649,7 +650,8 @@ class CommandReaderBase { *outLength = static_cast(val & length_mask); if (mDataRead + *outLength > mDataSize) { - ALOGE("command 0x%x has invalid command length %" PRIu16, *outCommand, *outLength); + ALOGE("command %s has invalid command length %" PRIu16, + toString(*outCommand).c_str(), *outLength); // undo the read() above mDataRead--; return false; From b0a66d9747cb118ad4d3e91341ced716da42dff0 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 23 May 2024 15:22:12 -0700 Subject: [PATCH 134/161] Lazy init property configs. This is the first step towards supporting delayed property config discovery. Right now this does not bring too much benefit since essential system service such as carwatchdog is still querying property conifg early in the boot process. In the future once we separate essential properties with non-essential properties, we can improve more. Test: atest DefaultVehicleHalTest Bug: 342470570 Change-Id: Ie85aa163fa9128aa061dd5b3221954c7acac050c --- .../impl/vhal/include/DefaultVehicleHal.h | 117 +++++++----------- .../aidl/impl/vhal/src/DefaultVehicleHal.cpp | 74 +++++++---- 2 files changed, 99 insertions(+), 92 deletions(-) diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h index 250b30cac6..fa2a310d4e 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h +++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h @@ -42,10 +42,11 @@ namespace hardware { namespace automotive { namespace vehicle { -class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehicle::BnVehicle { +namespace aidlvhal = ::aidl::android::hardware::automotive::vehicle; + +class DefaultVehicleHal final : public aidlvhal::BnVehicle { public: - using CallbackType = - std::shared_ptr; + using CallbackType = std::shared_ptr; explicit DefaultVehicleHal(std::unique_ptr hardware); @@ -54,26 +55,16 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi ~DefaultVehicleHal(); - ndk::ScopedAStatus getAllPropConfigs( - aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) - override; - ndk::ScopedAStatus getValues( - const CallbackType& callback, - const aidl::android::hardware::automotive::vehicle::GetValueRequests& requests) - override; - ndk::ScopedAStatus setValues( - const CallbackType& callback, - const aidl::android::hardware::automotive::vehicle::SetValueRequests& requests) - override; - ndk::ScopedAStatus getPropConfigs( - const std::vector& props, - aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) - override; - ndk::ScopedAStatus subscribe( - const CallbackType& callback, - const std::vector& - options, - int32_t maxSharedMemoryFileCount) override; + ndk::ScopedAStatus getAllPropConfigs(aidlvhal::VehiclePropConfigs* returnConfigs) override; + ndk::ScopedAStatus getValues(const CallbackType& callback, + const aidlvhal::GetValueRequests& requests) override; + ndk::ScopedAStatus setValues(const CallbackType& callback, + const aidlvhal::SetValueRequests& requests) override; + ndk::ScopedAStatus getPropConfigs(const std::vector& props, + aidlvhal::VehiclePropConfigs* returnConfigs) override; + ndk::ScopedAStatus subscribe(const CallbackType& callback, + const std::vector& options, + int32_t maxSharedMemoryFileCount) override; ndk::ScopedAStatus unsubscribe(const CallbackType& callback, const std::vector& propIds) override; ndk::ScopedAStatus returnSharedMemory(const CallbackType& callback, @@ -86,12 +77,8 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi // friend class for unit testing. friend class DefaultVehicleHalTest; - using GetValuesClient = - GetSetValuesClient; - using SetValuesClient = - GetSetValuesClient; + using GetValuesClient = GetSetValuesClient; + using SetValuesClient = GetSetValuesClient; // A wrapper for binder lifecycle operations to enable stubbing for test. class BinderLifecycleInterface { @@ -137,28 +124,27 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi bool mShouldRefreshPropertyConfigs; std::unique_ptr mVehicleHardware; - // mConfigsByPropId and mConfigFile are only modified during initialization, so no need to - // lock guard them. - std::unordered_map - mConfigsByPropId; - // Only modified in constructor, so thread-safe. - std::unique_ptr mConfigFile; // PendingRequestPool is thread-safe. std::shared_ptr mPendingRequestPool; // SubscriptionManager is thread-safe. std::shared_ptr mSubscriptionManager; // ConcurrentQueue is thread-safe. - std::shared_ptr> - mBatchedEventQueue; + std::shared_ptr> mBatchedEventQueue; // BatchingConsumer is thread-safe. - std::shared_ptr< - BatchingConsumer> + std::shared_ptr> mPropertyChangeEventsBatchingConsumer; // Only set once during initialization. std::chrono::nanoseconds mEventBatchingWindow; // Only used for testing. int32_t mTestInterfaceVersion = 0; + // mConfigsByPropId and mConfigFile is lazy initialized. + mutable std::mutex mConfigInitLock; + mutable bool mConfigInit GUARDED_BY(mConfigInitLock) = false; + mutable std::unordered_map mConfigsByPropId + GUARDED_BY(mConfigInitLock); + mutable std::unique_ptr mConfigFile GUARDED_BY(mConfigInitLock); + std::mutex mLock; std::unordered_map> mOnBinderDiedContexts GUARDED_BY(mLock); @@ -182,32 +168,23 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi // A thread to handle onBinderDied or onBinderUnlinked event. std::thread mOnBinderDiedUnlinkedHandlerThread; - android::base::Result checkProperty( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); + android::base::Result checkProperty(const aidlvhal::VehiclePropValue& propValue); android::base::Result> checkDuplicateRequests( - const std::vector& - requests); + const std::vector& requests); android::base::Result> checkDuplicateRequests( - const std::vector& - requests); - VhalResult checkSubscribeOptions( - const std::vector& - options); + const std::vector& requests); + VhalResult checkSubscribeOptions(const std::vector& options); - VhalResult checkPermissionHelper( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, - aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess accessToTest) const; + VhalResult checkPermissionHelper(const aidlvhal::VehiclePropValue& value, + aidlvhal::VehiclePropertyAccess accessToTest) const; - VhalResult checkReadPermission( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + VhalResult checkReadPermission(const aidlvhal::VehiclePropValue& value) const; - VhalResult checkWritePermission( - const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + VhalResult checkWritePermission(const aidlvhal::VehiclePropValue& value) const; - android::base::Result - getConfig(int32_t propId) const; + android::base::Result getConfig(int32_t propId) const; void onBinderDiedWithContext(const AIBinder* clientId); @@ -219,7 +196,7 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi bool checkDumpPermission(); - bool getAllPropConfigsFromHardware(); + bool getAllPropConfigsFromHardwareLocked() const REQUIRES(mConfigInitLock); // The looping handler function to process all onBinderDied or onBinderUnlinked events in // mBinderEvents. @@ -228,19 +205,19 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi size_t countSubscribeClients(); // Handles the property change events in batch. - void handleBatchedPropertyEvents( - std::vector&& - batchedEvents); + void handleBatchedPropertyEvents(std::vector&& batchedEvents); - int32_t getVhalInterfaceVersion(); + int32_t getVhalInterfaceVersion() const; + + // Gets mConfigsByPropId, lazy init it if necessary. + const std::unordered_map& getConfigsByPropId() const; + // Gets mConfigFile, lazy init it if necessary. + const ndk::ScopedFileDescriptor* getConfigFile() const; // Puts the property change events into a queue so that they can handled in batch. static void batchPropertyChangeEvent( - const std::weak_ptr>& - batchedEventQueue, - std::vector&& - updatedValues); + const std::weak_ptr>& batchedEventQueue, + std::vector&& updatedValues); // Gets or creates a {@code T} object for the client to or from {@code clients}. template @@ -248,10 +225,8 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi std::unordered_map>* clients, const CallbackType& callback, std::shared_ptr pendingRequestPool); - static void onPropertyChangeEvent( - const std::weak_ptr& subscriptionManager, - std::vector&& - updatedValues); + static void onPropertyChangeEvent(const std::weak_ptr& subscriptionManager, + std::vector&& updatedValues); static void onPropertySetErrorEvent( const std::weak_ptr& subscriptionManager, diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index a29861f475..9dc039df13 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -71,6 +72,7 @@ using ::android::base::StringPrintf; using ::ndk::ScopedAIBinder_DeathRecipient; using ::ndk::ScopedAStatus; +using ::ndk::ScopedFileDescriptor; std::string toString(const std::unordered_set& values) { std::string str = ""; @@ -103,10 +105,7 @@ DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr vehicleHa : mVehicleHardware(std::move(vehicleHardware)), mPendingRequestPool(std::make_shared(TIMEOUT_IN_NANO)), mTestInterfaceVersion(testInterfaceVersion) { - if (!getAllPropConfigsFromHardware()) { - return; - } - + ALOGD("DefaultVehicleHal init"); IVehicleHardware* vehicleHardwarePtr = mVehicleHardware.get(); mSubscriptionManager = std::make_shared(vehicleHardwarePtr); mEventBatchingWindow = mVehicleHardware->getPropertyOnChangeEventBatchingWindow(); @@ -319,16 +318,18 @@ void DefaultVehicleHal::setTimeout(int64_t timeoutInNano) { mPendingRequestPool = std::make_unique(timeoutInNano); } -int32_t DefaultVehicleHal::getVhalInterfaceVersion() { +int32_t DefaultVehicleHal::getVhalInterfaceVersion() const { if (mTestInterfaceVersion != 0) { return mTestInterfaceVersion; } int32_t myVersion = 0; - getInterfaceVersion(&myVersion); + // getInterfaceVersion is in-reality a const method. + const_cast(this)->getInterfaceVersion(&myVersion); return myVersion; } -bool DefaultVehicleHal::getAllPropConfigsFromHardware() { +bool DefaultVehicleHal::getAllPropConfigsFromHardwareLocked() const { + ALOGD("Get all property configs from hardware"); auto configs = mVehicleHardware->getAllPropertyConfigs(); std::vector filteredConfigs; int32_t myVersion = getVhalInterfaceVersion(); @@ -373,22 +374,46 @@ bool DefaultVehicleHal::getAllPropConfigsFromHardware() { return true; } +const ScopedFileDescriptor* DefaultVehicleHal::getConfigFile() const { + std::scoped_lock lockGuard(mConfigInitLock); + if (!mConfigInit) { + CHECK(getAllPropConfigsFromHardwareLocked()) + << "Failed to get property configs from hardware"; + mConfigInit = true; + } + return mConfigFile.get(); +} + +const std::unordered_map& DefaultVehicleHal::getConfigsByPropId() + const { + std::scoped_lock lockGuard(mConfigInitLock); + if (!mConfigInit) { + CHECK(getAllPropConfigsFromHardwareLocked()) + << "Failed to get property configs from hardware"; + mConfigInit = true; + } + return mConfigsByPropId; +} + ScopedAStatus DefaultVehicleHal::getAllPropConfigs(VehiclePropConfigs* output) { - if (mConfigFile != nullptr) { + const ScopedFileDescriptor* configFile = getConfigFile(); + const auto& configsByPropId = getConfigsByPropId(); + if (configFile != nullptr) { output->payloads.clear(); - output->sharedMemoryFd.set(dup(mConfigFile->get())); + output->sharedMemoryFd.set(dup(configFile->get())); return ScopedAStatus::ok(); } - output->payloads.reserve(mConfigsByPropId.size()); - for (const auto& [_, config] : mConfigsByPropId) { + output->payloads.reserve(configsByPropId.size()); + for (const auto& [_, config] : configsByPropId) { output->payloads.push_back(config); } return ScopedAStatus::ok(); } Result DefaultVehicleHal::getConfig(int32_t propId) const { - auto it = mConfigsByPropId.find(propId); - if (it == mConfigsByPropId.end()) { + const auto& configsByPropId = getConfigsByPropId(); + auto it = configsByPropId.find(propId); + if (it == configsByPropId.end()) { return Error() << "no config for property, ID: " << propId; } return &(it->second); @@ -634,9 +659,11 @@ ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback, ScopedAStatus DefaultVehicleHal::getPropConfigs(const std::vector& props, VehiclePropConfigs* output) { std::vector configs; + const auto& configsByPropId = getConfigsByPropId(); for (int32_t prop : props) { - if (mConfigsByPropId.find(prop) != mConfigsByPropId.end()) { - configs.push_back(mConfigsByPropId[prop]); + auto it = configsByPropId.find(prop); + if (it != configsByPropId.end()) { + configs.push_back(it->second); } else { return ScopedAStatus::fromServiceSpecificErrorWithMessage( toInt(StatusCode::INVALID_ARG), @@ -665,13 +692,15 @@ bool areaConfigsHaveRequiredAccess(const std::vector& areaCon VhalResult DefaultVehicleHal::checkSubscribeOptions( const std::vector& options) { + const auto& configsByPropId = getConfigsByPropId(); for (const auto& option : options) { int32_t propId = option.propId; - if (mConfigsByPropId.find(propId) == mConfigsByPropId.end()) { + auto it = configsByPropId.find(propId); + if (it == configsByPropId.end()) { return StatusError(StatusCode::INVALID_ARG) << StringPrintf("no config for property, ID: %" PRId32, propId); } - const VehiclePropConfig& config = mConfigsByPropId[propId]; + const VehiclePropConfig& config = it->second; std::vector areaConfigs; if (option.areaIds.empty()) { areaConfigs = config.areaConfigs; @@ -744,10 +773,11 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, } std::vector onChangeSubscriptions; std::vector continuousSubscriptions; + const auto& configsByPropId = getConfigsByPropId(); for (const auto& option : options) { int32_t propId = option.propId; // We have already validate config exists. - const VehiclePropConfig& config = mConfigsByPropId[propId]; + const VehiclePropConfig& config = configsByPropId.at(propId); SubscribeOptions optionCopy = option; // If areaIds is empty, subscribe to all areas. @@ -871,7 +901,7 @@ VhalResult DefaultVehicleHal::checkPermissionHelper( (areaConfig == nullptr || !hasRequiredAccess(areaConfig->access, accessToTest))) { return StatusError(StatusCode::ACCESS_DENIED) << StringPrintf("Property %" PRId32 " does not have the following access: %" PRId32, - propId, accessToTest); + propId, static_cast(accessToTest)); } return {}; } @@ -936,17 +966,19 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA } DumpResult result = mVehicleHardware->dump(options); if (result.refreshPropertyConfigs) { - getAllPropConfigsFromHardware(); + std::scoped_lock lockGuard(mConfigInitLock); + getAllPropConfigsFromHardwareLocked(); } dprintf(fd, "%s", (result.buffer + "\n").c_str()); if (!result.callerShouldDumpState) { return STATUS_OK; } dprintf(fd, "Vehicle HAL State: \n"); + const auto& configsByPropId = getConfigsByPropId(); { std::scoped_lock lockGuard(mLock); dprintf(fd, "Interface version: %" PRId32 "\n", getVhalInterfaceVersion()); - dprintf(fd, "Containing %zu property configs\n", mConfigsByPropId.size()); + dprintf(fd, "Containing %zu property configs\n", configsByPropId.size()); dprintf(fd, "Currently have %zu getValues clients\n", mGetValuesClients.size()); dprintf(fd, "Currently have %zu setValues clients\n", mSetValuesClients.size()); dprintf(fd, "Currently have %zu subscribe clients\n", countSubscribeClients()); From bb729471a9e97a3016dc595d8e1416f211c08472 Mon Sep 17 00:00:00 2001 From: sandeepjs Date: Tue, 21 May 2024 18:08:44 +0000 Subject: [PATCH 135/161] update vts set sim slot mapping test cases to handle different MEP types Bug: 342543877 Test: atest PerInstance/RadioConfigTest#setSimSlotsMapping/0_android_hardware_radio_config_IRadioConfig_default Change-Id: I34229669713afabbb7802dfa7c79ff9689a7bdf5 --- radio/aidl/vts/radio_config_test.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp index 6f18d18c49..e7214e5da1 100644 --- a/radio/aidl/vts/radio_config_test.cpp +++ b/radio/aidl/vts/radio_config_test.cpp @@ -278,7 +278,14 @@ TEST_P(RadioConfigTest, setSimSlotsMapping) { EXPECT_LT(logicalSlotId, slotPortMappingList.size()); if (logicalSlotId >= 0 && logicalSlotId < slotPortMappingList.size()) { slotPortMappingList[logicalSlotId].physicalSlotId = i; - slotPortMappingList[logicalSlotId].portId = j; + if (radioRsp_config->simSlotStatus[i].supportedMepMode == + MultipleEnabledProfilesMode::MEP_A1 || + radioRsp_config->simSlotStatus[i].supportedMepMode == + MultipleEnabledProfilesMode::MEP_A2) { + slotPortMappingList[logicalSlotId].portId = j + 1; + } else { + slotPortMappingList[logicalSlotId].portId = j; + } } } } From a97e8abba768e967fdbaed5f3778446789472be3 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 22 May 2024 16:48:23 -0700 Subject: [PATCH 136/161] Improve FakeVehicleHardware dump. Add supported area IDs to "--list" dump. Test: dumpsys android.hardware.automotive.vehicle.IVehicle/default --list Bug: 342260344 Change-Id: I889fa0a5b8a97d36a3b8ddf1620160e7d4d3e308 --- .../hardware/src/FakeVehicleHardware.cpp | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 9b880cd8ad..3e4713a1c6 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -281,6 +281,19 @@ void maybeGetGrpcServiceInfo(std::string* address) { ifs.close(); } +inline std::string vecToStringOfHexValues(const std::vector& vec) { + std::stringstream ss; + ss << "["; + for (size_t i = 0; i < vec.size(); i++) { + if (i != 0) { + ss << ","; + } + ss << std::showbase << std::hex << vec[i]; + } + ss << "]"; + return ss.str(); +} + } // namespace void FakeVehicleHardware::storePropInitialValue(const ConfigDeclaration& config) { @@ -1770,19 +1783,26 @@ std::string FakeVehicleHardware::dumpHelp() { return "Usage: \n\n" "[no args]: dumps (id and value) all supported properties \n" "--help: shows this help\n" - "--list: lists the ids of all supported properties\n" - "--get [PROP2] [PROPN]: dumps the value of specific properties. \n" - "--getWithArg [ValueArguments]: gets the value for a specific property with " - "arguments. \n" - "--set [ValueArguments]: sets the value of property PROP. \n" - "--save-prop [-a AREA_ID]: saves the current value for PROP, integration test" - " that modifies prop value must call this before test and restore-prop after test. \n" - "--restore-prop [-a AREA_ID]: restores a previously saved property value. \n" - "--inject-event [ValueArguments]: inject a property update event from car\n\n" - "ValueArguments are in the format of [-i INT_VALUE [INT_VALUE ...]] " - "[-i64 INT64_VALUE [INT64_VALUE ...]] [-f FLOAT_VALUE [FLOAT_VALUE ...]] [-s STR_VALUE] " - "[-b BYTES_VALUE] [-a AREA_ID].\n" - "Notice that the string, bytes and area value can be set just once, while the other can" + "--list: lists the property IDs and their supported area IDs for all supported " + "properties\n" + "--get [PROP_ID_2] [PROP_ID_N]: dumps the value of specific properties. \n" + "--getWithArg [ValueArguments]: gets the value for a specific property. " + "The value arguments constructs a VehiclePropValue used in the getValue request. \n" + "--set [ValueArguments]: sets the value of property PROP_ID, the value " + "arguments constructs a VehiclePropValue used in the setValue request. \n" + "--save-prop [-a AREA_ID]: saves the current value for PROP_ID, integration " + "tests that modify prop value must call this before test and restore-prop after test. \n" + "--restore-prop [-a AREA_ID]: restores a previously saved property value. \n" + "--inject-event [ValueArguments]: inject a property update event from car\n\n" + "ValueArguments are in the format of [-a OPTIONAL_AREA_ID] " + "[-i INT_VALUE_1 [INT_VALUE_2 ...]] " + "[-i64 INT64_VALUE_1 [INT64_VALUE_2 ...]] " + "[-f FLOAT_VALUE_1 [FLOAT_VALUE_2 ...]] " + "[-s STR_VALUE] " + "[-b BYTES_VALUE].\n" + "For example: to set property ID 0x1234, areaId 0x1 to int32 values: [1, 2, 3], " + "use \"--set 0x1234 -a 0x1 -i 1 2 3\"\n" + "Note that the string, bytes and area value can be set just once, while the other can" " have multiple values (so they're used in the respective array), " "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n" + genFakeDataHelp() + "Fake user HAL usage: \n" + mFakeUserHal->showDumpHelp(); @@ -1848,11 +1868,18 @@ std::string FakeVehicleHardware::dumpListProperties() { return "no properties to list\n"; } int rowNumber = 1; - std::string msg = StringPrintf("listing %zu properties\n", configs.size()); + std::stringstream ss; + ss << "listing " << configs.size() << " properties" << std::endl; for (const auto& config : configs) { - msg += StringPrintf("%d: %s\n", rowNumber++, PROP_ID_TO_CSTR(config.prop)); + std::vector areaIds; + for (const auto& areaConfig : config.areaConfigs) { + areaIds.push_back(areaConfig.areaId); + } + ss << rowNumber++ << ": " << PROP_ID_TO_CSTR(config.prop) << ", propID: " << std::showbase + << std::hex << config.prop << std::noshowbase << std::dec + << ", areaIDs: " << vecToStringOfHexValues(areaIds) << std::endl; } - return msg; + return ss.str(); } Result FakeVehicleHardware::checkArgumentsSize(const std::vector& options, From 77f21c8016413f9e4922fd8d417219c1eecb1447 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 22 May 2024 17:44:32 -0700 Subject: [PATCH 137/161] Allow using property name in debug command. Add stringToPropertyId to VehicleUtils and use that in FakeVehicleHardware to support commands like "--set PERF_VEHICLE_SPEED". Test: atest VehicleUtilsTest FakeVehicleHardwareTest Bug: 342260344 Change-Id: If317929376eb18bb0c28f87c4d7a3321c58d72b1 --- .../hardware/include/FakeVehicleHardware.h | 22 +++++----- .../hardware/src/FakeVehicleHardware.cpp | 16 ++++++-- .../hardware/test/FakeVehicleHardwareTest.cpp | 23 +++++++++-- .../impl/utils/common/include/VehicleUtils.h | 4 ++ .../impl/utils/common/src/VehicleUtils.cpp | 41 +++++++++++++++++++ .../utils/common/test/VehicleUtilsTest.cpp | 17 ++++++++ 6 files changed, 106 insertions(+), 17 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 583e40b369..79d3e77f84 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -269,16 +269,6 @@ class FakeVehicleHardware : public IVehicleHardware { std::string dumpInjectEvent(const std::vector& options); std::string dumpSubscriptions(); - template - android::base::Result safelyParseInt(int index, const std::string& s) { - T out; - if (!::android::base::ParseInt(s, &out)) { - return android::base::Error() << android::base::StringPrintf( - "non-integer argument at index %d: %s\n", index, s.c_str()); - } - return out; - } - android::base::Result safelyParseFloat(int index, const std::string& s); std::vector getOptionValues(const std::vector& options, size_t* index); android::base::Result @@ -325,6 +315,18 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& vehiclePropConfig, int32_t areaId); + template + static android::base::Result safelyParseInt(int index, const std::string& s) { + T out; + if (!::android::base::ParseInt(s, &out)) { + return android::base::Error() << android::base::StringPrintf( + "non-integer argument at index %d: %s\n", index, s.c_str()); + } + return out; + } + static android::base::Result safelyParseFloat(int index, const std::string& s); + static android::base::Result parsePropId(const std::vector& options, + size_t index); }; } // namespace fake diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 3e4713a1c6..4f060e26af 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -1892,6 +1892,16 @@ Result FakeVehicleHardware::checkArgumentsSize(const std::vector FakeVehicleHardware::parsePropId(const std::vector& options, + size_t index) { + const std::string& propIdStr = options[index]; + auto result = stringToPropId(propIdStr); + if (result.ok()) { + return result; + } + return safelyParseInt(index, propIdStr); +} + std::string FakeVehicleHardware::dumpSpecificProperty(const std::vector& options) { if (auto result = checkArgumentsSize(options, /*minSize=*/2); !result.ok()) { return getErrorMsg(result); @@ -1902,7 +1912,7 @@ std::string FakeVehicleHardware::dumpSpecificProperty(const std::vector(i, options[i]); + auto propResult = parsePropId(options, i); if (!propResult.ok()) { msg += getErrorMsg(propResult); continue; @@ -1938,9 +1948,9 @@ Result FakeVehicleHardware::parsePropOptions( // --set/get/inject-event PROP [-f f1 f2...] [-i i1 i2...] [-i64 i1 i2...] [-s s1 s2...] // [-b b1 b2...] [-a a] [-t timestamp] size_t optionIndex = 1; - auto result = safelyParseInt(optionIndex, options[optionIndex]); + auto result = parsePropId(options, optionIndex); if (!result.ok()) { - return Error() << StringPrintf("Property value: \"%s\" is not a valid int: %s\n", + return Error() << StringPrintf("Property ID/Name: \"%s\" is not valid: %s\n", options[optionIndex].c_str(), getErrorMsg(result).c_str()); } VehiclePropValue prop = {}; diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index cab33e10e8..0924360b9f 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -2613,6 +2613,23 @@ TEST_F(FakeVehicleHardwareTest, testDumpSpecificProperties) { prop1.c_str(), prop2.c_str(), prop2.c_str()))); } +TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertiesWithName) { + std::vector options; + options.push_back("--get"); + std::string prop1 = "INFO_FUEL_CAPACITY"; + std::string prop2 = "TIRE_PRESSURE"; + int prop1Int = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + int prop2Int = toInt(VehicleProperty::TIRE_PRESSURE); + options.push_back(prop1); + options.push_back(prop2); + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, + ContainsRegex(StringPrintf("1:.*prop: %d.*\n2-0:.*prop: %d.*\n2-1:.*prop: %d.*\n", + prop1Int, prop2Int, prop2Int))); +} + TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertiesInvalidProp) { std::vector options; options.push_back("--get"); @@ -2766,6 +2783,7 @@ std::vector GenSetPropParams() { std::string infoMakeProperty = std::to_string(toInt(VehicleProperty::INFO_MAKE)); return { {"success_set_string", {"--set", infoMakeProperty, "-s", CAR_MAKE}, true}, + {"success_set_with_name", {"--set", "INFO_MAKE", "-s", CAR_MAKE}, true}, {"success_set_bytes", {"--set", infoMakeProperty, "-b", "0xdeadbeef"}, true}, {"success_set_bytes_caps", {"--set", infoMakeProperty, "-b", "0xDEADBEEF"}, true}, {"success_set_int", {"--set", infoMakeProperty, "-i", "2147483647"}, true}, @@ -2790,10 +2808,7 @@ std::vector GenSetPropParams() { false, "No values specified"}, {"fail_unknown_options", {"--set", infoMakeProperty, "-abcd"}, false, "Unknown option"}, - {"fail_invalid_property", - {"--set", "not valid", "-s", CAR_MAKE}, - false, - "not a valid int"}, + {"fail_invalid_property", {"--set", "not_valid", "-s", CAR_MAKE}, false, "not valid"}, {"fail_duplicate_string", {"--set", infoMakeProperty, "-s", CAR_MAKE, "-s", CAR_MAKE}, false, diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h index aca725df56..f48bb2aa34 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h @@ -328,11 +328,15 @@ struct PropIdAreaIdHash { } }; +// This is for debug purpose only. inline std::string propIdToString(int32_t propId) { return toString( static_cast(propId)); } +// This is for debug purpose only. +android::base::Result stringToPropId(const std::string& propName); + template void roundToNearestResolution(std::vector& arrayToSanitize, float resolution) { if (resolution == 0) { diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp index f85728d4b6..4d06e4e32d 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp @@ -16,14 +16,18 @@ #include "VehicleUtils.h" +#include + namespace android { namespace hardware { namespace automotive { namespace vehicle { using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::toString; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; @@ -31,6 +35,39 @@ using ::android::base::Error; using ::android::base::Result; using ::ndk::ScopedAStatus; +namespace { + +class PropertyIdByNameSingleton { + public: + static PropertyIdByNameSingleton& getInstance() { + static PropertyIdByNameSingleton instance; + return instance; + } + + Result getPropertyId(const std::string& name) { + auto it = mPropertyIdByName.find(name); + if (it == mPropertyIdByName.end()) { + return Error(); + } + return it->second; + } + + PropertyIdByNameSingleton(PropertyIdByNameSingleton const&) = delete; + void operator=(PropertyIdByNameSingleton const&) = delete; + + private: + std::unordered_map mPropertyIdByName; + + PropertyIdByNameSingleton() { + constexpr auto values = ndk::internal::enum_values; + for (unsigned int i = 0; i < values.size(); i++) { + mPropertyIdByName.emplace(toString(values[i]), toInt(values[i])); + } + } +}; + +} // namespace + Result checkPropValue(const VehiclePropValue& value, const VehiclePropConfig* config) { int32_t property = value.prop; VehiclePropertyType type = getPropType(property); @@ -213,6 +250,10 @@ std::string VhalError::print() const { return aidl::android::hardware::automotive::vehicle::toString(mCode); } +Result stringToPropId(const std::string& propName) { + return PropertyIdByNameSingleton::getInstance().getPropertyId(propName); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp index 9abb2a2fe6..1048877201 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp @@ -770,6 +770,23 @@ TEST(VehicleUtilsTest, testVhalError) { ASSERT_EQ(result.error().message(), "error message: INVALID_ARG"); } +TEST(VehicleUtilsTest, testPropIdToString) { + ASSERT_EQ(propIdToString(toInt(VehicleProperty::PERF_VEHICLE_SPEED)), "PERF_VEHICLE_SPEED"); +} + +TEST(VehicleUtilsTest, testStringToPropId) { + auto result = stringToPropId("PERF_VEHICLE_SPEED"); + + ASSERT_TRUE(result.ok()); + ASSERT_EQ(result.value(), toInt(VehicleProperty::PERF_VEHICLE_SPEED)); +} + +TEST(VehicleUtilsTest, testStringToPropId_InvalidName) { + auto result = stringToPropId("PERF_VEHICLE_SPEED12345"); + + ASSERT_FALSE(result.ok()); +} + class InvalidPropValueTest : public testing::TestWithParam {}; INSTANTIATE_TEST_SUITE_P(InvalidPropValueTests, InvalidPropValueTest, From ef17819c0323e72cf2071c61028b92ae4f999c1e Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Sun, 26 May 2024 04:59:11 +0000 Subject: [PATCH 138/161] Add a front camera instance This change updates a configuration for the default EVS HAL implementation with an additional camera element that represents the front-view camera. Bug: 342834307 Test: atest CarEvsManagerTest Change-Id: I8d01a9f9b6decf981e54c498fdf0e595b861e12f --- .../resources/evs_mock_configuration.xml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml index 6cbc18eacf..af5b354bc8 100644 --- a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml +++ b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml @@ -42,6 +42,30 @@ + + + + + + + + + + + + + + + + +