From 479ec9e172e9b302512171e1f236e90ccdfe6597 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Wed, 18 May 2022 15:59:32 -0700 Subject: [PATCH] VTS setSystemSelectionChannels maintain current state Test: atest VtsHalRadioTargetTest Bug: 231271472 Change-Id: If261f548da102963130b8cd669eb6392c9270f9a --- radio/aidl/vts/radio_network_response.cpp | 3 ++- radio/aidl/vts/radio_network_test.cpp | 24 +++++++++++++++++++---- radio/aidl/vts/radio_network_utils.h | 1 + 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 666d617771..2292c549ca 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -109,8 +109,9 @@ ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse( } ndk::ScopedAStatus RadioNetworkResponse::getSystemSelectionChannelsResponse( - const RadioResponseInfo& info, const std::vector& /*specifier*/) { + const RadioResponseInfo& info, const std::vector& specifiers) { rspInfo = info; + this->specifiers = specifiers; parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 0bae3748da..c83571ee0a 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -769,6 +769,16 @@ TEST_P(RadioNetworkTest, setLinkCapacityReportingCriteria_Geran) { */ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = radio_network->getSystemSelectionChannels(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + if (radioRsp_network->specifiers.size() == 0) { + // TODO (b/189255895): Throw an error once getSystemSelectionChannels is functional. + ALOGI("Skipped the test due to empty system selection channels."); + GTEST_SKIP(); + } + std::vector originalSpecifiers = radioRsp_network->specifiers; RadioAccessSpecifierBands bandP900 = RadioAccessSpecifierBands::make( @@ -781,8 +791,8 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { RadioAccessSpecifier specifier850 = { .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}}; - ndk::ScopedAStatus res = - radio_network->setSystemSelectionChannels(serial, true, {specifierP900, specifier850}); + serial = GetRandomSerialNumber(); + res = radio_network->setSystemSelectionChannels(serial, true, {specifierP900, specifier850}); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); @@ -795,8 +805,8 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { if (radioRsp_network->rspInfo.error == RadioError::NONE) { serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = radio_network->setSystemSelectionChannels( - serial, false, {specifierP900, specifier850}); + res = radio_network->setSystemSelectionChannels(serial, false, + {specifierP900, specifier850}); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); @@ -805,6 +815,12 @@ TEST_P(RadioNetworkTest, setSystemSelectionChannels) { toString(radioRsp_network->rspInfo.error).c_str()); EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error); } + + serial = GetRandomSerialNumber(); + res = radio_network->setSystemSelectionChannels(serial, true, originalSpecifiers); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); } /* diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 29ba2f282e..29f20e8dbd 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -45,6 +45,7 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { CellIdentity barringCellIdentity; std::vector barringInfoList; UsageSetting usageSetting; + std::vector specifiers; virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;