From 2fd5c7cdf9d8b7b28b375c53827170f0d74d3c6b Mon Sep 17 00:00:00 2001 From: Johan Ankner Date: Tue, 17 Dec 2019 10:30:30 +0100 Subject: [PATCH 1/5] VTS: only assert that IGnssDebug present for non-automotive VTS test VtsHalGnssV1_0Target#GnssHalTest.GetAllExtensions tests that IGnss::getEnxtensionGnssDebug returns an actual extension. Make an exception for automotive devices. Bug: 143966170 Test: ran VtsHalGnssV1_0Target on Volvo IHU Change-Id: I1588099a5be704c7869d6d5e8c0312d8b498bb95 --- .../vts/functional/VtsHalGnssV1_0TargetTest.cpp | 14 +++++++++++--- gnss/1.1/vts/functional/gnss_hal_test_cases.cpp | 9 ++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp index c26f60a703..0541c9038c 100644 --- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp @@ -25,6 +25,8 @@ #include #include +#include + using android::hardware::Return; using android::hardware::Void; @@ -36,6 +38,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_0::IGnssMeasurement; using android::sp; +static bool IsAutomotiveDevice() { + char buffer[PROPERTY_VALUE_MAX] = {0}; + property_get("ro.hardware.type", buffer, ""); + return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; +} + #define TIMEOUT_SEC 2 // for basic commands/responses // for command line argument on how strictly to run the test @@ -460,9 +468,9 @@ TEST_F(GnssHalTest, GetAllExtensions) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); - if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { - sp iGnssDebug = gnssDebug; - EXPECT_NE(iGnssDebug, nullptr); + if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { + sp iGnssDebug = gnssDebug; + EXPECT_NE(iGnssDebug, nullptr); } } diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp index 2d901f3301..051e514203 100644 --- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp @@ -21,6 +21,7 @@ #include #include +#include using android::hardware::hidl_vec; @@ -30,6 +31,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_1::IGnssConfiguration; using android::hardware::gnss::V1_1::IGnssMeasurement; +static bool IsAutomotiveDevice() { + char buffer[PROPERTY_VALUE_MAX] = {0}; + property_get("ro.hardware.type", buffer, ""); + return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; +} + /* * SetupTeardownCreateCleanup: * Requests the gnss HAL then calls cleanup @@ -425,7 +432,7 @@ TEST_F(GnssHalTest, InjectBestLocation) { TEST_F(GnssHalTest, GnssDebugValuesSanityTest) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); - if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { + if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { sp iGnssDebug = gnssDebug; EXPECT_NE(iGnssDebug, nullptr); From 4c1b6780b4fd2111a23ee47e9aab0a6ec7aa8b82 Mon Sep 17 00:00:00 2001 From: Kyounghan Lee Date: Wed, 29 Jan 2020 14:56:15 +0900 Subject: [PATCH 2/5] wifi(implementation): Clear wifi event callback objects while stopping This fixes a deadlock between WifiNative and HalDeviceManager because it removes about 30 times callbacks of IWifiEventCallback#onFailure() or onStop(). Such excessive callbacks within a short period tend to make high probabilities of the deadlock. Note: This is a side effect of how the framework is registering multiple callbacks. But, unfortunately there is no HAL API to unregister callback. So, this is somewhat of a workaround fix. Bug: 144137870 Test: Verified that the HAL no longer accumulates callbacks from framework. Test: Device boots up and connects to wifi networks. Change-Id: I441e2f815a0a49c3936615f06a65a6ed5366a628 Merged-In: I441e2f815a0a49c3936615f06a65a6ed5366a628 --- wifi/1.3/default/wifi.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wifi/1.3/default/wifi.cpp b/wifi/1.3/default/wifi.cpp index 2f21819dbc..4229d352d5 100644 --- a/wifi/1.3/default/wifi.cpp +++ b/wifi/1.3/default/wifi.cpp @@ -124,6 +124,8 @@ WifiStatus Wifi::startInternal() { } } LOG(ERROR) << "Wifi HAL start failed"; + // Clear the event callback objects since the HAL start failed. + event_cb_handler_.invalidate(); } return wifi_status; } @@ -158,6 +160,8 @@ WifiStatus Wifi::stopInternal( } LOG(ERROR) << "Wifi HAL stop failed"; } + // Clear the event callback objects since the HAL is now stopped. + event_cb_handler_.invalidate(); return wifi_status; } From aa5673385a4aad41f6f4de961365cb741f6dc7a8 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Tue, 18 Feb 2020 10:16:06 -0800 Subject: [PATCH 3/5] Camera: Fix possible ExifUtils heap corruption Both EXIF_TAG_IMAGE_WIDTH and EXIF_TAG_IMAGE_LENGTH expect short values as per EXIF spec. Call appropriate libexif function to avoid possible heap corruption. Bug: 148223871 Test: Successful build Change-Id: Ib16bf1ae8ab2093da529efe6ff0778331c3e9eb3 --- camera/common/1.0/default/Exif.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/common/1.0/default/Exif.cpp b/camera/common/1.0/default/Exif.cpp index 6054999a07..b04c8084fe 100644 --- a/camera/common/1.0/default/Exif.cpp +++ b/camera/common/1.0/default/Exif.cpp @@ -632,13 +632,13 @@ bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { } bool ExifUtilsImpl::setImageHeight(uint32_t length) { - SET_LONG(EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, length); + SET_SHORT(EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, length); SET_LONG(EXIF_IFD_EXIF, EXIF_TAG_PIXEL_Y_DIMENSION, length); return true; } bool ExifUtilsImpl::setImageWidth(uint32_t width) { - SET_LONG(EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, width); + SET_SHORT(EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, width); SET_LONG(EXIF_IFD_EXIF, EXIF_TAG_PIXEL_X_DIMENSION, width); return true; } From 092efbd9f47b038bab33072dd8f5c2bd0f8ab50d Mon Sep 17 00:00:00 2001 From: Huihong Luo Date: Thu, 6 Feb 2020 18:39:56 -0800 Subject: [PATCH 4/5] Don't send brightness to car service inside Emulator This fixes this cts test: android.cts.statsd.atom.UidAtomTests#testScreenBrightness Bug: 139959479 Test: atest android.cts.statsd.atom.UidAtomTests#testScreenBrightness Change-Id: I66f858ce7686a90cd395f4e646133e8ea4604be4 Merged-In: I66f858ce7686a90cd395f4e646133e8ea4604be4 (cherry picked from commit 1322465c48d0c3dfa5953573b80a89460b8e7e95) --- .../impl/vhal_v2_0/EmulatedVehicleHal.cpp | 26 +++++++++++++++++-- .../impl/vhal_v2_0/EmulatedVehicleHal.h | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp index ba81a521a0..79ce81c4d7 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp @@ -15,8 +15,9 @@ */ #define LOG_TAG "DefaultVehicleHal_v2_0" -#include #include +#include +#include #include "EmulatedVehicleHal.h" #include "JsonFakeValueGenerator.h" @@ -203,8 +204,16 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { } getEmulatorOrDie()->doSetValueFromClient(propValue); - doHalEvent(getValuePool()->obtain(propValue)); + if (mInEmulator && propValue.prop == toInt(VehicleProperty::DISPLAY_BRIGHTNESS)) { + // Emulator does not support remote brightness control, b/139959479 + // do not send it down so that it does not bring unnecessary property change event + // return other error code, such NOT_AVAILABLE, causes Emulator to be freezing + // TODO: return StatusCode::NOT_AVAILABLE once the above issue is fixed + return StatusCode::OK; + } + + doHalEvent(getValuePool()->obtain(propValue)); return StatusCode::OK; } @@ -219,6 +228,17 @@ static bool isDiagnosticProperty(VehiclePropConfig propConfig) { return false; } +// determine if it's running inside Android Emulator +static bool isInEmulator() { + char propValue[PROP_VALUE_MAX]; + bool isEmulator = (__system_property_get("ro.kernel.qemu", propValue) != 0); + if (!isEmulator) { + isEmulator = (__system_property_get("ro.hardware", propValue) != 0) && + (!strcmp(propValue, "ranchu") || !strcmp(propValue, "goldfish")); + } + return isEmulator; +} + // Parse supported properties list and generate vector of property values to hold current values. void EmulatedVehicleHal::onCreate() { static constexpr bool shouldUpdateStatus = true; @@ -269,6 +289,8 @@ void EmulatedVehicleHal::onCreate() { } initObd2LiveFrame(*mPropStore->getConfigOrDie(OBD2_LIVE_FRAME)); initObd2FreezeFrame(*mPropStore->getConfigOrDie(OBD2_FREEZE_FRAME)); + mInEmulator = isInEmulator(); + ALOGD("mInEmulator=%s", mInEmulator ? "true" : "false"); } std::vector EmulatedVehicleHal::listProperties() { diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h index 78895e3db2..367a6ec96e 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h @@ -86,6 +86,7 @@ private: std::unordered_set mHvacPowerProps; RecurrentTimer mRecurrentTimer; GeneratorHub mGeneratorHub; + bool mInEmulator; }; } // impl From fcba82540cef4b9f35aa21556fe900552735efe0 Mon Sep 17 00:00:00 2001 From: Pawin Vongmasa Date: Mon, 4 Feb 2019 18:54:13 -0800 Subject: [PATCH 5/5] RESTRICT AUTOMERGE Relax timeout for all operations Test: make vts -j123 && vts-tradefed run commandAndExit vts \ -m VtsHalMediaOmxV1_0Host Bug: 70933963 Change-Id: I01e53e9e4e78e4bc5fd11f4e931d703c4fb5407d --- media/omx/1.0/vts/functional/common/media_hidl_test_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h index 3635473502..c276ad3829 100644 --- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h +++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h @@ -40,7 +40,7 @@ /* As component is switching states (loaded<->idle<->execute), dequeueMessage() * expects the events to be received within this duration */ -#define DEFAULT_TIMEOUT 100000 +#define DEFAULT_TIMEOUT 150000 /* Time interval between successive Input/Output enqueues */ #define DEFAULT_TIMEOUT_Q 2000 /* While the component is amidst a process call, asynchronous commands like