Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 522df425 authored by Jack Nudelman's avatar Jack Nudelman Committed by Android (Google) Code Review
Browse files

Merge "HAL changes for ThermalMitigation API."

parents e7998580 62fd3447
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -320,4 +320,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);
};
+11 −0
Original line number Diff line number Diff line
@@ -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);
};
+22 −0
Original line number Diff line number Diff line
@@ -394,3 +394,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
};
+66 −0
Original line number Diff line number Diff line
@@ -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}));
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -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 */
Loading