From 1a5f1ccfce831694e16b05fa08604e1f37b2c30a Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 2 Nov 2022 06:28:35 +0000 Subject: [PATCH] Update libradiocompat for IRadioIms in CF Bug: 216387835 Bug: 250912118 Test: atest VtsHalRadioTargetTest Change-Id: I0761c7e3111a3f5a008a9b55ef3c068f3fe0702c --- radio/aidl/compat/libradiocompat/Android.bp | 4 + .../compat/libradiocompat/ims/RadioIms.cpp | 88 +++++++++++++++++++ .../ims/RadioIndication-ims.cpp | 39 ++++++++ .../libradiocompat/ims/RadioResponse-ims.cpp | 38 ++++++++ .../include/libradiocompat/RadioIms.h | 62 +++++++++++++ .../include/libradiocompat/RadioIndication.h | 8 ++ .../include/libradiocompat/RadioResponse.h | 7 ++ radio/aidl/compat/service/Android.bp | 1 + 8 files changed, 247 insertions(+) create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIms.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index f79e045f63..0ceaec49dd 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -37,6 +37,7 @@ cc_library { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", @@ -69,6 +70,9 @@ cc_library { "data/RadioResponse-data.cpp", "data/RadioData.cpp", "data/structs.cpp", + "ims/RadioIndication-ims.cpp", + "ims/RadioResponse-ims.cpp", + "ims/RadioIms.cpp", "messaging/RadioIndication-messaging.cpp", "messaging/RadioMessaging.cpp", "messaging/RadioResponse-messaging.cpp", diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp new file mode 100644 index 0000000000..d2bdfff954 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "Ims" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +namespace aidl = ::aidl::android::hardware::radio::ims; +constexpr auto ok = &ScopedAStatus::ok; + +std::shared_ptr RadioIms::respond() { + return mCallbackManager->response().imsCb(); +} + +ScopedAStatus RadioIms::setSrvccCallInfo( + int32_t serial, const std::vector& /*srvccCalls*/) { + LOG_CALL << serial; + LOG(ERROR) << " setSrvccCallInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::updateImsRegistrationInfo( + int32_t serial, const aidl::ImsRegistration& /*imsRegistration*/) { + LOG_CALL << serial; + LOG(ERROR) << " updateImsRegistrationInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::startImsTraffic( + int32_t serial, int32_t /*token*/, aidl::ImsTrafficType /*imsTrafficType*/, + ::aidl::android::hardware::radio::AccessNetwork /*accessNetworkType*/, + ::aidl::android::hardware::radio::ims::ImsCall::Direction /*trafficDirection*/) { + LOG_CALL << serial; + LOG(ERROR) << " startImsTraffic is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::stopImsTraffic(int32_t serial, int32_t /*token*/) { + LOG_CALL << serial; + LOG(ERROR) << " stopImsTraffic is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::triggerEpsFallback(int32_t serial, aidl::EpsFallbackReason /*reason*/) { + LOG_CALL << serial; + LOG(ERROR) << " triggerEpsFallback is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::sendAnbrQuery( + int32_t serial, aidl::ImsStreamType /*mediaType*/, aidl::ImsStreamDirection /*direction*/, + int32_t /*bitsPerSecond*/) { + LOG_CALL << serial; + LOG(ERROR) << " sendAnbrQuery is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::updateImsCallStatus( + int32_t serial, const std::vector& /*imsCalls*/) { + LOG_CALL << serial; + LOG(ERROR) << " updateImsCallStatus is unsupported by HIDL HALs"; + return ok(); +} + +ScopedAStatus RadioIms::setResponseFunctions( + const std::shared_ptr& response, + const std::shared_ptr& indication) { + LOG_CALL << response << ' ' << indication; + mCallbackManager->setResponseFunctions(response, indication); + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp new file mode 100644 index 0000000000..10109b8f9b --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp @@ -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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsIndication" + +namespace android::hardware::radio::compat { + +using ::aidl::android::hardware::radio::RadioTechnology; +namespace aidl = ::aidl::android::hardware::radio::ims; + +void RadioIndication::setResponseFunction(std::shared_ptr imsCb) { + mImsCb = imsCb; +} + +std::shared_ptr RadioIndication::imsCb() { + return mImsCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp new file mode 100644 index 0000000000..831a0ae9c8 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp @@ -0,0 +1,38 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsResponse" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::ims; + +void RadioResponse::setResponseFunction(std::shared_ptr imsCb) { + mImsCb = imsCb; +} + +std::shared_ptr RadioResponse::imsCb() { + return mImsCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h new file mode 100644 index 0000000000..0dbc565c0e --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h @@ -0,0 +1,62 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" + +#include + +namespace android::hardware::radio::compat { + +class RadioIms : public RadioCompatBase, public aidl::android::hardware::radio::ims::BnRadioIms { + ::ndk::ScopedAStatus setSrvccCallInfo( + int32_t serial, + const std::vector<::aidl::android::hardware::radio::ims::SrvccCall>& srvccCalls) + override; + ::ndk::ScopedAStatus updateImsRegistrationInfo( + int32_t serial, + const ::aidl::android::hardware::radio::ims::ImsRegistration& imsRegistration) override; + ::ndk::ScopedAStatus startImsTraffic( + int32_t serial, int32_t token, + ::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType, + ::aidl::android::hardware::radio::AccessNetwork accessNetworkType, + ::aidl::android::hardware::radio::ims::ImsCall::Direction trafficDirection) override; + ::ndk::ScopedAStatus stopImsTraffic(int32_t serial, int32_t token) override; + ::ndk::ScopedAStatus triggerEpsFallback( + int32_t serial, + ::aidl::android::hardware::radio::ims::EpsFallbackReason reason) override; + ::ndk::ScopedAStatus sendAnbrQuery( + int32_t serial, ::aidl::android::hardware::radio::ims::ImsStreamType mediaType, + ::aidl::android::hardware::radio::ims::ImsStreamDirection direction, + int32_t bitsPerSecond) override; + ::ndk::ScopedAStatus updateImsCallStatus( + int32_t serial, + const std::vector<::aidl::android::hardware::radio::ims::ImsCall>& imsCalls) override; + + ::ndk::ScopedAStatus setResponseFunctions( + const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse>& + radioImsResponse, + const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication>& + radioImsIndication) override; + + protected: + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> respond(); + + public: + using RadioCompatBase::RadioCompatBase; +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index 6cfd59c6a3..f042456409 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -19,6 +19,7 @@ #include "GuaranteedCallback.h" #include +#include #include #include #include @@ -55,6 +56,10 @@ class RadioIndication : public V1_6::IRadioIndication { ::aidl::android::hardware::radio::voice::IRadioVoiceIndication, ::aidl::android::hardware::radio::voice::IRadioVoiceIndicationDefault, true> mVoiceCb; + GuaranteedCallback< // + ::aidl::android::hardware::radio::ims::IRadioImsIndication, + ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true> + mImsCb; // IRadioIndication @ 1.0 Return radioStateChanged(V1_0::RadioIndicationType type, @@ -220,6 +225,8 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication> @@ -228,6 +235,7 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb(); + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index 1f82dd19ca..22451aec7e 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -19,6 +19,7 @@ #include "GuaranteedCallback.h" #include +#include #include #include #include @@ -49,6 +50,9 @@ class RadioResponse : public V1_6::IRadioResponse { GuaranteedCallback<::aidl::android::hardware::radio::voice::IRadioVoiceResponse, ::aidl::android::hardware::radio::voice::IRadioVoiceResponseDefault> mVoiceCb; + GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse, + ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault> + mImsCb; // IRadioResponse @ 1.0 Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, @@ -440,6 +444,8 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> @@ -448,6 +454,7 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb(); + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 4dbaef4e71..d16773e6a7 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -40,6 +40,7 @@ cc_binary { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk",