Add APIs for ANBR
Test: manual
Change-Id: I5bd11679db7c923b3500f8c2db06abc9d15f8245
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
index 2930338..5ccf584 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
@@ -39,4 +39,6 @@
oneway void notifyImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, boolean isStart);
oneway void performAcbCheck(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType);
oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication);
+ oneway void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled);
+ oneway void sendAnbrQuery(int serial, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
index 0246af1..06f7fa0 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
@@ -36,4 +36,5 @@
interface IRadioImsIndication {
oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info);
oneway void onAccessAllowed(in android.hardware.radio.RadioIndicationType type, int token);
+ oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
index 58f7eb9..60f396f 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
@@ -38,4 +38,6 @@
oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void notifyImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void performAcbCheckResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void setAnbrEnabledResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl
new file mode 100644
index 0000000..b5a33c7
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @VintfStability
+enum ImsStreamDirection {
+ UPLINK = 1,
+ DOWNLINK = 2,
+}
\ No newline at end of file
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
index 1e5e2f7..cae6bd0 100644
--- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
+++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
@@ -21,6 +21,7 @@
import android.hardware.radio.ims.IRadioImsIndication;
import android.hardware.radio.ims.IRadioImsResponse;
import android.hardware.radio.ims.SrvccCall;
+import android.hardware.radio.ims.ImsStreamDirection;
/**
* This interface is used by IMS telephony layer to talk to cellular radio.
@@ -105,4 +106,34 @@
*/
void setResponseFunctions(in IRadioImsResponse radioImsResponse,
in IRadioImsIndication radioImsIndication);
+
+ /**
+ * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114.
+ * This API is used to enable or disable the ANBR feature
+ * for the bearer corresponding to the qosSessionId
+ * This will be invoked when both parties in a call support the ANBR feature
+ * In case of video call, the modem shall use qosSessionId to identify
+ * appropriate media stream
+ *
+ * @param serial Serial number of request
+ * @param qosSessionId QoS session ID is used to identify media stream such as audio or video
+ * @param isEnabled True if Anbr feature is enabled, false otherwise
+ *
+ * Response function is IRadioImsResponse.setAnbrEnabledResponse()
+ */
+ void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled);
+
+ /**
+ * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114.
+ * This API triggers radio to send ANBRQ message
+ * to the access network to query the desired bitrate.
+ *
+ * @param serial Serial number of request
+ * @param qosSessionId QoS session ID is used to identify media stream such as audio or video
+ * @param direction Direction of this packet stream (e.g. uplink or downlink)
+ * @param bitsPerSecond The bit rate requested by the opponent UE
+ *
+ * Response function is IRadioImsResponse.sendAnbrQueryResponse()
+ */
+ void sendAnbrQuery(int serial, int qosSessionId, ImsStreamDirection direction, int bitsPerSecond);
}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
index 2731c80..317158c 100644
--- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
+++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
@@ -18,6 +18,7 @@
import android.hardware.radio.RadioIndicationType;
import android.hardware.radio.ims.ConnectionFailureInfo;
+import android.hardware.radio.ims.ImsStreamDirection;
/**
* Interface declaring unsolicited radio indications for ims APIs.
@@ -43,4 +44,17 @@
* @param type Type of radio indication
*/
void onAccessAllowed(in RadioIndicationType type, int token);
+
+ /**
+ * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114.
+ * Notifies the bit rate received from the network via ANBR message
+ *
+ * @param type Type of radio indication
+ * @param qosSessionId QoS session ID is used to identify media stream such as audio or video
+ * @param direction Direction of this packet stream (e.g. uplink or downlink)
+ * @param bitsPerSecond The recommended bit rate for the UE
+ * for a specific logical channel and a specific direction by NW
+ */
+ void notifyAnbr(in RadioIndicationType type, int qosSessionId, ImsStreamDirection direction,
+ int bitsPerSecond);
}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
index 8a736fa..7cc58a6 100644
--- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
+++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
@@ -91,4 +91,38 @@
* RadioError:NO_RESOURCES
*/
void performAcbCheckResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void setAnbrEnabledResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void sendAnbrQueryResponse(in RadioResponseInfo info);
}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl
new file mode 100644
index 0000000..8336a74
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.ims;
+
+@VintfStability
+@Backing(type="int")
+enum ImsStreamDirection {
+ /** DIRECTION_UPLINK - From UE to Network **/
+ UPLINK = 1,
+ /** DIRECTION_DOWNLINK - From Network to UE **/
+ DOWNLINK = 2,
+}
diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp
index 8c4aa14..79b4c3b 100644
--- a/radio/aidl/vts/radio_ims_indication.cpp
+++ b/radio/aidl/vts/radio_ims_indication.cpp
@@ -27,3 +27,8 @@
int /*token*/) {
return ndk::ScopedAStatus::ok();
}
+
+ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/,
+ int /*qosSessionId*/, int /*bitsPerSecond*/) {
+ return ndk::ScopedAStatus::ok();
+}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp
index f9f3401..dd629a5 100644
--- a/radio/aidl/vts/radio_ims_response.cpp
+++ b/radio/aidl/vts/radio_ims_response.cpp
@@ -42,3 +42,15 @@
parent_ims.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
+
+ndk::ScopedAStatus RadioImsResponse::setAnbrEnabledResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
\ No newline at end of file
diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp
index 62a18f1..8db8791 100644
--- a/radio/aidl/vts/radio_ims_test.cpp
+++ b/radio/aidl/vts/radio_ims_test.cpp
@@ -162,6 +162,58 @@
verifyError(radioRsp_ims->rspInfo.error);
}
+/*
+ * Test IRadioIms.setAnbrEnabled() for the response returned.
+ */
+TEST_P(RadioImsTest, setAnbrEnabled) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping setAnbrEnabled because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running setAnbrEnabled because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->setAnbrEnabled(serial, 1, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("setAnbrEnabled, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.sendAnbrQuery() for the response returned.
+ */
+TEST_P(RadioImsTest, sendAnbrQuery) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping sendAnbrQuery because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running sendAnbrQuery because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->sendAnbrQuery(serial, 1, 0, 13200);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("sendAnbrQuery, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
void RadioImsTest::verifyError(RadioError resp) {
switch (resp) {
case RadioError::NONE: