Merge "HAL changes for ThermalMitigation API."

This commit is contained in:
Treehugger Robot
2020-11-21 02:02:39 +00:00
committed by Gerrit Code Review
6 changed files with 134 additions and 0 deletions

View File

@@ -324,4 +324,29 @@ interface IRadio extends @1.5::IRadio {
*/
oneway setAllowedNetworkTypeBitmap(
uint32_t serial, bitfield<RadioAccessFamily> networkTypeBitmap);
/**
* Control data throttling at modem.
* - DataThrottlingAction:NO_DATA_THROTTLING should clear any existing
* data throttling within the requested completion window.
* - DataThrottlingAction:THROTTLE_SECONDARY_CARRIER: Remove any existing
* throttling on anchor carrier and achieve maximum data throttling on
* secondary carrier within the requested completion window.
* - DataThrottlingAction:THROTTLE_ANCHOR_CARRIER: disable secondary
* carrier and achieve maximum data throttling on anchor carrier by
* requested completion window.
* - DataThrottlingAction:HOLD: Immediately hold on to current level of
* throttling.
*
* @param serial Serial number of request.
* @param dataThrottlingAction DataThrottlingAction as defined in types.hal
* @param completionWindowSecs window, in seconds, in which the requested
* throttling action has to be achieved. This must be 0 when
* dataThrottlingAction is DataThrottlingAction:HOLD.
*
* Response function is IRadioResponse.setDataThrottlingResponse()
*/
oneway setDataThrottling(int32_t serial,
DataThrottlingAction dataThrottlingAction,
int32_t completionWindowSecs);
};

View File

@@ -306,4 +306,15 @@ interface IRadioResponse extends @1.5::IRadioResponse {
* RadioError:NO_RESOURCES
*/
oneway setAllowedNetworkTypeBitmapResponse(RadioResponseInfo info);
/**
* @param info Response info struct containing response type, serial no. and error
*
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:MODEM_ERR
* RadioError:INVALID_ARGUMENTS
*/
oneway setDataThrottlingResponse(RadioResponseInfo info);
};

View File

@@ -395,3 +395,25 @@ struct LinkCapacityEstimate {
*/
uint32_t secondaryUplinkCapacityKbps;
};
enum DataThrottlingAction : int32_t {
/* Clear all existing data throttling. */
NO_DATA_THROTTLING = 0,
/**
* Enact secondary carrier data throttling and remove any existing data
* throttling on anchor carrier.
*/
THROTTLE_SECONDARY_CARRIER = 1,
/**
* Enact anchor carrier data throttling and disable data on secondary
* carrier if currently enabled.
*/
THROTTLE_ANCHOR_CARRIER = 2,
/**
* Immediately hold on to current level of throttling.
*/
HOLD = 3
};

View File

@@ -295,3 +295,69 @@ TEST_P(RadioHidlTest_v1_6, isNrDualConnectivityEnabled) {
::android::hardware::radio::V1_6::RadioError::INTERNAL_ERR,
::android::hardware::radio::V1_6::RadioError::NONE}));
}
/*
* Test IRadio.setDataThrottling() for the response returned.
*/
TEST_P(RadioHidlTest_v1_6, setDataThrottling) {
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_6->setDataThrottling(
serial, DataThrottlingAction::THROTTLE_SECONDARY_CARRIER, 60);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
{::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
::android::hardware::radio::V1_6::RadioError::MODEM_ERR,
::android::hardware::radio::V1_6::RadioError::NONE,
::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS}));
serial = GetRandomSerialNumber();
res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::THROTTLE_ANCHOR_CARRIER, 60);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
{::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
::android::hardware::radio::V1_6::RadioError::MODEM_ERR,
::android::hardware::radio::V1_6::RadioError::NONE,
::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS}));
serial = GetRandomSerialNumber();
res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::HOLD, 60);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
{::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
::android::hardware::radio::V1_6::RadioError::MODEM_ERR,
::android::hardware::radio::V1_6::RadioError::NONE,
::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS}));
serial = GetRandomSerialNumber();
res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::NO_DATA_THROTTLING, 60);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
{::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
::android::hardware::radio::V1_6::RadioError::MODEM_ERR,
::android::hardware::radio::V1_6::RadioError::NONE,
::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS}));
}

View File

@@ -792,6 +792,9 @@ class RadioResponse_v1_6 : public ::android::hardware::radio::V1_6::IRadioRespon
Return<void> setAllowedNetworkTypeBitmapResponse(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
Return<void> setDataThrottlingResponse(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
};
/* Callback class for radio indication */

View File

@@ -1156,3 +1156,10 @@ Return<void> RadioResponse_v1_6::setAllowedNetworkTypeBitmapResponse(
parent_v1_6.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_6::setDataThrottlingResponse(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info) {
rspInfo = info;
parent_v1_6.notify(info.serial);
return Void();
}