1#!/usr/bin/env python3
2#
3#   Copyright 2021 - Google
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17from acts import signals
18from acts.test_decorators import test_tracker_info
19from acts_contrib.test_utils.tel.loggers.telephony_metric_logger import TelephonyMetricLogger
20from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
21from acts_contrib.test_utils.tel.tel_defines import CAPABILITY_CONFERENCE
22from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
23from acts_contrib.test_utils.tel.tel_dsds_utils import erase_call_forwarding
24from acts_contrib.test_utils.tel.tel_dsds_utils import msim_volte_wfc_call_forwarding
25from acts_contrib.test_utils.tel.tel_dsds_utils import msim_volte_wfc_call_voice_conf
26from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_phones_idle
27from acts_contrib.test_utils.tel.tel_subscription_utils import get_outgoing_voice_sub_id
28from acts_contrib.test_utils.tel.tel_test_utils import get_capability_for_subscription
29from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode
30from acts_contrib.test_utils.tel.tel_wifi_utils import set_wifi_to_default
31
32
33class Nsa5gDSDSWfcSupplementaryServiceTest(TelephonyBaseTest):
34    def setup_class(self):
35        TelephonyBaseTest.setup_class(self)
36        self.tel_logger = TelephonyMetricLogger.for_test_case()
37        toggle_airplane_mode(self.log, self.android_devices[0], False)
38        erase_call_forwarding(self.log, self.android_devices[0])
39        if not get_capability_for_subscription(
40            self.android_devices[0],
41            CAPABILITY_CONFERENCE,
42            get_outgoing_voice_sub_id(self.android_devices[0])):
43            self.android_devices[0].log.error(
44                "Conference call is not supported, abort test.")
45            raise signals.TestAbortClass(
46                "Conference call is not supported, abort test.")
47
48    def teardown_test(self):
49        toggle_airplane_mode(self.log, self.android_devices[0], False)
50        ensure_phones_idle(self.log, self.android_devices)
51        erase_call_forwarding(self.log, self.android_devices[0])
52        set_wifi_to_default(self.log, self.android_devices[0])
53
54    @test_tracker_info(uuid="53169ee2-eb70-423e-bbe0-3112f34d2d73")
55    @TelephonyBaseTest.tel_test_wrap
56    def test_msim_cfu_psim_5g_nsa_wfc_wifi_preferred_apm_off_dds_0(self):
57        return msim_volte_wfc_call_forwarding(
58            self.log,
59            self.tel_logger,
60            self.android_devices,
61            0,
62            0,
63            callee_rat=['5g_wfc', 'general'],
64            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
65            wifi_network_ssid=self.wifi_network_ssid,
66            wifi_network_pass=self.wifi_network_pass)
67
68    @test_tracker_info(uuid="f0b1c9ce-a386-4b25-8a44-8ca4897fc650")
69    @TelephonyBaseTest.tel_test_wrap
70    def test_msim_cfu_psim_5g_nsa_wfc_wifi_preferred_apm_off_dds_1(self):
71        return msim_volte_wfc_call_forwarding(
72            self.log,
73            self.tel_logger,
74            self.android_devices,
75            0,
76            1,
77            callee_rat=['5g_wfc', 'general'],
78            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
79            wifi_network_ssid=self.wifi_network_ssid,
80            wifi_network_pass=self.wifi_network_pass)
81
82    @test_tracker_info(uuid="c952fe28-823d-412d-a3ac-797bd6e2dc09")
83    @TelephonyBaseTest.tel_test_wrap
84    def test_msim_cfu_psim_5g_nsa_volte_cellular_preferred_wifi_on_dds_0(self):
85        return msim_volte_wfc_call_forwarding(
86            self.log,
87            self.tel_logger,
88            self.android_devices,
89            0,
90            0,
91            callee_rat=["5g_volte", "general"],
92            is_wifi_connected=True,
93            wifi_network_ssid=self.wifi_network_ssid,
94            wifi_network_pass=self.wifi_network_pass)
95
96    @test_tracker_info(uuid="d9e58366-46ea-454a-a1b1-466ec91112ef")
97    @TelephonyBaseTest.tel_test_wrap
98    def test_msim_cfu_esim_5g_nsa_wfc_wifi_preferred_apm_off_dds_0(self):
99        return msim_volte_wfc_call_forwarding(
100            self.log,
101            self.tel_logger,
102            self.android_devices,
103            1,
104            0,
105            callee_rat=['general', '5g_wfc'],
106            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
107            wifi_network_ssid=self.wifi_network_ssid,
108            wifi_network_pass=self.wifi_network_pass)
109
110    @test_tracker_info(uuid="18ce70a6-972c-4723-8e65-0c9814d14e76")
111    @TelephonyBaseTest.tel_test_wrap
112    def test_msim_cfu_esim_5g_nsa_wfc_wifi_preferred_apm_off_dds_1(self):
113        return msim_volte_wfc_call_forwarding(
114            self.log,
115            self.tel_logger,
116            self.android_devices,
117            1,
118            1,
119            callee_rat=['general', '5g_wfc'],
120            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
121            wifi_network_ssid=self.wifi_network_ssid,
122            wifi_network_pass=self.wifi_network_pass)
123
124    @test_tracker_info(uuid="d843d4cd-c562-47f1-b35b-57a84896314e")
125    @TelephonyBaseTest.tel_test_wrap
126    def test_msim_cfu_esim_5g_nsa_volte_cellular_preferred_wifi_on_dds_0(self):
127        return msim_volte_wfc_call_forwarding(
128            self.log,
129            self.tel_logger,
130            self.android_devices,
131            1,
132            0,
133            callee_rat=["general", "5g_volte"],
134            is_wifi_connected=True,
135            wifi_network_ssid=self.wifi_network_ssid,
136            wifi_network_pass=self.wifi_network_pass)
137
138    @test_tracker_info(uuid="556a0737-f2c2-44c4-acfd-4eeb57e4c15e")
139    @TelephonyBaseTest.tel_test_wrap
140    def test_msim_cw_hold_swap_psim_5g_nsa_wfc_wifi_preferred_apm_off_dds_0(self):
141        return msim_volte_wfc_call_voice_conf(
142            self.log,
143            self.tel_logger,
144            self.android_devices,
145            0,
146            0,
147            host_rat=['5g_wfc', 'general'],
148            merge=False,
149            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
150            reject_once=True,
151            wifi_network_ssid=self.wifi_network_ssid,
152            wifi_network_pass=self.wifi_network_pass)
153
154    @test_tracker_info(uuid="d86de799-73ed-432e-b9b8-e762df459ad0")
155    @TelephonyBaseTest.tel_test_wrap
156    def test_msim_cw_hold_swap_psim_5g_nsa_wfc_wifi_preferred_apm_off_dds_1(self):
157        return msim_volte_wfc_call_voice_conf(
158            self.log,
159            self.tel_logger,
160            self.android_devices,
161            0,
162            1,
163            host_rat=['5g_wfc', 'general'],
164            merge=False,
165            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
166            reject_once=True,
167            wifi_network_ssid=self.wifi_network_ssid,
168            wifi_network_pass=self.wifi_network_pass)
169
170    @test_tracker_info(uuid="9b9a9cd0-218f-4694-b5b7-ec2818abad48")
171    @TelephonyBaseTest.tel_test_wrap
172    def test_msim_cw_hold_swap_psim_5g_nsa_volte_cellular_preferred_wifi_on_dds_0(self):
173        return msim_volte_wfc_call_voice_conf(
174            self.log,
175            self.tel_logger,
176            self.android_devices,
177            0,
178            0,
179            host_rat=["5g_volte", "general"],
180            merge=False,
181            is_airplane_mode=False,
182            is_wifi_connected=True,
183            reject_once=True,
184            wifi_network_ssid=self.wifi_network_ssid,
185            wifi_network_pass=self.wifi_network_pass)
186
187    @test_tracker_info(uuid="02dd5686-0a55-497f-8b0c-9f624b6d7af5")
188    @TelephonyBaseTest.tel_test_wrap
189    def test_msim_cw_hold_swap_esim_5g_nsa_wfc_wifi_preferred_apm_off_dds_0(self):
190        return msim_volte_wfc_call_voice_conf(
191            self.log,
192            self.tel_logger,
193            self.android_devices,
194            1,
195            0,
196            host_rat=['general', '5g_wfc'],
197            merge=False,
198            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
199            reject_once=True,
200            wifi_network_ssid=self.wifi_network_ssid,
201            wifi_network_pass=self.wifi_network_pass)
202
203    @test_tracker_info(uuid="1527f060-8226-4507-a502-09e55096da0a")
204    @TelephonyBaseTest.tel_test_wrap
205    def test_msim_cw_hold_swap_esim_5g_nsa_wfc_wifi_preferred_apm_off_dds_1(self):
206        return msim_volte_wfc_call_voice_conf(
207            self.log,
208            self.tel_logger,
209            self.android_devices,
210            1,
211            1,
212            host_rat=['general', '5g_wfc'],
213            merge=False,
214            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
215            reject_once=True,
216            wifi_network_ssid=self.wifi_network_ssid,
217            wifi_network_pass=self.wifi_network_pass)
218
219    @test_tracker_info(uuid="e6db2878-8d64-4566-95f9-e8cbf28723e8")
220    @TelephonyBaseTest.tel_test_wrap
221    def test_msim_cw_hold_swap_esim_5g_nsa_volte_cellular_preferred_wifi_on_dds_0(self):
222        return msim_volte_wfc_call_voice_conf(
223            self.log,
224            self.tel_logger,
225            self.android_devices,
226            1,
227            0,
228            host_rat=["general", "5g_volte"],
229            merge=False,
230            is_airplane_mode=False,
231            is_wifi_connected=True,
232            reject_once=True,
233            wifi_network_ssid=self.wifi_network_ssid,
234            wifi_network_pass=self.wifi_network_pass)
235
236    @test_tracker_info(uuid="5dfb45b7-2706-418f-a5c1-2f8ca9602a29")
237    @TelephonyBaseTest.tel_test_wrap
238    def test_msim_conf_psim_5g_nsa_wfc_wifi_preferred_apm_off_dds_0(self):
239        return msim_volte_wfc_call_voice_conf(
240            self.log,
241            self.tel_logger,
242            self.android_devices,
243            0,
244            0,
245            host_rat=['5g_wfc', 'general'],
246            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
247            wifi_network_ssid=self.wifi_network_ssid,
248            wifi_network_pass=self.wifi_network_pass)
249
250    @test_tracker_info(uuid="3b520d38-e1f4-46dd-90a7-90d91766e290")
251    @TelephonyBaseTest.tel_test_wrap
252    def test_msim_conf_psim_5g_nsa_wfc_wifi_preferred_apm_off_dds_1(self):
253        return msim_volte_wfc_call_voice_conf(
254            self.log,
255            self.tel_logger,
256            self.android_devices,
257            0,
258            1,
259            host_rat=['5g_wfc', 'general'],
260            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
261            wifi_network_ssid=self.wifi_network_ssid,
262            wifi_network_pass=self.wifi_network_pass)
263
264    @test_tracker_info(uuid="f3f09280-bd34-46dc-b813-e017d671ddba")
265    @TelephonyBaseTest.tel_test_wrap
266    def test_msim_conf_psim_5g_nsa_volte_cellular_preferred_wifi_on_dds_0(self):
267        return msim_volte_wfc_call_voice_conf(
268            self.log,
269            self.tel_logger,
270            self.android_devices,
271            0,
272            0,
273            host_rat=["5g_volte", "general"],
274            is_wifi_connected=True,
275            wifi_network_ssid=self.wifi_network_ssid,
276            wifi_network_pass=self.wifi_network_pass)
277
278    @test_tracker_info(uuid="f157ba39-b4ae-464a-840a-56e94ba62736")
279    @TelephonyBaseTest.tel_test_wrap
280    def test_msim_conf_esim_5g_wfc_wifi_preferred_apm_off_dds_0(self):
281        return msim_volte_wfc_call_voice_conf(
282            self.log,
283            self.tel_logger,
284            self.android_devices,
285            1,
286            0,
287            host_rat=['general', '5g_wfc'],
288            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
289            wifi_network_ssid=self.wifi_network_ssid,
290            wifi_network_pass=self.wifi_network_pass)
291
292    @test_tracker_info(uuid="872413fa-ae9c-4482-9e87-a3a4a2738bab")
293    @TelephonyBaseTest.tel_test_wrap
294    def test_msim_conf_esim_5g_nsa_wfc_wifi_preferred_apm_off_dds_1(self):
295        return msim_volte_wfc_call_voice_conf(
296            self.log,
297            self.tel_logger,
298            self.android_devices,
299            1,
300            1,
301            host_rat=['general', '5g_wfc'],
302            wfc_mode=[WFC_MODE_WIFI_PREFERRED, WFC_MODE_WIFI_PREFERRED],
303            wifi_network_ssid=self.wifi_network_ssid,
304            wifi_network_pass=self.wifi_network_pass)
305
306    @test_tracker_info(uuid="18023ab7-fa96-4dda-a9ed-dd7562a0d185")
307    @TelephonyBaseTest.tel_test_wrap
308    def test_msim_conf_esim_5g_nsa_volte_cellular_preferred_wifi_on_dds_0(self):
309        return msim_volte_wfc_call_voice_conf(
310            self.log,
311            self.tel_logger,
312            self.android_devices,
313            1,
314            0,
315            host_rat=["general", "5g_volte"],
316            is_wifi_connected=True,
317            wifi_network_ssid=self.wifi_network_ssid,
318            wifi_network_pass=self.wifi_network_pass)