Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c65008f0 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by Android (Google) Code Review
Browse files

Merge "libminradio: drop RadioModemResponseTracker" into main

parents c85aed31 ca26d642
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ cc_library {
        "config/RadioConfig.cpp",
        "data/RadioData.cpp",
        "modem/RadioModem.cpp",
        "modem/RadioModemResponseTracker.cpp",
        "network/RadioNetwork.cpp",
        "network/RadioNetworkResponseTracker.cpp",
        "network/structs.cpp",
+0 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@

#include <libminradio/GuaranteedCallback.h>
#include <libminradio/RadioSlotBase.h>
#include <libminradio/modem/RadioModemResponseTracker.h>

#include <aidl/android/hardware/radio/modem/BnRadioModem.h>

@@ -67,7 +66,6 @@ class RadioModem : public RadioSlotBase,
            respond;

  private:
    std::shared_ptr<RadioModemResponseTracker> mResponseTracker;
    int32_t mRatBitmap;

    std::string getModemUuid() const;
+0 −43
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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 <libminradio/ResponseTracker.h>

#include <aidl/android/hardware/radio/modem/BnRadioModemResponse.h>
#include <aidl/android/hardware/radio/modem/IRadioModem.h>

namespace android::hardware::radio::minimal {

class RadioModemResponseTracker
    : public ResponseTracker<::aidl::android::hardware::radio::modem::IRadioModem,
                             ::aidl::android::hardware::radio::modem::IRadioModemResponse> {
  public:
    RadioModemResponseTracker(
            std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModem> req,
            const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse>&
                    resp);

    // TODO(now): remove if not needed
    ResponseTrackerResult<::aidl::android::hardware::radio::modem::ImeiInfo> getImei();

  protected:
    ::ndk::ScopedAStatus getImeiResponse(
            const ::aidl::android::hardware::radio::RadioResponseInfo& info,
            const std::optional<::aidl::android::hardware::radio::modem::ImeiInfo>& imei) override;
};

}  // namespace android::hardware::radio::minimal
+1 −2
Original line number Diff line number Diff line
@@ -188,8 +188,7 @@ ScopedAStatus RadioModem::setResponseFunctions(
    LOG_CALL_NOSERIAL << response << ' ' << indication;
    CHECK(response);
    CHECK(indication);
    respond = mResponseTracker =
            ndk::SharedRefBase::make<RadioModemResponseTracker>(ref<aidl::IRadioModem>(), response);
    respond = response;
    indicate = indication;

    indicate()->rilConnected(RadioIndicationType::UNSOLICITED);
+0 −56
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.
 */

// see assert2_no_op in ResponseTracker.cpp
#define __assert2 assert2_no_op
#define __noreturn__ const
#include <aidl/android/hardware/radio/modem/BnRadioModemResponse.h>
#undef __assert2
#undef __noreturn__
#include <cassert>

#include <libminradio/modem/RadioModemResponseTracker.h>

#include <libminradio/debug.h>

#define RADIO_MODULE "ModemResponse"

namespace android::hardware::radio::minimal {

using namespace ::android::hardware::radio::minimal::binder_printing;
using ::aidl::android::hardware::radio::RadioResponseInfo;
using ::ndk::ScopedAStatus;
namespace aidl = ::aidl::android::hardware::radio::modem;

RadioModemResponseTracker::RadioModemResponseTracker(
        std::shared_ptr<aidl::IRadioModem> req,
        const std::shared_ptr<aidl::IRadioModemResponse>& resp)
    : ResponseTracker(req, resp) {}

ResponseTrackerResult<aidl::ImeiInfo> RadioModemResponseTracker::getImei() {
    auto serial = newSerial();
    if (auto status = request()->getImei(serial); !status.isOk()) return status;
    return getResult<aidl::ImeiInfo>(serial);
}

ScopedAStatus RadioModemResponseTracker::getImeiResponse(
        const RadioResponseInfo& info, const std::optional<aidl::ImeiInfo>& respData) {
    LOG_CALL_RESPONSE << respData;
    if (isTracked(info.serial)) return handle(info, respData.value_or(aidl::ImeiInfo{}));
    return IRadioModemResponseDelegator::getImeiResponse(info, respData);
}

}  // namespace android::hardware::radio::minimal