Use AIDL callbacks directly.
Bug: 210498497
Test: build cuttlefish with ag/16322062, watch logs
Change-Id: I1e0cd95f5f9a911564d14be2d8bbb328572de8c8
diff --git a/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp b/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp
index c7342b1..e5c33b3 100644
--- a/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp
+++ b/radio/aidl/compat/libradiocompat/messaging/RadioIndication-messaging.cpp
@@ -27,67 +27,62 @@
namespace aidl = ::aidl::android::hardware::radio::messaging;
void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingIndication> rmiCb) {
- CHECK(rmiCb);
mMessagingCb = rmiCb;
}
+std::shared_ptr<aidl::IRadioMessagingIndication> RadioIndication::messagingCb() {
+ return mMessagingCb.get();
+}
+
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));
+ messagingCb()->cdmaNewSms(toAidl(type), toAidl(msg));
return {};
}
Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) {
LOG_CALL << type;
- CHECK_CB(mMessagingCb);
- mMessagingCb->cdmaRuimSmsStorageFull(toAidl(type));
+ messagingCb()->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);
+ messagingCb()->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);
+ messagingCb()->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);
+ messagingCb()->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);
+ messagingCb()->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);
+ messagingCb()->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));
+ messagingCb()->simSmsStorageFull(toAidl(type));
return {};
}
diff --git a/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp b/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp
index c1a82b5..79e7c01 100644
--- a/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp
+++ b/radio/aidl/compat/libradiocompat/messaging/RadioMessaging.cpp
@@ -29,6 +29,10 @@
namespace aidl = ::aidl::android::hardware::radio::messaging;
constexpr auto ok = &ScopedAStatus::ok;
+std::shared_ptr<aidl::IRadioMessagingResponse> RadioMessaging::respond() {
+ return mRadioResponse->messagingCb();
+}
+
ScopedAStatus RadioMessaging::acknowledgeIncomingGsmSmsWithPdu( //
int32_t serial, bool success, const std::string& ackPdu) {
LOG_CALL << serial << ' ' << success << ' ' << ackPdu;
diff --git a/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp b/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp
index 379e463..24ad3d7 100644
--- a/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp
+++ b/radio/aidl/compat/libradiocompat/messaging/RadioResponse-messaging.cpp
@@ -29,52 +29,49 @@
namespace aidl = ::aidl::android::hardware::radio::messaging;
void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioMessagingResponse> rmrCb) {
- CHECK(rmrCb);
mMessagingCb = rmrCb;
}
+std::shared_ptr<aidl::IRadioMessagingResponse> RadioResponse::messagingCb() {
+ return mMessagingCb.get();
+}
+
Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->acknowledgeIncomingGsmSmsWithPduResponse(toAidl(info));
+ messagingCb()->acknowledgeIncomingGsmSmsWithPduResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->acknowledgeLastIncomingCdmaSmsResponse(toAidl(info));
+ messagingCb()->acknowledgeLastIncomingCdmaSmsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->acknowledgeLastIncomingGsmSmsResponse(toAidl(info));
+ messagingCb()->acknowledgeLastIncomingGsmSmsResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->cancelPendingUssdResponse(toAidl(info));
+ messagingCb()->cancelPendingUssdResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->deleteSmsOnRuimResponse(toAidl(info));
+ messagingCb()->deleteSmsOnRuimResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->deleteSmsOnSimResponse(toAidl(info));
+ messagingCb()->deleteSmsOnSimResponse(toAidl(info));
return {};
}
@@ -82,162 +79,141 @@
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));
+ messagingCb()->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));
+ messagingCb()->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);
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->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));
+ messagingCb()->sendUssdResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCdmaBroadcastActivationResponse(
const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->setCdmaBroadcastActivationResponse(toAidl(info));
+ messagingCb()->setCdmaBroadcastActivationResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->setCdmaBroadcastConfigResponse(toAidl(info));
+ messagingCb()->setCdmaBroadcastConfigResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->setGsmBroadcastActivationResponse(toAidl(info));
+ messagingCb()->setGsmBroadcastActivationResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->setGsmBroadcastConfigResponse(toAidl(info));
+ messagingCb()->setGsmBroadcastConfigResponse(toAidl(info));
return {};
}
Return<void> RadioResponse::setSmscAddressResponse(const V1_0::RadioResponseInfo& info) {
LOG_CALL << info.serial;
- CHECK_CB(mMessagingCb);
- mMessagingCb->setSmscAddressResponse(toAidl(info));
+ messagingCb()->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);
+ messagingCb()->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);
+ messagingCb()->writeSmsToSimResponse(toAidl(info), index);
return {};
}