Merge changes I670f78af,Ie2dce95b,Ic44227c9,I5770ee41,I82d27049, ... am: a15bdb9413

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1909397

Change-Id: Iaf2e40784ce2b69a57b2595da0990fe97e63a105
This commit is contained in:
Treehugger Robot
2021-12-08 22:54:00 +00:00
committed by Automerger Merge Worker
62 changed files with 8699 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
// Copyright (C) 2021 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
cc_library {
name: "android.hardware.radio-library.compat",
relative_install_path: "hw",
vendor: true,
cflags: [
"-Wall",
"-Wextra",
//"-Wold-style-cast", // TODO(b/203699028) enable after aosp/1900880 gets merged
"-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
],
shared_libs: [
"android.hardware.radio.config-V1-ndk",
"android.hardware.radio.config@1.0",
"android.hardware.radio.config@1.1",
"android.hardware.radio.config@1.2",
"android.hardware.radio.config@1.3",
"android.hardware.radio.data-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
"android.hardware.radio.network-V1-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio.voice-V1-ndk",
"android.hardware.radio@1.0",
"android.hardware.radio@1.1",
"android.hardware.radio@1.2",
"android.hardware.radio@1.3",
"android.hardware.radio@1.4",
"android.hardware.radio@1.5",
"android.hardware.radio@1.6",
"libbase",
"libbinder_ndk",
"libhidlbase",
"libutils",
],
srcs: [
"RadioCompatBase.cpp",
"RadioResponse.cpp",
"commonStructs.cpp",
"config/RadioConfig.cpp",
"config/RadioConfigIndication.cpp",
"config/RadioConfigResponse.cpp",
"config/structs.cpp",
"data/RadioIndication-data.cpp",
"data/RadioResponse-data.cpp",
"data/RadioData.cpp",
"data/structs.cpp",
"messaging/RadioIndication-messaging.cpp",
"messaging/RadioMessaging.cpp",
"messaging/RadioResponse-messaging.cpp",
"messaging/structs.cpp",
"modem/RadioIndication-modem.cpp",
"modem/RadioResponse-modem.cpp",
"modem/RadioModem.cpp",
"modem/structs.cpp",
"network/RadioIndication-network.cpp",
"network/RadioNetwork.cpp",
"network/RadioResponse-network.cpp",
"network/structs.cpp",
"network/utils.cpp",
"sim/RadioIndication-sim.cpp",
"sim/RadioResponse-sim.cpp",
"sim/RadioSim.cpp",
"sim/structs.cpp",
"voice/RadioIndication-voice.cpp",
"voice/RadioResponse-voice.cpp",
"voice/RadioVoice.cpp",
"voice/structs.cpp",
],
export_include_dirs: ["include"],
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioCompatBase.h>
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
RadioCompatBase::RadioCompatBase(sp<V1_5::IRadio> hidlHal, sp<RadioResponse> radioResponse,
sp<RadioIndication> radioIndication)
: mHal1_5(hidlHal),
mHal1_6(V1_6::IRadio::castFrom(hidlHal)),
mRadioResponse(radioResponse),
mRadioIndication(radioIndication) {}
V1_6::IRadioResponse& RadioCompatBase::respond() {
CHECK(mRadioResponse) << "This shouldn't happen (response functions are passed in constructor)";
return *mRadioResponse;
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "debug.h"
#define RADIO_MODULE "Common"
namespace android::hardware::radio::compat {
Return<void> RadioResponse::acknowledgeRequest(int32_t serial) {
LOG_CALL << serial;
// TODO(b/203699028): send to correct requestor or confirm if spam is not a problem
if (mDataCb) mDataCb->acknowledgeRequest(serial);
if (mMessagingCb) mMessagingCb->acknowledgeRequest(serial);
if (mModemCb) mModemCb->acknowledgeRequest(serial);
if (mNetworkCb) mNetworkCb->acknowledgeRequest(serial);
if (mSimCb) mSimCb->acknowledgeRequest(serial);
if (mVoiceCb) mVoiceCb->acknowledgeRequest(serial);
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,122 @@
/*
* Copyright (C) 2021 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 <hidl/HidlSupport.h>
#include <type_traits>
#include <variant>
namespace android::hardware::radio::compat {
/**
* Converts hidl_vec<T> HIDL list to std::vector<T> AIDL list.
*
* To convert values, the template uses toAidl functions for a given type T, assuming it's defined.
*
* \param inp vector to convert
*/
template <typename T>
auto toAidl(const hidl_vec<T>& inp) {
std::vector<decltype(toAidl(T{}))> out(inp.size());
for (size_t i = 0; i < inp.size(); i++) {
out[i] = toAidl(inp[i]);
}
return out;
}
/**
* Converts std::vector<T> AIDL list to hidl_vec<T> HIDL list.
*
* To convert values, the template uses toHidl functions for a given type T, assuming it's defined.
*
* \param inp vector to convert
*/
template <typename T>
auto toHidl(const std::vector<T>& inp) {
hidl_vec<decltype(toHidl(T{}))> out(inp.size());
for (size_t i = 0; i < inp.size(); i++) {
out[i] = toHidl(inp[i]);
}
return out;
}
/**
* Converts hidl_array<T> HIDL list to std::vector<T> AIDL list.
*
* To convert values, the template uses toAidl functions for a given type T, assuming it's defined.
*
* \param inp array to convert
*/
template <typename T, size_t N>
auto toAidl(const hidl_array<T, N>& inp) {
std::vector<decltype(toAidl(T{}))> out(N);
for (size_t i = 0; i < N; i++) {
out[i] = toAidl(inp[i]);
}
return out;
}
/**
* Converts T=OptionalX HIDL value to std::optional<X> AIDL value.
*
* To convert values, the template uses toAidl functions for a given type T.value.
*/
template <typename T>
std::optional<decltype(toAidl(T{}.value()))> toAidl(const T& opt) {
if (opt.getDiscriminator() == T::hidl_discriminator::noinit) return std::nullopt;
return toAidl(opt.value());
}
/**
* Converts T=OptionalX HIDL value to std::variant<bool, X> AIDL value.
*
* For some reason, not every OptionalX gets generated into a std::optional<X>.
*/
template <typename T>
std::variant<bool, decltype(toAidl(T{}.value()))> toAidlVariant(const T& opt) {
if (opt.getDiscriminator() == T::hidl_discriminator::noinit) return false;
return toAidl(opt.value());
}
/**
* Converts std::optional<X> AIDL value to T=OptionalX HIDL value.
*
* X is inferred from toAidl(T.value) declaration. Please note that toAidl(T.value) doesn't have to
* be implemented if it's not needed for anything else than giving this hint to type system.
*
* To convert values, the template uses toHidl functions for a given type T, assuming it's defined.
*
* \param opt value to convert
*/
template <typename T>
T toHidl(const std::optional<decltype(toAidl(T{}.value()))>& opt) {
T hidl;
if (opt.has_value()) hidl.value(toHidl(*opt));
return hidl;
}
/**
* Converts U AIDL bitfield value to HIDL T bitfield value.
*
* \param val value to convert
*/
template <typename T, typename U>
hidl_bitfield<T> toHidlBitfield(U val) {
return static_cast<int>(val);
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,83 @@
/*
* Copyright (C) 2021 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 "commonStructs.h"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio;
V1_6::RadioResponseInfo notSupported(int32_t serial) {
return {
.type = V1_0::RadioResponseType::SOLICITED,
.serial = serial,
.error = V1_6::RadioError::REQUEST_NOT_SUPPORTED,
};
}
std::string toAidl(const hidl_string& str) {
return str;
}
hidl_string toHidl(const std::string& str) {
return str;
}
uint8_t toAidl(int8_t v) {
return v;
}
int8_t toAidl(uint8_t v) {
return v;
}
int32_t toAidl(uint32_t v) {
return v;
}
aidl::RadioIndicationType toAidl(V1_0::RadioIndicationType type) {
return aidl::RadioIndicationType(type);
}
aidl::RadioResponseType toAidl(V1_0::RadioResponseType type) {
return aidl::RadioResponseType(type);
}
aidl::RadioError toAidl(V1_0::RadioError err) {
return aidl::RadioError(err);
}
aidl::RadioError toAidl(V1_6::RadioError err) {
return aidl::RadioError(err);
}
aidl::RadioResponseInfo toAidl(const V1_0::RadioResponseInfo& info) {
return {
.type = toAidl(info.type),
.serial = info.serial,
.error = toAidl(info.error),
};
}
aidl::RadioResponseInfo toAidl(const V1_6::RadioResponseInfo& info) {
return {
.type = toAidl(info.type),
.serial = info.serial,
.error = toAidl(info.error),
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/RadioIndicationType.h>
#include <aidl/android/hardware/radio/RadioResponseInfo.h>
#include <android/hardware/radio/1.6/types.h>
namespace android::hardware::radio::compat {
V1_6::RadioResponseInfo notSupported(int32_t serial);
std::string toAidl(const hidl_string& str);
hidl_string toHidl(const std::string& str);
uint8_t toAidl(int8_t v);
int8_t toAidl(uint8_t v);
int32_t toAidl(uint32_t v);
aidl::android::hardware::radio::RadioIndicationType toAidl(V1_0::RadioIndicationType type);
aidl::android::hardware::radio::RadioResponseType toAidl(V1_0::RadioResponseType type);
aidl::android::hardware::radio::RadioError toAidl(V1_0::RadioError type);
aidl::android::hardware::radio::RadioError toAidl(V1_6::RadioError type);
aidl::android::hardware::radio::RadioResponseInfo toAidl(const V1_0::RadioResponseInfo& info);
aidl::android::hardware::radio::RadioResponseInfo toAidl(const V1_6::RadioResponseInfo& info);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,103 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioConfig.h>
#include "RadioConfigIndication.h"
#include "RadioConfigResponse.h"
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#define RADIO_MODULE "Config"
namespace android::hardware::radio::compat {
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::config;
constexpr auto ok = &ScopedAStatus::ok;
RadioConfig::RadioConfig(sp<config::V1_1::IRadioConfig> hidlHal)
: mHal1_1(hidlHal), mHal1_3(config::V1_3::IRadioConfig::castFrom(hidlHal)) {}
config::V1_3::IRadioConfigResponse& RadioConfig::respond() {
CHECK(mRadioConfigResponse) << "setResponseFunctions was not called yet";
return *mRadioConfigResponse;
}
ScopedAStatus RadioConfig::getHalDeviceCapabilities(int32_t serial) {
LOG_CALL << serial;
if (mHal1_3) {
mHal1_3->getHalDeviceCapabilities(serial);
} else {
respond().getHalDeviceCapabilitiesResponse(notSupported(serial), false);
}
return ok();
}
ScopedAStatus RadioConfig::getNumOfLiveModems(int32_t serial) {
LOG_CALL << serial;
mHal1_1->getModemsConfig(serial);
return ok();
}
ScopedAStatus RadioConfig::getPhoneCapability(int32_t serial) {
LOG_CALL << serial;
mHal1_1->getPhoneCapability(serial);
return ok();
}
ScopedAStatus RadioConfig::getSimSlotsStatus(int32_t serial) {
LOG_CALL << serial;
mHal1_1->getSimSlotsStatus(serial);
return ok();
}
ScopedAStatus RadioConfig::setNumOfLiveModems(int32_t serial, int8_t numOfLiveModems) {
LOG_CALL << serial;
mHal1_1->setModemsConfig(serial, {static_cast<uint8_t>(numOfLiveModems)});
return ok();
}
ScopedAStatus RadioConfig::setPreferredDataModem(int32_t serial, int8_t modemId) {
LOG_CALL << serial;
mHal1_1->setPreferredDataModem(serial, modemId);
return ok();
}
ScopedAStatus RadioConfig::setResponseFunctions(
const std::shared_ptr<aidl::IRadioConfigResponse>& radioConfigResponse,
const std::shared_ptr<aidl::IRadioConfigIndication>& radioConfigIndication) {
LOG_CALL << radioConfigResponse << ' ' << radioConfigIndication;
CHECK(radioConfigResponse);
CHECK(radioConfigIndication);
mRadioConfigResponse = sp<RadioConfigResponse>::make(radioConfigResponse);
mRadioConfigIndication = sp<RadioConfigIndication>::make(radioConfigIndication);
mHal1_1->setResponseFunctions(mRadioConfigResponse, mRadioConfigIndication);
return ok();
}
ScopedAStatus RadioConfig::setSimSlotsMapping( //
int32_t serial, const std::vector<aidl::SlotPortMapping>& slotMap) {
LOG_CALL << serial;
mHal1_1->setSimSlotsMapping(serial, toHidl(slotMap));
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2021 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 "RadioConfigIndication.h"
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "ConfigIndication"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::config;
RadioConfigIndication::RadioConfigIndication(std::shared_ptr<aidl::IRadioConfigIndication> callback)
: mCallback(callback) {}
Return<void> RadioConfigIndication::simSlotsStatusChanged(
V1_0::RadioIndicationType type, const hidl_vec<config::V1_0::SimSlotStatus>& slotStatus) {
LOG_CALL << type;
mCallback->simSlotsStatusChanged(toAidl(type), toAidl(slotStatus));
return {};
}
Return<void> RadioConfigIndication::simSlotsStatusChanged_1_2(
V1_0::RadioIndicationType type, const hidl_vec<config::V1_2::SimSlotStatus>& slotStatus) {
LOG_CALL << type;
mCallback->simSlotsStatusChanged(toAidl(type), toAidl(slotStatus));
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfigIndication.h>
#include <android/hardware/radio/config/1.2/IRadioConfigIndication.h>
namespace android::hardware::radio::compat {
class RadioConfigIndication : public config::V1_2::IRadioConfigIndication {
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfigIndication> mCallback;
Return<void> simSlotsStatusChanged(
V1_0::RadioIndicationType type,
const hidl_vec<config::V1_0::SimSlotStatus>& slotStatus) override;
Return<void> simSlotsStatusChanged_1_2(
V1_0::RadioIndicationType type,
const hidl_vec<config::V1_2::SimSlotStatus>& slotStatus) override;
public:
RadioConfigIndication(
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfigIndication> cb);
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,90 @@
/*
* Copyright (C) 2021 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 "RadioConfigResponse.h"
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "ConfigResponse"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::config;
RadioConfigResponse::RadioConfigResponse(std::shared_ptr<aidl::IRadioConfigResponse> callback)
: mCallback(callback) {}
Return<void> RadioConfigResponse::getSimSlotsStatusResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<config::V1_0::SimSlotStatus>& slotStatus) {
LOG_CALL << info.serial;
mCallback->getSimSlotsStatusResponse(toAidl(info), toAidl(slotStatus));
return {};
};
Return<void> RadioConfigResponse::getSimSlotsStatusResponse_1_2(
const V1_0::RadioResponseInfo& info,
const hidl_vec<config::V1_2::SimSlotStatus>& slotStatus) {
LOG_CALL << info.serial;
mCallback->getSimSlotsStatusResponse(toAidl(info), toAidl(slotStatus));
return {};
};
Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
mCallback->setSimSlotsMappingResponse(toAidl(info));
return {};
};
Return<void> RadioConfigResponse::getPhoneCapabilityResponse(
const V1_0::RadioResponseInfo& info, const config::V1_1::PhoneCapability& phoneCapability) {
LOG_CALL << info.serial;
mCallback->getPhoneCapabilityResponse(toAidl(info), toAidl(phoneCapability));
return {};
};
Return<void> RadioConfigResponse::setPreferredDataModemResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
mCallback->setPreferredDataModemResponse(toAidl(info));
return {};
};
Return<void> RadioConfigResponse::setModemsConfigResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
mCallback->setNumOfLiveModemsResponse(toAidl(info));
return {};
};
Return<void> RadioConfigResponse::getModemsConfigResponse(
const V1_0::RadioResponseInfo& info, const config::V1_1::ModemsConfig& modemsConfig) {
LOG_CALL << info.serial;
mCallback->getNumOfLiveModemsResponse(toAidl(info), modemsConfig.numOfLiveModems);
return {};
};
Return<void> RadioConfigResponse::getHalDeviceCapabilitiesResponse(
const V1_6::RadioResponseInfo& info, bool modemReducedFeatureSet1) {
LOG_CALL << info.serial;
mCallback->getHalDeviceCapabilitiesResponse(toAidl(info), modemReducedFeatureSet1);
return {};
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/IRadioConfigResponse.h>
#include <android/hardware/radio/config/1.3/IRadioConfigResponse.h>
namespace android::hardware::radio::compat {
class RadioConfigResponse : public config::V1_3::IRadioConfigResponse {
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfigResponse> mCallback;
Return<void> getSimSlotsStatusResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<config::V1_0::SimSlotStatus>& slotStatus) override;
Return<void> setSimSlotsMappingResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getPhoneCapabilityResponse(
const V1_0::RadioResponseInfo& info,
const config::V1_1::PhoneCapability& phoneCapability) override;
Return<void> setPreferredDataModemResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setModemsConfigResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getModemsConfigResponse(const V1_0::RadioResponseInfo& info,
const config::V1_1::ModemsConfig& modemsConfig) override;
Return<void> getSimSlotsStatusResponse_1_2(
const V1_0::RadioResponseInfo& info,
const hidl_vec<config::V1_2::SimSlotStatus>& slotStatus) override;
Return<void> getHalDeviceCapabilitiesResponse(const V1_6::RadioResponseInfo& info,
bool modemReducedFeatureSet1) override;
public:
RadioConfigResponse(
std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfigResponse> callback);
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "collections.h"
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::config;
hidl_vec<uint32_t> toHidl(const std::vector<aidl::SlotPortMapping>& slotMap) {
hidl_vec<uint32_t> out(slotMap.size());
for (const auto& el : slotMap) {
CHECK_GE(el.portId, 0);
CHECK_LT(static_cast<size_t>(el.portId), out.size());
out[el.portId] = el.physicalSlotId;
}
return out;
}
aidl::SimSlotStatus toAidl(const config::V1_0::SimSlotStatus& sst) {
return toAidl({sst, ""});
}
aidl::SimSlotStatus toAidl(const config::V1_2::SimSlotStatus& sst) {
const aidl::SimPortInfo portInfo = {
.iccId = sst.base.iccid,
.logicalSlotId = static_cast<int32_t>(sst.base.logicalSlotId),
.portActive = sst.base.slotState == config::V1_0::SlotState::ACTIVE,
};
return {
.cardState = static_cast<int32_t>(sst.base.cardState),
.atr = sst.base.atr,
.eid = sst.eid,
.portInfo = {portInfo},
};
}
uint8_t toAidl(const config::V1_1::ModemInfo& info) {
return info.modemId;
}
aidl::PhoneCapability toAidl(const config::V1_1::PhoneCapability& phoneCapability) {
return {
.maxActiveData = static_cast<int8_t>(phoneCapability.maxActiveData),
.maxActiveInternetData = static_cast<int8_t>(phoneCapability.maxActiveInternetData),
.isInternetLingeringSupported = phoneCapability.isInternetLingeringSupported,
.logicalModemIds = toAidl(phoneCapability.logicalModemList),
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/PhoneCapability.h>
#include <aidl/android/hardware/radio/config/SimSlotStatus.h>
#include <aidl/android/hardware/radio/config/SlotPortMapping.h>
#include <android/hardware/radio/config/1.1/types.h>
#include <android/hardware/radio/config/1.2/types.h>
namespace android::hardware::radio::compat {
hidl_vec<uint32_t> //
toHidl(const std::vector<aidl::android::hardware::radio::config::SlotPortMapping>& slotMap);
aidl::android::hardware::radio::config::SimSlotStatus //
toAidl(const config::V1_0::SimSlotStatus& sst);
aidl::android::hardware::radio::config::SimSlotStatus //
toAidl(const config::V1_2::SimSlotStatus& sst);
uint8_t toAidl(const config::V1_1::ModemInfo& info);
aidl::android::hardware::radio::config::PhoneCapability //
toAidl(const config::V1_1::PhoneCapability& pc);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,180 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioData.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "Data"
namespace android::hardware::radio::compat {
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::data;
namespace aidlCommon = ::aidl::android::hardware::radio;
constexpr auto ok = &ScopedAStatus::ok;
ScopedAStatus RadioData::allocatePduSessionId(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->allocatePduSessionId(serial);
} else {
respond().allocatePduSessionIdResponse(notSupported(serial), 0);
}
return ok();
}
ScopedAStatus RadioData::cancelHandover(int32_t serial, int32_t callId) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->cancelHandover(serial, callId);
} else {
respond().cancelHandoverResponse(notSupported(serial));
}
return ok();
}
ScopedAStatus RadioData::deactivateDataCall(int32_t serial, int32_t cid,
aidl::DataRequestReason reason) {
LOG_CALL << serial;
mHal1_5->deactivateDataCall_1_2(serial, cid, V1_2::DataRequestReason(reason));
return ok();
}
ScopedAStatus RadioData::getDataCallList(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getDataCallList(serial);
return ok();
}
ScopedAStatus RadioData::getSlicingConfig(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->getSlicingConfig(serial);
} else {
respond().getSlicingConfigResponse(notSupported(serial), {});
}
return ok();
}
ScopedAStatus RadioData::releasePduSessionId(int32_t serial, int32_t id) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->releasePduSessionId(serial, id);
} else {
respond().releasePduSessionIdResponse(notSupported(serial));
}
return ok();
}
ScopedAStatus RadioData::responseAcknowledgement() {
LOG_CALL;
mHal1_5->responseAcknowledgement();
return ok();
}
ScopedAStatus RadioData::setDataAllowed(int32_t serial, bool allow) {
LOG_CALL << serial;
mHal1_5->setDataAllowed(serial, allow);
return ok();
}
ScopedAStatus RadioData::setDataProfile(int32_t serial,
const std::vector<aidl::DataProfileInfo>& profiles) {
LOG_CALL << serial;
mHal1_5->setDataProfile_1_5(serial, toHidl(profiles));
return ok();
}
ScopedAStatus RadioData::setDataThrottling(int32_t serial, aidl::DataThrottlingAction dta,
int64_t completionDurationMs) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->setDataThrottling(serial, V1_6::DataThrottlingAction(dta), completionDurationMs);
} else {
respond().setDataThrottlingResponse(notSupported(serial));
}
return ok();
}
ScopedAStatus RadioData::setInitialAttachApn(int32_t serial, const aidl::DataProfileInfo& info) {
LOG_CALL << serial;
mHal1_5->setInitialAttachApn_1_5(serial, toHidl(info));
return ok();
}
ScopedAStatus RadioData::setResponseFunctions(
const std::shared_ptr<aidl::IRadioDataResponse>& dataResponse,
const std::shared_ptr<aidl::IRadioDataIndication>& dataIndication) {
LOG_CALL << dataResponse << ' ' << dataIndication;
CHECK(dataResponse);
CHECK(dataIndication);
mRadioResponse->setResponseFunction(dataResponse);
mRadioIndication->setResponseFunction(dataIndication);
return ok();
}
ScopedAStatus RadioData::setupDataCall( //
int32_t serial, aidlCommon::AccessNetwork accessNetwork,
const aidl::DataProfileInfo& dataProfileInfo, bool roamingAllowed,
aidl::DataRequestReason reason, const std::vector<aidl::LinkAddress>& addresses,
const std::vector<std::string>& dnses, int32_t pduSessId,
const std::optional<aidl::SliceInfo>& sliceInfo,
const std::optional<aidl::TrafficDescriptor>& trDesc, bool matchAllRuleAllowed) {
if (mHal1_6) {
mHal1_6->setupDataCall_1_6( //
serial, V1_5::AccessNetwork(accessNetwork), toHidl(dataProfileInfo), roamingAllowed,
V1_2::DataRequestReason(reason), toHidl(addresses), toHidl(dnses), pduSessId,
toHidl<V1_6::OptionalSliceInfo>(sliceInfo),
toHidl<V1_6::OptionalTrafficDescriptor>(trDesc), matchAllRuleAllowed);
} else {
mHal1_5->setupDataCall_1_5( //
serial, V1_5::AccessNetwork(accessNetwork), toHidl(dataProfileInfo), roamingAllowed,
V1_2::DataRequestReason(reason), toHidl(addresses), toHidl(dnses));
}
return ok();
}
ScopedAStatus RadioData::startHandover(int32_t serial, int32_t callId) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->startHandover(serial, callId);
} else {
respond().startHandoverResponse(notSupported(serial));
}
return ok();
}
ScopedAStatus RadioData::startKeepalive(int32_t serial, const aidl::KeepaliveRequest& keepalive) {
LOG_CALL << serial;
mHal1_5->startKeepalive(serial, toHidl(keepalive));
return ok();
}
ScopedAStatus RadioData::stopKeepalive(int32_t serial, int32_t sessionHandle) {
LOG_CALL << serial;
mHal1_5->stopKeepalive(serial, sessionHandle);
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,90 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioIndication.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "DataIndication"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::data;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioDataIndication> dataCb) {
CHECK(dataCb);
mDataCb = dataCb;
}
Return<void> RadioIndication::dataCallListChanged(V1_0::RadioIndicationType type,
const hidl_vec<V1_0::SetupDataCallResult>&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioIndication::dataCallListChanged_1_4(V1_0::RadioIndicationType type,
const hidl_vec<V1_4::SetupDataCallResult>&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioIndication::dataCallListChanged_1_5(
V1_0::RadioIndicationType type, const hidl_vec<V1_5::SetupDataCallResult>& dcList) {
LOG_CALL << type;
CHECK_CB(mDataCb);
mDataCb->dataCallListChanged(toAidl(type), toAidl(dcList));
return {};
}
Return<void> RadioIndication::dataCallListChanged_1_6(
V1_0::RadioIndicationType type, const hidl_vec<V1_6::SetupDataCallResult>& dcList) {
LOG_CALL << type;
CHECK_CB(mDataCb);
mDataCb->dataCallListChanged(toAidl(type), toAidl(dcList));
return {};
}
Return<void> RadioIndication::keepaliveStatus(V1_0::RadioIndicationType type,
const V1_1::KeepaliveStatus& status) {
LOG_CALL << type;
CHECK_CB(mDataCb);
mDataCb->keepaliveStatus(toAidl(type), toAidl(status));
return {};
}
Return<void> RadioIndication::pcoData(V1_0::RadioIndicationType type,
const V1_0::PcoDataInfo& pco) {
LOG_CALL << type;
CHECK_CB(mDataCb);
mDataCb->pcoData(toAidl(type), toAidl(pco));
return {};
}
Return<void> RadioIndication::unthrottleApn(V1_0::RadioIndicationType type,
const hidl_string& apn) {
LOG_CALL << type;
CHECK_CB(mDataCb);
mDataCb->unthrottleApn(toAidl(type), apn);
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,199 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "DataResponse"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::data;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioDataResponse> dataCb) {
CHECK(dataCb);
mDataCb = dataCb;
}
Return<void> RadioResponse::allocatePduSessionIdResponse(const V1_6::RadioResponseInfo& info,
int32_t id) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->allocatePduSessionIdResponse(toAidl(info), id);
return {};
}
Return<void> RadioResponse::cancelHandoverResponse(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->cancelHandoverResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->deactivateDataCallResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::getDataCallListResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::SetupDataCallResult>&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::getDataCallListResponse_1_4(
const V1_0::RadioResponseInfo& info, const hidl_vec<V1_4::SetupDataCallResult>&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioResponse::getDataCallListResponse_1_5(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_5::SetupDataCallResult>& dcResponse) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->getDataCallListResponse(toAidl(info), toAidl(dcResponse));
return {};
}
Return<void> RadioResponse::getDataCallListResponse_1_6(
const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::SetupDataCallResult>& dcResponse) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->getDataCallListResponse(toAidl(info), toAidl(dcResponse));
return {};
}
Return<void> RadioResponse::getSlicingConfigResponse(const V1_6::RadioResponseInfo& info,
const V1_6::SlicingConfig& slicingConfig) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->getSlicingConfigResponse(toAidl(info), toAidl(slicingConfig));
return {};
}
Return<void> RadioResponse::releasePduSessionIdResponse(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->releasePduSessionIdResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setDataAllowedResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setDataAllowedResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setDataProfileResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setDataProfileResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setDataProfileResponse_1_5(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setDataProfileResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setDataThrottlingResponse(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setDataThrottlingResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setInitialAttachApnResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setInitialAttachApnResponse_1_5(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setInitialAttachApnResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setupDataCallResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SetupDataCallResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info,
const V1_4::SetupDataCallResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::setupDataCallResponse_1_5(const V1_0::RadioResponseInfo& info,
const V1_5::SetupDataCallResult& dcResponse) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setupDataCallResponse(toAidl(info), toAidl(dcResponse));
return {};
}
Return<void> RadioResponse::setupDataCallResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_6::SetupDataCallResult& dcResponse) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->setupDataCallResponse(toAidl(info), toAidl(dcResponse));
return {};
}
Return<void> RadioResponse::startHandoverResponse(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->startHandoverResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::startKeepaliveResponse(const V1_0::RadioResponseInfo& info,
const V1_1::KeepaliveStatus& status) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->startKeepaliveResponse(toAidl(info), toAidl(status));
return {};
}
Return<void> RadioResponse::stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mDataCb);
mDataCb->stopKeepaliveResponse(toAidl(info));
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,288 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "commonStructs.h"
#include "collections.h"
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::data;
V1_5::DataProfileInfo toHidl(const aidl::DataProfileInfo& info) {
return {
.profileId = V1_0::DataProfileId{info.profileId},
.apn = info.apn,
.protocol = V1_4::PdpProtocolType{info.protocol},
.roamingProtocol = V1_4::PdpProtocolType{info.roamingProtocol},
.authType = V1_0::ApnAuthType{info.authType},
.user = info.user,
.password = info.password,
.type = V1_0::DataProfileInfoType{info.type},
.maxConnsTime = info.maxConnsTime,
.maxConns = info.maxConns,
.waitTime = info.waitTime,
.enabled = info.enabled,
.supportedApnTypesBitmap = toHidlBitfield<V1_5::ApnTypes>(info.supportedApnTypesBitmap),
.bearerBitmap = toHidlBitfield<V1_4::RadioAccessFamily>(info.bearerBitmap),
.mtuV4 = info.mtuV4,
.mtuV6 = info.mtuV6,
.preferred = info.preferred,
.persistent = info.persistent,
};
}
V1_5::LinkAddress toHidl(const aidl::LinkAddress& addr) {
return {
.address = addr.address,
.properties = addr.addressProperties,
.deprecationTime = static_cast<uint64_t>(addr.deprecationTime),
.expirationTime = static_cast<uint64_t>(addr.expirationTime),
};
}
aidl::SliceInfo toAidl(const V1_6::SliceInfo& info) {
return {
.sliceServiceType = static_cast<int8_t>(info.sst),
.sliceDifferentiator = info.sliceDifferentiator,
.mappedHplmnSst = static_cast<int8_t>(info.mappedHplmnSst),
.mappedHplmnSd = info.mappedHplmnSD,
.status = static_cast<int8_t>(info.status),
};
}
V1_6::SliceInfo toHidl(const aidl::SliceInfo& info) {
return {
.sst = static_cast<V1_6::SliceServiceType>(info.sliceServiceType),
.sliceDifferentiator = info.sliceDifferentiator,
.mappedHplmnSst = static_cast<V1_6::SliceServiceType>(info.mappedHplmnSst),
.mappedHplmnSD = info.mappedHplmnSd,
.status = V1_6::SliceStatus{info.status},
};
}
aidl::TrafficDescriptor toAidl(const V1_6::TrafficDescriptor& descr) {
return {
.dnn = toAidl(descr.dnn),
.osAppId = toAidl(descr.osAppId),
};
}
V1_6::TrafficDescriptor toHidl(const aidl::TrafficDescriptor& descr) {
return {
.dnn = toHidl<V1_6::OptionalDnn>(descr.dnn),
.osAppId = toHidl<V1_6::OptionalOsAppId>(descr.osAppId),
};
}
aidl::OsAppId toAidl(const V1_6::OsAppId& appId) {
return {
.osAppId = appId.osAppId,
};
}
V1_6::OsAppId toHidl(const aidl::OsAppId& appId) {
return {
.osAppId = appId.osAppId,
};
}
V1_1::KeepaliveRequest toHidl(const aidl::KeepaliveRequest& keep) {
return {
.type = V1_1::KeepaliveType{keep.type},
.sourceAddress = keep.sourceAddress,
.sourcePort = keep.sourcePort,
.destinationAddress = keep.destinationAddress,
.destinationPort = keep.destinationPort,
.maxKeepaliveIntervalMillis = keep.maxKeepaliveIntervalMillis,
.cid = keep.cid,
};
}
static aidl::QosBandwidth toAidl(const V1_6::QosBandwidth& bw) {
return {
.maxBitrateKbps = static_cast<int32_t>(bw.maxBitrateKbps),
.guaranteedBitrateKbps = static_cast<int32_t>(bw.guaranteedBitrateKbps),
};
}
static aidl::EpsQos toAidl(const V1_6::EpsQos& qos) {
return {
.qci = qos.qci,
.downlink = toAidl(qos.downlink),
.uplink = toAidl(qos.uplink),
};
}
static aidl::NrQos toAidl(const V1_6::NrQos& qos) {
return {
.fiveQi = qos.fiveQi,
.downlink = toAidl(qos.downlink),
.uplink = toAidl(qos.uplink),
.qfi = static_cast<int8_t>(qos.qfi),
.averagingWindowMs = qos.averagingWindowMs,
};
}
static std::variant<bool, aidl::EpsQos, aidl::NrQos> toAidl(const V1_6::Qos& qos) {
if (qos.getDiscriminator() == V1_6::Qos::hidl_discriminator::eps) return toAidl(qos.eps());
if (qos.getDiscriminator() == V1_6::Qos::hidl_discriminator::nr) return toAidl(qos.nr());
return false;
}
aidl::SetupDataCallResult toAidl(const V1_5::SetupDataCallResult& res) {
return {
.cause = aidl::DataCallFailCause(res.cause),
.suggestedRetryTime = res.suggestedRetryTime,
.cid = res.cid,
.active = static_cast<int32_t>(res.active),
.type = aidl::PdpProtocolType(res.type),
.ifname = res.ifname,
.addresses = toAidl(res.addresses),
.dnses = toAidl(res.dnses),
.gateways = toAidl(res.gateways),
.pcscf = toAidl(res.pcscf),
.mtuV4 = res.mtuV4,
.mtuV6 = res.mtuV6,
};
}
aidl::SetupDataCallResult toAidl(const V1_6::SetupDataCallResult& res) {
return {
.cause = aidl::DataCallFailCause(res.cause),
.suggestedRetryTime = res.suggestedRetryTime,
.cid = res.cid,
.active = static_cast<int32_t>(res.active),
.type = aidl::PdpProtocolType(res.type),
.ifname = res.ifname,
.addresses = toAidl(res.addresses),
.dnses = toAidl(res.dnses),
.gateways = toAidl(res.gateways),
.pcscf = toAidl(res.pcscf),
.mtuV4 = res.mtuV4,
.mtuV6 = res.mtuV6,
.defaultQos = toAidl(res.defaultQos),
.qosSessions = toAidl(res.qosSessions),
.handoverFailureMode = static_cast<int8_t>(res.handoverFailureMode),
.pduSessionId = res.pduSessionId,
.sliceInfo = toAidl(res.sliceInfo),
.trafficDescriptors = toAidl(res.trafficDescriptors),
};
}
aidl::LinkAddress toAidl(const V1_5::LinkAddress& addr) {
return {
.address = addr.address,
.addressProperties = addr.properties,
.deprecationTime = static_cast<int64_t>(addr.deprecationTime),
.expirationTime = static_cast<int64_t>(addr.expirationTime),
};
}
aidl::QosSession toAidl(const V1_6::QosSession& sess) {
return {
.qosSessionId = sess.qosSessionId,
.qos = toAidl(sess.qos),
.qosFilters = toAidl(sess.qosFilters),
};
}
static aidl::PortRange toAidl(const V1_6::PortRange& range) {
return {
.start = range.start,
.end = range.end,
};
}
static std::optional<aidl::PortRange> toAidl(const V1_6::MaybePort& opt) {
if (opt.getDiscriminator() == V1_6::MaybePort::hidl_discriminator::noinit) return std::nullopt;
return toAidl(opt.range()); // can't use MaybeX template - this field is not named "value"
}
aidl::QosFilter toAidl(const V1_6::QosFilter& filter) {
return {
.localAddresses = toAidl(filter.localAddresses),
.remoteAddresses = toAidl(filter.remoteAddresses),
.localPort = toAidl(filter.localPort),
.remotePort = toAidl(filter.remotePort),
.protocol = static_cast<int8_t>(filter.protocol),
.tos = toAidlVariant(filter.tos),
.flowLabel = toAidlVariant(filter.flowLabel),
.spi = toAidlVariant(filter.spi),
.direction = static_cast<int8_t>(filter.direction),
.precedence = filter.precedence,
};
}
aidl::KeepaliveStatus toAidl(const V1_1::KeepaliveStatus& status) {
return {
.sessionHandle = status.sessionHandle,
.code = static_cast<int32_t>(status.code),
};
}
aidl::PcoDataInfo toAidl(const V1_0::PcoDataInfo& info) {
return {
.cid = info.cid,
.bearerProto = info.bearerProto,
.pcoId = info.pcoId,
.contents = info.contents,
};
}
aidl::SlicingConfig toAidl(const V1_6::SlicingConfig& cfg) {
return {
.urspRules = toAidl(cfg.urspRules),
.sliceInfo = toAidl(cfg.sliceInfo),
};
}
aidl::UrspRule toAidl(const V1_6::UrspRule& rule) {
return {
.precedence = rule.precedence,
.trafficDescriptors = toAidl(rule.trafficDescriptors),
.routeSelectionDescriptor = toAidl(rule.routeSelectionDescriptor),
};
}
static int8_t toAidl(const V1_6::OptionalSscMode& opt) {
if (opt.getDiscriminator() == V1_6::OptionalSscMode::hidl_discriminator::noinit) {
return aidl::RouteSelectionDescriptor::SSC_MODE_UNKNOWN;
}
return static_cast<int8_t>(opt.value());
}
static aidl::PdpProtocolType toAidl(const V1_6::OptionalPdpProtocolType& opt) {
using discriminator = V1_6::OptionalPdpProtocolType::hidl_discriminator;
if (opt.getDiscriminator() == discriminator::noinit) return aidl::PdpProtocolType::UNKNOWN;
return aidl::PdpProtocolType(opt.value());
}
aidl::RouteSelectionDescriptor toAidl(const V1_6::RouteSelectionDescriptor& descr) {
return {
.precedence = static_cast<int8_t>(descr.precedence),
.sessionType = toAidl(descr.sessionType),
.sscMode = toAidl(descr.sscMode),
.sliceInfo = toAidl(descr.sliceInfo),
.dnn = toAidl(descr.dnn),
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/data/DataProfileInfo.h>
#include <aidl/android/hardware/radio/data/KeepaliveRequest.h>
#include <aidl/android/hardware/radio/data/KeepaliveStatus.h>
#include <aidl/android/hardware/radio/data/LinkAddress.h>
#include <aidl/android/hardware/radio/data/OsAppId.h>
#include <aidl/android/hardware/radio/data/PcoDataInfo.h>
#include <aidl/android/hardware/radio/data/RouteSelectionDescriptor.h>
#include <aidl/android/hardware/radio/data/SetupDataCallResult.h>
#include <aidl/android/hardware/radio/data/SliceInfo.h>
#include <aidl/android/hardware/radio/data/SlicingConfig.h>
#include <aidl/android/hardware/radio/data/TrafficDescriptor.h>
#include <aidl/android/hardware/radio/data/UrspRule.h>
#include <android/hardware/radio/1.6/types.h>
namespace android::hardware::radio::compat {
V1_5::DataProfileInfo toHidl(const ::aidl::android::hardware::radio::data::DataProfileInfo& info);
V1_5::LinkAddress toHidl(const ::aidl::android::hardware::radio::data::LinkAddress& addr);
::aidl::android::hardware::radio::data::SliceInfo toAidl(const V1_6::SliceInfo& info);
V1_6::SliceInfo toHidl(const ::aidl::android::hardware::radio::data::SliceInfo& info);
::aidl::android::hardware::radio::data::TrafficDescriptor toAidl(const V1_6::TrafficDescriptor& td);
V1_6::TrafficDescriptor toHidl(const ::aidl::android::hardware::radio::data::TrafficDescriptor& td);
V1_1::KeepaliveRequest toHidl(const ::aidl::android::hardware::radio::data::KeepaliveRequest& keep);
::aidl::android::hardware::radio::data::OsAppId toAidl(const V1_6::OsAppId& appId);
V1_6::OsAppId toHidl(const ::aidl::android::hardware::radio::data::OsAppId& appId);
::aidl::android::hardware::radio::data::SetupDataCallResult //
toAidl(const V1_5::SetupDataCallResult& res);
::aidl::android::hardware::radio::data::SetupDataCallResult //
toAidl(const V1_6::SetupDataCallResult& res);
::aidl::android::hardware::radio::data::LinkAddress toAidl(const V1_5::LinkAddress& addr);
::aidl::android::hardware::radio::data::QosSession toAidl(const V1_6::QosSession& session);
::aidl::android::hardware::radio::data::QosFilter toAidl(const V1_6::QosFilter& filter);
::aidl::android::hardware::radio::data::KeepaliveStatus toAidl(const V1_1::KeepaliveStatus& status);
::aidl::android::hardware::radio::data::PcoDataInfo toAidl(const V1_0::PcoDataInfo& info);
::aidl::android::hardware::radio::data::SlicingConfig toAidl(const V1_6::SlicingConfig& cfg);
::aidl::android::hardware::radio::data::UrspRule toAidl(const V1_6::UrspRule& rule);
::aidl::android::hardware::radio::data::RouteSelectionDescriptor //
toAidl(const V1_6::RouteSelectionDescriptor& descr);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 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 <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace debug {
static constexpr bool kSuperVerbose = true;
#define LOG_CALL \
if constexpr (debug::kSuperVerbose) LOG(VERBOSE) << (RADIO_MODULE ".") << __func__ << ' '
#define CHECK_CB(field) \
if (!field) { \
LOG(WARNING) << "Callback not set"; \
return {}; \
}
} // namespace debug
inline std::ostream& operator<<(std::ostream& os, const V1_0::RadioIndicationType& type) {
return os << static_cast<int>(type);
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2021 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 "RadioIndication.h"
#include "RadioResponse.h"
#include <android/hardware/radio/1.6/IRadio.h>
namespace android::hardware::radio::compat {
class RadioCompatBase {
protected:
sp<V1_5::IRadio> mHal1_5;
sp<V1_6::IRadio> mHal1_6;
sp<RadioResponse> mRadioResponse;
sp<RadioIndication> mRadioIndication;
V1_6::IRadioResponse& respond();
public:
RadioCompatBase(sp<V1_5::IRadio> hidlHal, sp<RadioResponse> radioResponse,
sp<RadioIndication> radioIndication);
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/config/BnRadioConfig.h>
#include <android/hardware/radio/config/1.2/IRadioConfigIndication.h>
#include <android/hardware/radio/config/1.3/IRadioConfig.h>
#include <android/hardware/radio/config/1.3/IRadioConfigResponse.h>
namespace android::hardware::radio::compat {
/**
* HAL translator from HIDL IRadioConfig to AIDL IRadioConfig.
*
* This class wraps existing HIDL implementation (either a binder stub or real
* class implementing the HAL) and implements AIDL HAL. It's up to the caller to
* fetch source implementation and publish resulting HAL instance.
*/
class RadioConfig : public aidl::android::hardware::radio::config::BnRadioConfig {
sp<config::V1_1::IRadioConfig> mHal1_1;
sp<config::V1_3::IRadioConfig> mHal1_3;
sp<config::V1_3::IRadioConfigResponse> mRadioConfigResponse;
sp<config::V1_2::IRadioConfigIndication> mRadioConfigIndication;
::ndk::ScopedAStatus getHalDeviceCapabilities(int32_t serial) override;
::ndk::ScopedAStatus getNumOfLiveModems(int32_t serial) override;
::ndk::ScopedAStatus getPhoneCapability(int32_t serial) override;
::ndk::ScopedAStatus getSimSlotsStatus(int32_t serial) override;
::ndk::ScopedAStatus setNumOfLiveModems(int32_t serial, int8_t numOfLiveModems) override;
::ndk::ScopedAStatus setPreferredDataModem(int32_t serial, int8_t modemId) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfigResponse>&
radioConfigResponse,
const std::shared_ptr<aidl::android::hardware::radio::config::IRadioConfigIndication>&
radioConfigIndication) override;
::ndk::ScopedAStatus setSimSlotsMapping(
int32_t serial,
const std::vector<aidl::android::hardware::radio::config::SlotPortMapping>& slotMap)
override;
config::V1_3::IRadioConfigResponse& respond();
public:
/**
* Constructs AIDL IRadioConfig instance wrapping existing HIDL IRadioConfig instance.
*
* \param hidlHal existing HIDL IRadioConfig HAL instance
*/
RadioConfig(sp<config::V1_1::IRadioConfig> hidlHal);
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,70 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/data/BnRadioData.h>
namespace android::hardware::radio::compat {
class RadioData : public RadioCompatBase, public aidl::android::hardware::radio::data::BnRadioData {
::ndk::ScopedAStatus allocatePduSessionId(int32_t serial) override;
::ndk::ScopedAStatus cancelHandover(int32_t serial, int32_t callId) override;
::ndk::ScopedAStatus deactivateDataCall(
int32_t serial, int32_t cid,
::aidl::android::hardware::radio::data::DataRequestReason reason) override;
::ndk::ScopedAStatus getDataCallList(int32_t serial) override;
::ndk::ScopedAStatus getSlicingConfig(int32_t serial) override;
::ndk::ScopedAStatus releasePduSessionId(int32_t serial, int32_t id) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus setDataAllowed(int32_t serial, bool allow) override;
::ndk::ScopedAStatus setDataProfile(
int32_t serial,
const std::vector<::aidl::android::hardware::radio::data::DataProfileInfo>& profiles)
override;
::ndk::ScopedAStatus setDataThrottling(
int32_t serial,
::aidl::android::hardware::radio::data::DataThrottlingAction dataThrottlingAction,
int64_t completionDurationMillis) override;
::ndk::ScopedAStatus setInitialAttachApn(
int32_t serial,
const ::aidl::android::hardware::radio::data::DataProfileInfo& dpInfo) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse>&
radioDataResponse,
const std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication>&
radioDataIndication) override;
::ndk::ScopedAStatus setupDataCall(
int32_t serial, ::aidl::android::hardware::radio::AccessNetwork accessNetwork,
const ::aidl::android::hardware::radio::data::DataProfileInfo& dataProfileInfo,
bool roamingAllowed, ::aidl::android::hardware::radio::data::DataRequestReason reason,
const std::vector<::aidl::android::hardware::radio::data::LinkAddress>& addresses,
const std::vector<std::string>& dnses, int32_t pduSessionId,
const std::optional<::aidl::android::hardware::radio::data::SliceInfo>& sliceInfo,
const std::optional<::aidl::android::hardware::radio::data::TrafficDescriptor>& trDescr,
bool matchAllRuleAllowed) override;
::ndk::ScopedAStatus startHandover(int32_t serial, int32_t callId) override;
::ndk::ScopedAStatus startKeepalive(
int32_t serial,
const ::aidl::android::hardware::radio::data::KeepaliveRequest& keepalive) override;
::ndk::ScopedAStatus stopKeepalive(int32_t serial, int32_t sessionHandle) override;
public:
using RadioCompatBase::RadioCompatBase;
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,199 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/data/IRadioDataIndication.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessagingIndication.h>
#include <aidl/android/hardware/radio/modem/IRadioModemIndication.h>
#include <aidl/android/hardware/radio/network/IRadioNetworkIndication.h>
#include <aidl/android/hardware/radio/sim/IRadioSimIndication.h>
#include <aidl/android/hardware/radio/voice/IRadioVoiceIndication.h>
#include <android/hardware/radio/1.6/IRadioIndication.h>
namespace android::hardware::radio::compat {
class RadioIndication : public V1_6::IRadioIndication {
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> mDataCb;
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
mMessagingCb;
std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication> mModemCb;
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> mNetworkCb;
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> mSimCb;
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> mVoiceCb;
// IRadioIndication @ 1.0
Return<void> radioStateChanged(V1_0::RadioIndicationType type,
V1_0::RadioState radioState) override;
Return<void> callStateChanged(V1_0::RadioIndicationType type) override;
Return<void> networkStateChanged(V1_0::RadioIndicationType type) override;
Return<void> newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) override;
Return<void> newSmsStatusReport(V1_0::RadioIndicationType type,
const hidl_vec<uint8_t>& pdu) override;
Return<void> newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) override;
Return<void> onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
const hidl_string& msg) override;
Return<void> nitzTimeReceived(V1_0::RadioIndicationType type, const hidl_string& nitzTime,
uint64_t receivedTime) override;
Return<void> currentSignalStrength(V1_0::RadioIndicationType type,
const V1_0::SignalStrength& signalStrength) override;
Return<void> dataCallListChanged(V1_0::RadioIndicationType type,
const hidl_vec<V1_0::SetupDataCallResult>& dcList) override;
Return<void> suppSvcNotify(V1_0::RadioIndicationType type,
const V1_0::SuppSvcNotification& suppSvc) override;
Return<void> stkSessionEnd(V1_0::RadioIndicationType type) override;
Return<void> stkProactiveCommand(V1_0::RadioIndicationType type,
const hidl_string& cmd) override;
Return<void> stkEventNotify(V1_0::RadioIndicationType type, const hidl_string& cmd) override;
Return<void> stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) override;
Return<void> simSmsStorageFull(V1_0::RadioIndicationType type) override;
Return<void> simRefresh(V1_0::RadioIndicationType type,
const V1_0::SimRefreshResult& refreshResult) override;
Return<void> callRing(V1_0::RadioIndicationType type, bool isGsm,
const V1_0::CdmaSignalInfoRecord& record) override;
Return<void> simStatusChanged(V1_0::RadioIndicationType type) override;
Return<void> cdmaNewSms(V1_0::RadioIndicationType type,
const V1_0::CdmaSmsMessage& msg) override;
Return<void> newBroadcastSms(V1_0::RadioIndicationType type,
const hidl_vec<uint8_t>& data) override;
Return<void> cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) override;
Return<void> restrictedStateChanged(V1_0::RadioIndicationType type,
V1_0::PhoneRestrictedState state) override;
Return<void> enterEmergencyCallbackMode(V1_0::RadioIndicationType type) override;
Return<void> cdmaCallWaiting(V1_0::RadioIndicationType type,
const V1_0::CdmaCallWaiting& callWaitingRecord) override;
Return<void> cdmaOtaProvisionStatus(V1_0::RadioIndicationType type,
V1_0::CdmaOtaProvisionStatus status) override;
Return<void> cdmaInfoRec(V1_0::RadioIndicationType type,
const V1_0::CdmaInformationRecords& records) override;
Return<void> indicateRingbackTone(V1_0::RadioIndicationType type, bool start) override;
Return<void> resendIncallMute(V1_0::RadioIndicationType type) override;
Return<void> cdmaSubscriptionSourceChanged(V1_0::RadioIndicationType type,
V1_0::CdmaSubscriptionSource cdmaSource) override;
Return<void> cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) override;
Return<void> exitEmergencyCallbackMode(V1_0::RadioIndicationType type) override;
Return<void> rilConnected(V1_0::RadioIndicationType type) override;
Return<void> voiceRadioTechChanged(V1_0::RadioIndicationType type,
V1_0::RadioTechnology rat) override;
Return<void> cellInfoList(V1_0::RadioIndicationType type,
const hidl_vec<V1_0::CellInfo>& records) override;
Return<void> imsNetworkStateChanged(V1_0::RadioIndicationType type) override;
Return<void> subscriptionStatusChanged(V1_0::RadioIndicationType type, bool activate) override;
Return<void> srvccStateNotify(V1_0::RadioIndicationType type, V1_0::SrvccState state) override;
Return<void> hardwareConfigChanged(V1_0::RadioIndicationType type,
const hidl_vec<V1_0::HardwareConfig>& configs) override;
Return<void> radioCapabilityIndication(V1_0::RadioIndicationType type,
const V1_0::RadioCapability& rc) override;
Return<void> onSupplementaryServiceIndication(V1_0::RadioIndicationType type,
const V1_0::StkCcUnsolSsResult& ss) override;
Return<void> stkCallControlAlphaNotify(V1_0::RadioIndicationType type,
const hidl_string& alpha) override;
Return<void> lceData(V1_0::RadioIndicationType type, const V1_0::LceDataInfo& lce) override;
Return<void> pcoData(V1_0::RadioIndicationType type, const V1_0::PcoDataInfo& pco) override;
Return<void> modemReset(V1_0::RadioIndicationType type, const hidl_string& reason) override;
// IRadioIndication @ 1.1
Return<void> carrierInfoForImsiEncryption(V1_0::RadioIndicationType info) override;
Return<void> networkScanResult(V1_0::RadioIndicationType type,
const V1_1::NetworkScanResult& result) override;
Return<void> keepaliveStatus(V1_0::RadioIndicationType type,
const V1_1::KeepaliveStatus& status) override;
// IRadioIndication @ 1.2
Return<void> networkScanResult_1_2(V1_0::RadioIndicationType type,
const V1_2::NetworkScanResult& result) override;
Return<void> cellInfoList_1_2(V1_0::RadioIndicationType type,
const hidl_vec<V1_2::CellInfo>& records) override;
Return<void> currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
const V1_2::LinkCapacityEstimate& lce) override;
Return<void> currentPhysicalChannelConfigs(
V1_0::RadioIndicationType type,
const hidl_vec<V1_2::PhysicalChannelConfig>& configs) override;
Return<void> currentSignalStrength_1_2(V1_0::RadioIndicationType type,
const V1_2::SignalStrength& signalStrength) override;
// IRadioIndication @ 1.4
Return<void> currentEmergencyNumberList(
V1_0::RadioIndicationType type,
const hidl_vec<V1_4::EmergencyNumber>& emergencyNumberList) override;
Return<void> cellInfoList_1_4(V1_0::RadioIndicationType type,
const hidl_vec<V1_4::CellInfo>& records) override;
Return<void> networkScanResult_1_4(V1_0::RadioIndicationType type,
const V1_4::NetworkScanResult& result) override;
Return<void> currentPhysicalChannelConfigs_1_4(
V1_0::RadioIndicationType type,
const hidl_vec<V1_4::PhysicalChannelConfig>& configs) override;
Return<void> dataCallListChanged_1_4(
V1_0::RadioIndicationType type,
const hidl_vec<V1_4::SetupDataCallResult>& dcList) override;
Return<void> currentSignalStrength_1_4(V1_0::RadioIndicationType type,
const V1_4::SignalStrength& signalStrength) override;
// IRadioIndication @ 1.5
Return<void> uiccApplicationsEnablementChanged(V1_0::RadioIndicationType type,
bool enabled) override;
Return<void> registrationFailed( //
V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
int32_t additionalCauseCode) override;
Return<void> barringInfoChanged( //
V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
const hidl_vec<V1_5::BarringInfo>& barringInfos) override;
Return<void> cellInfoList_1_5(V1_0::RadioIndicationType type,
const hidl_vec<V1_5::CellInfo>& records) override;
Return<void> networkScanResult_1_5(V1_0::RadioIndicationType type,
const V1_5::NetworkScanResult& result) override;
Return<void> dataCallListChanged_1_5(
V1_0::RadioIndicationType type,
const hidl_vec<V1_5::SetupDataCallResult>& dcList) override;
// IRadioIndication @ 1.6
Return<void> dataCallListChanged_1_6(
V1_0::RadioIndicationType type,
const hidl_vec<V1_6::SetupDataCallResult>& dcList) override;
Return<void> unthrottleApn(V1_0::RadioIndicationType type, const hidl_string& apn) override;
Return<void> currentLinkCapacityEstimate_1_6(V1_0::RadioIndicationType type,
const V1_6::LinkCapacityEstimate& lce) override;
Return<void> currentSignalStrength_1_6(V1_0::RadioIndicationType type,
const V1_6::SignalStrength& signalStrength) override;
Return<void> cellInfoList_1_6(V1_0::RadioIndicationType type,
const hidl_vec<V1_6::CellInfo>& records) override;
Return<void> networkScanResult_1_6(V1_0::RadioIndicationType type,
const V1_6::NetworkScanResult& result) override;
Return<void> currentPhysicalChannelConfigs_1_6(
V1_0::RadioIndicationType type,
const hidl_vec<V1_6::PhysicalChannelConfig>& configs) override;
Return<void> simPhonebookChanged(V1_0::RadioIndicationType type) override;
Return<void> simPhonebookRecordsReceived(
V1_0::RadioIndicationType type, V1_6::PbReceivedStatus status,
const hidl_vec<V1_6::PhonebookRecordInfo>& records) override;
public:
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
radioMessagingIndication);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication> modmCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> ni);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb);
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,89 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/messaging/BnRadioMessaging.h>
namespace android::hardware::radio::compat {
class RadioMessaging : public RadioCompatBase,
public aidl::android::hardware::radio::messaging::BnRadioMessaging {
::ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
const std::string& ackPdu) override;
::ndk::ScopedAStatus acknowledgeLastIncomingCdmaSms(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::CdmaSmsAck& smsAck) override;
::ndk::ScopedAStatus acknowledgeLastIncomingGsmSms(
int32_t serial, bool success,
::aidl::android::hardware::radio::messaging::SmsAcknowledgeFailCause cause) override;
::ndk::ScopedAStatus cancelPendingUssd(int32_t serial) override;
::ndk::ScopedAStatus deleteSmsOnRuim(int32_t serial, int32_t index) override;
::ndk::ScopedAStatus deleteSmsOnSim(int32_t serial, int32_t index) override;
::ndk::ScopedAStatus getCdmaBroadcastConfig(int32_t serial) override;
::ndk::ScopedAStatus getGsmBroadcastConfig(int32_t serial) override;
::ndk::ScopedAStatus getSmscAddress(int32_t serial) override;
::ndk::ScopedAStatus reportSmsMemoryStatus(int32_t serial, bool available) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus sendCdmaSms(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::CdmaSmsMessage& sms) override;
::ndk::ScopedAStatus sendCdmaSmsExpectMore(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::CdmaSmsMessage& sms) override;
::ndk::ScopedAStatus sendImsSms(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::ImsSmsMessage& message) override;
::ndk::ScopedAStatus sendSms(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::GsmSmsMessage& message) override;
::ndk::ScopedAStatus sendSmsExpectMore(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::GsmSmsMessage& message) override;
::ndk::ScopedAStatus sendUssd(int32_t serial, const std::string& ussd) override;
::ndk::ScopedAStatus setCdmaBroadcastActivation(int32_t serial, bool activate) override;
::ndk::ScopedAStatus setCdmaBroadcastConfig(
int32_t serial,
const std::vector<
::aidl::android::hardware::radio::messaging::CdmaBroadcastSmsConfigInfo>&
configInfo) override;
::ndk::ScopedAStatus setGsmBroadcastActivation(int32_t serial, bool activate) override;
::ndk::ScopedAStatus setGsmBroadcastConfig(
int32_t serial,
const std::vector<
::aidl::android::hardware::radio::messaging::GsmBroadcastSmsConfigInfo>&
configInfo) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<
::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>&
radioMessagingResponse,
const std::shared_ptr<
::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>&
radioMessagingIndication) override;
::ndk::ScopedAStatus setSmscAddress(int32_t serial, const std::string& smsc) override;
::ndk::ScopedAStatus writeSmsToRuim(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::CdmaSmsWriteArgs& cdmaSms) override;
::ndk::ScopedAStatus writeSmsToSim(
int32_t serial,
const ::aidl::android::hardware::radio::messaging::SmsWriteArgs& smsWriteArgs) override;
public:
using RadioCompatBase::RadioCompatBase;
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/modem/BnRadioModem.h>
namespace android::hardware::radio::compat {
class RadioModem : public RadioCompatBase,
public aidl::android::hardware::radio::modem::BnRadioModem {
::ndk::ScopedAStatus enableModem(int32_t serial, bool on) override;
::ndk::ScopedAStatus getBasebandVersion(int32_t serial) override;
::ndk::ScopedAStatus getDeviceIdentity(int32_t serial) override;
::ndk::ScopedAStatus getHardwareConfig(int32_t serial) override;
::ndk::ScopedAStatus getModemActivityInfo(int32_t serial) override;
::ndk::ScopedAStatus getModemStackStatus(int32_t serial) override;
::ndk::ScopedAStatus getRadioCapability(int32_t serial) override;
::ndk::ScopedAStatus nvReadItem(
int32_t serial, ::aidl::android::hardware::radio::modem::NvItem itemId) override;
::ndk::ScopedAStatus nvResetConfig(
int32_t serial, ::aidl::android::hardware::radio::modem::ResetNvType type) override;
::ndk::ScopedAStatus nvWriteCdmaPrl(int32_t serial, const std::vector<uint8_t>& prl) override;
::ndk::ScopedAStatus nvWriteItem(
int32_t serial, const ::aidl::android::hardware::radio::modem::NvWriteItem& i) override;
::ndk::ScopedAStatus requestShutdown(int32_t serial) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus sendDeviceState(
int32_t serial, ::aidl::android::hardware::radio::modem::DeviceStateType stateType,
bool state) override;
::ndk::ScopedAStatus setRadioCapability(
int32_t s, const ::aidl::android::hardware::radio::modem::RadioCapability& rc) override;
::ndk::ScopedAStatus setRadioPower(int32_t serial, bool powerOn, bool forEmergencyCall,
bool preferredForEmergencyCall) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse>&
radioModemResponse,
const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication>&
radioModemIndication) override;
public:
using RadioCompatBase::RadioCompatBase;
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,96 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/network/BnRadioNetwork.h>
namespace android::hardware::radio::compat {
class RadioNetwork : public RadioCompatBase,
public aidl::android::hardware::radio::network::BnRadioNetwork {
::ndk::ScopedAStatus getAllowedNetworkTypesBitmap(int32_t serial) override;
::ndk::ScopedAStatus getAvailableBandModes(int32_t serial) override;
::ndk::ScopedAStatus getAvailableNetworks(int32_t serial) override;
::ndk::ScopedAStatus getBarringInfo(int32_t serial) override;
::ndk::ScopedAStatus getCdmaRoamingPreference(int32_t serial) override;
::ndk::ScopedAStatus getCellInfoList(int32_t serial) override;
::ndk::ScopedAStatus getDataRegistrationState(int32_t serial) override;
::ndk::ScopedAStatus getImsRegistrationState(int32_t serial) override;
::ndk::ScopedAStatus getNetworkSelectionMode(int32_t serial) override;
::ndk::ScopedAStatus getOperator(int32_t serial) override;
::ndk::ScopedAStatus getSignalStrength(int32_t serial) override;
::ndk::ScopedAStatus getSystemSelectionChannels(int32_t serial) override;
::ndk::ScopedAStatus getVoiceRadioTechnology(int32_t serial) override;
::ndk::ScopedAStatus getVoiceRegistrationState(int32_t serial) override;
::ndk::ScopedAStatus isNrDualConnectivityEnabled(int32_t serial) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus setAllowedNetworkTypesBitmap(
int32_t serial,
::aidl::android::hardware::radio::RadioAccessFamily networkTypeBitmap) override;
::ndk::ScopedAStatus setBandMode(
int32_t serial, ::aidl::android::hardware::radio::network::RadioBandMode mode) override;
::ndk::ScopedAStatus setBarringPassword(int32_t serial, const std::string& facility,
const std::string& oldPassword,
const std::string& newPassword) override;
::ndk::ScopedAStatus setCdmaRoamingPreference(
int32_t serial,
::aidl::android::hardware::radio::network::CdmaRoamingType type) override;
::ndk::ScopedAStatus setCellInfoListRate(int32_t serial, int32_t rate) override;
::ndk::ScopedAStatus setIndicationFilter(
int32_t serial,
::aidl::android::hardware::radio::network::IndicationFilter indicationFilter) override;
::ndk::ScopedAStatus setLinkCapacityReportingCriteria(
int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps,
int32_t hysteresisUlKbps, const std::vector<int32_t>& thresholdsDownlinkKbps,
const std::vector<int32_t>& thresholdsUplinkKbps,
::aidl::android::hardware::radio::AccessNetwork accessNetwork) override;
::ndk::ScopedAStatus setLocationUpdates(int32_t serial, bool enable) override;
::ndk::ScopedAStatus setNetworkSelectionModeAutomatic(int32_t serial) override;
::ndk::ScopedAStatus setNetworkSelectionModeManual(
int32_t serial, const std::string& operatorNumeric,
::aidl::android::hardware::radio::AccessNetwork ran) override;
::ndk::ScopedAStatus setNrDualConnectivityState(
int32_t serial,
::aidl::android::hardware::radio::network::NrDualConnectivityState nrSt) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse>&
radioNetworkResponse,
const std::shared_ptr<
::aidl::android::hardware::radio::network::IRadioNetworkIndication>&
radioNetworkIndication) override;
::ndk::ScopedAStatus setSignalStrengthReportingCriteria(
int32_t serial,
const std::vector<::aidl::android::hardware::radio::network::SignalThresholdInfo>&
signalThresholdInfos) override;
::ndk::ScopedAStatus setSuppServiceNotifications(int32_t serial, bool enable) override;
::ndk::ScopedAStatus setSystemSelectionChannels(
int32_t serial, bool specifyChannels,
const std::vector<::aidl::android::hardware::radio::network::RadioAccessSpecifier>&
specifiers) override;
::ndk::ScopedAStatus startNetworkScan(
int32_t serial,
const ::aidl::android::hardware::radio::network::NetworkScanRequest& request) override;
::ndk::ScopedAStatus stopNetworkScan(int32_t serial) override;
::ndk::ScopedAStatus supplyNetworkDepersonalization(int32_t serial,
const std::string& netPin) override;
public:
using RadioCompatBase::RadioCompatBase;
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,427 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/data/IRadioDataResponse.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessagingResponse.h>
#include <aidl/android/hardware/radio/modem/IRadioModemResponse.h>
#include <aidl/android/hardware/radio/network/IRadioNetworkResponse.h>
#include <aidl/android/hardware/radio/sim/IRadioSimResponse.h>
#include <aidl/android/hardware/radio/voice/IRadioVoiceResponse.h>
#include <android/hardware/radio/1.6/IRadioResponse.h>
namespace android::hardware::radio::compat {
class RadioResponse : public V1_6::IRadioResponse {
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> mDataCb;
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>
mMessagingCb;
std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse> mModemCb;
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> mNetworkCb;
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> mSimCb;
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> mVoiceCb;
// IRadioResponse @ 1.0
Return<void> getIccCardStatusResponse(const V1_0::RadioResponseInfo& info,
const V1_0::CardStatus& cardStatus) override;
Return<void> supplyIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> supplyIccPukForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> supplyIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> supplyIccPuk2ForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> changeIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> changeIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> supplyNetworkDepersonalizationResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) override;
Return<void> getCurrentCallsResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::Call>& calls) override;
Return<void> dialResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getIMSIForAppResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& imsi) override;
Return<void> hangupConnectionResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> hangupForegroundResumeBackgroundResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> switchWaitingOrHoldingAndActiveResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> conferenceResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> rejectCallResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getLastCallFailCauseResponse(
const V1_0::RadioResponseInfo& info,
const V1_0::LastCallFailCauseInfo& failCauseinfo) override;
Return<void> getSignalStrengthResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SignalStrength& sigStrength) override;
Return<void> getVoiceRegistrationStateResponse(
const V1_0::RadioResponseInfo& info,
const V1_0::VoiceRegStateResult& voiceRegResponse) override;
Return<void> getDataRegistrationStateResponse(
const V1_0::RadioResponseInfo& info,
const V1_0::DataRegStateResult& dataRegResponse) override;
Return<void> getOperatorResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& longName, const hidl_string& shortName,
const hidl_string& numeric) override;
Return<void> setRadioPowerResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> sendDtmfResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> sendSmsResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> setupDataCallResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SetupDataCallResult& dcResponse) override;
Return<void> iccIOForAppResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& iccIo) override;
Return<void> sendUssdResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n,
int32_t m) override;
Return<void> setClirResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getCallForwardStatusResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::CallForwardInfo>& callForwardInfos) override;
Return<void> setCallForwardResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable,
int32_t serviceClass) override;
Return<void> setCallWaitingResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> acknowledgeLastIncomingGsmSmsResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> acceptCallResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t response) override;
Return<void> setFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t retry) override;
Return<void> setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info,
bool manual) override;
Return<void> setNetworkSelectionModeAutomaticResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> setNetworkSelectionModeManualResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> getAvailableNetworksResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::OperatorInfo>& networkInfos) override;
Return<void> startDtmfResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> stopDtmfResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getBasebandVersionResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& version) override;
Return<void> separateConnectionResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setMuteResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) override;
Return<void> getClipResponse(const V1_0::RadioResponseInfo& info,
V1_0::ClipStatus status) override;
Return<void> getDataCallListResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::SetupDataCallResult>& dcResponse) override;
Return<void> setSuppServiceNotificationsResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> writeSmsToSimResponse(const V1_0::RadioResponseInfo& info, int32_t index) override;
Return<void> deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setBandModeResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getAvailableBandModesResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::RadioBandMode>& bandModes) override;
Return<void> sendEnvelopeResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& commandResponse) override;
Return<void> sendTerminalResponseToSimResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> handleStkCallSetupRequestFromSimResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
V1_0::PreferredNetworkType nwType) override;
Return<void> getNeighboringCidsResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::NeighboringCell>& cells) override;
Return<void> setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info,
V1_0::CdmaRoamingType type) override;
Return<void> setTTYModeResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getTTYModeResponse(const V1_0::RadioResponseInfo& info,
V1_0::TtyMode mode) override;
Return<void> setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info,
bool enable) override;
Return<void> sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> acknowledgeLastIncomingCdmaSmsResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> getGsmBroadcastConfigResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& configs) override;
Return<void> setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getCdmaBroadcastConfigResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configs) override;
Return<void> setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setCdmaBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getCDMASubscriptionResponse( //
const V1_0::RadioResponseInfo& info, const hidl_string& mdn, const hidl_string& hSid,
const hidl_string& hNid, const hidl_string& min, const hidl_string& prl) override;
Return<void> writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info,
uint32_t index) override;
Return<void> deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getDeviceIdentityResponse( //
const V1_0::RadioResponseInfo& info, const hidl_string& imei, const hidl_string& imeisv,
const hidl_string& esn, const hidl_string& meid) override;
Return<void> exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getSmscAddressResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& smsc) override;
Return<void> setSmscAddressResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> reportStkServiceIsRunningResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info,
V1_0::CdmaSubscriptionSource source) override;
Return<void> requestIsimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& response) override;
Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> sendEnvelopeWithStatusResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& iccIo) override;
Return<void> getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info,
V1_0::RadioTechnology rat) override;
Return<void> getCellInfoListResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::CellInfo>& cellInfo) override;
Return<void> setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getImsRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
bool isRegistered,
V1_0::RadioTechnologyFamily ratFamily) override;
Return<void> sendImsSmsResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> iccTransmitApduBasicChannelResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& result) override;
Return<void> iccOpenLogicalChannelResponse(const V1_0::RadioResponseInfo& info,
int32_t channelId,
const hidl_vec<int8_t>& selectResponse) override;
Return<void> iccCloseLogicalChannelResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> iccTransmitApduLogicalChannelResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& result) override;
Return<void> nvReadItemResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& result) override;
Return<void> nvWriteItemResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> nvWriteCdmaPrlResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> nvResetConfigResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setUiccSubscriptionResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setDataAllowedResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getHardwareConfigResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::HardwareConfig>& config) override;
Return<void> requestIccSimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& result) override;
Return<void> setDataProfileResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> requestShutdownResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
const V1_0::RadioCapability& rc) override;
Return<void> setRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
const V1_0::RadioCapability& rc) override;
Return<void> startLceServiceResponse(const V1_0::RadioResponseInfo& info,
const V1_0::LceStatusInfo& statusInfo) override;
Return<void> stopLceServiceResponse(const V1_0::RadioResponseInfo& info,
const V1_0::LceStatusInfo& statusInfo) override;
Return<void> pullLceDataResponse(const V1_0::RadioResponseInfo& info,
const V1_0::LceDataInfo& lceInfo) override;
Return<void> getModemActivityInfoResponse(const V1_0::RadioResponseInfo& info,
const V1_0::ActivityStatsInfo& activityInfo) override;
Return<void> setAllowedCarriersResponse(const V1_0::RadioResponseInfo& info,
int32_t numAllowed) override;
Return<void> getAllowedCarriersResponse(const V1_0::RadioResponseInfo& info, bool allAllowed,
const V1_0::CarrierRestrictions& carriers) override;
Return<void> sendDeviceStateResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> setSimCardPowerResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> acknowledgeRequest(int32_t serial) override;
// IRadioResponse @ 1.1
Return<void> setCarrierInfoForImsiEncryptionResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> setSimCardPowerResponse_1_1(const V1_0::RadioResponseInfo& info) override;
Return<void> startNetworkScanResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> startKeepaliveResponse(const V1_0::RadioResponseInfo& info,
const V1_1::KeepaliveStatus& status) override;
Return<void> stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) override;
// IRadioResponse @ 1.2
Return<void> getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_2::CellInfo>& cellInfo) override;
Return<void> getIccCardStatusResponse_1_2(const V1_0::RadioResponseInfo& info,
const V1_2::CardStatus& cardStatus) override;
Return<void> setSignalStrengthReportingCriteriaResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> setLinkCapacityReportingCriteriaResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_2::Call>& calls) override;
Return<void> getSignalStrengthResponse_1_2(const V1_0::RadioResponseInfo& info,
const V1_2::SignalStrength& signalStrength) override;
Return<void> getVoiceRegistrationStateResponse_1_2(
const V1_0::RadioResponseInfo& info,
const V1_2::VoiceRegStateResult& voiceRegResponse) override;
Return<void> getDataRegistrationStateResponse_1_2(
const V1_0::RadioResponseInfo& info,
const V1_2::DataRegStateResult& dataRegResponse) override;
// IRadioResponse @ 1.3
Return<void> setSystemSelectionChannelsResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> enableModemResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> getModemStackStatusResponse(const V1_0::RadioResponseInfo& info,
bool isEnabled) override;
// IRadioResponse @ 1.4
Return<void> emergencyDialResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) override;
Return<void> getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_4::CellInfo>& cellInfo) override;
Return<void> getDataRegistrationStateResponse_1_4(
const V1_0::RadioResponseInfo& info,
const V1_4::DataRegStateResult& dataRegResponse) override;
Return<void> getIccCardStatusResponse_1_4(const V1_0::RadioResponseInfo& info,
const V1_4::CardStatus& cardStatus) override;
Return<void> getPreferredNetworkTypeBitmapResponse(
const V1_0::RadioResponseInfo& info,
hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) override;
Return<void> setPreferredNetworkTypeBitmapResponse(
const V1_0::RadioResponseInfo& info) override;
Return<void> getDataCallListResponse_1_4(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_4::SetupDataCallResult>& dcResponse) override;
Return<void> setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info,
const V1_4::SetupDataCallResult& dcResponse) override;
Return<void> setAllowedCarriersResponse_1_4(const V1_0::RadioResponseInfo& info) override;
Return<void> getAllowedCarriersResponse_1_4(
const V1_0::RadioResponseInfo& info,
const V1_4::CarrierRestrictionsWithPriority& carriers,
V1_4::SimLockMultiSimPolicy multiSimPolicy) override;
Return<void> getSignalStrengthResponse_1_4(const V1_0::RadioResponseInfo& info,
const V1_4::SignalStrength& signalStrength) override;
// IRadioResponse @ 1.5
Return<void> setSignalStrengthReportingCriteriaResponse_1_5(
const V1_0::RadioResponseInfo& info) override;
Return<void> setLinkCapacityReportingCriteriaResponse_1_5(
const V1_0::RadioResponseInfo& info) override;
Return<void> enableUiccApplicationsResponse(const V1_0::RadioResponseInfo& info) override;
Return<void> areUiccApplicationsEnabledResponse(const V1_0::RadioResponseInfo& info,
bool enabled) override;
Return<void> setSystemSelectionChannelsResponse_1_5(
const V1_0::RadioResponseInfo& info) override;
Return<void> startNetworkScanResponse_1_5(const V1_0::RadioResponseInfo& info) override;
Return<void> setupDataCallResponse_1_5(const V1_0::RadioResponseInfo& info,
const V1_5::SetupDataCallResult& dcResponse) override;
Return<void> getDataCallListResponse_1_5(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_5::SetupDataCallResult>& dcResponse) override;
Return<void> setInitialAttachApnResponse_1_5(const V1_0::RadioResponseInfo& info) override;
Return<void> setDataProfileResponse_1_5(const V1_0::RadioResponseInfo& info) override;
Return<void> setRadioPowerResponse_1_5(const V1_0::RadioResponseInfo& info) override;
Return<void> setIndicationFilterResponse_1_5(const V1_0::RadioResponseInfo& info) override;
Return<void> getBarringInfoResponse(const V1_0::RadioResponseInfo& info,
const V1_5::CellIdentity& cellIdentity,
const hidl_vec<V1_5::BarringInfo>& barringInfos) override;
Return<void> getVoiceRegistrationStateResponse_1_5(
const V1_0::RadioResponseInfo& info,
const V1_5::RegStateResult& voiceRegResponse) override;
Return<void> getDataRegistrationStateResponse_1_5(
const V1_0::RadioResponseInfo& info,
const V1_5::RegStateResult& dataRegResponse) override;
Return<void> getCellInfoListResponse_1_5(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_5::CellInfo>& cellInfo) override;
Return<void> setNetworkSelectionModeManualResponse_1_5(
const V1_0::RadioResponseInfo& info) override;
Return<void> sendCdmaSmsExpectMoreResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> supplySimDepersonalizationResponse(const V1_0::RadioResponseInfo& info,
V1_5::PersoSubstate persoType,
int32_t remainingRetries) override;
Return<void> getIccCardStatusResponse_1_5(const V1_0::RadioResponseInfo& info,
const V1_5::CardStatus& cardStatus) override;
// IRadioResponse @ 1.6
Return<void> setRadioPowerResponse_1_6(const V1_6::RadioResponseInfo& info) override;
Return<void> setupDataCallResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_6::SetupDataCallResult& dcResponse) override;
Return<void> getDataCallListResponse_1_6(
const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::SetupDataCallResult>& dcResponse) override;
Return<void> sendSmsResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> sendSmsExpectMoreResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> sendCdmaSmsResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> sendCdmaSmsExpectMoreResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) override;
Return<void> setSimCardPowerResponse_1_6(const V1_6::RadioResponseInfo& info) override;
Return<void> setNrDualConnectivityStateResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> isNrDualConnectivityEnabledResponse(const V1_6::RadioResponseInfo& info,
bool isEnabled) override;
Return<void> allocatePduSessionIdResponse(const V1_6::RadioResponseInfo& info,
int32_t id) override;
Return<void> releasePduSessionIdResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> startHandoverResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> cancelHandoverResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> setAllowedNetworkTypesBitmapResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> getAllowedNetworkTypesBitmapResponse(
const V1_6::RadioResponseInfo& info,
hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) override;
Return<void> setDataThrottlingResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> getSystemSelectionChannelsResponse(
const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_5::RadioAccessSpecifier>& specifiers) override;
Return<void> getCellInfoListResponse_1_6(const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::CellInfo>& cellInfo) override;
Return<void> getSignalStrengthResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_6::SignalStrength& signalStrength) override;
Return<void> getVoiceRegistrationStateResponse_1_6(
const V1_6::RadioResponseInfo& info,
const V1_6::RegStateResult& voiceRegResponse) override;
Return<void> getDataRegistrationStateResponse_1_6(
const V1_6::RadioResponseInfo& info,
const V1_6::RegStateResult& dataRegResponse) override;
Return<void> getCurrentCallsResponse_1_6(const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::Call>& calls) override;
Return<void> getSlicingConfigResponse(const V1_6::RadioResponseInfo& info,
const V1_6::SlicingConfig& slicingConfig) override;
Return<void> getSimPhonebookRecordsResponse(const V1_6::RadioResponseInfo& info) override;
Return<void> getSimPhonebookCapacityResponse(const V1_6::RadioResponseInfo& info,
const V1_6::PhonebookCapacity& capacity) override;
Return<void> updateSimPhonebookRecordsResponse(const V1_6::RadioResponseInfo& info,
int32_t updatedRecordIndex) override;
public:
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>
radioMessagingResponse);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse> modemCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> nwCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb);
void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb);
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,107 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/sim/BnRadioSim.h>
namespace android::hardware::radio::compat {
class RadioSim : public RadioCompatBase, public aidl::android::hardware::radio::sim::BnRadioSim {
::ndk::ScopedAStatus areUiccApplicationsEnabled(int32_t serial) override;
::ndk::ScopedAStatus changeIccPin2ForApp(int32_t serial, const std::string& oldPin2,
const std::string& newPin2,
const std::string& aid) override;
::ndk::ScopedAStatus changeIccPinForApp(int32_t serial, const std::string& oldPin,
const std::string& newPin,
const std::string& aid) override;
::ndk::ScopedAStatus enableUiccApplications(int32_t serial, bool enable) override;
::ndk::ScopedAStatus getAllowedCarriers(int32_t serial) override;
::ndk::ScopedAStatus getCdmaSubscription(int32_t serial) override;
::ndk::ScopedAStatus getCdmaSubscriptionSource(int32_t serial) override;
::ndk::ScopedAStatus getFacilityLockForApp(int32_t serial, const std::string& facility,
const std::string& password, int32_t serviceClass,
const std::string& appId) override;
::ndk::ScopedAStatus getIccCardStatus(int32_t serial) override;
::ndk::ScopedAStatus getImsiForApp(int32_t serial, const std::string& aid) override;
::ndk::ScopedAStatus getSimPhonebookCapacity(int32_t serial) override;
::ndk::ScopedAStatus getSimPhonebookRecords(int32_t serial) override;
::ndk::ScopedAStatus iccCloseLogicalChannel(int32_t serial, int32_t channelId) override;
::ndk::ScopedAStatus iccIoForApp(
int32_t serial, const ::aidl::android::hardware::radio::sim::IccIo& iccIo) override;
::ndk::ScopedAStatus iccOpenLogicalChannel(int32_t serial, const std::string& aid,
int32_t p2) override;
::ndk::ScopedAStatus iccTransmitApduBasicChannel(
int32_t serial, const ::aidl::android::hardware::radio::sim::SimApdu& message) override;
::ndk::ScopedAStatus iccTransmitApduLogicalChannel(
int32_t serial, const ::aidl::android::hardware::radio::sim::SimApdu& message) override;
::ndk::ScopedAStatus reportStkServiceIsRunning(int32_t serial) override;
::ndk::ScopedAStatus requestIccSimAuthentication(int32_t serial, int32_t authContext,
const std::string& authData,
const std::string& aid) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus sendEnvelope(int32_t serial, const std::string& command) override;
::ndk::ScopedAStatus sendEnvelopeWithStatus(int32_t serial,
const std::string& contents) override;
::ndk::ScopedAStatus sendTerminalResponseToSim(int32_t serial,
const std::string& commandResponse) override;
::ndk::ScopedAStatus setAllowedCarriers(
int32_t serial,
const ::aidl::android::hardware::radio::sim::CarrierRestrictions& carriers,
::aidl::android::hardware::radio::sim::SimLockMultiSimPolicy multiSimPolicy) override;
::ndk::ScopedAStatus setCarrierInfoForImsiEncryption(
int32_t serial,
const ::aidl::android::hardware::radio::sim::ImsiEncryptionInfo& imsiEncryptionInfo)
override;
::ndk::ScopedAStatus setCdmaSubscriptionSource(
int32_t serial,
::aidl::android::hardware::radio::sim::CdmaSubscriptionSource cdmaSub) override;
::ndk::ScopedAStatus setFacilityLockForApp( //
int32_t serial, const std::string& facility, bool lockState, const std::string& passwd,
int32_t serviceClass, const std::string& appId) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse>&
radioSimResponse,
const std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication>&
radioSimIndication) override;
::ndk::ScopedAStatus setSimCardPower(
int32_t serial, ::aidl::android::hardware::radio::sim::CardPowerState powerUp) override;
::ndk::ScopedAStatus setUiccSubscription(
int32_t serial,
const ::aidl::android::hardware::radio::sim::SelectUiccSub& uiccSub) override;
::ndk::ScopedAStatus supplyIccPin2ForApp(int32_t serial, const std::string& pin2,
const std::string& aid) override;
::ndk::ScopedAStatus supplyIccPinForApp(int32_t serial, const std::string& pin,
const std::string& aid) override;
::ndk::ScopedAStatus supplyIccPuk2ForApp(int32_t serial, const std::string& puk2,
const std::string& pin2,
const std::string& aid) override;
::ndk::ScopedAStatus supplyIccPukForApp(int32_t serial, const std::string& puk,
const std::string& pin,
const std::string& aid) override;
::ndk::ScopedAStatus supplySimDepersonalization(
int32_t serial, ::aidl::android::hardware::radio::sim::PersoSubstate persoType,
const std::string& controlKey) override;
::ndk::ScopedAStatus updateSimPhonebookRecords(
int32_t serial,
const ::aidl::android::hardware::radio::sim::PhonebookRecordInfo& recordInfo) override;
public:
using RadioCompatBase::RadioCompatBase;
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,84 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/voice/BnRadioVoice.h>
namespace android::hardware::radio::compat {
class RadioVoice : public RadioCompatBase,
public aidl::android::hardware::radio::voice::BnRadioVoice {
::ndk::ScopedAStatus acceptCall(int32_t serial) override;
::ndk::ScopedAStatus conference(int32_t serial) override;
::ndk::ScopedAStatus dial(
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo) override;
::ndk::ScopedAStatus emergencyDial(
int32_t serial, const ::aidl::android::hardware::radio::voice::Dial& dialInfo,
::aidl::android::hardware::radio::voice::EmergencyServiceCategory categories,
const std::vector<std::string>& urns,
::aidl::android::hardware::radio::voice::EmergencyCallRouting routing,
bool hasKnownUserIntentEmergency, bool isTesting) override;
::ndk::ScopedAStatus exitEmergencyCallbackMode(int32_t serial) override;
::ndk::ScopedAStatus explicitCallTransfer(int32_t serial) override;
::ndk::ScopedAStatus getCallForwardStatus(
int32_t serial,
const ::aidl::android::hardware::radio::voice::CallForwardInfo& callInfo) override;
::ndk::ScopedAStatus getCallWaiting(int32_t serial, int32_t serviceClass) override;
::ndk::ScopedAStatus getClip(int32_t serial) override;
::ndk::ScopedAStatus getClir(int32_t serial) override;
::ndk::ScopedAStatus getCurrentCalls(int32_t serial) override;
::ndk::ScopedAStatus getLastCallFailCause(int32_t serial) override;
::ndk::ScopedAStatus getMute(int32_t serial) override;
::ndk::ScopedAStatus getPreferredVoicePrivacy(int32_t serial) override;
::ndk::ScopedAStatus getTtyMode(int32_t serial) override;
::ndk::ScopedAStatus handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override;
::ndk::ScopedAStatus hangup(int32_t serial, int32_t gsmIndex) override;
::ndk::ScopedAStatus hangupForegroundResumeBackground(int32_t serial) override;
::ndk::ScopedAStatus hangupWaitingOrBackground(int32_t serial) override;
::ndk::ScopedAStatus isVoNrEnabled(int32_t serial) override;
::ndk::ScopedAStatus rejectCall(int32_t serial) override;
::ndk::ScopedAStatus responseAcknowledgement() override;
::ndk::ScopedAStatus sendBurstDtmf(int32_t serial, const std::string& dtmf, int32_t on,
int32_t off) override;
::ndk::ScopedAStatus sendCdmaFeatureCode(int32_t serial, const std::string& fcode) override;
::ndk::ScopedAStatus sendDtmf(int32_t serial, const std::string& s) override;
::ndk::ScopedAStatus separateConnection(int32_t serial, int32_t gsmIndex) override;
::ndk::ScopedAStatus setCallForward(
int32_t serial,
const ::aidl::android::hardware::radio::voice::CallForwardInfo& callInfo) override;
::ndk::ScopedAStatus setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override;
::ndk::ScopedAStatus setClir(int32_t serial, int32_t status) override;
::ndk::ScopedAStatus setMute(int32_t serial, bool enable) override;
::ndk::ScopedAStatus setPreferredVoicePrivacy(int32_t serial, bool enable) override;
::ndk::ScopedAStatus setResponseFunctions(
const std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse>&
radioVoiceResponse,
const std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication>&
radioVoiceIndication) override;
::ndk::ScopedAStatus setTtyMode(int32_t serial,
::aidl::android::hardware::radio::voice::TtyMode mode) override;
::ndk::ScopedAStatus setVoNrEnabled(int32_t serial, bool enable) override;
::ndk::ScopedAStatus startDtmf(int32_t serial, const std::string& s) override;
::ndk::ScopedAStatus stopDtmf(int32_t serial) override;
::ndk::ScopedAStatus switchWaitingOrHoldingAndActive(int32_t serial) override;
public:
using RadioCompatBase::RadioCompatBase;
};
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioIndication.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#define RADIO_MODULE "MessagingIndication"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::messaging;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingIndication> rmiCb) {
CHECK(rmiCb);
mMessagingCb = rmiCb;
}
Return<void> RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type,
const V1_0::CdmaSmsMessage& msg) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->cdmaNewSms(toAidl(type), toAidl(msg));
return {};
}
Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->cdmaRuimSmsStorageFull(toAidl(type));
return {};
}
Return<void> RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type,
const hidl_vec<uint8_t>& data) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->newBroadcastSms(toAidl(type), data);
return {};
}
Return<void> RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->newSms(toAidl(type), pdu);
return {};
}
Return<void> RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->newSmsOnSim(toAidl(type), recordNumber);
return {};
}
Return<void> RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type,
const hidl_vec<uint8_t>& pdu) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->newSmsStatusReport(toAidl(type), pdu);
return {};
}
Return<void> RadioIndication::onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
const hidl_string& msg) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->onUssd(toAidl(type), aidl::UssdModeType(modeType), msg);
return {};
}
Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mMessagingCb);
mMessagingCb->simSmsStorageFull(toAidl(type));
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,195 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioMessaging.h>
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "Messaging"
namespace android::hardware::radio::compat {
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::messaging;
constexpr auto ok = &ScopedAStatus::ok;
ScopedAStatus RadioMessaging::acknowledgeIncomingGsmSmsWithPdu( //
int32_t serial, bool success, const std::string& ackPdu) {
LOG_CALL << serial << ' ' << success << ' ' << ackPdu;
mHal1_5->acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
return ok();
}
ScopedAStatus RadioMessaging::acknowledgeLastIncomingCdmaSms( //
int32_t serial, const aidl::CdmaSmsAck& smsAck) {
LOG_CALL << serial;
mHal1_5->acknowledgeLastIncomingCdmaSms(serial, toHidl(smsAck));
return ok();
}
ScopedAStatus RadioMessaging::acknowledgeLastIncomingGsmSms( //
int32_t serial, bool success, aidl::SmsAcknowledgeFailCause cause) {
LOG_CALL << serial << ' ' << success;
mHal1_5->acknowledgeLastIncomingGsmSms(serial, success, V1_0::SmsAcknowledgeFailCause(cause));
return ok();
}
ScopedAStatus RadioMessaging::cancelPendingUssd(int32_t serial) {
LOG_CALL << serial;
mHal1_5->cancelPendingUssd(serial);
return ok();
}
ScopedAStatus RadioMessaging::deleteSmsOnRuim(int32_t serial, int32_t index) {
LOG_CALL << serial << ' ' << index;
mHal1_5->deleteSmsOnRuim(serial, index);
return ok();
}
ScopedAStatus RadioMessaging::deleteSmsOnSim(int32_t serial, int32_t index) {
LOG_CALL << serial << ' ' << index;
mHal1_5->deleteSmsOnSim(serial, index);
return ok();
}
ScopedAStatus RadioMessaging::getCdmaBroadcastConfig(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getCdmaBroadcastConfig(serial);
return ok();
}
ScopedAStatus RadioMessaging::getGsmBroadcastConfig(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getGsmBroadcastConfig(serial);
return ok();
}
ScopedAStatus RadioMessaging::getSmscAddress(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getSmscAddress(serial);
return ok();
}
ScopedAStatus RadioMessaging::reportSmsMemoryStatus(int32_t serial, bool available) {
LOG_CALL << serial << ' ' << available;
mHal1_5->reportSmsMemoryStatus(serial, available);
return ok();
}
ScopedAStatus RadioMessaging::responseAcknowledgement() {
LOG_CALL;
mHal1_5->responseAcknowledgement();
return ok();
}
ScopedAStatus RadioMessaging::sendCdmaSms(int32_t serial, const aidl::CdmaSmsMessage& sms) {
LOG_CALL << serial;
mHal1_5->sendCdmaSms(serial, toHidl(sms));
return ok();
}
ScopedAStatus RadioMessaging::sendCdmaSmsExpectMore(int32_t serial, const aidl::CdmaSmsMessage& m) {
LOG_CALL << serial;
mHal1_5->sendCdmaSmsExpectMore(serial, toHidl(m));
return ok();
}
ScopedAStatus RadioMessaging::sendImsSms(int32_t serial, const aidl::ImsSmsMessage& message) {
LOG_CALL << serial;
mHal1_5->sendImsSms(serial, toHidl(message));
return ok();
}
ScopedAStatus RadioMessaging::sendSms(int32_t serial, const aidl::GsmSmsMessage& message) {
LOG_CALL << serial;
mHal1_5->sendSms(serial, toHidl(message));
return ok();
}
ScopedAStatus RadioMessaging::sendSmsExpectMore(int32_t serial, const aidl::GsmSmsMessage& msg) {
LOG_CALL << serial;
mHal1_5->sendSMSExpectMore(serial, toHidl(msg));
return ok();
}
ScopedAStatus RadioMessaging::sendUssd(int32_t serial, const std::string& ussd) {
LOG_CALL << serial << ' ' << ussd;
mHal1_5->sendUssd(serial, ussd);
return ok();
}
ScopedAStatus RadioMessaging::setCdmaBroadcastActivation(int32_t serial, bool activate) {
LOG_CALL << serial << ' ' << activate;
mHal1_5->setCdmaBroadcastActivation(serial, activate);
return ok();
}
ScopedAStatus RadioMessaging::setCdmaBroadcastConfig(
int32_t serial, const std::vector<aidl::CdmaBroadcastSmsConfigInfo>& cfgInfo) {
LOG_CALL << serial;
mHal1_5->setCdmaBroadcastConfig(serial, toHidl(cfgInfo));
return ok();
}
ScopedAStatus RadioMessaging::setGsmBroadcastActivation(int32_t serial, bool activate) {
LOG_CALL << serial << ' ' << activate;
mHal1_5->setGsmBroadcastActivation(serial, activate);
return ok();
}
ScopedAStatus RadioMessaging::setGsmBroadcastConfig(
int32_t serial, const std::vector<aidl::GsmBroadcastSmsConfigInfo>& configInfo) {
LOG_CALL << serial;
mHal1_5->setGsmBroadcastConfig(serial, toHidl(configInfo));
return ok();
}
ScopedAStatus RadioMessaging::setResponseFunctions(
const std::shared_ptr<aidl::IRadioMessagingResponse>& messagingResponse,
const std::shared_ptr<aidl::IRadioMessagingIndication>& messagingIndication) {
LOG_CALL << messagingResponse << ' ' << messagingIndication;
CHECK(messagingResponse);
CHECK(messagingIndication);
mRadioResponse->setResponseFunction(messagingResponse);
mRadioIndication->setResponseFunction(messagingIndication);
return ok();
}
ScopedAStatus RadioMessaging::setSmscAddress(int32_t serial, const std::string& smsc) {
LOG_CALL << serial << ' ' << smsc;
mHal1_5->setSmscAddress(serial, smsc);
return ok();
}
ScopedAStatus RadioMessaging::writeSmsToRuim(int32_t serial, const aidl::CdmaSmsWriteArgs& sms) {
LOG_CALL << serial;
mHal1_5->writeSmsToRuim(serial, toHidl(sms));
return ok();
}
ScopedAStatus RadioMessaging::writeSmsToSim(int32_t serial, const aidl::SmsWriteArgs& smsWrArgs) {
LOG_CALL << serial;
mHal1_5->writeSmsToSim(serial, toHidl(smsWrArgs));
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,244 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "MessagingResponse"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::messaging;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingResponse> rmrCb) {
CHECK(rmrCb);
mMessagingCb = rmrCb;
}
Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->acknowledgeIncomingGsmSmsWithPduResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->acknowledgeLastIncomingCdmaSmsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->acknowledgeLastIncomingGsmSmsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->cancelPendingUssdResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->deleteSmsOnRuimResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->deleteSmsOnSimResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configs) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->getCdmaBroadcastConfigResponse(toAidl(info), toAidl(configs));
return {};
}
Return<void> RadioResponse::getGsmBroadcastConfigResponse(
const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& cfg) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->getGsmBroadcastConfigResponse(toAidl(info), toAidl(cfg));
return {};
}
Return<void> RadioResponse::getSmscAddressResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& smsc) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->getSmscAddressResponse(toAidl(info), smsc);
return {};
}
Return<void> RadioResponse::reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->reportSmsMemoryStatusResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::sendCdmaSmsExpectMoreResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendCdmaSmsExpectMoreResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendCdmaSmsExpectMoreResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendCdmaSmsExpectMoreResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendCdmaSmsResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendCdmaSmsResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendCdmaSmsResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendImsSmsResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendImsSmsResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendSmsExpectMoreResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendSmsExpectMoreResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendSmsExpectMoreResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendSmsResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendSmsResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendSmsResponse_1_6(const V1_6::RadioResponseInfo& info,
const V1_0::SendSmsResult& sms) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendSmsResponse(toAidl(info), toAidl(sms));
return {};
}
Return<void> RadioResponse::sendUssdResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->sendUssdResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCdmaBroadcastActivationResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->setCdmaBroadcastActivationResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->setCdmaBroadcastConfigResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->setGsmBroadcastActivationResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->setGsmBroadcastConfigResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSmscAddressResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mMessagingCb);
mMessagingCb->setSmscAddressResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info,
uint32_t index) {
LOG_CALL << info.serial << ' ' << index;
CHECK_CB(mMessagingCb);
mMessagingCb->writeSmsToRuimResponse(toAidl(info), index);
return {};
}
Return<void> RadioResponse::writeSmsToSimResponse(const V1_0::RadioResponseInfo& info,
int32_t index) {
LOG_CALL << info.serial << ' ' << index;
CHECK_CB(mMessagingCb);
mMessagingCb->writeSmsToSimResponse(toAidl(info), index);
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,172 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "collections.h"
#include <aidl/android/hardware/radio/messaging/CdmaSmsAddress.h>
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::messaging;
V1_0::CdmaSmsAck toHidl(const aidl::CdmaSmsAck& smsAck) {
return {
.errorClass = (smsAck.errorClass ? V1_0::CdmaSmsErrorClass::ERROR
: V1_0::CdmaSmsErrorClass::NO_ERROR),
.smsCauseCode = smsAck.smsCauseCode,
};
}
static aidl::CdmaSmsAddress toAidl(const V1_0::CdmaSmsAddress& addr) {
return {
.digitMode = static_cast<int32_t>(addr.digitMode),
.isNumberModeDataNetwork = addr.numberMode == V1_0::CdmaSmsNumberMode::DATA_NETWORK,
.numberType = static_cast<int32_t>(addr.numberType),
.numberPlan = static_cast<int32_t>(addr.numberPlan),
.digits = addr.digits,
};
}
static V1_0::CdmaSmsAddress toHidl(const aidl::CdmaSmsAddress& addr) {
return {
.digitMode = V1_0::CdmaSmsDigitMode{addr.digitMode},
.numberMode = addr.isNumberModeDataNetwork ? V1_0::CdmaSmsNumberMode::DATA_NETWORK
: V1_0::CdmaSmsNumberMode::NOT_DATA_NETWORK,
.numberType = V1_0::CdmaSmsNumberType{addr.numberType},
.numberPlan = V1_0::CdmaSmsNumberPlan{addr.numberPlan},
.digits = addr.digits,
};
}
static aidl::CdmaSmsSubaddress toAidl(const V1_0::CdmaSmsSubaddress& addr) {
return {
.subaddressType = static_cast<int32_t>(addr.subaddressType),
.odd = addr.odd,
.digits = addr.digits,
};
}
static V1_0::CdmaSmsSubaddress toHidl(const aidl::CdmaSmsSubaddress& addr) {
return {
.subaddressType = V1_0::CdmaSmsSubaddressType{addr.subaddressType},
.odd = addr.odd,
.digits = addr.digits,
};
}
::aidl::android::hardware::radio::messaging::CdmaSmsMessage toAidl(const V1_0::CdmaSmsMessage& m) {
return {
.teleserviceId = m.teleserviceId,
.isServicePresent = m.isServicePresent,
.serviceCategory = m.serviceCategory,
.address = toAidl(m.address),
.subAddress = toAidl(m.subAddress),
.bearerData = m.bearerData,
};
}
V1_0::CdmaSmsMessage toHidl(const aidl::CdmaSmsMessage& msg) {
return {
.teleserviceId = msg.teleserviceId,
.isServicePresent = msg.isServicePresent,
.serviceCategory = msg.serviceCategory,
.address = toHidl(msg.address),
.subAddress = toHidl(msg.subAddress),
.bearerData = msg.bearerData,
};
}
V1_0::ImsSmsMessage toHidl(const aidl::ImsSmsMessage& msg) {
return {
.tech = V1_0::RadioTechnologyFamily{msg.tech},
.retry = msg.retry,
.messageRef = msg.messageRef,
.cdmaMessage = toHidl(msg.cdmaMessage),
.gsmMessage = toHidl(msg.gsmMessage),
};
}
V1_0::GsmSmsMessage toHidl(const aidl::GsmSmsMessage& msg) {
return {
.smscPdu = msg.smscPdu,
.pdu = msg.pdu,
};
}
aidl::CdmaBroadcastSmsConfigInfo toAidl(const V1_0::CdmaBroadcastSmsConfigInfo& info) {
return {
.serviceCategory = info.serviceCategory,
.language = info.language,
.selected = info.selected,
};
}
V1_0::CdmaBroadcastSmsConfigInfo toHidl(const aidl::CdmaBroadcastSmsConfigInfo& info) {
return {
.serviceCategory = info.serviceCategory,
.language = info.language,
.selected = info.selected,
};
}
aidl::GsmBroadcastSmsConfigInfo toAidl(const V1_0::GsmBroadcastSmsConfigInfo& info) {
return {
.fromServiceId = info.fromServiceId,
.toServiceId = info.toServiceId,
.fromCodeScheme = info.fromCodeScheme,
.toCodeScheme = info.toCodeScheme,
.selected = info.selected,
};
}
V1_0::GsmBroadcastSmsConfigInfo toHidl(const aidl::GsmBroadcastSmsConfigInfo& info) {
return {
.fromServiceId = info.fromServiceId,
.toServiceId = info.toServiceId,
.fromCodeScheme = info.fromCodeScheme,
.toCodeScheme = info.toCodeScheme,
.selected = info.selected,
};
}
V1_0::CdmaSmsWriteArgs toHidl(const aidl::CdmaSmsWriteArgs& args) {
return {
.status = V1_0::CdmaSmsWriteArgsStatus{args.status},
.message = toHidl(args.message),
};
}
V1_0::SmsWriteArgs toHidl(const aidl::SmsWriteArgs& args) {
return {
.status = V1_0::SmsWriteArgsStatus{args.status},
.pdu = args.pdu,
.smsc = args.smsc,
};
}
::aidl::android::hardware::radio::messaging::SendSmsResult toAidl(
const V1_0::SendSmsResult& result) {
return {
.messageRef = result.messageRef,
.ackPDU = result.ackPDU,
.errorCode = result.errorCode,
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.h>
#include <aidl/android/hardware/radio/messaging/CdmaSmsAck.h>
#include <aidl/android/hardware/radio/messaging/CdmaSmsMessage.h>
#include <aidl/android/hardware/radio/messaging/CdmaSmsWriteArgs.h>
#include <aidl/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.h>
#include <aidl/android/hardware/radio/messaging/GsmSmsMessage.h>
#include <aidl/android/hardware/radio/messaging/ImsSmsMessage.h>
#include <aidl/android/hardware/radio/messaging/SendSmsResult.h>
#include <aidl/android/hardware/radio/messaging/SmsWriteArgs.h>
#include <android/hardware/radio/1.0/types.h>
namespace android::hardware::radio::compat {
V1_0::CdmaSmsAck toHidl(const ::aidl::android::hardware::radio::messaging::CdmaSmsAck& ack);
::aidl::android::hardware::radio::messaging::CdmaSmsMessage toAidl(const V1_0::CdmaSmsMessage& msg);
V1_0::CdmaSmsMessage toHidl(const ::aidl::android::hardware::radio::messaging::CdmaSmsMessage& msg);
V1_0::ImsSmsMessage toHidl(const ::aidl::android::hardware::radio::messaging::ImsSmsMessage& msg);
V1_0::GsmSmsMessage toHidl(const ::aidl::android::hardware::radio::messaging::GsmSmsMessage& msg);
::aidl::android::hardware::radio::messaging::CdmaBroadcastSmsConfigInfo //
toAidl(const V1_0::CdmaBroadcastSmsConfigInfo& info);
V1_0::CdmaBroadcastSmsConfigInfo //
toHidl(const ::aidl::android::hardware::radio::messaging::CdmaBroadcastSmsConfigInfo& info);
::aidl::android::hardware::radio::messaging::GsmBroadcastSmsConfigInfo //
toAidl(const V1_0::GsmBroadcastSmsConfigInfo& info);
V1_0::GsmBroadcastSmsConfigInfo //
toHidl(const ::aidl::android::hardware::radio::messaging::GsmBroadcastSmsConfigInfo& info);
V1_0::CdmaSmsWriteArgs //
toHidl(const ::aidl::android::hardware::radio::messaging::CdmaSmsWriteArgs& args);
V1_0::SmsWriteArgs toHidl(const ::aidl::android::hardware::radio::messaging::SmsWriteArgs& args);
::aidl::android::hardware::radio::messaging::SendSmsResult toAidl(const V1_0::SendSmsResult& res);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioIndication.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "ModemIndication"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::modem;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioModemIndication> modemCb) {
CHECK(modemCb);
mModemCb = modemCb;
}
Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type,
const hidl_vec<V1_0::HardwareConfig>& configs) {
LOG_CALL << type;
CHECK_CB(mModemCb);
mModemCb->hardwareConfigChanged(toAidl(type), toAidl(configs));
return {};
}
Return<void> RadioIndication::modemReset(V1_0::RadioIndicationType type, const hidl_string& reasn) {
LOG_CALL << type;
CHECK_CB(mModemCb);
mModemCb->modemReset(toAidl(type), reasn);
return {};
}
Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type,
const V1_0::RadioCapability& rc) {
LOG_CALL << type;
CHECK_CB(mModemCb);
mModemCb->radioCapabilityIndication(toAidl(type), toAidl(rc));
return {};
}
Return<void> RadioIndication::radioStateChanged(V1_0::RadioIndicationType t, V1_0::RadioState st) {
LOG_CALL << t;
CHECK_CB(mModemCb);
mModemCb->radioStateChanged(toAidl(t), aidl::RadioState(st));
return {};
}
Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mModemCb);
mModemCb->rilConnected(toAidl(type));
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,145 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioModem.h>
#include "debug.h"
#include "structs.h"
#define RADIO_MODULE "Modem"
namespace android::hardware::radio::compat {
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::modem;
constexpr auto ok = &ScopedAStatus::ok;
ScopedAStatus RadioModem::enableModem(int32_t serial, bool on) {
LOG_CALL << serial;
mHal1_5->enableModem(serial, on);
return ok();
}
ScopedAStatus RadioModem::getBasebandVersion(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getBasebandVersion(serial);
return ok();
}
ScopedAStatus RadioModem::getDeviceIdentity(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getDeviceIdentity(serial);
return ok();
}
ScopedAStatus RadioModem::getHardwareConfig(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getHardwareConfig(serial);
return ok();
}
ScopedAStatus RadioModem::getModemActivityInfo(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getModemActivityInfo(serial);
return ok();
}
ScopedAStatus RadioModem::getModemStackStatus(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getModemStackStatus(serial);
return ok();
}
ScopedAStatus RadioModem::getRadioCapability(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getRadioCapability(serial);
return ok();
}
ScopedAStatus RadioModem::nvReadItem(int32_t serial, aidl::NvItem itemId) {
LOG_CALL << serial;
mHal1_5->nvReadItem(serial, V1_0::NvItem(itemId));
return ok();
}
ScopedAStatus RadioModem::nvResetConfig(int32_t serial, aidl::ResetNvType resetType) {
LOG_CALL << serial;
mHal1_5->nvResetConfig(serial, V1_0::ResetNvType(resetType));
return ok();
}
ScopedAStatus RadioModem::nvWriteCdmaPrl(int32_t serial, const std::vector<uint8_t>& prl) {
LOG_CALL << serial;
mHal1_5->nvWriteCdmaPrl(serial, prl);
return ok();
}
ScopedAStatus RadioModem::nvWriteItem(int32_t serial, const aidl::NvWriteItem& item) {
LOG_CALL << serial;
mHal1_5->nvWriteItem(serial, toHidl(item));
return ok();
}
ScopedAStatus RadioModem::requestShutdown(int32_t serial) {
LOG_CALL << serial;
mHal1_5->requestShutdown(serial);
return ok();
}
ScopedAStatus RadioModem::responseAcknowledgement() {
LOG_CALL;
mHal1_5->responseAcknowledgement();
return ok();
}
ScopedAStatus RadioModem::sendDeviceState(int32_t serial, aidl::DeviceStateType type, bool state) {
LOG_CALL << serial;
mHal1_5->sendDeviceState(serial, V1_0::DeviceStateType(type), state);
return ok();
}
ScopedAStatus RadioModem::setRadioCapability(int32_t serial, const aidl::RadioCapability& rc) {
LOG_CALL << serial;
mHal1_5->setRadioCapability(serial, toHidl(rc));
return ok();
}
ScopedAStatus RadioModem::setRadioPower(int32_t serial, bool powerOn, bool forEmergencyCall,
bool preferredForEmergencyCall) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->setRadioPower_1_6(serial, powerOn, forEmergencyCall, preferredForEmergencyCall);
} else {
mHal1_5->setRadioPower_1_5(serial, powerOn, forEmergencyCall, preferredForEmergencyCall);
}
return ok();
}
ScopedAStatus RadioModem::setResponseFunctions(
const std::shared_ptr<aidl::IRadioModemResponse>& modemResponse,
const std::shared_ptr<aidl::IRadioModemIndication>& modemIndication) {
LOG_CALL << modemResponse << ' ' << modemIndication;
CHECK(modemResponse);
CHECK(modemIndication);
mRadioResponse->setResponseFunction(modemResponse);
mRadioIndication->setResponseFunction(modemIndication);
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,164 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "ModemResponse"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::modem;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioModemResponse> modemCb) {
CHECK(modemCb);
mModemCb = modemCb;
}
Return<void> RadioResponse::enableModemResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->enableModemResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::getBasebandVersionResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& version) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->getBasebandVersionResponse(toAidl(info), version);
return {};
}
Return<void> RadioResponse::getDeviceIdentityResponse( //
const V1_0::RadioResponseInfo& info, const hidl_string& imei, const hidl_string& imeisv,
const hidl_string& esn, const hidl_string& meid) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->getDeviceIdentityResponse(toAidl(info), imei, imeisv, esn, meid);
return {};
}
Return<void> RadioResponse::getHardwareConfigResponse(
const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::HardwareConfig>& config) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->getHardwareConfigResponse(toAidl(info), toAidl(config));
return {};
}
Return<void> RadioResponse::getModemActivityInfoResponse(
const V1_0::RadioResponseInfo& info, const V1_0::ActivityStatsInfo& activityInfo) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->getModemActivityInfoResponse(toAidl(info), toAidl(activityInfo));
return {};
}
Return<void> RadioResponse::getModemStackStatusResponse(const V1_0::RadioResponseInfo& info,
bool isEnabled) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->getModemStackStatusResponse(toAidl(info), isEnabled);
return {};
}
Return<void> RadioResponse::getRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
const V1_0::RadioCapability& rc) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->getRadioCapabilityResponse(toAidl(info), toAidl(rc));
return {};
}
Return<void> RadioResponse::nvReadItemResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& result) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->nvReadItemResponse(toAidl(info), result);
return {};
}
Return<void> RadioResponse::nvResetConfigResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->nvResetConfigResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::nvWriteCdmaPrlResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->nvWriteCdmaPrlResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::nvWriteItemResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->nvWriteItemResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::requestShutdownResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->requestShutdownResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::sendDeviceStateResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->sendDeviceStateResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
const V1_0::RadioCapability& rc) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->setRadioCapabilityResponse(toAidl(info), toAidl(rc));
return {};
}
Return<void> RadioResponse::setRadioPowerResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->setRadioPowerResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setRadioPowerResponse_1_5(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->setRadioPowerResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setRadioPowerResponse_1_6(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mModemCb);
mModemCb->setRadioPowerResponse(toAidl(info));
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,93 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "commonStructs.h"
#include "collections.h"
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
namespace aidl = ::aidl::android::hardware::radio::modem;
V1_0::NvWriteItem toHidl(const aidl::NvWriteItem& item) {
return {
.itemId = V1_0::NvItem{item.itemId},
.value = item.value,
};
}
aidl::RadioCapability toAidl(const V1_0::RadioCapability& capa) {
return {
.session = capa.session,
.phase = static_cast<int32_t>(capa.phase),
.raf = RadioAccessFamily(capa.raf),
.logicalModemUuid = capa.logicalModemUuid,
.status = static_cast<int32_t>(capa.status),
};
}
V1_0::RadioCapability toHidl(const aidl::RadioCapability& capa) {
return {
.session = capa.session,
.phase = V1_0::RadioCapabilityPhase{capa.phase},
.raf = toHidlBitfield<V1_0::RadioAccessFamily>(capa.raf),
.logicalModemUuid = capa.logicalModemUuid,
.status = V1_0::RadioCapabilityStatus{capa.status},
};
}
aidl::HardwareConfig toAidl(const V1_0::HardwareConfig& config) {
return {
.type = static_cast<int32_t>(config.type),
.uuid = config.uuid,
.state = static_cast<int32_t>(config.state),
.modem = toAidl(config.modem),
.sim = toAidl(config.sim),
};
}
aidl::HardwareConfigModem toAidl(const V1_0::HardwareConfigModem& modem) {
return {
.rilModel = modem.rilModel,
.rat = RadioTechnology(modem.rat),
.maxVoiceCalls = modem.maxVoice,
.maxDataCalls = modem.maxData,
.maxStandby = modem.maxStandby,
};
}
aidl::HardwareConfigSim toAidl(const V1_0::HardwareConfigSim& sim) {
return {
.modemUuid = sim.modemUuid,
};
}
aidl::ActivityStatsInfo toAidl(const V1_0::ActivityStatsInfo& info) {
return {
.sleepModeTimeMs = static_cast<int32_t>(info.sleepModeTimeMs),
.idleModeTimeMs = static_cast<int32_t>(info.idleModeTimeMs),
.txmModetimeMs = toAidl(info.txmModetimeMs),
.rxModeTimeMs = static_cast<int32_t>(info.rxModeTimeMs),
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/modem/ActivityStatsInfo.h>
#include <aidl/android/hardware/radio/modem/HardwareConfig.h>
#include <aidl/android/hardware/radio/modem/HardwareConfigModem.h>
#include <aidl/android/hardware/radio/modem/HardwareConfigSim.h>
#include <aidl/android/hardware/radio/modem/NvWriteItem.h>
#include <aidl/android/hardware/radio/modem/RadioCapability.h>
#include <android/hardware/radio/1.0/types.h>
namespace android::hardware::radio::compat {
V1_0::NvWriteItem toHidl(const ::aidl::android::hardware::radio::modem::NvWriteItem& item);
::aidl::android::hardware::radio::modem::RadioCapability toAidl(const V1_0::RadioCapability& capa);
V1_0::RadioCapability toHidl(const ::aidl::android::hardware::radio::modem::RadioCapability& capa);
::aidl::android::hardware::radio::modem::HardwareConfig toAidl(const V1_0::HardwareConfig& config);
::aidl::android::hardware::radio::modem::HardwareConfigModem //
toAidl(const V1_0::HardwareConfigModem& modem);
::aidl::android::hardware::radio::modem::HardwareConfigSim toAidl(const V1_0::HardwareConfigSim& s);
::aidl::android::hardware::radio::modem::ActivityStatsInfo toAidl(const V1_0::ActivityStatsInfo& i);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,259 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioIndication.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "NetworkIndication"
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::RadioTechnology;
namespace aidl = ::aidl::android::hardware::radio::network;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioNetworkIndication> netCb) {
CHECK(netCb);
mNetworkCb = netCb;
}
Return<void> RadioIndication::barringInfoChanged(V1_0::RadioIndicationType type,
const V1_5::CellIdentity& cellIdentity,
const hidl_vec<V1_5::BarringInfo>& barringInfos) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->barringInfoChanged(toAidl(type), toAidl(cellIdentity), toAidl(barringInfos));
return {};
}
Return<void> RadioIndication::cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->cdmaPrlChanged(toAidl(type), version);
return {};
}
Return<void> RadioIndication::cellInfoList(V1_0::RadioIndicationType type,
const hidl_vec<V1_0::CellInfo>&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioIndication::cellInfoList_1_2(V1_0::RadioIndicationType type,
const hidl_vec<V1_2::CellInfo>&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioIndication::cellInfoList_1_4(V1_0::RadioIndicationType type,
const hidl_vec<V1_4::CellInfo>&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioIndication::cellInfoList_1_5(V1_0::RadioIndicationType type,
const hidl_vec<V1_5::CellInfo>& records) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->cellInfoList(toAidl(type), toAidl(records));
return {};
}
Return<void> RadioIndication::cellInfoList_1_6(V1_0::RadioIndicationType type,
const hidl_vec<V1_6::CellInfo>& records) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->cellInfoList(toAidl(type), toAidl(records));
return {};
}
Return<void> RadioIndication::currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
const V1_2::LinkCapacityEstimate& lce) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->currentLinkCapacityEstimate(toAidl(type), toAidl(lce));
return {};
}
Return<void> RadioIndication::currentLinkCapacityEstimate_1_6(
V1_0::RadioIndicationType type, const V1_6::LinkCapacityEstimate& lce) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->currentLinkCapacityEstimate(toAidl(type), toAidl(lce));
return {};
}
Return<void> RadioIndication::currentPhysicalChannelConfigs(
V1_0::RadioIndicationType type, const hidl_vec<V1_2::PhysicalChannelConfig>&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioIndication::currentPhysicalChannelConfigs_1_4(
V1_0::RadioIndicationType type, const hidl_vec<V1_4::PhysicalChannelConfig>& configs) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->currentPhysicalChannelConfigs(toAidl(type), toAidl(configs));
return {};
}
Return<void> RadioIndication::currentPhysicalChannelConfigs_1_6(
V1_0::RadioIndicationType type, const hidl_vec<V1_6::PhysicalChannelConfig>& configs) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->currentPhysicalChannelConfigs(toAidl(type), toAidl(configs));
return {};
}
Return<void> RadioIndication::currentSignalStrength(V1_0::RadioIndicationType type,
const V1_0::SignalStrength&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioIndication::currentSignalStrength_1_2(V1_0::RadioIndicationType type,
const V1_2::SignalStrength&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioIndication::currentSignalStrength_1_4(
V1_0::RadioIndicationType type, const V1_4::SignalStrength& signalStrength) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->currentSignalStrength(toAidl(type), toAidl(signalStrength));
return {};
}
Return<void> RadioIndication::currentSignalStrength_1_6(
V1_0::RadioIndicationType type, const V1_6::SignalStrength& signalStrength) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->currentSignalStrength(toAidl(type), toAidl(signalStrength));
return {};
}
Return<void> RadioIndication::imsNetworkStateChanged(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->imsNetworkStateChanged(toAidl(type));
return {};
}
Return<void> RadioIndication::networkScanResult(V1_0::RadioIndicationType type,
const V1_1::NetworkScanResult&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioIndication::networkScanResult_1_2(V1_0::RadioIndicationType type,
const V1_2::NetworkScanResult&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioIndication::networkScanResult_1_4(V1_0::RadioIndicationType type,
const V1_4::NetworkScanResult&) {
LOG_CALL << type;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioIndication::networkScanResult_1_5(V1_0::RadioIndicationType type,
const V1_5::NetworkScanResult& result) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->networkScanResult(toAidl(type), toAidl(result));
return {};
}
Return<void> RadioIndication::networkScanResult_1_6(V1_0::RadioIndicationType type,
const V1_6::NetworkScanResult& result) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->networkScanResult(toAidl(type), toAidl(result));
return {};
}
Return<void> RadioIndication::networkStateChanged(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->networkStateChanged(toAidl(type));
return {};
}
Return<void> RadioIndication::nitzTimeReceived(V1_0::RadioIndicationType type,
const hidl_string& nitzTime, uint64_t receivedTime) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->nitzTimeReceived(toAidl(type), nitzTime, receivedTime, 0);
return {};
}
Return<void> RadioIndication::registrationFailed( //
V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
int32_t additionalCauseCode) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->registrationFailed(toAidl(type), toAidl(cellIdentity), chosenPlmn,
aidl::Domain(domain), causeCode, additionalCauseCode);
return {};
}
Return<void> RadioIndication::restrictedStateChanged(V1_0::RadioIndicationType type,
V1_0::PhoneRestrictedState state) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->restrictedStateChanged(toAidl(type), aidl::PhoneRestrictedState(state));
return {};
}
Return<void> RadioIndication::suppSvcNotify(V1_0::RadioIndicationType type,
const V1_0::SuppSvcNotification& suppSvc) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->suppSvcNotify(toAidl(type), toAidl(suppSvc));
return {};
}
Return<void> RadioIndication::voiceRadioTechChanged(V1_0::RadioIndicationType type,
V1_0::RadioTechnology rat) {
LOG_CALL << type;
CHECK_CB(mNetworkCb);
mNetworkCb->voiceRadioTechChanged(toAidl(type), RadioTechnology(rat));
return {};
}
Return<void> RadioIndication::lceData(V1_0::RadioIndicationType type, const V1_0::LceDataInfo&) {
LOG_CALL << type;
LOG(WARNING) << "lceData indication is deprecated";
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,281 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioNetwork.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "utils.h"
#include "collections.h"
#define RADIO_MODULE "Network"
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::AccessNetwork;
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::network;
constexpr auto ok = &ScopedAStatus::ok;
ScopedAStatus RadioNetwork::getAllowedNetworkTypesBitmap(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->getAllowedNetworkTypesBitmap(serial);
} else {
mHal1_5->getPreferredNetworkType(serial);
}
return ok();
}
ScopedAStatus RadioNetwork::getAvailableBandModes(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getAvailableBandModes(serial);
return ok();
}
ScopedAStatus RadioNetwork::getAvailableNetworks(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getAvailableNetworks(serial);
return ok();
}
ScopedAStatus RadioNetwork::getBarringInfo(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getBarringInfo(serial);
return ok();
}
ScopedAStatus RadioNetwork::getCdmaRoamingPreference(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getCdmaRoamingPreference(serial);
return ok();
}
ScopedAStatus RadioNetwork::getCellInfoList(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getCellInfoList(serial);
return ok();
}
ScopedAStatus RadioNetwork::getDataRegistrationState(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getDataRegistrationState(serial);
return ok();
}
ScopedAStatus RadioNetwork::getImsRegistrationState(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getImsRegistrationState(serial);
return ok();
}
ScopedAStatus RadioNetwork::getNetworkSelectionMode(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getNetworkSelectionMode(serial);
return ok();
}
ScopedAStatus RadioNetwork::getOperator(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getOperator(serial);
return ok();
}
ScopedAStatus RadioNetwork::getSignalStrength(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getSignalStrength(serial);
return ok();
}
ScopedAStatus RadioNetwork::getSystemSelectionChannels(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->getSystemSelectionChannels(serial);
} else {
respond().getSystemSelectionChannelsResponse(notSupported(serial), {});
}
return ok();
}
ScopedAStatus RadioNetwork::getVoiceRadioTechnology(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getVoiceRadioTechnology(serial);
return ok();
}
ScopedAStatus RadioNetwork::getVoiceRegistrationState(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getVoiceRegistrationState(serial);
return ok();
}
ScopedAStatus RadioNetwork::isNrDualConnectivityEnabled(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->isNrDualConnectivityEnabled(serial);
} else {
respond().isNrDualConnectivityEnabledResponse(notSupported(serial), false);
}
return ok();
}
ScopedAStatus RadioNetwork::responseAcknowledgement() {
LOG_CALL;
mHal1_5->responseAcknowledgement();
return ok();
}
ScopedAStatus RadioNetwork::setAllowedNetworkTypesBitmap(int32_t serial, RadioAccessFamily ntype) {
LOG_CALL << serial;
const auto raf = toHidlBitfield<V1_4::RadioAccessFamily>(ntype);
if (mHal1_6) {
mHal1_6->setAllowedNetworkTypesBitmap(serial, raf);
} else {
mHal1_5->setPreferredNetworkType(serial, getNetworkTypeFromRaf(raf));
}
return ok();
}
ScopedAStatus RadioNetwork::setBandMode(int32_t serial, aidl::RadioBandMode mode) {
LOG_CALL << serial;
mHal1_5->setBandMode(serial, V1_0::RadioBandMode(mode));
return ok();
}
ScopedAStatus RadioNetwork::setBarringPassword(int32_t serial, const std::string& facility,
const std::string& oldPw, const std::string& newPw) {
LOG_CALL << serial;
mHal1_5->setBarringPassword(serial, facility, oldPw, newPw);
return ok();
}
ScopedAStatus RadioNetwork::setCdmaRoamingPreference(int32_t serial, aidl::CdmaRoamingType type) {
LOG_CALL << serial;
mHal1_5->setCdmaRoamingPreference(serial, V1_0::CdmaRoamingType(type));
return ok();
}
ScopedAStatus RadioNetwork::setCellInfoListRate(int32_t serial, int32_t rate) {
LOG_CALL << serial;
mHal1_5->setCellInfoListRate(serial, rate);
return ok();
}
ScopedAStatus RadioNetwork::setIndicationFilter(int32_t serial, aidl::IndicationFilter indFilter) {
LOG_CALL << serial;
mHal1_5->setIndicationFilter(serial, toHidlBitfield<V1_0::IndicationFilter>(indFilter));
return ok();
}
ScopedAStatus RadioNetwork::setLinkCapacityReportingCriteria( //
int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps,
const std::vector<int32_t>& thrDownlinkKbps, const std::vector<int32_t>& thrUplinkKbps,
AccessNetwork accessNetwork) {
LOG_CALL << serial;
mHal1_5->setLinkCapacityReportingCriteria( //
serial, hysteresisMs, hysteresisDlKbps, hysteresisUlKbps, thrDownlinkKbps,
thrUplinkKbps, V1_2::AccessNetwork(accessNetwork));
return ok();
}
ScopedAStatus RadioNetwork::setLocationUpdates(int32_t serial, bool enable) {
LOG_CALL << serial;
mHal1_5->setLocationUpdates(serial, enable);
return ok();
}
ScopedAStatus RadioNetwork::setNetworkSelectionModeAutomatic(int32_t serial) {
LOG_CALL << serial;
mHal1_5->setNetworkSelectionModeAutomatic(serial);
return ok();
}
ScopedAStatus RadioNetwork::setNetworkSelectionModeManual( //
int32_t serial, const std::string& opNumeric, AccessNetwork ran) {
LOG_CALL << serial;
mHal1_5->setNetworkSelectionModeManual_1_5(serial, opNumeric, V1_5::RadioAccessNetworks(ran));
return ok();
}
ScopedAStatus RadioNetwork::setNrDualConnectivityState(int32_t serial,
aidl::NrDualConnectivityState st) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->setNrDualConnectivityState(serial, V1_6::NrDualConnectivityState(st));
} else {
respond().setNrDualConnectivityStateResponse(notSupported(serial));
}
return ok();
}
ScopedAStatus RadioNetwork::setResponseFunctions(
const std::shared_ptr<aidl::IRadioNetworkResponse>& networkResponse,
const std::shared_ptr<aidl::IRadioNetworkIndication>& networkIndication) {
LOG_CALL << networkResponse << ' ' << networkIndication;
CHECK(networkResponse);
CHECK(networkIndication);
mRadioResponse->setResponseFunction(networkResponse);
mRadioIndication->setResponseFunction(networkIndication);
return ok();
}
ScopedAStatus RadioNetwork::setSignalStrengthReportingCriteria(
int32_t serial, const std::vector<aidl::SignalThresholdInfo>& infos) {
LOG_CALL << serial;
// TODO(b/203699028): how about other infos?
mHal1_5->setSignalStrengthReportingCriteria_1_5(serial, toHidl(infos[0]),
V1_5::AccessNetwork(infos[0].ran));
return ok();
}
ScopedAStatus RadioNetwork::setSuppServiceNotifications(int32_t serial, bool enable) {
LOG_CALL << serial;
mHal1_5->setSuppServiceNotifications(serial, enable);
return ok();
}
ScopedAStatus RadioNetwork::setSystemSelectionChannels( //
int32_t serial, bool specifyCh, const std::vector<aidl::RadioAccessSpecifier>& specifiers) {
LOG_CALL << serial;
mHal1_5->setSystemSelectionChannels_1_5(serial, specifyCh, toHidl(specifiers));
return ok();
}
ScopedAStatus RadioNetwork::startNetworkScan(int32_t serial, const aidl::NetworkScanRequest& req) {
LOG_CALL << serial;
mHal1_5->startNetworkScan_1_5(serial, toHidl(req));
return ok();
}
ScopedAStatus RadioNetwork::stopNetworkScan(int32_t serial) {
LOG_CALL << serial;
mHal1_5->stopNetworkScan(serial);
return ok();
}
ScopedAStatus RadioNetwork::supplyNetworkDepersonalization(int32_t ser, const std::string& nPin) {
LOG_CALL << ser;
mHal1_5->supplyNetworkDepersonalization(ser, nPin);
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,506 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "utils.h"
#include "collections.h"
#define RADIO_MODULE "NetworkResponse"
namespace android::hardware::radio::compat {
using ::aidl::android::hardware::radio::RadioAccessFamily;
using ::aidl::android::hardware::radio::RadioTechnology;
using ::aidl::android::hardware::radio::RadioTechnologyFamily;
namespace aidl = ::aidl::android::hardware::radio::network;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioNetworkResponse> netCb) {
CHECK(netCb);
mNetworkCb = netCb;
}
Return<void> RadioResponse::getAllowedNetworkTypesBitmapResponse(
const V1_6::RadioResponseInfo& info,
hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getAllowedNetworkTypesBitmapResponse(toAidl(info),
RadioAccessFamily(networkTypeBitmap));
return {};
}
Return<void> RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
V1_0::PreferredNetworkType nwType) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getAllowedNetworkTypesBitmapResponse( //
toAidl(info), RadioAccessFamily(getRafFromNetworkType(nwType)));
return {};
}
Return<void> RadioResponse::getPreferredNetworkTypeBitmapResponse(
const V1_0::RadioResponseInfo& info, hidl_bitfield<V1_4::RadioAccessFamily>) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioResponse::getAvailableBandModesResponse(
const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::RadioBandMode>& bandModes) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getAvailableBandModesResponse(toAidl(info), toAidl(bandModes));
return {};
}
Return<void> RadioResponse::getAvailableNetworksResponse(
const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::OperatorInfo>& networkInfos) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getAvailableNetworksResponse(toAidl(info), toAidl(networkInfos));
return {};
}
Return<void> RadioResponse::getBarringInfoResponse(
const V1_0::RadioResponseInfo& info, const V1_5::CellIdentity& cellIdentity,
const hidl_vec<V1_5::BarringInfo>& barringInfos) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getBarringInfoResponse(toAidl(info), toAidl(cellIdentity), toAidl(barringInfos));
return {};
}
Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info,
V1_0::CdmaRoamingType type) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getCdmaRoamingPreferenceResponse(toAidl(info), aidl::CdmaRoamingType(type));
return {};
}
Return<void> RadioResponse::getCellInfoListResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::CellInfo>&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_2::CellInfo>&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioResponse::getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_4::CellInfo>&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioResponse::getCellInfoListResponse_1_5(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_5::CellInfo>& cellInfo) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getCellInfoListResponse(toAidl(info), toAidl(cellInfo));
return {};
}
Return<void> RadioResponse::getCellInfoListResponse_1_6(const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::CellInfo>& cellInfo) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getCellInfoListResponse(toAidl(info), toAidl(cellInfo));
return {};
}
Return<void> RadioResponse::getDataRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
const V1_0::DataRegStateResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::getDataRegistrationStateResponse_1_2(
const V1_0::RadioResponseInfo& info, const V1_2::DataRegStateResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioResponse::getDataRegistrationStateResponse_1_4(
const V1_0::RadioResponseInfo& info, const V1_4::DataRegStateResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioResponse::getDataRegistrationStateResponse_1_5(
const V1_0::RadioResponseInfo& info, const V1_5::RegStateResult& dataRegResponse) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getDataRegistrationStateResponse(toAidl(info), toAidl(dataRegResponse));
return {};
}
Return<void> RadioResponse::getDataRegistrationStateResponse_1_6(
const V1_6::RadioResponseInfo& info, const V1_6::RegStateResult& dataRegResponse) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getDataRegistrationStateResponse(toAidl(info), toAidl(dataRegResponse));
return {};
}
Return<void> RadioResponse::getImsRegistrationStateResponse( //
const V1_0::RadioResponseInfo& info, bool isRegd, V1_0::RadioTechnologyFamily ratFamily) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getImsRegistrationStateResponse(toAidl(info), isRegd,
RadioTechnologyFamily(ratFamily));
return {};
}
Return<void> RadioResponse::getNeighboringCidsResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::NeighboringCell>&) {
LOG_CALL << info.serial;
LOG(ERROR) << "getNeighboringCidsResponse is not supposed to be called";
return {};
}
Return<void> RadioResponse::getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info,
bool manual) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getNetworkSelectionModeResponse(toAidl(info), manual);
return {};
}
Return<void> RadioResponse::getOperatorResponse( //
const V1_0::RadioResponseInfo& info, const hidl_string& longName,
const hidl_string& shortName, const hidl_string& numeric) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getOperatorResponse(toAidl(info), longName, shortName, numeric);
return {};
}
Return<void> RadioResponse::getSignalStrengthResponse(const V1_0::RadioResponseInfo& info,
const V1_0::SignalStrength&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::getSignalStrengthResponse_1_2(const V1_0::RadioResponseInfo& info,
const V1_2::SignalStrength&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioResponse::getSignalStrengthResponse_1_4(
const V1_0::RadioResponseInfo& info, const V1_4::SignalStrength& signalStrength) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getSignalStrengthResponse(toAidl(info), toAidl(signalStrength));
return {};
}
Return<void> RadioResponse::getSignalStrengthResponse_1_6(
const V1_6::RadioResponseInfo& info, const V1_6::SignalStrength& signalStrength) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getSignalStrengthResponse(toAidl(info), toAidl(signalStrength));
return {};
}
Return<void> RadioResponse::getSystemSelectionChannelsResponse(
const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_5::RadioAccessSpecifier>& specifiers) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getSystemSelectionChannelsResponse(toAidl(info), toAidl(specifiers));
return {};
}
Return<void> RadioResponse::getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info,
V1_0::RadioTechnology rat) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getVoiceRadioTechnologyResponse(toAidl(info), RadioTechnology(rat));
return {};
}
Return<void> RadioResponse::getVoiceRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
const V1_0::VoiceRegStateResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.0 not supported";
return {};
}
Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_2(
const V1_0::RadioResponseInfo& info, const V1_2::VoiceRegStateResult&) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.2 not supported";
return {};
}
Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_5(
const V1_0::RadioResponseInfo& info, const V1_5::RegStateResult& voiceRegResponse) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getVoiceRegistrationStateResponse(toAidl(info), toAidl(voiceRegResponse));
return {};
}
Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_6(
const V1_6::RadioResponseInfo& info, const V1_6::RegStateResult& voiceRegResponse) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->getVoiceRegistrationStateResponse(toAidl(info), toAidl(voiceRegResponse));
return {};
}
Return<void> RadioResponse::isNrDualConnectivityEnabledResponse(const V1_6::RadioResponseInfo& info,
bool isEnabled) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->isNrDualConnectivityEnabledResponse(toAidl(info), isEnabled);
return {};
}
Return<void> RadioResponse::pullLceDataResponse(const V1_0::RadioResponseInfo& info,
const V1_0::LceDataInfo&) {
LOG_CALL << info.serial;
LOG(ERROR) << "pullLceDataResponse is not supposed to be called";
return {};
}
Return<void> RadioResponse::setAllowedNetworkTypesBitmapResponse(const V1_6::RadioResponseInfo& i) {
LOG_CALL << i.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setAllowedNetworkTypesBitmapResponse(toAidl(i));
return {};
}
Return<void> RadioResponse::setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setAllowedNetworkTypesBitmapResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setPreferredNetworkTypeBitmapResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
LOG(ERROR) << "IRadio HAL 1.4 not supported";
return {};
}
Return<void> RadioResponse::setBandModeResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setBandModeResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setBarringPasswordResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setCdmaRoamingPreferenceResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setCellInfoListRateResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setIndicationFilterResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setIndicationFilterResponse_1_5(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setIndicationFilterResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setLinkCapacityReportingCriteriaResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse_1_5(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setLinkCapacityReportingCriteriaResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setLocationUpdatesResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setNetworkSelectionModeAutomaticResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setNetworkSelectionModeManualResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setNetworkSelectionModeManualResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setNetworkSelectionModeManualResponse_1_5(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setNetworkSelectionModeManualResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setNrDualConnectivityStateResponse(
const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setNrDualConnectivityStateResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setSignalStrengthReportingCriteriaResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse_1_5(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setSignalStrengthReportingCriteriaResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSuppServiceNotificationsResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setSuppServiceNotificationsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSystemSelectionChannelsResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setSystemSelectionChannelsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSystemSelectionChannelsResponse_1_5(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->setSystemSelectionChannelsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::startNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->startNetworkScanResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->startNetworkScanResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::startNetworkScanResponse_1_5(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->startNetworkScanResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->stopNetworkScanResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
const V1_0::RadioResponseInfo& info, int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mNetworkCb);
mNetworkCb->supplyNetworkDepersonalizationResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::startLceServiceResponse(const V1_0::RadioResponseInfo& info,
const V1_0::LceStatusInfo&) {
LOG_CALL << info.serial;
LOG(WARNING) << "startLceServiceResponse is deprecated";
return {};
}
Return<void> RadioResponse::stopLceServiceResponse(const V1_0::RadioResponseInfo& info,
const V1_0::LceStatusInfo&) {
LOG_CALL << info.serial;
LOG(WARNING) << "stopLceServiceResponse is deprecated";
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,668 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "commonStructs.h"
#include "collections.h"
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::network;
using ::aidl::android::hardware::radio::AccessNetwork;
using ::aidl::android::hardware::radio::RadioTechnology;
aidl::RadioBandMode toAidl(V1_0::RadioBandMode mode) {
return aidl::RadioBandMode(mode);
}
aidl::GeranBands toAidl(V1_1::GeranBands band) {
return aidl::GeranBands(band);
}
V1_1::GeranBands toHidl(aidl::GeranBands band) {
return V1_1::GeranBands(band);
}
aidl::UtranBands toAidl(V1_5::UtranBands band) {
return aidl::UtranBands(band);
}
V1_5::UtranBands toHidl(aidl::UtranBands band) {
return V1_5::UtranBands(band);
}
aidl::EutranBands toAidl(V1_5::EutranBands band) {
return aidl::EutranBands(band);
}
V1_5::EutranBands toHidl(aidl::EutranBands band) {
return V1_5::EutranBands(band);
}
aidl::NgranBands toAidl(V1_5::NgranBands band) {
return aidl::NgranBands(band);
}
V1_5::NgranBands toHidl(aidl::NgranBands band) {
return V1_5::NgranBands(band);
}
V1_5::SignalThresholdInfo toHidl(const aidl::SignalThresholdInfo& info) {
return {
.signalMeasurement = V1_5::SignalMeasurementType{info.signalMeasurement},
.hysteresisMs = info.hysteresisMs,
.hysteresisDb = info.hysteresisDb,
.thresholds = info.thresholds,
.isEnabled = info.isEnabled,
};
}
static aidl::RadioAccessSpecifierBands toAidl(const V1_5::RadioAccessSpecifier::Bands& bands) {
using Discr = V1_5::RadioAccessSpecifier::Bands::hidl_discriminator;
const auto discr = bands.getDiscriminator();
if (discr == Discr::geranBands) return toAidl(bands.geranBands());
if (discr == Discr::utranBands) return toAidl(bands.utranBands());
if (discr == Discr::eutranBands) return toAidl(bands.eutranBands());
if (discr == Discr::ngranBands) return toAidl(bands.ngranBands());
return {};
}
static V1_5::RadioAccessSpecifier::Bands toHidl(const aidl::RadioAccessSpecifierBands& bands) {
V1_5::RadioAccessSpecifier::Bands hidl;
using Tag = aidl::RadioAccessSpecifierBands::Tag;
if (bands.getTag() == Tag::geranBands) hidl.geranBands(toHidl(bands.get<Tag::geranBands>()));
if (bands.getTag() == Tag::utranBands) hidl.utranBands(toHidl(bands.get<Tag::utranBands>()));
if (bands.getTag() == Tag::eutranBands) hidl.eutranBands(toHidl(bands.get<Tag::eutranBands>()));
if (bands.getTag() == Tag::ngranBands) hidl.ngranBands(toHidl(bands.get<Tag::ngranBands>()));
return hidl;
}
aidl::RadioAccessSpecifier toAidl(const V1_5::RadioAccessSpecifier& spec) {
return {
.accessNetwork = AccessNetwork(spec.radioAccessNetwork),
.bands = toAidl(spec.bands),
.channels = spec.channels,
};
}
V1_5::RadioAccessSpecifier toHidl(const aidl::RadioAccessSpecifier& spec) {
return {
.radioAccessNetwork = V1_5::RadioAccessNetworks{spec.accessNetwork},
.bands = toHidl(spec.bands),
.channels = spec.channels,
};
}
V1_5::NetworkScanRequest toHidl(const aidl::NetworkScanRequest& req) {
return {
.type = V1_1::ScanType{req.type},
.interval = req.interval,
.specifiers = toHidl(req.specifiers),
.maxSearchTime = req.maxSearchTime,
.incrementalResults = req.incrementalResults,
.incrementalResultsPeriodicity = req.incrementalResultsPeriodicity,
.mccMncs = toHidl(req.mccMncs),
};
}
static aidl::OperatorInfo toAidl(const V1_2::CellIdentityOperatorNames& names) {
return {
.alphaLong = names.alphaLong,
.alphaShort = names.alphaShort,
.operatorNumeric = "",
.status = aidl::OperatorInfo::STATUS_UNKNOWN,
};
}
static aidl::CellIdentityGsm toAidl(const V1_5::CellIdentityGsm& ci) {
return {
.mcc = ci.base.base.mcc,
.mnc = ci.base.base.mnc,
.lac = ci.base.base.lac,
.cid = ci.base.base.cid,
.arfcn = ci.base.base.arfcn,
.bsic = static_cast<int8_t>(ci.base.base.bsic),
.operatorNames = toAidl(ci.base.operatorNames),
.additionalPlmns = toAidl(ci.additionalPlmns),
};
}
aidl::ClosedSubscriberGroupInfo toAidl(const V1_5::ClosedSubscriberGroupInfo& info) {
return {
.csgIndication = info.csgIndication,
.homeNodebName = info.homeNodebName,
.csgIdentity = info.csgIdentity,
};
}
static std::optional<aidl::ClosedSubscriberGroupInfo> toAidl(const V1_5::OptionalCsgInfo& opt) {
using descr = V1_5::OptionalCsgInfo::hidl_discriminator;
if (opt.getDiscriminator() == descr::noinit) return std::nullopt;
return toAidl(opt.csgInfo());
}
static aidl::CellIdentityWcdma toAidl(const V1_5::CellIdentityWcdma& ci) {
return {
.mcc = ci.base.base.mcc,
.mnc = ci.base.base.mnc,
.lac = ci.base.base.lac,
.cid = ci.base.base.cid,
.psc = ci.base.base.psc,
.uarfcn = ci.base.base.uarfcn,
.operatorNames = toAidl(ci.base.operatorNames),
.additionalPlmns = toAidl(ci.additionalPlmns),
.csgInfo = toAidl(ci.optionalCsgInfo),
};
}
static aidl::CellIdentityTdscdma toAidl(const V1_5::CellIdentityTdscdma& ci) {
return {
.mcc = ci.base.base.mcc,
.mnc = ci.base.base.mnc,
.lac = ci.base.base.lac,
.cid = ci.base.base.cid,
.cpid = ci.base.base.cpid,
.uarfcn = ci.base.uarfcn,
.operatorNames = toAidl(ci.base.operatorNames),
.additionalPlmns = toAidl(ci.additionalPlmns),
.csgInfo = toAidl(ci.optionalCsgInfo),
};
}
static aidl::CellIdentityCdma toAidl(const V1_2::CellIdentityCdma& ci) {
return {
.networkId = ci.base.networkId,
.systemId = ci.base.systemId,
.baseStationId = ci.base.baseStationId,
.longitude = ci.base.longitude,
.latitude = ci.base.latitude,
.operatorNames = toAidl(ci.operatorNames),
};
}
static aidl::CellIdentityLte toAidl(const V1_5::CellIdentityLte& ci) {
return {
.mcc = ci.base.base.mcc,
.mnc = ci.base.base.mnc,
.ci = ci.base.base.ci,
.pci = ci.base.base.pci,
.tac = ci.base.base.tac,
.earfcn = ci.base.base.earfcn,
.operatorNames = toAidl(ci.base.operatorNames),
.bandwidth = ci.base.bandwidth,
.additionalPlmns = toAidl(ci.additionalPlmns),
.csgInfo = toAidl(ci.optionalCsgInfo),
.bands = toAidl(ci.bands),
};
}
static aidl::CellIdentityNr toAidl(const V1_5::CellIdentityNr& ci) {
return {
.mcc = ci.base.mcc,
.mnc = ci.base.mnc,
.nci = static_cast<int64_t>(ci.base.nci),
.pci = static_cast<int32_t>(ci.base.pci),
.tac = ci.base.tac,
.nrarfcn = ci.base.nrarfcn,
.operatorNames = toAidl(ci.base.operatorNames),
.additionalPlmns = toAidl(ci.additionalPlmns),
.bands = toAidl(ci.bands),
};
}
aidl::CellIdentity toAidl(const V1_5::CellIdentity& ci) {
using Discr = V1_5::CellIdentity::hidl_discriminator;
const auto discr = ci.getDiscriminator();
if (discr == Discr::gsm) return toAidl(ci.gsm());
if (discr == Discr::wcdma) return toAidl(ci.wcdma());
if (discr == Discr::tdscdma) return toAidl(ci.tdscdma());
if (discr == Discr::cdma) return toAidl(ci.cdma());
if (discr == Discr::lte) return toAidl(ci.lte());
if (discr == Discr::nr) return toAidl(ci.nr());
return {};
}
static std::optional<aidl::BarringTypeSpecificInfo> //
toAidl(const V1_5::BarringInfo::BarringTypeSpecificInfo& opt) {
using discr = V1_5::BarringInfo::BarringTypeSpecificInfo::hidl_discriminator;
if (opt.getDiscriminator() == discr::noinit) return std::nullopt;
const auto& info = opt.conditional();
return aidl::BarringTypeSpecificInfo{
.factor = info.factor,
.timeSeconds = info.timeSeconds,
.isBarred = info.isBarred,
};
}
aidl::BarringInfo toAidl(const V1_5::BarringInfo& info) {
return {
.serviceType = static_cast<int32_t>(info.serviceType),
.barringType = static_cast<int32_t>(info.barringType),
.barringTypeSpecificInfo = toAidl(info.barringTypeSpecificInfo),
};
}
static aidl::GsmSignalStrength toAidl(const V1_0::GsmSignalStrength& sig) {
return {
.signalStrength = static_cast<int32_t>(sig.signalStrength),
.bitErrorRate = static_cast<int32_t>(sig.bitErrorRate),
.timingAdvance = sig.timingAdvance,
};
}
static aidl::CellInfoGsm toAidl(const V1_5::CellInfoGsm& info) {
return {
.cellIdentityGsm = toAidl(info.cellIdentityGsm),
.signalStrengthGsm = toAidl(info.signalStrengthGsm),
};
}
static aidl::WcdmaSignalStrength toAidl(const V1_2::WcdmaSignalStrength& sig) {
return {
.signalStrength = sig.base.signalStrength,
.bitErrorRate = sig.base.bitErrorRate,
.rscp = static_cast<int32_t>(sig.rscp),
.ecno = static_cast<int32_t>(sig.ecno),
};
}
static aidl::CellInfoWcdma toAidl(const V1_5::CellInfoWcdma& info) {
return {
.cellIdentityWcdma = toAidl(info.cellIdentityWcdma),
.signalStrengthWcdma = toAidl(info.signalStrengthWcdma),
};
}
static aidl::TdscdmaSignalStrength toAidl(const V1_2::TdscdmaSignalStrength& sig) {
return {
.signalStrength = static_cast<int32_t>(sig.signalStrength),
.bitErrorRate = static_cast<int32_t>(sig.bitErrorRate),
.rscp = static_cast<int32_t>(sig.rscp),
};
}
static aidl::CellInfoTdscdma toAidl(const V1_5::CellInfoTdscdma& info) {
return {
.cellIdentityTdscdma = toAidl(info.cellIdentityTdscdma),
.signalStrengthTdscdma = toAidl(info.signalStrengthTdscdma),
};
}
static aidl::LteSignalStrength toAidl(const V1_6::LteSignalStrength& sig) {
return {
.signalStrength = static_cast<int32_t>(sig.base.signalStrength),
.rsrp = static_cast<int32_t>(sig.base.rsrp),
.rsrq = static_cast<int32_t>(sig.base.rsrq),
.rssnr = sig.base.rssnr,
.cqi = static_cast<int32_t>(sig.base.cqi),
.timingAdvance = static_cast<int32_t>(sig.base.timingAdvance),
.cqiTableIndex = static_cast<int32_t>(sig.cqiTableIndex),
};
}
static aidl::LteSignalStrength toAidl(const V1_0::LteSignalStrength& sig) {
return toAidl({sig, 0});
}
static aidl::CellInfoLte toAidl(const V1_5::CellInfoLte& info) {
return {
.cellIdentityLte = toAidl(info.cellIdentityLte),
.signalStrengthLte = toAidl(info.signalStrengthLte),
};
}
static aidl::CellInfoLte toAidl(const V1_6::CellInfoLte& info) {
return {
.cellIdentityLte = toAidl(info.cellIdentityLte),
.signalStrengthLte = toAidl(info.signalStrengthLte),
};
}
static aidl::NrSignalStrength toAidl(const V1_6::NrSignalStrength& sig) {
return {
.ssRsrp = sig.base.ssRsrp,
.ssRsrq = sig.base.ssRsrq,
.ssSinr = sig.base.ssSinr,
.csiRsrp = sig.base.csiRsrp,
.csiRsrq = sig.base.csiRsrq,
.csiSinr = sig.base.csiSinr,
.csiCqiTableIndex = static_cast<int32_t>(sig.csiCqiTableIndex),
.csiCqiReport = sig.csiCqiReport,
};
}
static aidl::NrSignalStrength toAidl(const V1_4::NrSignalStrength& sig) {
return toAidl({sig, 0, 0});
}
static aidl::CellInfoNr toAidl(const V1_5::CellInfoNr& info) {
return {
.cellIdentityNr = toAidl(info.cellIdentityNr),
.signalStrengthNr = toAidl(info.signalStrengthNr),
};
}
static aidl::CellInfoNr toAidl(const V1_6::CellInfoNr& info) {
return {
.cellIdentityNr = toAidl(info.cellIdentityNr),
.signalStrengthNr = toAidl(info.signalStrengthNr),
};
}
static aidl::CdmaSignalStrength toAidl(const V1_0::CdmaSignalStrength& sig) {
return {
.dbm = static_cast<int32_t>(sig.dbm),
.ecio = static_cast<int32_t>(sig.ecio),
};
}
static aidl::EvdoSignalStrength toAidl(const V1_0::EvdoSignalStrength& sig) {
return {
.dbm = static_cast<int32_t>(sig.dbm),
.ecio = static_cast<int32_t>(sig.ecio),
.signalNoiseRatio = static_cast<int32_t>(sig.signalNoiseRatio),
};
}
static aidl::CellInfoCdma toAidl(const V1_2::CellInfoCdma& info) {
return {
.cellIdentityCdma = toAidl(info.cellIdentityCdma),
.signalStrengthCdma = toAidl(info.signalStrengthCdma),
.signalStrengthEvdo = toAidl(info.signalStrengthEvdo),
};
}
static aidl::CellInfoRatSpecificInfo toAidl(const V1_5::CellInfo::CellInfoRatSpecificInfo& ci) {
using Discr = V1_5::CellInfo::CellInfoRatSpecificInfo::hidl_discriminator;
const auto discr = ci.getDiscriminator();
if (discr == Discr::gsm) return toAidl(ci.gsm());
if (discr == Discr::wcdma) return toAidl(ci.wcdma());
if (discr == Discr::tdscdma) return toAidl(ci.tdscdma());
if (discr == Discr::lte) return toAidl(ci.lte());
if (discr == Discr::nr) return toAidl(ci.nr());
if (discr == Discr::cdma) return toAidl(ci.cdma());
return {};
}
static aidl::CellInfoRatSpecificInfo toAidl(const V1_6::CellInfo::CellInfoRatSpecificInfo& ci) {
using Discr = V1_6::CellInfo::CellInfoRatSpecificInfo::hidl_discriminator;
const auto discr = ci.getDiscriminator();
if (discr == Discr::gsm) return toAidl(ci.gsm());
if (discr == Discr::wcdma) return toAidl(ci.wcdma());
if (discr == Discr::tdscdma) return toAidl(ci.tdscdma());
if (discr == Discr::lte) return toAidl(ci.lte());
if (discr == Discr::nr) return toAidl(ci.nr());
if (discr == Discr::cdma) return toAidl(ci.cdma());
return {};
}
aidl::CellInfo toAidl(const V1_5::CellInfo& info) {
return {
.registered = info.registered,
// ignored: timeStampType and timeStamp
.connectionStatus = aidl::CellConnectionStatus(info.connectionStatus),
.ratSpecificInfo = toAidl(info.ratSpecificInfo),
};
}
aidl::CellInfo toAidl(const V1_6::CellInfo& info) {
return {
.registered = info.registered,
.connectionStatus = aidl::CellConnectionStatus(info.connectionStatus),
.ratSpecificInfo = toAidl(info.ratSpecificInfo),
};
}
aidl::LinkCapacityEstimate toAidl(const V1_2::LinkCapacityEstimate& e) {
return {
.downlinkCapacityKbps = static_cast<int32_t>(e.downlinkCapacityKbps),
.uplinkCapacityKbps = static_cast<int32_t>(e.uplinkCapacityKbps),
};
}
aidl::LinkCapacityEstimate toAidl(const V1_6::LinkCapacityEstimate& e) {
return {
.downlinkCapacityKbps = static_cast<int32_t>(e.downlinkCapacityKbps),
.uplinkCapacityKbps = static_cast<int32_t>(e.uplinkCapacityKbps),
.secondaryDownlinkCapacityKbps = static_cast<int32_t>(e.secondaryDownlinkCapacityKbps),
.secondaryUplinkCapacityKbps = static_cast<int32_t>(e.secondaryUplinkCapacityKbps),
};
}
static aidl::PhysicalChannelConfigBand toAidl(const V1_6::PhysicalChannelConfig::Band& band) {
using Discr = V1_6::PhysicalChannelConfig::Band::hidl_discriminator;
const auto discr = band.getDiscriminator();
if (discr == Discr::geranBand) return aidl::GeranBands(band.geranBand());
if (discr == Discr::utranBand) return aidl::UtranBands(band.utranBand());
if (discr == Discr::eutranBand) return aidl::EutranBands(band.eutranBand());
if (discr == Discr::ngranBand) return aidl::NgranBands(band.ngranBand());
return {};
}
aidl::PhysicalChannelConfig toAidl(const V1_4::PhysicalChannelConfig& cfg) {
int32_t downlinkChannelNumber = 0;
// ignored rfInfo.range
using Discr = V1_4::RadioFrequencyInfo::hidl_discriminator;
if (cfg.rfInfo.getDiscriminator() == Discr::channelNumber) {
downlinkChannelNumber = cfg.rfInfo.channelNumber();
}
return {
.status = aidl::CellConnectionStatus(cfg.base.status),
.rat = RadioTechnology(cfg.rat),
.downlinkChannelNumber = downlinkChannelNumber,
.cellBandwidthDownlinkKhz = cfg.base.cellBandwidthDownlink,
.contextIds = cfg.contextIds,
.physicalCellId = static_cast<int32_t>(cfg.physicalCellId),
};
}
aidl::PhysicalChannelConfig toAidl(const V1_6::PhysicalChannelConfig& cfg) {
return {
.status = aidl::CellConnectionStatus(cfg.status),
.rat = RadioTechnology(cfg.rat),
.downlinkChannelNumber = cfg.downlinkChannelNumber,
.uplinkChannelNumber = cfg.uplinkChannelNumber,
.cellBandwidthDownlinkKhz = cfg.cellBandwidthDownlinkKhz,
.cellBandwidthUplinkKhz = cfg.cellBandwidthUplinkKhz,
.contextIds = cfg.contextIds,
.physicalCellId = static_cast<int32_t>(cfg.physicalCellId),
.band = toAidl(cfg.band),
};
}
aidl::SignalStrength toAidl(const V1_4::SignalStrength& sig) {
return {
.gsm = toAidl(sig.gsm),
.cdma = toAidl(sig.cdma),
.evdo = toAidl(sig.evdo),
.lte = toAidl(sig.lte),
.tdscdma = toAidl(sig.tdscdma),
.wcdma = toAidl(sig.wcdma),
.nr = toAidl(sig.nr),
};
}
aidl::SignalStrength toAidl(const V1_6::SignalStrength& sig) {
return {
.gsm = toAidl(sig.gsm),
.cdma = toAidl(sig.cdma),
.evdo = toAidl(sig.evdo),
.lte = toAidl(sig.lte),
.tdscdma = toAidl(sig.tdscdma),
.wcdma = toAidl(sig.wcdma),
.nr = toAidl(sig.nr),
};
}
aidl::NetworkScanResult toAidl(const V1_5::NetworkScanResult& res) {
return {
.status = static_cast<int32_t>(res.status),
.error = toAidl(res.error),
.networkInfos = toAidl(res.networkInfos),
};
}
aidl::NetworkScanResult toAidl(const V1_6::NetworkScanResult& res) {
return {
.status = static_cast<int32_t>(res.status),
.error = toAidl(res.error),
.networkInfos = toAidl(res.networkInfos),
};
}
aidl::SuppSvcNotification toAidl(const V1_0::SuppSvcNotification& svc) {
return {
.isMT = svc.isMT,
.code = svc.code,
.index = svc.index,
.type = svc.type,
.number = svc.number,
};
}
aidl::OperatorInfo toAidl(const V1_0::OperatorInfo& info) {
return {
.alphaLong = info.alphaLong,
.alphaShort = info.alphaShort,
.operatorNumeric = info.operatorNumeric,
.status = static_cast<int32_t>(info.status),
};
}
static aidl::Cdma2000RegistrationInfo //
toAidl(const V1_5::RegStateResult::AccessTechnologySpecificInfo::Cdma2000RegistrationInfo& info) {
return {
.cssSupported = info.cssSupported,
.roamingIndicator = info.roamingIndicator,
.systemIsInPrl = static_cast<int32_t>(info.systemIsInPrl),
.defaultRoamingIndicator = info.defaultRoamingIndicator,
};
}
static aidl::LteVopsInfo toAidl(const V1_4::LteVopsInfo& info) {
return {
.isVopsSupported = info.isVopsSupported,
.isEmcBearerSupported = info.isEmcBearerSupported,
};
}
static aidl::NrIndicators toAidl(const V1_4::NrIndicators& info) {
return {
.isEndcAvailable = info.isEndcAvailable,
.isDcNrRestricted = info.isDcNrRestricted,
.isNrAvailable = info.isNrAvailable,
};
}
static aidl::EutranRegistrationInfo //
toAidl(const V1_5::RegStateResult::AccessTechnologySpecificInfo::EutranRegistrationInfo& info) {
return {
.lteVopsInfo = toAidl(info.lteVopsInfo),
.nrIndicators = toAidl(info.nrIndicators),
};
}
static aidl::NrVopsInfo toAidl(const V1_6::NrVopsInfo& info) {
return {
.vopsSupported = static_cast<int8_t>(info.vopsSupported),
.emcSupported = static_cast<int8_t>(info.emcSupported),
.emfSupported = static_cast<int8_t>(info.emfSupported),
};
}
static aidl::AccessTechnologySpecificInfo //
toAidl(const V1_5::RegStateResult::AccessTechnologySpecificInfo& info) {
using Discr = V1_5::RegStateResult::AccessTechnologySpecificInfo::hidl_discriminator;
const auto discr = info.getDiscriminator();
if (discr == Discr::cdmaInfo) return toAidl(info.cdmaInfo());
if (discr == Discr::eutranInfo) return toAidl(info.eutranInfo());
return {};
}
static aidl::AccessTechnologySpecificInfo //
toAidl(const V1_6::RegStateResult::AccessTechnologySpecificInfo& info) {
using Discr = V1_6::RegStateResult::AccessTechnologySpecificInfo::hidl_discriminator;
const auto discr = info.getDiscriminator();
if (discr == Discr::cdmaInfo) return toAidl(info.cdmaInfo());
if (discr == Discr::eutranInfo) return toAidl(info.eutranInfo());
if (discr == Discr::ngranNrVopsInfo) return toAidl(info.ngranNrVopsInfo());
if (discr == Discr::geranDtmSupported) {
using T = aidl::AccessTechnologySpecificInfo;
return T::make<T::Tag::geranDtmSupported>(info.geranDtmSupported());
}
return {};
}
aidl::RegStateResult toAidl(const V1_5::RegStateResult& res) {
return {
.regState = aidl::RegState(res.regState),
.rat = RadioTechnology(res.rat),
.reasonForDenial = aidl::RegistrationFailCause(res.reasonForDenial),
.cellIdentity = toAidl(res.cellIdentity),
.registeredPlmn = res.registeredPlmn,
.accessTechnologySpecificInfo = toAidl(res.accessTechnologySpecificInfo),
};
}
aidl::RegStateResult toAidl(const V1_6::RegStateResult& res) {
return {
.regState = aidl::RegState(res.regState),
.rat = RadioTechnology(res.rat),
.reasonForDenial = aidl::RegistrationFailCause(res.reasonForDenial),
.cellIdentity = toAidl(res.cellIdentity),
.registeredPlmn = res.registeredPlmn,
.accessTechnologySpecificInfo = toAidl(res.accessTechnologySpecificInfo),
};
}
aidl::NeighboringCell toAidl(const V1_0::NeighboringCell& cell) {
return {
.cid = cell.cid,
.rssi = cell.rssi,
};
}
aidl::LceDataInfo toAidl(const V1_0::LceDataInfo& info) {
return {
.lastHopCapacityKbps = static_cast<int32_t>(info.lastHopCapacityKbps),
.confidenceLevel = static_cast<int8_t>(info.confidenceLevel),
.lceSuspended = info.lceSuspended,
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,99 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/network/BarringInfo.h>
#include <aidl/android/hardware/radio/network/CellIdentity.h>
#include <aidl/android/hardware/radio/network/CellInfo.h>
#include <aidl/android/hardware/radio/network/LceDataInfo.h>
#include <aidl/android/hardware/radio/network/LinkCapacityEstimate.h>
#include <aidl/android/hardware/radio/network/NeighboringCell.h>
#include <aidl/android/hardware/radio/network/NetworkScanRequest.h>
#include <aidl/android/hardware/radio/network/NetworkScanResult.h>
#include <aidl/android/hardware/radio/network/OperatorInfo.h>
#include <aidl/android/hardware/radio/network/PhysicalChannelConfig.h>
#include <aidl/android/hardware/radio/network/RadioAccessSpecifier.h>
#include <aidl/android/hardware/radio/network/RadioBandMode.h>
#include <aidl/android/hardware/radio/network/RegStateResult.h>
#include <aidl/android/hardware/radio/network/SignalStrength.h>
#include <aidl/android/hardware/radio/network/SignalThresholdInfo.h>
#include <aidl/android/hardware/radio/network/SuppSvcNotification.h>
#include <android/hardware/radio/1.6/types.h>
namespace android::hardware::radio::compat {
::aidl::android::hardware::radio::network::RadioBandMode toAidl(V1_0::RadioBandMode mode);
::aidl::android::hardware::radio::network::GeranBands toAidl(V1_1::GeranBands band);
V1_1::GeranBands toHidl(::aidl::android::hardware::radio::network::GeranBands band);
::aidl::android::hardware::radio::network::UtranBands toAidl(V1_5::UtranBands band);
V1_5::UtranBands toHidl(::aidl::android::hardware::radio::network::UtranBands band);
::aidl::android::hardware::radio::network::EutranBands toAidl(V1_5::EutranBands band);
V1_5::EutranBands toHidl(::aidl::android::hardware::radio::network::EutranBands band);
::aidl::android::hardware::radio::network::NgranBands toAidl(V1_5::NgranBands band);
V1_5::NgranBands toHidl(::aidl::android::hardware::radio::network::NgranBands band);
V1_5::SignalThresholdInfo //
toHidl(const ::aidl::android::hardware::radio::network::SignalThresholdInfo& info);
::aidl::android::hardware::radio::network::RadioAccessSpecifier //
toAidl(const V1_5::RadioAccessSpecifier& spec);
V1_5::RadioAccessSpecifier //
toHidl(const ::aidl::android::hardware::radio::network::RadioAccessSpecifier& spec);
V1_5::NetworkScanRequest //
toHidl(const ::aidl::android::hardware::radio::network::NetworkScanRequest& req);
::aidl::android::hardware::radio::network::CellIdentity toAidl(const V1_5::CellIdentity& ci);
::aidl::android::hardware::radio::network::BarringInfo toAidl(const V1_5::BarringInfo& info);
::aidl::android::hardware::radio::network::ClosedSubscriberGroupInfo //
toAidl(const V1_5::ClosedSubscriberGroupInfo& info);
::aidl::android::hardware::radio::network::CellInfo toAidl(const V1_5::CellInfo& info);
::aidl::android::hardware::radio::network::CellInfo toAidl(const V1_6::CellInfo& info);
::aidl::android::hardware::radio::network::LinkCapacityEstimate //
toAidl(const V1_2::LinkCapacityEstimate& lce);
::aidl::android::hardware::radio::network::LinkCapacityEstimate //
toAidl(const V1_6::LinkCapacityEstimate& lce);
::aidl::android::hardware::radio::network::PhysicalChannelConfig //
toAidl(const V1_4::PhysicalChannelConfig& cfg);
::aidl::android::hardware::radio::network::PhysicalChannelConfig //
toAidl(const V1_6::PhysicalChannelConfig& cfg);
::aidl::android::hardware::radio::network::SignalStrength toAidl(const V1_4::SignalStrength& sig);
::aidl::android::hardware::radio::network::SignalStrength toAidl(const V1_6::SignalStrength& sig);
::aidl::android::hardware::radio::network::NetworkScanResult //
toAidl(const V1_5::NetworkScanResult& res);
::aidl::android::hardware::radio::network::NetworkScanResult //
toAidl(const V1_6::NetworkScanResult& res);
::aidl::android::hardware::radio::network::SuppSvcNotification //
toAidl(const V1_0::SuppSvcNotification& svc);
::aidl::android::hardware::radio::network::OperatorInfo toAidl(const V1_0::OperatorInfo& info);
::aidl::android::hardware::radio::network::RegStateResult toAidl(const V1_5::RegStateResult& res);
::aidl::android::hardware::radio::network::RegStateResult toAidl(const V1_6::RegStateResult& res);
::aidl::android::hardware::radio::network::NeighboringCell toAidl(const V1_0::NeighboringCell& c);
::aidl::android::hardware::radio::network::LceDataInfo toAidl(const V1_0::LceDataInfo& info);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,196 @@
/*
* Copyright (C) 2021 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 "utils.h"
namespace android::hardware::radio::compat {
namespace RAF {
using E = V1_4::RadioAccessFamily;
constexpr auto GSM = E::GSM | E::GPRS;
constexpr auto CDMA = E::IS95A | E::IS95B | E::ONE_X_RTT;
constexpr auto EVDO = E::EVDO_0 | E::EVDO_A | E::EVDO_B | E::EHRPD;
constexpr auto HS = E::HSUPA | E::HSDPA | E::HSPA | E::HSPAP;
constexpr auto WCDMA = HS | E::UMTS;
constexpr auto LTE = E::LTE | E::LTE_CA;
constexpr auto NR = E::NR;
} // namespace RAF
static hidl_bitfield<V1_4::RadioAccessFamily> //
getAdjustedRaf(hidl_bitfield<V1_4::RadioAccessFamily> raf) {
if (raf & RAF::GSM) raf |= RAF::GSM;
if (raf & RAF::WCDMA) raf |= RAF::WCDMA;
if (raf & RAF::CDMA) raf |= RAF::CDMA;
if (raf & RAF::EVDO) raf |= RAF::EVDO;
if (raf & RAF::LTE) raf |= RAF::LTE;
if (raf & RAF::NR) raf |= RAF::NR;
return raf;
}
V1_0::PreferredNetworkType getNetworkTypeFromRaf(hidl_bitfield<V1_4::RadioAccessFamily> raf) {
raf = getAdjustedRaf(raf);
switch (raf) {
case RAF::GSM | RAF::WCDMA:
return V1_0::PreferredNetworkType::GSM_WCDMA_AUTO;
case RAF::GSM:
return V1_0::PreferredNetworkType::GSM_ONLY;
case RAF::WCDMA:
return V1_0::PreferredNetworkType::WCDMA;
case (RAF::CDMA | RAF::EVDO):
return V1_0::PreferredNetworkType::CDMA_EVDO_AUTO;
case (RAF::LTE | RAF::CDMA | RAF::EVDO):
return V1_0::PreferredNetworkType::LTE_CDMA_EVDO;
case (RAF::LTE | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType::LTE_GSM_WCDMA;
case (RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA; // CDMA typo
case RAF::LTE:
return V1_0::PreferredNetworkType::LTE_ONLY;
case (RAF::LTE | RAF::WCDMA):
return V1_0::PreferredNetworkType::LTE_WCDMA;
case RAF::CDMA:
return V1_0::PreferredNetworkType::CDMA_ONLY;
case RAF::EVDO:
return V1_0::PreferredNetworkType::EVDO_ONLY;
case (RAF::GSM | RAF::WCDMA | RAF::CDMA | RAF::EVDO):
return V1_0::PreferredNetworkType::GSM_WCDMA_CDMA_EVDO_AUTO;
case static_cast<int>(RAF::E::TD_SCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_ONLY;
case (RAF::E::TD_SCDMA | RAF::WCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_WCDMA;
case (RAF::LTE | RAF::E::TD_SCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_LTE;
case (RAF::E::TD_SCDMA | RAF::GSM):
return V1_0::PreferredNetworkType::TD_SCDMA_GSM;
case (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM):
return V1_0::PreferredNetworkType::TD_SCDMA_GSM_LTE;
case (RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA;
case (RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_WCDMA_LTE;
case (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_LTE;
case (RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO;
case (RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType::TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA;
case static_cast<int>(RAF::NR):
return V1_0::PreferredNetworkType(23); // NR_ONLY
case (RAF::NR | RAF::LTE):
return V1_0::PreferredNetworkType(24); // NR_LTE
case (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO):
return V1_0::PreferredNetworkType(25); // NR_LTE_CDMA_EVDO
case (RAF::NR | RAF::LTE | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType(26); // NR_LTE_GSM_WCDMA
case (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType(27); // NR_LTE_CDMA_EVDO_GSM_WCDMA
case (RAF::NR | RAF::LTE | RAF::WCDMA):
return V1_0::PreferredNetworkType(28); // NR_LTE_WCDMA
case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA):
return V1_0::PreferredNetworkType(29); // NR_LTE_TDSCDMA
case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM):
return V1_0::PreferredNetworkType(30); // NR_LTE_TDSCDMA_GSM
case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA):
return V1_0::PreferredNetworkType(31); // NR_LTE_TDSCDMA_WCDMA
case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA):
return V1_0::PreferredNetworkType(32); // NR_LTE_TDSCDMA_GSM_WCDMA
case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM |
RAF::WCDMA):
return V1_0::PreferredNetworkType(33); // NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA
default:
return V1_0::PreferredNetworkType::WCDMA;
}
}
hidl_bitfield<V1_4::RadioAccessFamily> getRafFromNetworkType(V1_0::PreferredNetworkType type) {
switch (type) {
case V1_0::PreferredNetworkType::GSM_WCDMA_AUTO:
return RAF::GSM | RAF::WCDMA;
case V1_0::PreferredNetworkType::GSM_ONLY:
return RAF::GSM;
case V1_0::PreferredNetworkType::WCDMA:
return RAF::WCDMA;
case V1_0::PreferredNetworkType::CDMA_EVDO_AUTO:
return (RAF::CDMA | RAF::EVDO);
case V1_0::PreferredNetworkType::LTE_CDMA_EVDO:
return (RAF::LTE | RAF::CDMA | RAF::EVDO);
case V1_0::PreferredNetworkType::LTE_GSM_WCDMA:
return (RAF::LTE | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA:
return (RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType::LTE_ONLY:
return RAF::LTE;
case V1_0::PreferredNetworkType::LTE_WCDMA:
return (RAF::LTE | RAF::WCDMA);
case V1_0::PreferredNetworkType::CDMA_ONLY:
return RAF::CDMA;
case V1_0::PreferredNetworkType::EVDO_ONLY:
return RAF::EVDO;
case V1_0::PreferredNetworkType::GSM_WCDMA_CDMA_EVDO_AUTO:
return (RAF::GSM | RAF::WCDMA | RAF::CDMA | RAF::EVDO);
case V1_0::PreferredNetworkType::TD_SCDMA_ONLY:
return static_cast<int>(RAF::E::TD_SCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_WCDMA:
return (RAF::E::TD_SCDMA | RAF::WCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_LTE:
return (RAF::LTE | RAF::E::TD_SCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_GSM:
return (RAF::E::TD_SCDMA | RAF::GSM);
case V1_0::PreferredNetworkType::TD_SCDMA_GSM_LTE:
return (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM);
case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA:
return (RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_WCDMA_LTE:
return (RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_LTE:
return (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO:
return (RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType::TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA:
return (RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch"
case V1_0::PreferredNetworkType(23): // NR_ONLY
return static_cast<int>(RAF::NR);
case V1_0::PreferredNetworkType(24): // NR_LTE
return (RAF::NR | RAF::LTE);
case V1_0::PreferredNetworkType(25): // NR_LTE_CDMA_EVDO
return (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO);
case V1_0::PreferredNetworkType(26): // NR_LTE_GSM_WCDMA
return (RAF::NR | RAF::LTE | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType(27): // NR_LTE_CDMA_EVDO_GSM_WCDMA
return (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType(28): // NR_LTE_WCDMA
return (RAF::NR | RAF::LTE | RAF::WCDMA);
case V1_0::PreferredNetworkType(29): // NR_LTE_TDSCDMA
return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA);
case V1_0::PreferredNetworkType(30): // NR_LTE_TDSCDMA_GSM
return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM);
case V1_0::PreferredNetworkType(31): // NR_LTE_TDSCDMA_WCDMA
return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA);
case V1_0::PreferredNetworkType(32): // NR_LTE_TDSCDMA_GSM_WCDMA
return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA);
case V1_0::PreferredNetworkType(33): // NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA
return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM |
RAF::WCDMA);
#pragma GCC diagnostic pop
default:
return {}; // unknown
}
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2021 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 <android/hardware/radio/1.4/types.h>
namespace android::hardware::radio::compat {
V1_0::PreferredNetworkType getNetworkTypeFromRaf(hidl_bitfield<V1_4::RadioAccessFamily> raf);
hidl_bitfield<V1_4::RadioAccessFamily> getRafFromNetworkType(V1_0::PreferredNetworkType type);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,121 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioIndication.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "SimIndication"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::sim;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioSimIndication> simCb) {
CHECK(simCb);
mSimCb = simCb;
}
Return<void> RadioIndication::carrierInfoForImsiEncryption(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->carrierInfoForImsiEncryption(toAidl(type));
return {};
}
Return<void> RadioIndication::cdmaSubscriptionSourceChanged(
V1_0::RadioIndicationType type, V1_0::CdmaSubscriptionSource cdmaSource) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->cdmaSubscriptionSourceChanged(toAidl(type), aidl::CdmaSubscriptionSource(cdmaSource));
return {};
}
Return<void> RadioIndication::simPhonebookChanged(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->simPhonebookChanged(toAidl(type));
return {};
}
Return<void> RadioIndication::simPhonebookRecordsReceived(
V1_0::RadioIndicationType type, V1_6::PbReceivedStatus status,
const hidl_vec<V1_6::PhonebookRecordInfo>& rec) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->simPhonebookRecordsReceived(toAidl(type), aidl::PbReceivedStatus(status), toAidl(rec));
return {};
}
Return<void> RadioIndication::simRefresh(V1_0::RadioIndicationType type,
const V1_0::SimRefreshResult& refreshResult) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->simRefresh(toAidl(type), toAidl(refreshResult));
return {};
}
Return<void> RadioIndication::simStatusChanged(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->simStatusChanged(toAidl(type));
return {};
}
Return<void> RadioIndication::stkEventNotify(V1_0::RadioIndicationType type,
const hidl_string& cmd) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->stkEventNotify(toAidl(type), cmd);
return {};
}
Return<void> RadioIndication::stkProactiveCommand(V1_0::RadioIndicationType type,
const hidl_string& cmd) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->stkProactiveCommand(toAidl(type), cmd);
return {};
}
Return<void> RadioIndication::stkSessionEnd(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->stkSessionEnd(toAidl(type));
return {};
}
Return<void> RadioIndication::subscriptionStatusChanged(V1_0::RadioIndicationType type,
bool activate) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->subscriptionStatusChanged(toAidl(type), activate);
return {};
}
Return<void> RadioIndication::uiccApplicationsEnablementChanged(V1_0::RadioIndicationType type,
bool enabled) {
LOG_CALL << type;
CHECK_CB(mSimCb);
mSimCb->uiccApplicationsEnablementChanged(toAidl(type), enabled);
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,366 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "SimResponse"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::sim;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioSimResponse> simCb) {
CHECK(simCb);
mSimCb = simCb;
}
Return<void> RadioResponse::areUiccApplicationsEnabledResponse(const V1_0::RadioResponseInfo& info,
bool enabled) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->areUiccApplicationsEnabledResponse(toAidl(info), enabled);
return {};
}
Return<void> RadioResponse::changeIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->changeIccPin2ForAppResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::changeIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->changeIccPinForAppResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::enableUiccApplicationsResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->enableUiccApplicationsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::getAllowedCarriersResponse( //
const V1_0::RadioResponseInfo& info, bool allAllowed, const V1_0::CarrierRestrictions& cr) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
aidl::CarrierRestrictions aidlCr = toAidl(cr);
if (allAllowed) aidlCr = {};
mSimCb->getAllowedCarriersResponse(toAidl(info), aidlCr, {});
return {};
}
Return<void> RadioResponse::getAllowedCarriersResponse_1_4(
const V1_0::RadioResponseInfo& info, const V1_4::CarrierRestrictionsWithPriority& carriers,
V1_4::SimLockMultiSimPolicy multiSimPolicy) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getAllowedCarriersResponse(toAidl(info), toAidl(carriers),
aidl::SimLockMultiSimPolicy(multiSimPolicy));
return {};
}
Return<void> RadioResponse::getCDMASubscriptionResponse(
const V1_0::RadioResponseInfo& info, const hidl_string& mdn, const hidl_string& hSid,
const hidl_string& hNid, const hidl_string& min, const hidl_string& prl) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getCdmaSubscriptionResponse(toAidl(info), mdn, hSid, hNid, min, prl);
return {};
}
Return<void> RadioResponse::getCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info,
V1_0::CdmaSubscriptionSource s) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getCdmaSubscriptionSourceResponse(toAidl(info), aidl::CdmaSubscriptionSource(s));
return {};
}
Return<void> RadioResponse::getFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t response) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getFacilityLockForAppResponse(toAidl(info), response);
return {};
}
Return<void> RadioResponse::getIccCardStatusResponse(const V1_0::RadioResponseInfo& info,
const V1_0::CardStatus& cardStatus) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getIccCardStatusResponse(toAidl(info), toAidl(cardStatus));
return {};
}
Return<void> RadioResponse::getIccCardStatusResponse_1_2(const V1_0::RadioResponseInfo& info,
const V1_2::CardStatus& cardStatus) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getIccCardStatusResponse(toAidl(info), toAidl(cardStatus));
return {};
}
Return<void> RadioResponse::getIccCardStatusResponse_1_4(const V1_0::RadioResponseInfo& info,
const V1_4::CardStatus& cardStatus) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getIccCardStatusResponse(toAidl(info), toAidl(cardStatus));
return {};
}
Return<void> RadioResponse::getIccCardStatusResponse_1_5(const V1_0::RadioResponseInfo& info,
const V1_5::CardStatus& cardStatus) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getIccCardStatusResponse(toAidl(info), toAidl(cardStatus));
return {};
}
Return<void> RadioResponse::getIMSIForAppResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& imsi) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getImsiForAppResponse(toAidl(info), imsi);
return {};
}
Return<void> RadioResponse::getSimPhonebookCapacityResponse(
const V1_6::RadioResponseInfo& info, const V1_6::PhonebookCapacity& capacity) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getSimPhonebookCapacityResponse(toAidl(info), toAidl(capacity));
return {};
}
Return<void> RadioResponse::getSimPhonebookRecordsResponse(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->getSimPhonebookRecordsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::iccCloseLogicalChannelResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->iccCloseLogicalChannelResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::iccIOForAppResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& iccIo) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->iccIoForAppResponse(toAidl(info), toAidl(iccIo));
return {};
}
Return<void> RadioResponse::iccOpenLogicalChannelResponse( //
const V1_0::RadioResponseInfo& info, int32_t chanId, const hidl_vec<int8_t>& selectResp) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->iccOpenLogicalChannelResponse(toAidl(info), chanId, toAidl(selectResp));
return {};
}
Return<void> RadioResponse::iccTransmitApduBasicChannelResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& result) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->iccTransmitApduBasicChannelResponse(toAidl(info), toAidl(result));
return {};
}
Return<void> RadioResponse::iccTransmitApduLogicalChannelResponse(
const V1_0::RadioResponseInfo& info, const V1_0::IccIoResult& result) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->iccTransmitApduLogicalChannelResponse(toAidl(info), toAidl(result));
return {};
}
Return<void> RadioResponse::reportStkServiceIsRunningResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->reportStkServiceIsRunningResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::requestIccSimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& result) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->requestIccSimAuthenticationResponse(toAidl(info), toAidl(result));
return {};
}
Return<void> RadioResponse::requestIsimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
const hidl_string&) {
LOG_CALL << info.serial;
LOG(ERROR) << "requestIsimAuthenticationResponse is not supposed to be called";
return {};
}
Return<void> RadioResponse::sendEnvelopeResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& commandResponse) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->sendEnvelopeResponse(toAidl(info), commandResponse);
return {};
}
Return<void> RadioResponse::sendEnvelopeWithStatusResponse(const V1_0::RadioResponseInfo& info,
const V1_0::IccIoResult& iccIo) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->sendEnvelopeWithStatusResponse(toAidl(info), toAidl(iccIo));
return {};
}
Return<void> RadioResponse::sendTerminalResponseToSimResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->sendTerminalResponseToSimResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setAllowedCarriersResponse(const V1_0::RadioResponseInfo& info,
int32_t numAllowed) {
LOG_CALL << info.serial << ' ' << numAllowed;
CHECK_CB(mSimCb);
mSimCb->setAllowedCarriersResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setAllowedCarriersResponse_1_4(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setAllowedCarriersResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCarrierInfoForImsiEncryptionResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setCarrierInfoForImsiEncryptionResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setCdmaSubscriptionSourceResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t retry) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setFacilityLockForAppResponse(toAidl(info), retry);
return {};
}
Return<void> RadioResponse::setSimCardPowerResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setSimCardPowerResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSimCardPowerResponse_1_1(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setSimCardPowerResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSimCardPowerResponse_1_6(const V1_6::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setSimCardPowerResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setUiccSubscriptionResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->setUiccSubscriptionResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::supplyIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->supplyIccPin2ForAppResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::supplyIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->supplyIccPinForAppResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::supplyIccPuk2ForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->supplyIccPuk2ForAppResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::supplyIccPukForAppResponse(const V1_0::RadioResponseInfo& info,
int32_t remainingRetries) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->supplyIccPukForAppResponse(toAidl(info), remainingRetries);
return {};
}
Return<void> RadioResponse::supplySimDepersonalizationResponse(const V1_0::RadioResponseInfo& info,
V1_5::PersoSubstate persoType,
int32_t rRet) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->supplySimDepersonalizationResponse(toAidl(info), aidl::PersoSubstate(persoType), rRet);
return {};
}
Return<void> RadioResponse::updateSimPhonebookRecordsResponse(const V1_6::RadioResponseInfo& info,
int32_t updatedRecordIndex) {
LOG_CALL << info.serial;
CHECK_CB(mSimCb);
mSimCb->updateSimPhonebookRecordsResponse(toAidl(info), updatedRecordIndex);
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,295 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioSim.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "Sim"
namespace android::hardware::radio::compat {
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::sim;
constexpr auto ok = &ScopedAStatus::ok;
ScopedAStatus RadioSim::areUiccApplicationsEnabled(int32_t serial) {
LOG_CALL << serial;
mHal1_5->areUiccApplicationsEnabled(serial);
return ok();
}
ScopedAStatus RadioSim::changeIccPin2ForApp(int32_t serial, const std::string& oldPin2,
const std::string& newPin2, const std::string& aid) {
LOG_CALL << serial;
mHal1_5->changeIccPin2ForApp(serial, oldPin2, newPin2, aid);
return ok();
}
ScopedAStatus RadioSim::changeIccPinForApp(int32_t serial, const std::string& oldPin,
const std::string& newPin, const std::string& aid) {
LOG_CALL << serial;
mHal1_5->changeIccPinForApp(serial, oldPin, newPin, aid);
return ok();
}
ScopedAStatus RadioSim::enableUiccApplications(int32_t serial, bool enable) {
LOG_CALL << serial;
mHal1_5->enableUiccApplications(serial, enable);
return ok();
}
ScopedAStatus RadioSim::getAllowedCarriers(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getAllowedCarriers(serial);
return ok();
}
ScopedAStatus RadioSim::getCdmaSubscription(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getCDMASubscription(serial);
return ok();
}
ScopedAStatus RadioSim::getCdmaSubscriptionSource(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getCdmaSubscriptionSource(serial);
return ok();
}
ScopedAStatus RadioSim::getFacilityLockForApp( //
int32_t serial, const std::string& facility, const std::string& password,
int32_t serviceClass, const std::string& appId) {
LOG_CALL << serial;
mHal1_5->getFacilityLockForApp(serial, facility, password, serviceClass, appId);
return ok();
}
ScopedAStatus RadioSim::getIccCardStatus(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getIccCardStatus(serial);
return ok();
}
ScopedAStatus RadioSim::getImsiForApp(int32_t serial, const std::string& aid) {
LOG_CALL << serial;
mHal1_5->getImsiForApp(serial, aid);
return ok();
}
ScopedAStatus RadioSim::getSimPhonebookCapacity(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->getSimPhonebookCapacity(serial);
} else {
respond().getSimPhonebookCapacityResponse(notSupported(serial), {});
}
return ok();
}
ScopedAStatus RadioSim::getSimPhonebookRecords(int32_t serial) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->getSimPhonebookRecords(serial);
} else {
respond().getSimPhonebookRecordsResponse(notSupported(serial));
}
return ok();
}
ScopedAStatus RadioSim::iccCloseLogicalChannel(int32_t serial, int32_t channelId) {
LOG_CALL << serial;
mHal1_5->iccCloseLogicalChannel(serial, channelId);
return ok();
}
ScopedAStatus RadioSim::iccIoForApp(int32_t serial, const aidl::IccIo& iccIo) {
LOG_CALL << serial;
mHal1_5->iccIOForApp(serial, toHidl(iccIo));
return ok();
}
ScopedAStatus RadioSim::iccOpenLogicalChannel(int32_t serial, const std::string& aid, int32_t p2) {
LOG_CALL << serial;
mHal1_5->iccOpenLogicalChannel(serial, aid, p2);
return ok();
}
ScopedAStatus RadioSim::iccTransmitApduBasicChannel(int32_t serial, const aidl::SimApdu& message) {
LOG_CALL << serial;
mHal1_5->iccTransmitApduBasicChannel(serial, toHidl(message));
return ok();
}
ScopedAStatus RadioSim::iccTransmitApduLogicalChannel(int32_t serial,
const aidl::SimApdu& message) {
LOG_CALL << serial;
mHal1_5->iccTransmitApduLogicalChannel(serial, toHidl(message));
return ok();
}
ScopedAStatus RadioSim::reportStkServiceIsRunning(int32_t serial) {
LOG_CALL << serial;
mHal1_5->reportStkServiceIsRunning(serial);
return ok();
}
ScopedAStatus RadioSim::requestIccSimAuthentication( //
int32_t serial, int32_t authContext, const std::string& authData, const std::string& aid) {
LOG_CALL << serial;
mHal1_5->requestIccSimAuthentication(serial, authContext, authData, aid);
return ok();
}
ScopedAStatus RadioSim::responseAcknowledgement() {
LOG_CALL;
mHal1_5->responseAcknowledgement();
return ok();
}
ScopedAStatus RadioSim::sendEnvelope(int32_t serial, const std::string& command) {
LOG_CALL << serial;
mHal1_5->sendEnvelope(serial, command);
return ok();
}
ScopedAStatus RadioSim::sendEnvelopeWithStatus(int32_t serial, const std::string& contents) {
LOG_CALL << serial;
mHal1_5->sendEnvelopeWithStatus(serial, contents);
return ok();
}
ScopedAStatus RadioSim::sendTerminalResponseToSim(int32_t serial,
const std::string& commandResponse) {
LOG_CALL << serial;
mHal1_5->sendTerminalResponseToSim(serial, commandResponse);
return ok();
}
ScopedAStatus RadioSim::setAllowedCarriers( //
int32_t serial, const aidl::CarrierRestrictions& carriers, aidl::SimLockMultiSimPolicy mp) {
LOG_CALL << serial;
mHal1_5->setAllowedCarriers_1_4(serial, toHidl(carriers), V1_4::SimLockMultiSimPolicy(mp));
return ok();
}
ScopedAStatus RadioSim::setCarrierInfoForImsiEncryption(
int32_t serial, const aidl::ImsiEncryptionInfo& imsiEncryptionInfo) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->setCarrierInfoForImsiEncryption_1_6(serial, toHidl_1_6(imsiEncryptionInfo));
} else {
mHal1_5->setCarrierInfoForImsiEncryption(serial, toHidl(imsiEncryptionInfo));
}
return ok();
}
ScopedAStatus RadioSim::setCdmaSubscriptionSource(int32_t serial,
aidl::CdmaSubscriptionSource cdmaSub) {
LOG_CALL << serial;
mHal1_5->setCdmaSubscriptionSource(serial, V1_0::CdmaSubscriptionSource(cdmaSub));
return ok();
}
ScopedAStatus RadioSim::setFacilityLockForApp( //
int32_t serial, const std::string& facility, bool lockState, const std::string& password,
int32_t serviceClass, const std::string& appId) {
LOG_CALL << serial;
mHal1_5->setFacilityLockForApp(serial, facility, lockState, password, serviceClass, appId);
return ok();
}
ScopedAStatus RadioSim::setResponseFunctions(
const std::shared_ptr<aidl::IRadioSimResponse>& simResponse,
const std::shared_ptr<aidl::IRadioSimIndication>& simIndication) {
LOG_CALL << simResponse << ' ' << simIndication;
CHECK(simResponse);
CHECK(simIndication);
mRadioResponse->setResponseFunction(simResponse);
mRadioIndication->setResponseFunction(simIndication);
return ok();
}
ScopedAStatus RadioSim::setSimCardPower(int32_t serial, aidl::CardPowerState powerUp) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->setSimCardPower_1_6(serial, V1_1::CardPowerState(powerUp));
} else {
mHal1_5->setSimCardPower_1_1(serial, V1_1::CardPowerState(powerUp));
}
return ok();
}
ScopedAStatus RadioSim::setUiccSubscription(int32_t serial, const aidl::SelectUiccSub& uiccSub) {
LOG_CALL << serial;
mHal1_5->setUiccSubscription(serial, toHidl(uiccSub));
return ok();
}
ScopedAStatus RadioSim::supplyIccPin2ForApp(int32_t serial, const std::string& pin2,
const std::string& aid) {
LOG_CALL << serial;
mHal1_5->supplyIccPin2ForApp(serial, pin2, aid);
return ok();
}
ScopedAStatus RadioSim::supplyIccPinForApp(int32_t serial, const std::string& pin,
const std::string& aid) {
LOG_CALL << serial;
mHal1_5->supplyIccPinForApp(serial, pin, aid);
return ok();
}
ScopedAStatus RadioSim::supplyIccPuk2ForApp(int32_t serial, const std::string& puk2,
const std::string& pin2, const std::string& aid) {
LOG_CALL << serial;
mHal1_5->supplyIccPuk2ForApp(serial, puk2, pin2, aid);
return ok();
}
ScopedAStatus RadioSim::supplyIccPukForApp(int32_t serial, const std::string& puk,
const std::string& pin, const std::string& aid) {
LOG_CALL << serial;
mHal1_5->supplyIccPukForApp(serial, puk, pin, aid);
return ok();
}
ScopedAStatus RadioSim::supplySimDepersonalization(int32_t serial, aidl::PersoSubstate pss,
const std::string& controlKey) {
LOG_CALL << serial;
mHal1_5->supplySimDepersonalization(serial, V1_5::PersoSubstate(pss), controlKey);
return ok();
}
ScopedAStatus RadioSim::updateSimPhonebookRecords(int32_t serial,
const aidl::PhonebookRecordInfo& recordInfo) {
LOG_CALL << serial;
if (mHal1_6) {
mHal1_6->updateSimPhonebookRecords(serial, toHidl(recordInfo));
} else {
respond().updateSimPhonebookRecordsResponse(notSupported(serial), 0);
}
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,221 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "commonStructs.h"
#include "collections.h"
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::sim;
V1_0::IccIo toHidl(const aidl::IccIo& icc) {
return {
.command = icc.command,
.fileId = icc.fileId,
.path = icc.path,
.p1 = icc.p1,
.p2 = icc.p2,
.p3 = icc.p3,
.data = icc.data,
.pin2 = icc.pin2,
.aid = icc.aid,
};
}
V1_0::SimApdu toHidl(const aidl::SimApdu& apdu) {
return {
.sessionId = apdu.sessionId,
.cla = apdu.cla,
.instruction = apdu.instruction,
.p1 = apdu.p1,
.p2 = apdu.p2,
.p3 = apdu.p3,
.data = apdu.data,
};
}
aidl::Carrier toAidl(const V1_0::Carrier& carrier) {
return {
.mcc = carrier.mcc,
.mnc = carrier.mnc,
.matchType = static_cast<int32_t>(carrier.matchType),
.matchData = carrier.matchData,
};
}
V1_0::Carrier toHidl(const aidl::Carrier& carrier) {
return {
.mcc = carrier.mcc,
.mnc = carrier.mnc,
.matchType = V1_0::CarrierMatchType{carrier.matchType},
.matchData = carrier.matchData,
};
}
aidl::CarrierRestrictions toAidl(const V1_0::CarrierRestrictions& cr) {
return {
.allowedCarriers = toAidl(cr.allowedCarriers),
.excludedCarriers = toAidl(cr.excludedCarriers),
.allowedCarriersPrioritized = true,
};
}
aidl::CarrierRestrictions toAidl(const V1_4::CarrierRestrictionsWithPriority& cr) {
return {
.allowedCarriers = toAidl(cr.allowedCarriers),
.excludedCarriers = toAidl(cr.excludedCarriers),
.allowedCarriersPrioritized = cr.allowedCarriersPrioritized,
};
}
V1_4::CarrierRestrictionsWithPriority toHidl(const aidl::CarrierRestrictions& cr) {
return {
.allowedCarriers = toHidl(cr.allowedCarriers),
.excludedCarriers = toHidl(cr.excludedCarriers),
.allowedCarriersPrioritized = cr.allowedCarriersPrioritized,
};
}
V1_1::ImsiEncryptionInfo toHidl(const aidl::ImsiEncryptionInfo& info) {
return {
.mcc = info.mcc,
.mnc = info.mnc,
.carrierKey = info.carrierKey,
.keyIdentifier = info.keyIdentifier,
.expirationTime = info.expirationTime,
};
}
V1_6::ImsiEncryptionInfo toHidl_1_6(const aidl::ImsiEncryptionInfo& info) {
return {
.base = toHidl(info),
.keyType = V1_6::PublicKeyType{info.keyType},
};
}
V1_0::SelectUiccSub toHidl(const aidl::SelectUiccSub& sub) {
return {
.slot = sub.slot,
.appIndex = sub.appIndex,
.subType = {},
.actStatus = {},
};
}
aidl::PhonebookRecordInfo toAidl(const V1_6::PhonebookRecordInfo& info) {
return {
.recordId = static_cast<int32_t>(info.recordId),
.name = info.name,
.number = info.number,
.emails = toAidl(info.emails),
.additionalNumbers = toAidl(info.additionalNumbers),
};
}
V1_6::PhonebookRecordInfo toHidl(const aidl::PhonebookRecordInfo& info) {
return {
.recordId = static_cast<uint32_t>(info.recordId),
.name = info.name,
.number = info.number,
.emails = toHidl(info.emails),
.additionalNumbers = toHidl(info.additionalNumbers),
};
}
aidl::SimRefreshResult toAidl(const V1_0::SimRefreshResult& res) {
return {
.type = static_cast<int32_t>(res.type),
.efId = res.efId,
.aid = res.aid,
};
}
aidl::CardStatus toAidl(const V1_0::CardStatus& status) {
return toAidl(V1_2::CardStatus{status, 0, "", ""});
}
aidl::CardStatus toAidl(const V1_2::CardStatus& status) {
return toAidl(V1_4::CardStatus{status, ""});
}
aidl::CardStatus toAidl(const V1_4::CardStatus& status) {
auto aidlStatus = toAidl(V1_5::CardStatus{status, {}});
aidlStatus.applications = toAidl(status.base.base.applications);
return aidlStatus;
}
aidl::CardStatus toAidl(const V1_5::CardStatus& status) {
return {
.cardState = static_cast<int32_t>(status.base.base.base.cardState),
.universalPinState = aidl::PinState(status.base.base.base.universalPinState),
.gsmUmtsSubscriptionAppIndex = status.base.base.base.gsmUmtsSubscriptionAppIndex,
.cdmaSubscriptionAppIndex = status.base.base.base.cdmaSubscriptionAppIndex,
.imsSubscriptionAppIndex = status.base.base.base.imsSubscriptionAppIndex,
.applications = toAidl(status.applications),
.atr = status.base.base.atr,
.iccid = status.base.base.iccid,
.eid = status.base.eid,
// TODO(b/203699028): we don't know portId here (but we can get it from RadioConfig)
.slotMap = {static_cast<int32_t>(status.base.base.physicalSlotId), 0},
};
}
aidl::AppStatus toAidl(const V1_0::AppStatus& status) {
return toAidl({status, V1_5::PersoSubstate(status.persoSubstate)});
}
aidl::AppStatus toAidl(const V1_5::AppStatus& status) {
return {
.appType = static_cast<int32_t>(status.base.appType),
.appState = static_cast<int32_t>(status.base.appState),
.persoSubstate = aidl::PersoSubstate(status.persoSubstate),
.aidPtr = status.base.aidPtr,
.appLabelPtr = status.base.appLabelPtr,
.pin1Replaced = (status.base.pin1Replaced != 0),
.pin1 = aidl::PinState(status.base.pin1),
.pin2 = aidl::PinState(status.base.pin2),
};
}
aidl::PhonebookCapacity toAidl(const V1_6::PhonebookCapacity& c) {
return {
.maxAdnRecords = c.maxAdnRecords,
.usedAdnRecords = c.usedAdnRecords,
.maxEmailRecords = c.maxEmailRecords,
.usedEmailRecords = c.usedEmailRecords,
.maxAdditionalNumberRecords = c.maxAdditionalNumberRecords,
.usedAdditionalNumberRecords = c.usedAdditionalNumberRecords,
.maxNameLen = c.maxNameLen,
.maxNumberLen = c.maxNumberLen,
.maxEmailLen = c.maxEmailLen,
.maxAdditionalNumberLen = c.maxAdditionalNumberLen,
};
}
aidl::IccIoResult toAidl(const V1_0::IccIoResult& iir) {
return {
.sw1 = iir.sw1,
.sw2 = iir.sw2,
.simResponse = iir.simResponse,
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/sim/AppStatus.h>
#include <aidl/android/hardware/radio/sim/CardStatus.h>
#include <aidl/android/hardware/radio/sim/Carrier.h>
#include <aidl/android/hardware/radio/sim/CarrierRestrictions.h>
#include <aidl/android/hardware/radio/sim/IccIo.h>
#include <aidl/android/hardware/radio/sim/IccIoResult.h>
#include <aidl/android/hardware/radio/sim/ImsiEncryptionInfo.h>
#include <aidl/android/hardware/radio/sim/PhonebookCapacity.h>
#include <aidl/android/hardware/radio/sim/PhonebookRecordInfo.h>
#include <aidl/android/hardware/radio/sim/SelectUiccSub.h>
#include <aidl/android/hardware/radio/sim/SimApdu.h>
#include <aidl/android/hardware/radio/sim/SimRefreshResult.h>
#include <android/hardware/radio/1.6/types.h>
namespace android::hardware::radio::compat {
V1_0::IccIo toHidl(const ::aidl::android::hardware::radio::sim::IccIo& icc);
V1_0::SimApdu toHidl(const ::aidl::android::hardware::radio::sim::SimApdu& apdu);
::aidl::android::hardware::radio::sim::Carrier toAidl(const V1_0::Carrier& carrier);
V1_0::Carrier toHidl(const ::aidl::android::hardware::radio::sim::Carrier& carrier);
::aidl::android::hardware::radio::sim::CarrierRestrictions //
toAidl(const V1_0::CarrierRestrictions& cr);
::aidl::android::hardware::radio::sim::CarrierRestrictions //
toAidl(const V1_4::CarrierRestrictionsWithPriority& cr);
V1_4::CarrierRestrictionsWithPriority //
toHidl(const ::aidl::android::hardware::radio::sim::CarrierRestrictions& cr);
V1_1::ImsiEncryptionInfo //
toHidl(const ::aidl::android::hardware::radio::sim::ImsiEncryptionInfo& info);
V1_6::ImsiEncryptionInfo //
toHidl_1_6(const ::aidl::android::hardware::radio::sim::ImsiEncryptionInfo& info);
V1_0::SelectUiccSub toHidl(const ::aidl::android::hardware::radio::sim::SelectUiccSub& sub);
::aidl::android::hardware::radio::sim::PhonebookRecordInfo //
toAidl(const V1_6::PhonebookRecordInfo& info);
V1_6::PhonebookRecordInfo //
toHidl(const ::aidl::android::hardware::radio::sim::PhonebookRecordInfo& info);
::aidl::android::hardware::radio::sim::SimRefreshResult //
toAidl(const V1_0::SimRefreshResult& res);
::aidl::android::hardware::radio::sim::CardStatus toAidl(const V1_0::CardStatus& status);
::aidl::android::hardware::radio::sim::CardStatus toAidl(const V1_2::CardStatus& status);
::aidl::android::hardware::radio::sim::CardStatus toAidl(const V1_4::CardStatus& status);
::aidl::android::hardware::radio::sim::CardStatus toAidl(const V1_5::CardStatus& status);
::aidl::android::hardware::radio::sim::AppStatus toAidl(const V1_0::AppStatus& status);
::aidl::android::hardware::radio::sim::AppStatus toAidl(const V1_5::AppStatus& status);
::aidl::android::hardware::radio::sim::PhonebookCapacity toAidl(const V1_6::PhonebookCapacity& c);
::aidl::android::hardware::radio::sim::IccIoResult toAidl(const V1_0::IccIoResult& iir);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,142 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioIndication.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "VoiceIndication"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::voice;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioVoiceIndication> voiceCb) {
CHECK(voiceCb);
mVoiceCb = voiceCb;
}
Return<void> RadioIndication::callRing(V1_0::RadioIndicationType type, bool isGsm,
const V1_0::CdmaSignalInfoRecord& record) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->callRing(toAidl(type), isGsm, toAidl(record));
return {};
}
Return<void> RadioIndication::callStateChanged(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->callStateChanged(toAidl(type));
return {};
}
Return<void> RadioIndication::cdmaCallWaiting(V1_0::RadioIndicationType type,
const V1_0::CdmaCallWaiting& callWaitingRecord) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->cdmaCallWaiting(toAidl(type), toAidl(callWaitingRecord));
return {};
}
Return<void> RadioIndication::cdmaInfoRec(V1_0::RadioIndicationType type,
const V1_0::CdmaInformationRecords& records) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->cdmaInfoRec(toAidl(type), toAidl(records.infoRec));
return {};
}
Return<void> RadioIndication::cdmaOtaProvisionStatus(V1_0::RadioIndicationType type,
V1_0::CdmaOtaProvisionStatus status) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->cdmaOtaProvisionStatus(toAidl(type), aidl::CdmaOtaProvisionStatus(status));
return {};
}
Return<void> RadioIndication::currentEmergencyNumberList(
V1_0::RadioIndicationType type, const hidl_vec<V1_4::EmergencyNumber>& emergencyNumbers) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->currentEmergencyNumberList(toAidl(type), toAidl(emergencyNumbers));
return {};
}
Return<void> RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->enterEmergencyCallbackMode(toAidl(type));
return {};
}
Return<void> RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->exitEmergencyCallbackMode(toAidl(type));
return {};
}
Return<void> RadioIndication::indicateRingbackTone(V1_0::RadioIndicationType type, bool start) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->indicateRingbackTone(toAidl(type), start);
return {};
}
Return<void> RadioIndication::onSupplementaryServiceIndication(V1_0::RadioIndicationType type,
const V1_0::StkCcUnsolSsResult& ss) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->onSupplementaryServiceIndication(toAidl(type), toAidl(ss));
return {};
}
Return<void> RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->resendIncallMute(toAidl(type));
return {};
}
Return<void> RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type,
V1_0::SrvccState state) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->srvccStateNotify(toAidl(type), aidl::SrvccState(state));
return {};
}
Return<void> RadioIndication::stkCallControlAlphaNotify(V1_0::RadioIndicationType type,
const hidl_string& alpha) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->stkCallControlAlphaNotify(toAidl(type), alpha);
return {};
}
Return<void> RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) {
LOG_CALL << type;
CHECK_CB(mVoiceCb);
mVoiceCb->stkCallSetup(toAidl(type), timeout);
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,294 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioResponse.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "VoiceResponse"
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::voice;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioVoiceResponse> voiceCb) {
CHECK(voiceCb);
mVoiceCb = voiceCb;
}
Return<void> RadioResponse::acceptCallResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->acceptCallResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::conferenceResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->conferenceResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::dialResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->dialResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::emergencyDialResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->emergencyDialResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->exitEmergencyCallbackModeResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->explicitCallTransferResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::getCallForwardStatusResponse(
const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::CallForwardInfo>& callFwdInfos) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getCallForwardStatusResponse(toAidl(info), toAidl(callFwdInfos));
return {};
}
Return<void> RadioResponse::getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable,
int32_t serviceClass) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getCallWaitingResponse(toAidl(info), enable, serviceClass);
return {};
}
Return<void> RadioResponse::getClipResponse(const V1_0::RadioResponseInfo& info,
V1_0::ClipStatus status) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getClipResponse(toAidl(info), aidl::ClipStatus(status));
return {};
}
Return<void> RadioResponse::getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n,
int32_t m) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getClirResponse(toAidl(info), n, m);
return {};
}
Return<void> RadioResponse::getCurrentCallsResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::Call>& calls) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getCurrentCallsResponse(toAidl(info), toAidl(calls));
return {};
}
Return<void> RadioResponse::getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_2::Call>& calls) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getCurrentCallsResponse(toAidl(info), toAidl(calls));
return {};
}
Return<void> RadioResponse::getCurrentCallsResponse_1_6(const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::Call>& calls) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getCurrentCallsResponse(toAidl(info), toAidl(calls));
return {};
}
Return<void> RadioResponse::getLastCallFailCauseResponse(
const V1_0::RadioResponseInfo& info, const V1_0::LastCallFailCauseInfo& failCauseinfo) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getLastCallFailCauseResponse(toAidl(info), toAidl(failCauseinfo));
return {};
}
Return<void> RadioResponse::getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getMuteResponse(toAidl(info), enable);
return {};
}
Return<void> RadioResponse::getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info,
bool enable) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getPreferredVoicePrivacyResponse(toAidl(info), enable);
return {};
}
Return<void> RadioResponse::getTTYModeResponse(const V1_0::RadioResponseInfo& info,
V1_0::TtyMode mode) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->getTtyModeResponse(toAidl(info), aidl::TtyMode(mode));
return {};
}
Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->handleStkCallSetupRequestFromSimResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::hangupConnectionResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->hangupConnectionResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->hangupForegroundResumeBackgroundResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->hangupWaitingOrBackgroundResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::rejectCallResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->rejectCallResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->sendBurstDtmfResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->sendCdmaFeatureCodeResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::sendDtmfResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->sendDtmfResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::separateConnectionResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->separateConnectionResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCallForwardResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->setCallForwardResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCallWaitingResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->setCallWaitingResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setClirResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->setClirResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setMuteResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->setMuteResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->setPreferredVoicePrivacyResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setTTYModeResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->setTtyModeResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::startDtmfResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->startDtmfResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::stopDtmfResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->stopDtmfResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
CHECK_CB(mVoiceCb);
mVoiceCb->switchWaitingOrHoldingAndActiveResponse(toAidl(info));
return {};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,270 @@
/*
* Copyright (C) 2021 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 <libradiocompat/RadioVoice.h>
#include "commonStructs.h"
#include "debug.h"
#include "structs.h"
#include "collections.h"
#define RADIO_MODULE "Voice"
namespace android::hardware::radio::compat {
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::voice;
constexpr auto ok = &ScopedAStatus::ok;
ScopedAStatus RadioVoice::acceptCall(int32_t serial) {
LOG_CALL << serial;
mHal1_5->acceptCall(serial);
return ok();
}
ScopedAStatus RadioVoice::conference(int32_t serial) {
LOG_CALL << serial;
mHal1_5->conference(serial);
return ok();
}
ScopedAStatus RadioVoice::dial(int32_t serial, const aidl::Dial& dialInfo) {
LOG_CALL << serial;
mHal1_5->dial(serial, toHidl(dialInfo));
return ok();
}
ScopedAStatus RadioVoice::emergencyDial( //
int32_t serial, const aidl::Dial& dialInfo, aidl::EmergencyServiceCategory categories,
const std::vector<std::string>& urns, aidl::EmergencyCallRouting routing,
bool hasKnownUserIntentEmerg, bool isTesting) {
LOG_CALL << serial;
mHal1_5->emergencyDial(serial, toHidl(dialInfo),
toHidlBitfield<V1_4::EmergencyServiceCategory>(categories), toHidl(urns),
V1_4::EmergencyCallRouting(routing), hasKnownUserIntentEmerg, isTesting);
return ok();
}
ScopedAStatus RadioVoice::exitEmergencyCallbackMode(int32_t serial) {
LOG_CALL << serial;
mHal1_5->exitEmergencyCallbackMode(serial);
return ok();
}
ScopedAStatus RadioVoice::explicitCallTransfer(int32_t serial) {
LOG_CALL << serial;
mHal1_5->explicitCallTransfer(serial);
return ok();
}
ScopedAStatus RadioVoice::getCallForwardStatus(int32_t serial,
const aidl::CallForwardInfo& callInfo) {
LOG_CALL << serial;
mHal1_5->getCallForwardStatus(serial, toHidl(callInfo));
return ok();
}
ScopedAStatus RadioVoice::getCallWaiting(int32_t serial, int32_t serviceClass) {
LOG_CALL << serial;
mHal1_5->getCallWaiting(serial, serviceClass);
return ok();
}
ScopedAStatus RadioVoice::getClip(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getClip(serial);
return ok();
}
ScopedAStatus RadioVoice::getClir(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getClir(serial);
return ok();
}
ScopedAStatus RadioVoice::getCurrentCalls(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getCurrentCalls(serial);
return ok();
}
ScopedAStatus RadioVoice::getLastCallFailCause(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getLastCallFailCause(serial);
return ok();
}
ScopedAStatus RadioVoice::getMute(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getMute(serial);
return ok();
}
ScopedAStatus RadioVoice::getPreferredVoicePrivacy(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getPreferredVoicePrivacy(serial);
return ok();
}
ScopedAStatus RadioVoice::getTtyMode(int32_t serial) {
LOG_CALL << serial;
mHal1_5->getTTYMode(serial);
return ok();
}
ScopedAStatus RadioVoice::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) {
LOG_CALL << serial;
mHal1_5->handleStkCallSetupRequestFromSim(serial, accept);
return ok();
}
ScopedAStatus RadioVoice::hangup(int32_t serial, int32_t gsmIndex) {
LOG_CALL << serial;
mHal1_5->hangup(serial, gsmIndex);
return ok();
}
ScopedAStatus RadioVoice::hangupForegroundResumeBackground(int32_t serial) {
LOG_CALL << serial;
mHal1_5->hangupForegroundResumeBackground(serial);
return ok();
}
ScopedAStatus RadioVoice::hangupWaitingOrBackground(int32_t serial) {
LOG_CALL << serial;
mHal1_5->hangupWaitingOrBackground(serial);
return ok();
}
ScopedAStatus RadioVoice::isVoNrEnabled(int32_t serial) {
LOG_CALL << serial;
// TODO(b/203699028): can't call isVoNrEnabledResponse with 1.6 callback
return ok();
}
ScopedAStatus RadioVoice::rejectCall(int32_t serial) {
LOG_CALL << serial;
mHal1_5->rejectCall(serial);
return ok();
}
ScopedAStatus RadioVoice::responseAcknowledgement() {
LOG_CALL;
mHal1_5->responseAcknowledgement();
return ok();
}
ScopedAStatus RadioVoice::sendBurstDtmf(int32_t serial, const std::string& dtmf, int32_t on,
int32_t off) {
LOG_CALL << serial;
mHal1_5->sendBurstDtmf(serial, dtmf, on, off);
return ok();
}
ScopedAStatus RadioVoice::sendCdmaFeatureCode(int32_t serial, const std::string& featureCode) {
LOG_CALL << serial;
mHal1_5->sendCDMAFeatureCode(serial, featureCode);
return ok();
}
ScopedAStatus RadioVoice::sendDtmf(int32_t serial, const std::string& s) {
LOG_CALL << serial;
mHal1_5->sendDtmf(serial, s);
return ok();
}
ScopedAStatus RadioVoice::separateConnection(int32_t serial, int32_t gsmIndex) {
LOG_CALL << serial;
mHal1_5->separateConnection(serial, gsmIndex);
return ok();
}
ScopedAStatus RadioVoice::setCallForward(int32_t serial, const aidl::CallForwardInfo& callInfo) {
LOG_CALL << serial;
mHal1_5->setCallForward(serial, toHidl(callInfo));
return ok();
}
ScopedAStatus RadioVoice::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) {
LOG_CALL << serial;
mHal1_5->setCallWaiting(serial, enable, serviceClass);
return ok();
}
ScopedAStatus RadioVoice::setClir(int32_t serial, int32_t status) {
LOG_CALL << serial;
mHal1_5->setClir(serial, status);
return ok();
}
ScopedAStatus RadioVoice::setMute(int32_t serial, bool enable) {
LOG_CALL << serial;
mHal1_5->setMute(serial, enable);
return ok();
}
ScopedAStatus RadioVoice::setPreferredVoicePrivacy(int32_t serial, bool enable) {
LOG_CALL << serial;
mHal1_5->setPreferredVoicePrivacy(serial, enable);
return ok();
}
ScopedAStatus RadioVoice::setResponseFunctions(
const std::shared_ptr<aidl::IRadioVoiceResponse>& voiceResponse,
const std::shared_ptr<aidl::IRadioVoiceIndication>& voiceIndication) {
LOG_CALL << voiceResponse << ' ' << voiceIndication;
CHECK(voiceResponse);
CHECK(voiceIndication);
mRadioResponse->setResponseFunction(voiceResponse);
mRadioIndication->setResponseFunction(voiceIndication);
return ok();
}
ScopedAStatus RadioVoice::setTtyMode(int32_t serial, aidl::TtyMode mode) {
LOG_CALL << serial;
mHal1_5->setTTYMode(serial, V1_0::TtyMode(mode));
return ok();
}
ndk::ScopedAStatus RadioVoice::setVoNrEnabled(int32_t serial, [[maybe_unused]] bool enable) {
LOG_CALL << serial;
// TODO(b/203699028): should set `persist.radio.is_vonr_enabled_` property instead
return ok();
}
ScopedAStatus RadioVoice::startDtmf(int32_t serial, const std::string& s) {
LOG_CALL << serial;
mHal1_5->startDtmf(serial, s);
return ok();
}
ScopedAStatus RadioVoice::stopDtmf(int32_t serial) {
LOG_CALL << serial;
mHal1_5->stopDtmf(serial);
return ok();
}
ScopedAStatus RadioVoice::switchWaitingOrHoldingAndActive(int32_t serial) {
LOG_CALL << serial;
mHal1_5->switchWaitingOrHoldingAndActive(serial);
return ok();
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,223 @@
/*
* Copyright (C) 2021 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 "structs.h"
#include "commonStructs.h"
#include "collections.h"
#include <android-base/logging.h>
namespace android::hardware::radio::compat {
namespace aidl = ::aidl::android::hardware::radio::voice;
V1_0::Dial toHidl(const aidl::Dial& info) {
return {
.address = info.address,
.clir = V1_0::Clir{info.clir},
.uusInfo = toHidl(info.uusInfo),
};
}
V1_0::UusInfo toHidl(const aidl::UusInfo& info) {
return {
.uusType = V1_0::UusType{info.uusType},
.uusDcs = V1_0::UusDcs{info.uusDcs},
.uusData = info.uusData,
};
}
aidl::CallForwardInfo toAidl(const V1_0::CallForwardInfo& info) {
return {
.status = static_cast<int32_t>(info.status),
.reason = info.reason,
.serviceClass = info.serviceClass,
.toa = info.toa,
.number = info.number,
.timeSeconds = info.timeSeconds,
};
}
V1_0::CallForwardInfo toHidl(const aidl::CallForwardInfo& info) {
return {
.status = V1_0::CallForwardInfoStatus{info.status},
.reason = info.reason,
.serviceClass = info.serviceClass,
.toa = info.toa,
.number = info.number,
.timeSeconds = info.timeSeconds,
};
}
aidl::CdmaSignalInfoRecord toAidl(const V1_0::CdmaSignalInfoRecord& record) {
return {
.isPresent = record.isPresent,
.signalType = record.signalType,
.alertPitch = record.alertPitch,
.signal = record.signal,
};
}
aidl::CdmaCallWaiting toAidl(const V1_0::CdmaCallWaiting& call) {
return {
.number = call.number,
.numberPresentation = static_cast<int32_t>(call.numberPresentation),
.name = call.name,
.signalInfoRecord = toAidl(call.signalInfoRecord),
.numberType = static_cast<int32_t>(call.numberType),
.numberPlan = static_cast<int32_t>(call.numberPlan),
};
}
aidl::CdmaInformationRecord toAidl(const V1_0::CdmaInformationRecord& record) {
return {
.name = static_cast<int32_t>(record.name),
.display = toAidl(record.display),
.number = toAidl(record.number),
.signal = toAidl(record.signal),
.redir = toAidl(record.redir),
.lineCtrl = toAidl(record.lineCtrl),
.clir = toAidl(record.clir),
.audioCtrl = toAidl(record.audioCtrl),
};
}
aidl::CdmaDisplayInfoRecord toAidl(const V1_0::CdmaDisplayInfoRecord& record) {
return {
.alphaBuf = record.alphaBuf,
};
}
aidl::CdmaNumberInfoRecord toAidl(const V1_0::CdmaNumberInfoRecord& record) {
return {
.number = record.number,
.numberType = static_cast<int8_t>(record.numberType),
.numberPlan = static_cast<int8_t>(record.numberPlan),
.pi = static_cast<int8_t>(record.pi),
.si = static_cast<int8_t>(record.si),
};
}
aidl::CdmaRedirectingNumberInfoRecord toAidl(const V1_0::CdmaRedirectingNumberInfoRecord& record) {
return {
.redirectingNumber = toAidl(record.redirectingNumber),
.redirectingReason = static_cast<int32_t>(record.redirectingReason),
};
}
aidl::CdmaLineControlInfoRecord toAidl(const V1_0::CdmaLineControlInfoRecord& record) {
return {
.lineCtrlPolarityIncluded = static_cast<int8_t>(record.lineCtrlPolarityIncluded),
.lineCtrlToggle = static_cast<int8_t>(record.lineCtrlToggle),
.lineCtrlReverse = static_cast<int8_t>(record.lineCtrlReverse),
.lineCtrlPowerDenial = static_cast<int8_t>(record.lineCtrlPowerDenial),
};
}
aidl::CdmaT53ClirInfoRecord toAidl(const V1_0::CdmaT53ClirInfoRecord& record) {
return {
.cause = static_cast<int8_t>(record.cause),
};
}
aidl::CdmaT53AudioControlInfoRecord toAidl(const V1_0::CdmaT53AudioControlInfoRecord& record) {
return {
.upLink = static_cast<int8_t>(record.upLink),
.downLink = static_cast<int8_t>(record.downLink),
};
}
aidl::EmergencyNumber toAidl(const V1_4::EmergencyNumber& num) {
return {
.number = num.number,
.mcc = num.mcc,
.mnc = num.mnc,
.categories = aidl::EmergencyServiceCategory(num.categories),
.urns = toAidl(num.urns),
.sources = num.sources,
};
}
aidl::StkCcUnsolSsResult toAidl(const V1_0::StkCcUnsolSsResult& res) {
return {
.serviceType = static_cast<int32_t>(res.serviceType),
.requestType = static_cast<int32_t>(res.requestType),
.teleserviceType = static_cast<int32_t>(res.teleserviceType),
.serviceClass = res.serviceClass,
.result = toAidl(res.result),
.ssInfo = toAidl(res.ssInfo),
.cfData = toAidl(res.cfData),
};
}
aidl::SsInfoData toAidl(const V1_0::SsInfoData& info) {
return {
.ssInfo = info.ssInfo,
};
}
aidl::CfData toAidl(const V1_0::CfData& data) {
return {
.cfInfo = toAidl(data.cfInfo),
};
}
aidl::Call toAidl(const V1_0::Call& call) {
return toAidl(V1_2::Call{call, {}});
}
aidl::Call toAidl(const V1_2::Call& call) {
return toAidl(V1_6::Call{call, {}});
}
aidl::Call toAidl(const V1_6::Call& call) {
return {
.state = static_cast<int32_t>(call.base.base.state),
.index = call.base.base.index,
.toa = call.base.base.toa,
.isMpty = call.base.base.isMpty,
.isMT = call.base.base.isMT,
.als = static_cast<int8_t>(call.base.base.als),
.isVoice = call.base.base.isVoice,
.isVoicePrivacy = call.base.base.isVoicePrivacy,
.number = call.base.base.number,
.numberPresentation = static_cast<int32_t>(call.base.base.numberPresentation),
.name = call.base.base.name,
.namePresentation = static_cast<int32_t>(call.base.base.namePresentation),
.uusInfo = toAidl(call.base.base.uusInfo),
.audioQuality = aidl::AudioQuality(call.base.audioQuality),
.forwardedNumber = call.forwardedNumber,
};
}
aidl::UusInfo toAidl(const V1_0::UusInfo& info) {
return {
.uusType = static_cast<int32_t>(info.uusType),
.uusDcs = static_cast<int32_t>(info.uusDcs),
.uusData = info.uusData,
};
}
aidl::LastCallFailCauseInfo toAidl(const V1_0::LastCallFailCauseInfo& info) {
return {
.causeCode = aidl::LastCallFailCause(info.causeCode),
.vendorCause = info.vendorCause,
};
}
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,91 @@
/*
* Copyright (C) 2021 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 <aidl/android/hardware/radio/voice/Call.h>
#include <aidl/android/hardware/radio/voice/CallForwardInfo.h>
#include <aidl/android/hardware/radio/voice/CdmaCallWaiting.h>
#include <aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaInformationRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaLineControlInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaSignalInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CdmaT53ClirInfoRecord.h>
#include <aidl/android/hardware/radio/voice/CfData.h>
#include <aidl/android/hardware/radio/voice/Dial.h>
#include <aidl/android/hardware/radio/voice/EmergencyNumber.h>
#include <aidl/android/hardware/radio/voice/LastCallFailCauseInfo.h>
#include <aidl/android/hardware/radio/voice/SsInfoData.h>
#include <aidl/android/hardware/radio/voice/StkCcUnsolSsResult.h>
#include <aidl/android/hardware/radio/voice/UusInfo.h>
#include <android/hardware/radio/1.6/types.h>
namespace android::hardware::radio::compat {
V1_0::Dial toHidl(const ::aidl::android::hardware::radio::voice::Dial& info);
V1_0::UusInfo toHidl(const ::aidl::android::hardware::radio::voice::UusInfo& info);
::aidl::android::hardware::radio::voice::CallForwardInfo toAidl(const V1_0::CallForwardInfo& info);
V1_0::CallForwardInfo toHidl(const ::aidl::android::hardware::radio::voice::CallForwardInfo& info);
::aidl::android::hardware::radio::voice::CdmaSignalInfoRecord //
toAidl(const V1_0::CdmaSignalInfoRecord& record);
::aidl::android::hardware::radio::voice::CdmaCallWaiting toAidl(const V1_0::CdmaCallWaiting& call);
::aidl::android::hardware::radio::voice::CdmaInformationRecord //
toAidl(const V1_0::CdmaInformationRecord& record);
::aidl::android::hardware::radio::voice::CdmaDisplayInfoRecord //
toAidl(const V1_0::CdmaDisplayInfoRecord& record);
::aidl::android::hardware::radio::voice::CdmaNumberInfoRecord //
toAidl(const V1_0::CdmaNumberInfoRecord& record);
::aidl::android::hardware::radio::voice::CdmaRedirectingNumberInfoRecord //
toAidl(const V1_0::CdmaRedirectingNumberInfoRecord& record);
::aidl::android::hardware::radio::voice::CdmaLineControlInfoRecord //
toAidl(const V1_0::CdmaLineControlInfoRecord& record);
::aidl::android::hardware::radio::voice::CdmaT53ClirInfoRecord //
toAidl(const V1_0::CdmaT53ClirInfoRecord& record);
::aidl::android::hardware::radio::voice::CdmaT53AudioControlInfoRecord //
toAidl(const V1_0::CdmaT53AudioControlInfoRecord& record);
::aidl::android::hardware::radio::voice::EmergencyNumber toAidl(const V1_4::EmergencyNumber& num);
::aidl::android::hardware::radio::voice::StkCcUnsolSsResult //
toAidl(const V1_0::StkCcUnsolSsResult& res);
::aidl::android::hardware::radio::voice::SsInfoData toAidl(const V1_0::SsInfoData& info);
::aidl::android::hardware::radio::voice::CfData toAidl(const V1_0::CfData& data);
::aidl::android::hardware::radio::voice::Call toAidl(const V1_0::Call& call);
::aidl::android::hardware::radio::voice::Call toAidl(const V1_2::Call& call);
::aidl::android::hardware::radio::voice::Call toAidl(const V1_6::Call& call);
::aidl::android::hardware::radio::voice::UusInfo toAidl(const V1_0::UusInfo& info);
::aidl::android::hardware::radio::voice::LastCallFailCauseInfo //
toAidl(const V1_0::LastCallFailCauseInfo& info);
} // namespace android::hardware::radio::compat

View File

@@ -0,0 +1,64 @@
// Copyright (C) 2021 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
cc_binary {
name: "android.hardware.radio-service.compat",
relative_install_path: "hw",
init_rc: ["radio-compat.rc"],
vintf_fragments: ["radio-compat.xml"],
vendor: true,
cflags: [
"-Wall",
"-Wextra",
"-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
],
shared_libs: [
"android.hardware.radio-library.compat",
"android.hardware.radio.config-V1-ndk",
"android.hardware.radio.config@1.0",
"android.hardware.radio.config@1.1",
"android.hardware.radio.config@1.2",
"android.hardware.radio.config@1.3",
"android.hardware.radio.data-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
"android.hardware.radio.network-V1-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio.voice-V1-ndk",
"android.hardware.radio@1.0",
"android.hardware.radio@1.1",
"android.hardware.radio@1.2",
"android.hardware.radio@1.3",
"android.hardware.radio@1.4",
"android.hardware.radio@1.5",
"android.hardware.radio@1.6",
"libbase",
"libbinder_ndk",
"libhidlbase",
"libutils",
],
srcs: [
"hidl-utils.cpp",
"service.cpp",
],
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2021 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 "hidl-utils.h"
#include <android-base/logging.h>
#include <android/hidl/manager/1.2/IServiceManager.h>
namespace android::hardware::hidl_utils {
class HalDeathRecipient : public hidl_death_recipient {
void serviceDied(uint64_t /* cookie */, const wp<hidl::base::V1_0::IBase>& /* who */) override {
LOG(FATAL) << "One of the linked HALs died. Restarting...";
}
};
static const auto gHalDeathRecipient = sp<HalDeathRecipient>::make();
void linkDeathToDeath(sp<::android::hidl::base::V1_0::IBase> hal) {
const auto linkStatus = hal->linkToDeath(gHalDeathRecipient, 0);
CHECK(linkStatus.withDefault(false)) << "Failed to link to HAL death";
}
hidl_vec<hidl_string> listManifestByInterface(const char* descriptor) {
auto manager = hidl::manager::V1_2::IServiceManager::getService();
hidl_vec<hidl_string> services;
manager->listManifestByInterface(descriptor, hidl_utils::fill(&services));
CHECK_GT(services.size(), 0u) << "No " << descriptor
<< " services in manifest (missing privileges?)" << std::endl;
return services;
}
} // namespace android::hardware::hidl_utils

View File

@@ -0,0 +1,78 @@
/*
* Copyright (C) 2021 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 <android/hidl/base/1.0/IBase.h>
#include <functional>
namespace android::hardware::hidl_utils {
/**
* Helper functor to fetch results from multi-return HIDL calls.
* It's meant to be used in place of _hidl_cb callbacks.
*
* Please note extracting these return variables outside of the callback scope requires making
* a copy of each return variable. This may be costly for frequently called HIDL methods with
* non-negligible return object size. Please be cautious about performance when using this.
*
* Example usage:
* Result result;
* sp<ISomeInterface> iface;
* hidlObject->someMethod(arg1, arg2, hidl_utils::fill(&result, &iface)).assertOk();
* // use result and iface
*/
template <typename... T>
struct fill : public std::function<void(const T&...)> {
/**
* Create _hidl_cb functor that copies the call arguments to specified pointers.
*
* \param args... Targets to copy the call arguments to
*/
fill(T*... args) : mTargets(args...) {}
void operator()(const T&... args) { copy<0, T...>(args...); }
private:
std::tuple<T*...> mTargets;
template <int Pos, typename First>
inline void copy(const First& first) {
*std::get<Pos>(mTargets) = first;
}
template <int Pos, typename First, typename... Rest>
inline void copy(const First& first, const Rest&... rest) {
*std::get<Pos>(mTargets) = first;
copy<Pos + 1, Rest...>(rest...);
}
};
/**
* Link to a given HALs death and restart the current process in such a case.
* \param hal HAL to which death to link
*/
void linkDeathToDeath(sp<hidl::base::V1_0::IBase> hal);
/**
* List HAL instances of a given interface.
*
* \descriptor HIDL HAL descriptor
*/
hidl_vec<hidl_string> listManifestByInterface(const char* descriptor);
} // namespace android::hardware::hidl_utils

View File

@@ -0,0 +1,4 @@
service vendor.radio-compat /vendor/bin/hw/android.hardware.radio-service.compat
class hal
user nobody
group system

View File

@@ -0,0 +1,37 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.radio.config</name>
<fqname>IRadioConfig/default</fqname>
</hal>
<!--
Instances other than config are configured per-device, depending on the slot count (framework
currently supports slot1, slot2 and slot3 instances) and Radio HALs device wishes to provide.
You can either copy the following tags to device manifest or simply uncomment them here for
quick testing.
<hal format="aidl">
<name>android.hardware.radio.data</name>
<fqname>IRadioData/slot1</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.messaging</name>
<fqname>IRadioMessaging/slot1</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.modem</name>
<fqname>IRadioModem/slot1</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.network</name>
<fqname>IRadioNetwork/slot1</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.sim</name>
<fqname>IRadioSim/slot1</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.radio.voice</name>
<fqname>IRadioVoice/slot1</fqname>
</hal>
-->
</manifest>

View File

@@ -0,0 +1,108 @@
/*
* Copyright (C) 2021 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 "hidl-utils.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <libradiocompat/RadioConfig.h>
#include <libradiocompat/RadioData.h>
#include <libradiocompat/RadioIndication.h>
#include <libradiocompat/RadioMessaging.h>
#include <libradiocompat/RadioModem.h>
#include <libradiocompat/RadioNetwork.h>
#include <libradiocompat/RadioResponse.h>
#include <libradiocompat/RadioSim.h>
#include <libradiocompat/RadioVoice.h>
namespace android::hardware::radio::service {
using namespace std::string_literals;
static std::vector<std::shared_ptr<ndk::ICInterface>> gPublishedHals;
template <typename T>
static void publishRadioHal(sp<V1_5::IRadio> hidlHal, sp<compat::RadioResponse> responseCb,
sp<compat::RadioIndication> indicationCb, const std::string& slot) {
const auto instance = T::descriptor + "/"s + slot;
if (!AServiceManager_isDeclared(instance.c_str())) {
LOG(INFO) << instance << " is not declared in VINTF (this may be intentional)";
return;
}
LOG(DEBUG) << "Publishing " << instance;
auto aidlHal = ndk::SharedRefBase::make<T>(hidlHal, responseCb, indicationCb);
gPublishedHals.push_back(aidlHal);
const auto status = AServiceManager_addService(aidlHal->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
}
static void publishRadio(std::string slot) {
auto radioHidl = V1_5::IRadio::getService(slot);
CHECK(radioHidl) << "HIDL IRadio not present in VINTF";
hidl_utils::linkDeathToDeath(radioHidl);
auto responseCb = sp<compat::RadioResponse>::make();
auto indicationCb = sp<compat::RadioIndication>::make();
radioHidl->setResponseFunctions(responseCb, indicationCb).assertOk();
publishRadioHal<compat::RadioData>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioMessaging>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioModem>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioNetwork>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioSim>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioVoice>(radioHidl, responseCb, indicationCb, slot);
}
static void publishRadioConfig() {
auto hidlHal = config::V1_1::IRadioConfig::getService();
CHECK(hidlHal) << "HIDL IRadioConfig not present in VINTF";
hidl_utils::linkDeathToDeath(hidlHal);
auto aidlHal = ndk::SharedRefBase::make<compat::RadioConfig>(hidlHal);
gPublishedHals.push_back(aidlHal);
const auto instance = compat::RadioConfig::descriptor + "/default"s;
const auto status = AServiceManager_addService(aidlHal->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
}
static void main() {
base::SetDefaultTag("radiocompat");
base::SetMinimumLogSeverity(base::VERBOSE);
LOG(DEBUG) << "Radio HAL compat service starting...";
publishRadioConfig();
const auto slots = hidl_utils::listManifestByInterface(V1_0::IRadio::descriptor);
LOG(INFO) << "Found " << slots.size() << " slot(s)";
for (const auto& slot : slots) {
publishRadio(slot);
}
LOG(DEBUG) << "Radio HAL compat service is operational";
ABinderProcess_joinThreadPool();
LOG(FATAL) << "Radio HAL compat service has stopped";
}
} // namespace android::hardware::radio::service
int main() {
android::hardware::radio::service::main();
return EXIT_FAILURE; // should not reach
}