From fd4ce7e76a20b40c428293291fcb0e4488c122c8 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Thu, 27 Jun 2019 13:02:26 -0700 Subject: [PATCH 1/5] Camera: VTS: Don't access invalid resources There is no guarantee that the static metadata pointer passed in the "DeviceCb" contructor will be valid after the call completes. The device callback instance is expected to be active until the camera session is open. Clone the required metadata in "DeviceCb" and manage the lifetime appropriately by using the "CameraMetadata" wrapper. Bug: 135976837 Test: CameraHidlTest#processCaptureRequestPreview Change-Id: Idd3c6c8c2e5a3fc44a49712e25a04009cbd471b1 --- .../VtsHalCameraProviderV2_4TargetTest.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 86c2c1e15c..3cbcc7bf08 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -607,7 +607,9 @@ public: struct DeviceCb : public V3_5::ICameraDeviceCallback { DeviceCb(CameraHidlTest *parent, int deviceVersion, const camera_metadata_t *staticMeta) : - mParent(parent), mDeviceVersion(deviceVersion), mStaticMetadata(staticMeta) {} + mParent(parent), mDeviceVersion(deviceVersion) { + mStaticMetadata = staticMeta; + } Return processCaptureResult_3_4( const hidl_vec& results) override; @@ -631,7 +633,7 @@ public: CameraHidlTest *mParent; // Parent object int mDeviceVersion; - const camera_metadata_t *mStaticMetadata; + android::hardware::camera::common::V1_0::helper::CameraMetadata mStaticMetadata; bool hasOutstandingBuffersLocked(); /* members for requestStreamBuffers() and returnStreamBuffers()*/ @@ -1194,18 +1196,20 @@ bool CameraHidlTest::DeviceCb::processCaptureResultLocked(const CaptureResult& r // Verify final result metadata bool isAtLeast_3_5 = mDeviceVersion >= CAMERA_DEVICE_API_VERSION_3_5; if (isAtLeast_3_5) { + auto staticMetadataBuffer = mStaticMetadata.getAndLock(); bool isMonochrome = Status::OK == - CameraHidlTest::isMonochromeCamera(mStaticMetadata); + CameraHidlTest::isMonochromeCamera(staticMetadataBuffer); if (isMonochrome) { mParent->verifyMonochromeCameraResult(request->collectedResult); } // Verify logical camera result metadata bool isLogicalCamera = - Status::OK == CameraHidlTest::isLogicalMultiCamera(mStaticMetadata); + Status::OK == CameraHidlTest::isLogicalMultiCamera(staticMetadataBuffer); if (isLogicalCamera) { - mParent->verifyLogicalCameraResult(mStaticMetadata, request->collectedResult); + mParent->verifyLogicalCameraResult(staticMetadataBuffer, request->collectedResult); } + mStaticMetadata.unlock(staticMetadataBuffer); } } @@ -5402,7 +5406,7 @@ void CameraHidlTest::configurePreviewStream(const std::string &name, int32_t dev ASSERT_EQ(Status::OK, s); staticMeta = clone_camera_metadata( reinterpret_cast(metadata.data())); - ASSERT_NE(nullptr, staticMeta); + ASSERT_NE(nullptr, staticMeta); }); ASSERT_TRUE(ret.isOk()); From 6da3b839961cbd92e137bd5c955221618996a745 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 28 Jun 2019 16:41:32 -0700 Subject: [PATCH 2/5] Current (5) matrix: use radio.config@1.2::IRadioConfig 1.1 IRadioConfig does not exist. radio.config@1.2 is a minor version uprev that only updates the sub interfaces, not the top level interface. Test: builds Bug: 135172251 Change-Id: Ia576cea29c63850ddb531f7c972fa4ebaecd20c7 --- compatibility_matrices/compatibility_matrix.current.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 2284723f0a..6e1bc8fa78 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -365,7 +365,10 @@ android.hardware.radio.config - 1.2 + + 1.1 IRadioConfig default From 4d904009857a6d62a3838bf167f8542f0495a714 Mon Sep 17 00:00:00 2001 From: Anthony Stange Date: Mon, 1 Jul 2019 14:44:50 -0400 Subject: [PATCH 3/5] Deactivate sensors after flush events are received The VTS flush test case was previously deactivating sensors before waiting for flush events to be received causing any pending flush events to be discarded per the HAL contract. Bug: 136472044 Test: Run test and ensure it passes Change-Id: I23b94e650c6dbbc33640768bee356a49565ba753 --- sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp index 39053fe75f..62c5334441 100644 --- a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp +++ b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp @@ -683,11 +683,16 @@ void SensorsHidlTest::runFlushTest(const std::vector& sensors, bool Result flushResult = flush(sensor.sensorHandle); ASSERT_EQ(flushResult, expectedResponse); } - activate(sensor.sensorHandle, false); } // Wait up to one second for the flush events callback.waitForFlushEvents(sensors, flushCalls, 1000 /* timeoutMs */); + + // Deactivate all sensors after waiting for flush events so pending flush events are not + // abandoned by the HAL. + for (const SensorInfo& sensor : sensors) { + activate(sensor.sensorHandle, false); + } getEnvironment()->unregisterCallback(); // Check that the correct number of flushes are present for each sensor From b2e7c71f39f3d26a4d8a9149955eb8d8c887c51a Mon Sep 17 00:00:00 2001 From: sqian Date: Mon, 1 Jul 2019 13:20:45 -0700 Subject: [PATCH 4/5] Hang up EmergencyDial after Trigger in VTS The whole test case run emergencyDial.RadioHidlTest_v1_4 first and then come after startNetworkScan.RadioHidlTest_v1_4 test case immediately (within ~3 secs) the NWscan failure is device in emergency call in progress/connected while doing emergencyDial.RadioHidlTest_v1_4 test Although emergencyDial.RadioHidlTest_v1_4 only care about command/response is successful or not and don't care call is established or not, modem do care about call condition is in idle/progress/connected state before it can do NWscan When there's dedicated channel established, modem can not perform AP request NWscan in parallel as we are single HW modem restriction. Test: run vts Bug: 135595082 Change-Id: Iecba54b93b96d33b57bc59e00f082ff133d2e57b Merged-In: Iecba54b93b96d33b57bc59e00f082ff133d2e57b --- .../1.4/vts/functional/radio_hidl_hal_api.cpp | 18 ++++++++++++++++++ .../1.4/vts/functional/radio_hidl_hal_test.cpp | 17 +++++++++++++++++ .../vts/functional/radio_hidl_hal_utils_v1_4.h | 9 +++++++++ radio/1.4/vts/functional/radio_response.cpp | 7 +++++-- 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp index 696c746d65..26f2c90f54 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp @@ -41,6 +41,12 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial) { ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_v1_4->rspInfo.error).c_str()); EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error); + + // Give some time for modem to establish the emergency call channel. + sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME); + + // Disconnect all the potential established calls to prevent them affecting other tests. + clearPotentialEstablishedCalls(); } /* @@ -67,6 +73,12 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial_withServices) { ALOGI("emergencyDial_withServices, rspInfo.error = %s\n", toString(radioRsp_v1_4->rspInfo.error).c_str()); EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error); + + // Give some time for modem to establish the emergency call channel. + sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME); + + // Disconnect all the potential established calls to prevent them affecting other tests. + clearPotentialEstablishedCalls(); } /* @@ -93,6 +105,12 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) { ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n", toString(radioRsp_v1_4->rspInfo.error).c_str()); EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error); + + // Give some time for modem to establish the emergency call channel. + sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME); + + // Disconnect all the potential established calls to prevent them affecting other tests. + clearPotentialEstablishedCalls(); } /* diff --git a/radio/1.4/vts/functional/radio_hidl_hal_test.cpp b/radio/1.4/vts/functional/radio_hidl_hal_test.cpp index d2d21ce1f6..63e5f6ed53 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.4/vts/functional/radio_hidl_hal_test.cpp @@ -87,6 +87,23 @@ std::cv_status RadioHidlTest_v1_4::wait() { return status; } +void RadioHidlTest_v1_4::clearPotentialEstablishedCalls() { + // Get the current call Id to hangup the established emergency call. + serial = GetRandomSerialNumber(); + radio_v1_4->getCurrentCalls(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + + // Hang up to disconnect the established call channels. + for (const ::android::hardware::radio::V1_2::Call& call : radioRsp_v1_4->currentCalls) { + serial = GetRandomSerialNumber(); + radio_v1_4->hangup(serial, call.base.index); + ALOGI("Hang up to disconnect the established call channel: %d", call.base.index); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + // Give some time for modem to disconnect the established call channel. + sleep(MODEM_EMERGENCY_CALL_DISCONNECT_TIME); + } +} + void RadioHidlTest_v1_4::updateSimCardStatus() { serial = GetRandomSerialNumber(); radio_v1_4->getIccCardStatus(serial); diff --git a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h index f662472d22..b07f9c36e6 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h +++ b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h @@ -44,6 +44,9 @@ using ::android::hardware::Return; using ::android::hardware::Void; #define TIMEOUT_PERIOD 75 +#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 +#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 + #define RADIO_SERVICE_NAME "slot1" class RadioHidlTest_v1_4; @@ -59,6 +62,9 @@ class RadioResponse_v1_4 : public ::android::hardware::radio::V1_4::IRadioRespon RadioResponseInfo rspInfo; + // Call + hidl_vec<::android::hardware::radio::V1_2::Call> currentCalls; + // Modem bool isModemEnabled; bool enableModemResponseToggle; @@ -725,6 +731,9 @@ class RadioHidlTest_v1_4 : public ::testing::VtsHalHidlTargetTestBase { /* Serial number for radio request */ int serial; + /* Clear Potential Established Calls */ + void clearPotentialEstablishedCalls(); + /* Update Sim Card Status */ void updateSimCardStatus(); diff --git a/radio/1.4/vts/functional/radio_response.cpp b/radio/1.4/vts/functional/radio_response.cpp index eac0c6800f..a849926cf0 100644 --- a/radio/1.4/vts/functional/radio_response.cpp +++ b/radio/1.4/vts/functional/radio_response.cpp @@ -77,7 +77,9 @@ Return RadioResponse_v1_4::getIMSIForAppResponse( return Void(); } -Return RadioResponse_v1_4::hangupConnectionResponse(const RadioResponseInfo& /*info*/) { +Return RadioResponse_v1_4::hangupConnectionResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_4.notify(info.serial); return Void(); } @@ -729,9 +731,10 @@ Return RadioResponse_v1_4::getIccCardStatusResponse_1_2( Return RadioResponse_v1_4::getCurrentCallsResponse_1_2( const RadioResponseInfo& info, - const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& /*calls*/) { + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls) { rspInfo = info; parent_v1_4.notify(info.serial); + currentCalls = calls; return Void(); } From d21dd860ce736da44d123575dfb90db33c6068eb Mon Sep 17 00:00:00 2001 From: zhangweiwei Date: Thu, 4 Jul 2019 22:41:37 +0800 Subject: [PATCH 5/5] Camera: Vts: Fix missing session close Test: vendor testing, Camera VTS on Pixel Bug:135898951 Change-Id: I61f5a90d62732a00d0bc9abad05db0a1a9cc2b63 --- .../2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 3cbcc7bf08..a5369e7b8d 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -4135,6 +4135,8 @@ TEST_F(CameraHidlTest, processMultiCaptureRequestPreview) { &useHalBufManager /*out*/, &cb /*out*/, 0 /*streamConfigCounter*/, true /*allowUnsupport*/); if (session3_5 == nullptr) { + ret = session3_4->close(); + ASSERT_TRUE(ret.isOk()); continue; }