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

Commit 0de4d315 authored by sqian's avatar sqian Committed by Shuo Qian
Browse files

Radio Sap 1.2 default implementation

Checked points:
- service is on
- vts can run on it
- provided a dummy implementation that a VTS test can pass it
- applied with recent update in radio 1.2 hal
- format repaired
- pass on a 1.0 VTS test, a 1.1 VTS test, and a 1.2 VTS test

Bug: 74114758
Test: run vts

Change-Id: I8a052e3cedb41db9028552ab88f1e26492718497
parent f625c068
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
cc_binary {
    name: "android.hardware.radio@1.2-radio-service",
    init_rc: ["android.hardware.radio@1.2-radio-service.rc"],
    relative_install_path: "hw",
    vendor: true,
    srcs: [
        "Radio.cpp",
        "radio-service.cpp",
    ],
    shared_libs: [
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
        "android.hardware.radio@1.2",
        "android.hardware.radio@1.0",
        "android.hardware.radio@1.1",
    ],
}

cc_binary {
    name: "android.hardware.radio@1.2-sap-service",
    init_rc: ["android.hardware.radio@1.2-sap-service.rc"],
    relative_install_path: "hw",
    vendor: true,
    srcs: [
        "Sap.cpp",
        "sap-service.cpp",
    ],
    shared_libs: [
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
        "android.hardware.radio@1.2",
        "android.hardware.radio@1.0",
        "android.hardware.radio@1.1",
    ],
}
+911 −0

File added.

Preview size limit exceeded, changes collapsed.

+291 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.1 (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.1
 *
 * 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.
 */
#ifndef ANDROID_HARDWARE_RADIO_V1_2_RADIO_H
#define ANDROID_HARDWARE_RADIO_V1_2_RADIO_H

#include <android/hardware/radio/1.2/IRadio.h>
#include <android/hardware/radio/1.2/IRadioIndication.h>
#include <android/hardware/radio/1.2/IRadioResponse.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <log/log.h>

namespace android {
namespace hardware {
namespace radio {
namespace V1_2 {
namespace implementation {

using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;

struct Radio : public IRadio {
    sp<::android::hardware::radio::V1_0::IRadioResponse> mRadioResponse;
    sp<::android::hardware::radio::V1_0::IRadioIndication> mRadioIndication;
    sp<::android::hardware::radio::V1_1::IRadioResponse> mRadioResponseV1_1;
    sp<::android::hardware::radio::V1_1::IRadioIndication> mRadioIndicationV1_1;
    sp<::android::hardware::radio::V1_2::IRadioResponse> mRadioResponseV1_2;
    sp<::android::hardware::radio::V1_2::IRadioIndication> mRadioIndicationV1_2;

    // Methods from ::android::hardware::radio::V1_0::IRadio follow.
    Return<void> setResponseFunctions(
        const sp<::android::hardware::radio::V1_0::IRadioResponse>& radioResponse,
        const sp<::android::hardware::radio::V1_0::IRadioIndication>& radioIndication) override;
    Return<void> getIccCardStatus(int32_t serial) override;
    Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin,
                                    const hidl_string& aid) override;
    Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin,
                                    const hidl_string& aid) override;
    Return<void> supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2,
                                     const hidl_string& aid) override;
    Return<void> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2,
                                     const hidl_string& pin2, const hidl_string& aid) override;
    Return<void> changeIccPinForApp(int32_t serial, const hidl_string& oldPin,
                                    const hidl_string& newPin, const hidl_string& aid) override;
    Return<void> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2,
                                     const hidl_string& newPin2, const hidl_string& aid) override;
    Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) override;
    Return<void> getCurrentCalls(int32_t serial) override;
    Return<void> dial(int32_t serial,
                      const ::android::hardware::radio::V1_0::Dial& dialInfo) override;
    Return<void> getImsiForApp(int32_t serial, const hidl_string& aid) override;
    Return<void> hangup(int32_t serial, int32_t gsmIndex) override;
    Return<void> hangupWaitingOrBackground(int32_t serial) override;
    Return<void> hangupForegroundResumeBackground(int32_t serial) override;
    Return<void> switchWaitingOrHoldingAndActive(int32_t serial) override;
    Return<void> conference(int32_t serial) override;
    Return<void> rejectCall(int32_t serial) override;
    Return<void> getLastCallFailCause(int32_t serial) override;
    Return<void> getSignalStrength(int32_t serial) override;
    Return<void> getVoiceRegistrationState(int32_t serial) override;
    Return<void> getDataRegistrationState(int32_t serial) override;
    Return<void> getOperator(int32_t serial) override;
    Return<void> setRadioPower(int32_t serial, bool on) override;
    Return<void> sendDtmf(int32_t serial, const hidl_string& s) override;
    Return<void> sendSms(int32_t serial,
                         const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override;
    Return<void> sendSMSExpectMore(
        int32_t serial, const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override;
    Return<void> setupDataCall(
        int32_t serial, ::android::hardware::radio::V1_0::RadioTechnology radioTechnology,
        const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo,
        bool modemCognitive, bool roamingAllowed, bool isRoaming) override;
    Return<void> iccIOForApp(int32_t serial,
                             const ::android::hardware::radio::V1_0::IccIo& iccIo) override;
    Return<void> sendUssd(int32_t serial, const hidl_string& ussd) override;
    Return<void> cancelPendingUssd(int32_t serial) override;
    Return<void> getClir(int32_t serial) override;
    Return<void> setClir(int32_t serial, int32_t status) override;
    Return<void> getCallForwardStatus(
        int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override;
    Return<void> setCallForward(
        int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override;
    Return<void> getCallWaiting(int32_t serial, int32_t serviceClass) override;
    Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override;
    Return<void> acknowledgeLastIncomingGsmSms(
        int32_t serial, bool success,
        ::android::hardware::radio::V1_0::SmsAcknowledgeFailCause cause) override;
    Return<void> acceptCall(int32_t serial) override;
    Return<void> deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) override;
    Return<void> getFacilityLockForApp(int32_t serial, const hidl_string& facility,
                                       const hidl_string& password, int32_t serviceClass,
                                       const hidl_string& appId) override;
    Return<void> setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState,
                                       const hidl_string& password, int32_t serviceClass,
                                       const hidl_string& appId) override;
    Return<void> setBarringPassword(int32_t serial, const hidl_string& facility,
                                    const hidl_string& oldPassword,
                                    const hidl_string& newPassword) override;
    Return<void> getNetworkSelectionMode(int32_t serial) override;
    Return<void> setNetworkSelectionModeAutomatic(int32_t serial) override;
    Return<void> setNetworkSelectionModeManual(int32_t serial,
                                               const hidl_string& operatorNumeric) override;
    Return<void> getAvailableNetworks(int32_t serial) override;
    Return<void> startDtmf(int32_t serial, const hidl_string& s) override;
    Return<void> stopDtmf(int32_t serial) override;
    Return<void> getBasebandVersion(int32_t serial) override;
    Return<void> separateConnection(int32_t serial, int32_t gsmIndex) override;
    Return<void> setMute(int32_t serial, bool enable) override;
    Return<void> getMute(int32_t serial) override;
    Return<void> getClip(int32_t serial) override;
    Return<void> getDataCallList(int32_t serial) override;
    Return<void> setSuppServiceNotifications(int32_t serial, bool enable) override;
    Return<void> writeSmsToSim(
        int32_t serial,
        const ::android::hardware::radio::V1_0::SmsWriteArgs& smsWriteArgs) override;
    Return<void> deleteSmsOnSim(int32_t serial, int32_t index) override;
    Return<void> setBandMode(int32_t serial,
                             ::android::hardware::radio::V1_0::RadioBandMode mode) override;
    Return<void> getAvailableBandModes(int32_t serial) override;
    Return<void> sendEnvelope(int32_t serial, const hidl_string& command) override;
    Return<void> sendTerminalResponseToSim(int32_t serial,
                                           const hidl_string& commandResponse) override;
    Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override;
    Return<void> explicitCallTransfer(int32_t serial) override;
    Return<void> setPreferredNetworkType(
        int32_t serial, ::android::hardware::radio::V1_0::PreferredNetworkType nwType) override;
    Return<void> getPreferredNetworkType(int32_t serial) override;
    Return<void> getNeighboringCids(int32_t serial) override;
    Return<void> setLocationUpdates(int32_t serial, bool enable) override;
    Return<void> setCdmaSubscriptionSource(
        int32_t serial, ::android::hardware::radio::V1_0::CdmaSubscriptionSource cdmaSub) override;
    Return<void> setCdmaRoamingPreference(
        int32_t serial, ::android::hardware::radio::V1_0::CdmaRoamingType type) override;
    Return<void> getCdmaRoamingPreference(int32_t serial) override;
    Return<void> setTTYMode(int32_t serial,
                            ::android::hardware::radio::V1_0::TtyMode mode) override;
    Return<void> getTTYMode(int32_t serial) override;
    Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable) override;
    Return<void> getPreferredVoicePrivacy(int32_t serial) override;
    Return<void> sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) override;
    Return<void> sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on,
                               int32_t off) override;
    Return<void> sendCdmaSms(int32_t serial,
                             const ::android::hardware::radio::V1_0::CdmaSmsMessage& sms) override;
    Return<void> acknowledgeLastIncomingCdmaSms(
        int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsAck& smsAck) override;
    Return<void> getGsmBroadcastConfig(int32_t serial) override;
    Return<void> setGsmBroadcastConfig(
        int32_t serial,
        const hidl_vec<::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo>& configInfo)
        override;
    Return<void> setGsmBroadcastActivation(int32_t serial, bool activate) override;
    Return<void> getCdmaBroadcastConfig(int32_t serial) override;
    Return<void> setCdmaBroadcastConfig(
        int32_t serial,
        const hidl_vec<::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo>& configInfo)
        override;
    Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate) override;
    Return<void> getCDMASubscription(int32_t serial) override;
    Return<void> writeSmsToRuim(
        int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsWriteArgs& cdmaSms) override;
    Return<void> deleteSmsOnRuim(int32_t serial, int32_t index) override;
    Return<void> getDeviceIdentity(int32_t serial) override;
    Return<void> exitEmergencyCallbackMode(int32_t serial) override;
    Return<void> getSmscAddress(int32_t serial) override;
    Return<void> setSmscAddress(int32_t serial, const hidl_string& smsc) override;
    Return<void> reportSmsMemoryStatus(int32_t serial, bool available) override;
    Return<void> reportStkServiceIsRunning(int32_t serial) override;
    Return<void> getCdmaSubscriptionSource(int32_t serial) override;
    Return<void> requestIsimAuthentication(int32_t serial, const hidl_string& challenge) override;
    Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
                                                  const hidl_string& ackPdu) override;
    Return<void> sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) override;
    Return<void> getVoiceRadioTechnology(int32_t serial) override;
    Return<void> getCellInfoList(int32_t serial) override;
    Return<void> setCellInfoListRate(int32_t serial, int32_t rate) override;
    Return<void> setInitialAttachApn(
        int32_t serial, const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo,
        bool modemCognitive, bool isRoaming) override;
    Return<void> getImsRegistrationState(int32_t serial) override;
    Return<void> sendImsSms(
        int32_t serial, const ::android::hardware::radio::V1_0::ImsSmsMessage& message) override;
    Return<void> iccTransmitApduBasicChannel(
        int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override;
    Return<void> iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) override;
    Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId) override;
    Return<void> iccTransmitApduLogicalChannel(
        int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override;
    Return<void> nvReadItem(int32_t serial,
                            ::android::hardware::radio::V1_0::NvItem itemId) override;
    Return<void> nvWriteItem(int32_t serial,
                             const ::android::hardware::radio::V1_0::NvWriteItem& item) override;
    Return<void> nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) override;
    Return<void> nvResetConfig(int32_t serial,
                               ::android::hardware::radio::V1_0::ResetNvType resetType) override;
    Return<void> setUiccSubscription(
        int32_t serial, const ::android::hardware::radio::V1_0::SelectUiccSub& uiccSub) override;
    Return<void> setDataAllowed(int32_t serial, bool allow) override;
    Return<void> getHardwareConfig(int32_t serial) override;
    Return<void> requestIccSimAuthentication(int32_t serial, int32_t authContext,
                                             const hidl_string& authData,
                                             const hidl_string& aid) override;
    Return<void> setDataProfile(
        int32_t serial, const hidl_vec<::android::hardware::radio::V1_0::DataProfileInfo>& profiles,
        bool isRoaming) override;
    Return<void> requestShutdown(int32_t serial) override;
    Return<void> getRadioCapability(int32_t serial) override;
    Return<void> setRadioCapability(
        int32_t serial, const ::android::hardware::radio::V1_0::RadioCapability& rc) override;
    Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode) override;
    Return<void> stopLceService(int32_t serial) override;
    Return<void> pullLceData(int32_t serial) override;
    Return<void> getModemActivityInfo(int32_t serial) override;
    Return<void> setAllowedCarriers(
        int32_t serial, bool allAllowed,
        const ::android::hardware::radio::V1_0::CarrierRestrictions& carriers) override;
    Return<void> getAllowedCarriers(int32_t serial) override;
    Return<void> sendDeviceState(int32_t serial,
                                 ::android::hardware::radio::V1_0::DeviceStateType deviceStateType,
                                 bool state) override;
    Return<void> setIndicationFilter(int32_t serial,
                                     hidl_bitfield<IndicationFilter> indicationFilter) override;
    Return<void> setSimCardPower(int32_t serial, bool powerUp) override;
    Return<void> responseAcknowledgement() override;

    // Methods from ::android::hardware::radio::V1_1::IRadio follow.
    Return<void> setCarrierInfoForImsiEncryption(
        int32_t serial,
        const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) override;
    Return<void> setSimCardPower_1_1(
        int32_t serial, ::android::hardware::radio::V1_1::CardPowerState powerUp) override;
    Return<void> startNetworkScan(
        int32_t serial,
        const ::android::hardware::radio::V1_1::NetworkScanRequest& request) override;
    Return<void> stopNetworkScan(int32_t serial) override;
    Return<void> startKeepalive(
        int32_t serial,
        const ::android::hardware::radio::V1_1::KeepaliveRequest& keepalive) override;
    Return<void> stopKeepalive(int32_t serial, int32_t sessionHandle) override;

    // Methods from ::android::hardware::radio::V1_2::IRadio follow.
    Return<void> startNetworkScan_1_2(
        int32_t serial,
        const ::android::hardware::radio::V1_2::NetworkScanRequest& request) override;
    Return<void> setIndicationFilter_1_2(int32_t serial,
                                         hidl_bitfield<IndicationFilter> indicationFilter) override;
    Return<void> setSignalStrengthReportingCriteria(
        int32_t serial, int32_t hysteresisMs, int32_t hysteresisDb,
        const hidl_vec<int32_t>& thresholdsDbm,
        ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override;
    Return<void> setLinkCapacityReportingCriteria(
        int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps,
        const hidl_vec<int32_t>& thresholdsDownlinkKbps,
        const hidl_vec<int32_t>& thresholdsUplinkKbps,
        ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override;
    Return<void> setupDataCall_1_2(
        int32_t serial, ::android::hardware::radio::V1_2::AccessNetwork accessNetwork,
        const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo,
        bool modemCognitive, bool roamingAllowed, bool isRoaming,
        ::android::hardware::radio::V1_2::DataRequestReason reason,
        const hidl_vec<hidl_string>& addresses, const hidl_vec<hidl_string>& dnses) override;
    Return<void> deactivateDataCall_1_2(
        int32_t serial, int32_t cid,
        ::android::hardware::radio::V1_2::DataRequestReason reason) override;
};

}  // namespace implementation
}  // namespace V1_2
}  // namespace radio
}  // namespace hardware
}  // namespace android

#endif  // ANDROID_HARDWARE_RADIO_V1_2_RADIO_H
+79 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.1 (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.1
 *
 * 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 "Sap.h"

namespace android {
namespace hardware {
namespace radio {
namespace V1_2 {
namespace implementation {

// Methods from ::android::hardware::radio::V1_0::ISap follow.
Return<void> Sap::setCallback(
    const sp<::android::hardware::radio::V1_0::ISapCallback>& sapCallback) {
    mSapCallback = sapCallback;
    return Void();
}

Return<void> Sap::connectReq(int32_t /* token */, int32_t /* maxMsgSize */) {
    // TODO implement
    return Void();
}

Return<void> Sap::disconnectReq(int32_t /* token */) {
    // TODO implement
    return Void();
}

Return<void> Sap::apduReq(int32_t /* token */,
                          ::android::hardware::radio::V1_0::SapApduType /* type */,
                          const hidl_vec<uint8_t>& /* command */) {
    // TODO implement
    return Void();
}

Return<void> Sap::transferAtrReq(int32_t /* token */) {
    // TODO implement
    return Void();
}

Return<void> Sap::powerReq(int32_t /* token */, bool /* state */) {
    // TODO implement
    return Void();
}

Return<void> Sap::resetSimReq(int32_t /* token */) {
    // TODO implement
    return Void();
}

Return<void> Sap::transferCardReaderStatusReq(int32_t /* token */) {
    // TODO implement
    return Void();
}

Return<void> Sap::setTransferProtocolReq(
    int32_t /* token */,
    ::android::hardware::radio::V1_0::SapTransferProtocol /* transferProtocol */) {
    // TODO implement
    return Void();
}

}  // namespace implementation
}  // namespace V1_2
}  // namespace radio
}  // namespace hardware
}  // namespace android
+61 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.1 (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.1
 *
 * 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.
 */
#ifndef ANDROID_HARDWARE_RADIO_V1_2_SAP_H
#define ANDROID_HARDWARE_RADIO_V1_2_SAP_H

#include <android/hardware/radio/1.2/ISap.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>

namespace android {
namespace hardware {
namespace radio {
namespace V1_2 {
namespace implementation {

using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;

struct Sap : public ISap {
    sp<::android::hardware::radio::V1_0::ISapCallback> mSapCallback;
    // Methods from ::android::hardware::radio::V1_0::ISap follow.
    Return<void> setCallback(
        const sp<::android::hardware::radio::V1_0::ISapCallback>& sapCallback) override;
    Return<void> connectReq(int32_t token, int32_t maxMsgSize) override;
    Return<void> disconnectReq(int32_t token) override;
    Return<void> apduReq(int32_t token, ::android::hardware::radio::V1_0::SapApduType type,
                         const hidl_vec<uint8_t>& command) override;
    Return<void> transferAtrReq(int32_t token) override;
    Return<void> powerReq(int32_t token, bool state) override;
    Return<void> resetSimReq(int32_t token) override;
    Return<void> transferCardReaderStatusReq(int32_t token) override;
    Return<void> setTransferProtocolReq(
        int32_t token,
        ::android::hardware::radio::V1_0::SapTransferProtocol transferProtocol) override;
};

}  // namespace implementation
}  // namespace V1_2
}  // namespace radio
}  // namespace hardware
}  // namespace android

#endif  // ANDROID_HARDWARE_RADIO_V1_2_SAP_H
Loading