Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <aidl/android/hardware/radio/messaging/BnRadioMessagingIndication.h> |
| 20 | #include <aidl/android/hardware/radio/messaging/BnRadioMessagingResponse.h> |
| 21 | #include <aidl/android/hardware/radio/messaging/IRadioMessaging.h> |
| 22 | |
| 23 | #include "radio_aidl_hal_utils.h" |
| 24 | |
| 25 | using namespace aidl::android::hardware::radio::messaging; |
| 26 | |
| 27 | class RadioMessagingTest; |
| 28 | |
| 29 | /* Callback class for radio messaging response */ |
| 30 | class RadioMessagingResponse : public BnRadioMessagingResponse { |
| 31 | protected: |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 32 | RadioServiceTest& parent_messaging; |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 33 | |
| 34 | public: |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 35 | RadioMessagingResponse(RadioServiceTest& parent_messaging); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 36 | virtual ~RadioMessagingResponse() = default; |
| 37 | |
| 38 | RadioResponseInfo rspInfo; |
| 39 | SendSmsResult sendSmsResult; |
| 40 | |
| 41 | virtual ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPduResponse( |
| 42 | const RadioResponseInfo& info) override; |
| 43 | |
| 44 | virtual ndk::ScopedAStatus acknowledgeLastIncomingCdmaSmsResponse( |
| 45 | const RadioResponseInfo& info) override; |
| 46 | |
| 47 | virtual ndk::ScopedAStatus acknowledgeLastIncomingGsmSmsResponse( |
| 48 | const RadioResponseInfo& info) override; |
| 49 | |
| 50 | virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override; |
| 51 | |
| 52 | virtual ndk::ScopedAStatus cancelPendingUssdResponse(const RadioResponseInfo& info) override; |
| 53 | |
| 54 | virtual ndk::ScopedAStatus deleteSmsOnRuimResponse(const RadioResponseInfo& info) override; |
| 55 | |
| 56 | virtual ndk::ScopedAStatus deleteSmsOnSimResponse(const RadioResponseInfo& info) override; |
| 57 | |
| 58 | virtual ndk::ScopedAStatus getCdmaBroadcastConfigResponse( |
| 59 | const RadioResponseInfo& info, |
| 60 | const std::vector<CdmaBroadcastSmsConfigInfo>& configs) override; |
| 61 | |
| 62 | virtual ndk::ScopedAStatus getGsmBroadcastConfigResponse( |
| 63 | const RadioResponseInfo& info, |
| 64 | const std::vector<GsmBroadcastSmsConfigInfo>& configs) override; |
| 65 | |
| 66 | virtual ndk::ScopedAStatus getSmscAddressResponse(const RadioResponseInfo& info, |
| 67 | const std::string& smsc) override; |
| 68 | |
| 69 | virtual ndk::ScopedAStatus reportSmsMemoryStatusResponse( |
| 70 | const RadioResponseInfo& info) override; |
| 71 | |
| 72 | virtual ndk::ScopedAStatus sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info, |
| 73 | const SendSmsResult& sms) override; |
| 74 | |
| 75 | virtual ndk::ScopedAStatus sendCdmaSmsResponse(const RadioResponseInfo& info, |
| 76 | const SendSmsResult& sms) override; |
| 77 | |
| 78 | virtual ndk::ScopedAStatus sendImsSmsResponse(const RadioResponseInfo& info, |
| 79 | const SendSmsResult& sms) override; |
| 80 | |
| 81 | virtual ndk::ScopedAStatus sendSmsExpectMoreResponse(const RadioResponseInfo& info, |
| 82 | const SendSmsResult& sms) override; |
| 83 | |
| 84 | virtual ndk::ScopedAStatus sendSmsResponse(const RadioResponseInfo& info, |
| 85 | const SendSmsResult& sms) override; |
| 86 | |
| 87 | virtual ndk::ScopedAStatus sendUssdResponse(const RadioResponseInfo& info) override; |
| 88 | |
| 89 | virtual ndk::ScopedAStatus setCdmaBroadcastActivationResponse( |
| 90 | const RadioResponseInfo& info) override; |
| 91 | |
| 92 | virtual ndk::ScopedAStatus setCdmaBroadcastConfigResponse( |
| 93 | const RadioResponseInfo& info) override; |
| 94 | |
| 95 | virtual ndk::ScopedAStatus setGsmBroadcastActivationResponse( |
| 96 | const RadioResponseInfo& info) override; |
| 97 | |
| 98 | virtual ndk::ScopedAStatus setGsmBroadcastConfigResponse( |
| 99 | const RadioResponseInfo& info) override; |
| 100 | |
| 101 | virtual ndk::ScopedAStatus setSmscAddressResponse(const RadioResponseInfo& info) override; |
| 102 | |
| 103 | virtual ndk::ScopedAStatus writeSmsToRuimResponse(const RadioResponseInfo& info, |
| 104 | int32_t index) override; |
| 105 | |
| 106 | virtual ndk::ScopedAStatus writeSmsToSimResponse(const RadioResponseInfo& info, |
| 107 | int32_t index) override; |
| 108 | }; |
| 109 | |
| 110 | /* Callback class for radio messaging indication */ |
| 111 | class RadioMessagingIndication : public BnRadioMessagingIndication { |
| 112 | protected: |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 113 | RadioServiceTest& parent_messaging; |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 114 | |
| 115 | public: |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 116 | RadioMessagingIndication(RadioServiceTest& parent_messaging); |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 117 | virtual ~RadioMessagingIndication() = default; |
| 118 | |
| 119 | virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type, |
| 120 | const CdmaSmsMessage& msg) override; |
| 121 | |
| 122 | virtual ndk::ScopedAStatus cdmaRuimSmsStorageFull(RadioIndicationType type) override; |
| 123 | |
| 124 | virtual ndk::ScopedAStatus newBroadcastSms(RadioIndicationType type, |
| 125 | const std::vector<uint8_t>& data) override; |
| 126 | |
| 127 | virtual ndk::ScopedAStatus newSms(RadioIndicationType type, |
| 128 | const std::vector<uint8_t>& pdu) override; |
| 129 | |
| 130 | virtual ndk::ScopedAStatus newSmsOnSim(RadioIndicationType type, int32_t recordNumber) override; |
| 131 | |
| 132 | virtual ndk::ScopedAStatus newSmsStatusReport(RadioIndicationType type, |
| 133 | const std::vector<uint8_t>& pdu) override; |
| 134 | |
| 135 | virtual ndk::ScopedAStatus onUssd(RadioIndicationType type, UssdModeType modeType, |
| 136 | const std::string& msg) override; |
| 137 | |
| 138 | virtual ndk::ScopedAStatus simSmsStorageFull(RadioIndicationType type) override; |
| 139 | }; |
| 140 | |
| 141 | // The main test class for Radio AIDL Messaging. |
Sarah Chin | c83bce4 | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 142 | class RadioMessagingTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest { |
Sarah Chin | fc5603b | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 143 | public: |
| 144 | virtual void SetUp() override; |
| 145 | |
| 146 | /* radio messaging service handle */ |
| 147 | std::shared_ptr<IRadioMessaging> radio_messaging; |
| 148 | /* radio messaging response handle */ |
| 149 | std::shared_ptr<RadioMessagingResponse> radioRsp_messaging; |
| 150 | /* radio messaging indication handle */ |
| 151 | std::shared_ptr<RadioMessagingIndication> radioInd_messaging; |
| 152 | }; |