From ff576455cab9da39cbf3b49803ce731de1d0aa6c Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 21 Oct 2022 13:15:23 +0000 Subject: [PATCH] Update IRadioIms for startImsTraffic and updateImsCallStatus Add trafficDirection paramter to startImsTraffic. Add updateImsCallStatus. Bug: 255450284 Test: atest VtsHalRadioTargetTest Change-Id: I1f6db4dc2daaab0015810bf775263b4095eaa7c6 --- .../android/hardware/radio/ims/IRadioIms.aidl | 3 +- .../hardware/radio/ims/IRadioImsResponse.aidl | 1 + .../android/hardware/radio/ims/ImsCall.aidl | 64 ++++++++++++++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 23 +++++-- .../hardware/radio/ims/IRadioImsResponse.aidl | 17 +++++ .../android/hardware/radio/ims/ImsCall.aidl | 66 +++++++++++++++++++ radio/aidl/vts/radio_ims_response.cpp | 6 ++ radio/aidl/vts/radio_ims_test.cpp | 30 ++++++++- radio/aidl/vts/radio_ims_utils.h | 2 + 9 files changed, 205 insertions(+), 7 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsCall.aidl 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 e7403456a7..4df870969d 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 @@ -36,9 +36,10 @@ package android.hardware.radio.ims; interface IRadioIms { oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); - oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); + oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType, android.hardware.radio.ims.ImsCall.Direction trafficDirection); oneway void stopImsTraffic(int serial, int token); oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void updateImsCallStatus(int serial, in android.hardware.radio.ims.ImsCall[] imsCalls); } 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 d4fd23fcda..053ba46864 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 @@ -40,4 +40,5 @@ interface IRadioImsResponse { oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); oneway void triggerEpsFallbackResponse(in android.hardware.radio.RadioResponseInfo info); oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void updateImsCallStatusResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl new file mode 100644 index 0000000000..e48653bfd4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl @@ -0,0 +1,64 @@ +/* + * 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 -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; +@JavaDerive(toString=true) @VintfStability +parcelable ImsCall { + int index; + android.hardware.radio.ims.ImsCall.CallType callType; + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.ims.ImsCall.CallState callState; + android.hardware.radio.ims.ImsCall.Direction direction; + boolean isHeldByRemote; + @Backing(type="int") + enum CallType { + NORMAL = 0, + EMERGENCY = 1, + } + @Backing(type="int") + enum CallState { + ACTIVE = 0, + HOLDING = 1, + DIALING = 2, + ALERTING = 3, + INCOMING = 4, + WAITING = 5, + DISCONNECTING = 6, + DISCONNECTED = 7, + } + @Backing(type="int") + enum Direction { + INCOMING = 0, + OUTGOING = 1, + } +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index c5412e1688..bd661a7224 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -18,14 +18,14 @@ package android.hardware.radio.ims; import android.hardware.radio.AccessNetwork; import android.hardware.radio.ims.EpsFallbackReason; -import android.hardware.radio.ims.ImsRegistration; -import android.hardware.radio.ims.ImsStreamDirection; -import android.hardware.radio.ims.ImsTrafficType; import android.hardware.radio.ims.IRadioImsIndication; import android.hardware.radio.ims.IRadioImsResponse; -import android.hardware.radio.ims.SrvccCall; +import android.hardware.radio.ims.ImsCall; +import android.hardware.radio.ims.ImsRegistration; import android.hardware.radio.ims.ImsStreamDirection; import android.hardware.radio.ims.ImsStreamType; +import android.hardware.radio.ims.ImsTrafficType; +import android.hardware.radio.ims.SrvccCall; /** * This interface is used by IMS telephony layer to talk to cellular radio. @@ -85,11 +85,14 @@ oneway interface IRadioIms { * @param token A nonce to identify the request * @param imsTrafficType IMS traffic type like registration, voice, and video * @param accessNetworkType The type of the radio access network used + * @param trafficDirection Indicates whether traffic is originated by mobile originated or + * mobile terminated use case eg. MO/MT call/SMS etc * * Response function is IRadioImsResponse.startImsTrafficResponse() */ void startImsTraffic(int serial, int token, - ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType); + ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType, + ImsCall.Direction trafficDirection); /** * Indicates IMS traffic has been stopped. @@ -136,4 +139,14 @@ oneway interface IRadioIms { * Response function is IRadioImsResponse.sendAnbrQueryResponse() */ void sendAnbrQuery(int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond); + + /** + * Provides a list of IMS call information to radio. + * + * @param serial Serial number of request + * @param imsCalls The list of IMS calls + * + * Response function is IRadioImsResponse.updateImsCallStatusResponse() + */ + void updateImsCallStatus(int serial, in ImsCall[] imsCalls); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index 351e748400..b5e7680566 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -128,4 +128,21 @@ oneway interface IRadioImsResponse { * RadioError:NO_RESOURCES */ void sendAnbrQueryResponse(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 updateImsCallStatusResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl new file mode 100644 index 0000000000..b71682fae3 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl @@ -0,0 +1,66 @@ +/* + * 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; + +import android.hardware.radio.AccessNetwork; + +@VintfStability +@JavaDerive(toString=true) +parcelable ImsCall { + + @Backing(type="int") + enum CallType { + NORMAL, + EMERGENCY, + } + + @Backing(type="int") + enum CallState { + ACTIVE, + HOLDING, + DIALING, /* Outgoing only */ + ALERTING, /* Outgoing only */ + INCOMING, /* Incoming only */ + WAITING, /* Incoming only */ + DISCONNECTING, + DISCONNECTED, + } + + @Backing(type="int") + enum Direction { + INCOMING, + OUTGOING, + } + + /** Call index */ + int index; + + /** The type of the call */ + CallType callType; + + /** The access network where the call is in progress */ + AccessNetwork accessNetwork; + + /** The state of the call */ + CallState callState; + + /** The direction of the call */ + Direction direction; + + /** True if the call is put on HOLD by the other party */ + boolean isHeldByRemote; +} diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index 9d8db4a5d7..c6d62dce69 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -56,3 +56,9 @@ ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseIn parent_ims.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioImsResponse::updateImsCallStatusResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index fb81e0559e..5e3f057c61 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -125,7 +125,7 @@ TEST_P(RadioImsTest, startImsTraffic) { ndk::ScopedAStatus res = radio_ims->startImsTraffic(serial, 1, - ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN); + ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN, ImsCall::Direction::OUTGOING); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); @@ -214,6 +214,34 @@ TEST_P(RadioImsTest, sendAnbrQuery) { verifyError(radioRsp_ims->rspInfo.error); } +/* + * Test IRadioIms.updateImsCallStatus() for the response returned. + */ +TEST_P(RadioImsTest, updateImsCallStatus) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping updateImsCallStatus because ims is not supported in device"); + return; + } else { + ALOGI("Running updateImsCallStatus because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ImsCall imsCall; + + ndk::ScopedAStatus res = + radio_ims->updateImsCallStatus(serial, { imsCall }); + 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("updateImsCallStatus, 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: diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index a435e44d99..2bf80dc987 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -52,6 +52,8 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override; virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus updateImsCallStatusResponse(const RadioResponseInfo& info) override; }; /* Callback class for radio ims indication */