1#!/usr/bin/env python3.4
2#
3#   Copyright 2020 - 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"""
17    Test Script for 5G MMS scenarios
18"""
19
20from acts.test_decorators import test_tracker_info
21from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
22from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
23from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED
24from acts_contrib.test_utils.tel.tel_message_utils import message_test
25from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_phones_idle
26from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_volte
27from acts_contrib.test_utils.tel.tel_data_utils import active_file_download_task
28from acts_contrib.test_utils.tel.tel_test_utils import install_message_apk
29from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode
30from acts_contrib.test_utils.tel.tel_test_utils import verify_internet_connection
31from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_device_for_5g
32from acts.libs.utils.multithread import run_multithread_func
33
34
35class Nsa5gMmsTest(TelephonyBaseTest):
36    def setup_class(self):
37        super().setup_class()
38
39        self.message_util = self.user_params.get("message_apk", None)
40        if isinstance(self.message_util, list):
41            self.message_util = self.message_util[0]
42
43        if self.message_util:
44            ads = self.android_devices
45            for ad in ads:
46                install_message_apk(ad, self.message_util)
47
48    def setup_test(self):
49        TelephonyBaseTest.setup_test(self)
50
51    def teardown_test(self):
52        ensure_phones_idle(self.log, self.android_devices)
53
54    """ Tests Begin """
55
56    @test_tracker_info(uuid="bc484c2c-8086-42db-94cd-a1e4a35f35cf")
57    @TelephonyBaseTest.tel_test_wrap
58    def test_5g_nsa_mms_mo_mt(self):
59        """Test MMS between two phones in 5g NSA
60
61        Provision devices in 5g NSA
62        Send and Verify MMS from PhoneA to PhoneB
63        Verify both devices are still on 5g NSA
64
65        Returns:
66            True if success.
67            False if failed.
68        """
69        return message_test(self.log,
70                            self.android_devices[0],
71                            self.android_devices[1],
72                            mo_rat='5g',
73                            mt_rat='5g',
74                            msg_type='mms')
75
76    @test_tracker_info(uuid="88bd6658-30fa-41b1-b5d9-0f9dadd83219")
77    @TelephonyBaseTest.tel_test_wrap
78    def test_5g_nsa_mms_mo_general(self):
79        """Test MO MMS for 1 phone in 5g NSA. The other phone in any network
80
81        Provision PhoneA in 5g NSA
82        Send and Verify MMS from PhoneA to PhoneB
83        Verify phoneA is still on 5g NSA
84
85        Returns:
86            True if success.
87            False if failed.
88        """
89        return message_test(self.log,
90                            self.android_devices[0],
91                            self.android_devices[1],
92                            mo_rat='5g',
93                            mt_rat='default',
94                            msg_type='mms')
95
96    @test_tracker_info(uuid="11f2e2c8-bb63-43fa-b279-e7bb32f80596")
97    @TelephonyBaseTest.tel_test_wrap
98    def test_5g_nsa_mms_mt_general(self):
99        """Test MT MMS for 1 phone in 5g NSA. The other phone in any network
100
101        Provision PhoneA in 5g NSA
102        Send and Verify MMS from PhoneB to PhoneA
103        Verify phoneA is still on 5g NSA
104
105        Returns:
106            True if success.
107            False if failed.
108        """
109        return message_test(self.log,
110                            self.android_devices[1],
111                            self.android_devices[0],
112                            mo_rat='default',
113                            mt_rat='5g',
114                            msg_type='mms')
115
116    @test_tracker_info(uuid="51d42104-cb87-4c9b-9a16-302e246a21dc")
117    @TelephonyBaseTest.tel_test_wrap
118    def test_5g_nsa_mms_mo_mt_volte(self):
119        """Test MMS between two phones with VoLTE on 5G NSA
120
121        Provision devices on VoLTE
122        Provision devices in 5g NSA
123        Send and Verify MMS from PhoneA to PhoneB
124        Verify both devices are still on 5g NSA
125
126        Returns:
127            True if success.
128            False if failed.
129        """
130        return message_test(self.log,
131                            self.android_devices[0],
132                            self.android_devices[1],
133                            mo_rat='5g_volte',
134                            mt_rat='5g_volte',
135                            msg_type='mms')
136
137    @test_tracker_info(uuid="97d6b071-aef2-40c1-8245-7be6c31870a6")
138    @TelephonyBaseTest.tel_test_wrap
139    def test_5g_nsa_mms_mo_mt_in_call_volte(self):
140        """ Test MO MMS during a VoLTE call over 5G NSA.
141
142        Provision devices on VoLTE
143        Provision devices in 5g NSA
144        Make a Voice call from PhoneA to PhoneB
145        Send and Verify MMS from PhoneA to PhoneB
146        Verify both devices are still on 5g NSA
147
148        Returns:
149            True if pass; False if fail.
150        """
151        return message_test(self.log,
152                            self.android_devices[0],
153                            self.android_devices[1],
154                            mo_rat='5g_volte',
155                            mt_rat='5g_volte',
156                            msg_type='mms',
157                            msg_in_call=True)
158
159    @test_tracker_info(uuid="bbb4b80c-fc1b-4377-b3c7-eeed642c5980")
160    @TelephonyBaseTest.tel_test_wrap
161    def test_5g_nsa_mms_mo_mt_iwlan(self):
162        """ Test MMS text function between two phones,
163        Phones in APM, WiFi connected, WFC Cell Preferred mode.
164
165        Disable APM on both devices
166        Provision devices in 5g NSA
167        Provision devices for WFC Cell Pref with APM ON
168        Send and Verify MMS from PhoneA to PhoneB
169
170        Returns:
171            True if pass; False if fail.
172        """
173        apm_mode = [
174            toggle_airplane_mode(self.log, ad, False)
175            for ad in self.android_devices
176        ]
177        return message_test(self.log,
178                            self.android_devices[0],
179                            self.android_devices[1],
180                            mo_rat='5g_wfc',
181                            mt_rat='5g_wfc',
182                            msg_type='mms',
183                            is_airplane_mode=True,
184                            wfc_mode=WFC_MODE_CELLULAR_PREFERRED,
185                            wifi_ssid=self.wifi_network_ssid,
186                            wifi_pwd=self.wifi_network_pass)
187
188    @test_tracker_info(uuid="d36d95dc-0973-4711-bb08-c29ce23495e4")
189    @TelephonyBaseTest.tel_test_wrap
190    def test_5g_nsa_mms_mo_mt_iwlan_apm_off(self):
191        """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
192
193        Disable APM on both devices
194        Provision devices in 5g NSA
195        Provision devices for WFC Wifi Pref with APM OFF
196        Send and Verify MMS from PhoneA to PhoneB
197        Verify 5g NSA attach for both devices
198
199        Returns:
200            True if pass; False if fail.
201        """
202        apm_mode = [
203            toggle_airplane_mode(self.log, ad, False)
204            for ad in self.android_devices
205        ]
206        return message_test(self.log,
207                            self.android_devices[0],
208                            self.android_devices[1],
209                            mo_rat='5g_wfc',
210                            mt_rat='5g_wfc',
211                            msg_type='mms',
212                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
213                            wifi_ssid=self.wifi_network_ssid,
214                            wifi_pwd=self.wifi_network_pass)
215
216    @test_tracker_info(uuid="74ffb79e-f1e9-4087-a9d2-e07878e47869")
217    @TelephonyBaseTest.tel_test_wrap
218    def test_5g_nsa_mms_mo_mt_in_call_iwlan(self):
219        """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
220
221        Disable APM on both devices
222        Provision devices in 5g NSA
223        Provision devices for WFC Wifi Pref with APM ON
224        Make a Voice call from PhoneA to PhoneB
225        Send and Verify MMS from PhoneA to PhoneB
226
227        Returns:
228            True if pass; False if fail.
229        """
230        apm_mode = [
231            toggle_airplane_mode(self.log, ad, False)
232            for ad in self.android_devices
233        ]
234        return message_test(self.log,
235                            self.android_devices[0],
236                            self.android_devices[1],
237                            mo_rat='5g_wfc',
238                            mt_rat='5g_wfc',
239                            msg_type='mms',
240                            msg_in_call=True,
241                            is_airplane_mode=True,
242                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
243                            wifi_ssid=self.wifi_network_ssid,
244                            wifi_pwd=self.wifi_network_pass)
245
246    @test_tracker_info(uuid="68c8e0ca-bea4-45e4-92cf-19424ee47ca4")
247    @TelephonyBaseTest.tel_test_wrap
248    def test_5g_nsa_mms_mo_mt_in_call_volte_wifi(self):
249        """ Test MMS during VoLTE call and WiFi connected
250
251        Make sure PhoneA/B are in 5G NSA (with VoLTE).
252        Make sure PhoneA/B are able to make/receive call.
253        Connect PhoneA/B to Wifi.
254        Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
255        Make sure PhoneA/B are in 5G NSA.
256
257        Returns:
258            True if pass; False if fail.
259        """
260        return message_test(self.log,
261                            self.android_devices[0],
262                            self.android_devices[1],
263                            mo_rat='5g_volte',
264                            mt_rat='5g_volte',
265                            msg_type='mms',
266                            msg_in_call=True,
267                            wifi_ssid=self.wifi_network_ssid,
268                            wifi_pwd=self.wifi_network_pass)
269
270    @test_tracker_info(uuid="8c795c3a-59d4-408c-9b99-5287e79ba00b")
271    @TelephonyBaseTest.tel_test_wrap
272    def test_5g_nsa_mms_long_message_mo_mt(self):
273        """Test MMS basic function between two phone. Phones in nsa 5G network.
274
275        Airplane mode is off. Phone in nsa 5G.
276        Send MMS from PhoneA to PhoneB.
277        Verify received message on PhoneB is correct.
278
279        Returns:
280            True if success.
281            False if failed.
282        """
283        return message_test(self.log,
284                            self.android_devices[0],
285                            self.android_devices[1],
286                            mo_rat='5g',
287                            mt_rat='5g',
288                            msg_type='mms',
289                            long_msg=True)
290
291    @test_tracker_info(uuid="e09b82ab-69a9-4eae-8cbe-b6f2cff993ad")
292    @TelephonyBaseTest.tel_test_wrap
293    def test_5g_nsa_mms_mo_wifi(self):
294        """Test MMS basic function between two phone. Phones in nsa 5g network.
295
296        Airplane mode is off. Phone in nsa 5G.
297        Connect to Wifi.
298        Send MMS from PhoneA to PhoneB.
299        Verify received message on PhoneB is correct.
300
301        Returns:
302            True if success.
303            False if failed.
304        """
305        return message_test(self.log,
306                            self.android_devices[0],
307                            self.android_devices[1],
308                            mo_rat='5g',
309                            mt_rat='general',
310                            msg_type='mms',
311                            wifi_ssid=self.wifi_network_ssid,
312                            wifi_pwd=self.wifi_network_pass)
313
314    @test_tracker_info(uuid="fedae24f-2577-4f84-9d76-53bbbe109d48")
315    @TelephonyBaseTest.tel_test_wrap
316    def test_5g_nsa_mms_mt_wifi(self):
317        """Test MMS basic function between two phone. Phones in nsa 5g network.
318
319        Airplane mode is off. Phone in nsa 5G.
320        Connect to Wifi.
321        Send MMS from PhoneB to PhoneA.
322        Verify received message on PhoneA is correct.
323
324        Returns:
325            True if success.
326            False if failed.
327        """
328        return message_test(self.log,
329                            self.android_devices[1],
330                            self.android_devices[0],
331                            mo_rat='general',
332                            mt_rat='5g',
333                            msg_type='mms',
334                            wifi_ssid=self.wifi_network_ssid,
335                            wifi_pwd=self.wifi_network_pass)
336
337    @test_tracker_info(uuid="156bf832-acc2-4729-a69d-b471cd5cfbde")
338    @TelephonyBaseTest.tel_test_wrap
339    def test_5g_nsa_mms_mo_mt_in_call_csfb_wifi(self):
340        """ Test MO/MT MMS during a MO csfb call and devices connect to Wifi.
341
342        Disable APM on both devices
343        Set up PhoneA/PhoneB are in CSFB mode.
344        Provision PhoneA/B in 5g NSA.
345        Make sure PhoneA/B is able to make/receive call.
346        Connect PhoneA/B to Wifi.
347        Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA,
348         receive MMS on B.
349
350        Returns:
351            True if pass; False if fail.
352        """
353        return message_test(self.log,
354                            self.android_devices[0],
355                            self.android_devices[1],
356                            mo_rat='5g_csfb',
357                            mt_rat='5g_csfb',
358                            msg_type='mms',
359                            msg_in_call=True,
360                            wifi_ssid=self.wifi_network_ssid,
361                            wifi_pwd=self.wifi_network_pass)
362
363    @test_tracker_info(uuid="a76e4adc-ce37-47d4-9925-4ebe175f7b9c")
364    @TelephonyBaseTest.tel_test_wrap
365    def test_5g_nsa_mms_mo_volte(self):
366        """Test MO MMS for 1 phone with VoLTE on 5G NSA
367
368        Provision PhoneA on VoLTE
369        Provision PhoneA in 5g NSA
370        Send and Verify MMS from PhoneA to PhoneB
371        Verify PhoneA is still on 5g NSA
372
373        Returns:
374            True if success.
375            False if failed.
376        """
377        return message_test(self.log,
378                            self.android_devices[0],
379                            self.android_devices[1],
380                            mo_rat='5g_volte',
381                            mt_rat='default',
382                            msg_type='mms')
383
384    @test_tracker_info(uuid="c2282b01-e89f-49db-8925-79d38b63a373")
385    @TelephonyBaseTest.tel_test_wrap
386    def test_5g_nsa_mms_mt_volte(self):
387        """Test MT MMS for 1 phone with VoLTE on 5G NSA
388
389        Provision PhoneA on VoLTE
390        Provision PhoneA in 5g NSA
391        Send and Verify MMS from PhoneB to PhoneA
392        Verify PhoneA is still on 5g NSA
393
394        Returns:
395            True if success.
396            False if failed.
397        """
398        return message_test(self.log,
399                            self.android_devices[1],
400                            self.android_devices[0],
401                            mo_rat='default',
402                            mt_rat='5g_volte',
403                            msg_type='mms')
404
405    @test_tracker_info(uuid="fd9bc699-940f-4a4a-abf1-31080e54ab56")
406    @TelephonyBaseTest.tel_test_wrap
407    def test_5g_nsa_mms_mo_in_call_volte(self):
408        """ Test MO MMS during a VoLTE call over 5G NSA.
409
410        Provision PhoneA on VoLTE
411        Provision PhoneA in 5g NSA
412        Make a Voice call from PhoneA to PhoneB
413        Send and Verify MMS from PhoneA to PhoneB
414        Verify PhoneA is still on 5g NSA
415
416        Returns:
417            True if pass; False if fail.
418        """
419        return message_test(self.log,
420                            self.android_devices[0],
421                            self.android_devices[1],
422                            mo_rat='5g_volte',
423                            mt_rat='default',
424                            msg_type='mms',
425                            msg_in_call=True)
426
427    @test_tracker_info(uuid="cfbae1e0-842a-470a-914a-a3a25a18dc81")
428    @TelephonyBaseTest.tel_test_wrap
429    def test_5g_nsa_mms_mt_in_call_volte(self):
430        """ Test MT MMS during a VoLTE call over 5G NSA.
431
432        Provision PhoneA on VoLTE
433        Provision PhoneA in 5g NSA
434        Make a Voice call from PhoneB to PhoneA
435        Send and Verify MMS from PhoneB to PhoneA
436        Verify PhoneA is still on 5g NSA
437
438        Returns:
439            True if pass; False if fail.
440        """
441        return message_test(self.log,
442                            self.android_devices[1],
443                            self.android_devices[0],
444                            mo_rat='default',
445                            mt_rat='5g_volte',
446                            msg_type='mms',
447                            msg_in_call=True)
448
449    @test_tracker_info(uuid="fc8a996b-04b5-40e0-be25-cbbabf4d7957")
450    @TelephonyBaseTest.tel_test_wrap
451    def test_5g_nsa_mms_mo_iwlan(self):
452        """ Test MO MMS text function for 1 phone in APM,
453        WiFi connected, WFC Cell Preferred mode.
454
455        Disable APM on both devices
456        Provision PhoneA in 5g NSA
457        Provision PhoneA for WFC Cell Pref with APM ON
458        Send and Verify MMS from PhoneA to PhoneB
459
460        Returns:
461            True if pass; False if fail.
462        """
463        apm_mode = [
464            toggle_airplane_mode(self.log, ad, False)
465            for ad in self.android_devices
466        ]
467        return message_test(self.log,
468                            self.android_devices[0],
469                            self.android_devices[1],
470                            mo_rat='5g_wfc',
471                            mt_rat='default',
472                            msg_type='mms',
473                            is_airplane_mode=True,
474                            wfc_mode=WFC_MODE_CELLULAR_PREFERRED,
475                            wifi_ssid=self.wifi_network_ssid,
476                            wifi_pwd=self.wifi_network_pass)
477
478    @test_tracker_info(uuid="7f354997-38b5-49cd-8bee-12d0589e0380")
479    @TelephonyBaseTest.tel_test_wrap
480    def test_5g_nsa_mms_mt_iwlan(self):
481        """ Test MT MMS text function for 1 phone in APM,
482        WiFi connected, WFC Cell Preferred mode.
483
484        Disable APM on both devices
485        Provision PhoneA in 5g NSA
486        Provision PhoneA for WFC Cell Pref with APM ON
487        Send and Verify MMS from PhoneB to PhoneA
488
489        Returns:
490            True if pass; False if fail.
491        """
492        apm_mode = [
493            toggle_airplane_mode(self.log, ad, False)
494            for ad in self.android_devices
495        ]
496        return message_test(self.log,
497                            self.android_devices[1],
498                            self.android_devices[0],
499                            mo_rat='default',
500                            mt_rat='5g_wfc',
501                            msg_type='mms',
502                            is_airplane_mode=True,
503                            wfc_mode=WFC_MODE_CELLULAR_PREFERRED,
504                            wifi_ssid=self.wifi_network_ssid,
505                            wifi_pwd=self.wifi_network_pass)
506
507    @test_tracker_info(uuid="592ea897-cba1-4ab5-a4ed-54ac1f8d3039")
508    @TelephonyBaseTest.tel_test_wrap
509    def test_5g_nsa_mms_mo_iwlan_apm_off(self):
510        """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
511
512        Disable APM on both devices
513        Provision PhoneA in 5g NSA
514        Provision PhoneA for WFC Wifi Pref with APM OFF
515        Send and Verify MMS from PhoneA to PhoneB
516        Verify 5g NSA attach for PhoneA
517
518        Returns:
519            True if pass; False if fail.
520        """
521        apm_mode = [
522            toggle_airplane_mode(self.log, ad, False)
523            for ad in self.android_devices
524        ]
525        return message_test(self.log,
526                            self.android_devices[0],
527                            self.android_devices[1],
528                            mo_rat='5g_wfc',
529                            mt_rat='default',
530                            msg_type='mms',
531                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
532                            wifi_ssid=self.wifi_network_ssid,
533                            wifi_pwd=self.wifi_network_pass)
534
535    @test_tracker_info(uuid="3824205d-6a36-420f-a448-51ebb30948c2")
536    @TelephonyBaseTest.tel_test_wrap
537    def test_5g_nsa_mms_mt_iwlan_apm_off(self):
538        """ Test MT MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
539
540        Disable APM on both devices
541        Provision PhoneA in 5g NSA
542        Provision PhoneA for WFC Wifi Pref with APM OFF
543        Send and Verify MMS from PhoneB to PhoneA
544        Verify 5g NSA attach for PhoneA
545
546        Returns:
547            True if pass; False if fail.
548        """
549        apm_mode = [
550            toggle_airplane_mode(self.log, ad, False)
551            for ad in self.android_devices
552        ]
553        return message_test(self.log,
554                            self.android_devices[1],
555                            self.android_devices[0],
556                            mo_rat='default',
557                            mt_rat='5g_wfc',
558                            msg_type='mms',
559                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
560                            wifi_ssid=self.wifi_network_ssid,
561                            wifi_pwd=self.wifi_network_pass)
562
563    @test_tracker_info(uuid="91da5493-c810-4b1e-84f0-9d292a7b23eb")
564    @TelephonyBaseTest.tel_test_wrap
565    def test_5g_nsa_mms_mo_in_call_iwlan(self):
566        """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
567
568        Disable APM on both devices
569        Provision PhoneA in 5g NSA
570        Provision PhoneA for WFC Wifi Pref with APM ON
571        Make a Voice call from PhoneA to PhoneB
572        Send and Verify MMS from PhoneA to PhoneB
573
574        Returns:
575            True if pass; False if fail.
576        """
577        apm_mode = [
578            toggle_airplane_mode(self.log, ad, False)
579            for ad in self.android_devices
580        ]
581        return message_test(self.log,
582                            self.android_devices[0],
583                            self.android_devices[1],
584                            mo_rat='5g_wfc',
585                            mt_rat='default',
586                            msg_type='mms',
587                            msg_in_call=True,
588                            is_airplane_mode=True,
589                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
590                            wifi_ssid=self.wifi_network_ssid,
591                            wifi_pwd=self.wifi_network_pass)
592
593    @test_tracker_info(uuid="3e6a6700-1fcb-4db1-a757-e80801032605")
594    @TelephonyBaseTest.tel_test_wrap
595    def test_5g_nsa_mms_mt_in_call_iwlan(self):
596        """ Test MT MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
597
598        Disable APM on both devices
599        Provision PhoneA in 5g NSA
600        Provision PhoneA for WFC Wifi Pref with APM ON
601        Make a Voice call from PhoneB to PhoneA
602        Send and Verify MMS from PhoneB to PhoneA
603
604        Returns:
605            True if pass; False if fail.
606        """
607        apm_mode = [
608            toggle_airplane_mode(self.log, ad, False)
609            for ad in self.android_devices
610        ]
611        return message_test(self.log,
612                            self.android_devices[1],
613                            self.android_devices[0],
614                            mo_rat='default',
615                            mt_rat='5g_wfc',
616                            msg_type='mms',
617                            msg_in_call=True,
618                            is_airplane_mode=True,
619                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
620                            wifi_ssid=self.wifi_network_ssid,
621                            wifi_pwd=self.wifi_network_pass)
622
623    @test_tracker_info(uuid="dc483cc-d7c7-4cdd-9500-4bfc4f1b5bab")
624    @TelephonyBaseTest.tel_test_wrap
625    def test_5g_nsa_mms_mo_in_call_volte_wifi(self):
626        """ Test MO MMS during VoLTE call and WiFi connected
627
628        Make sure PhoneA is in 5G NSA (with VoLTE).
629        Make sure PhoneA is able to make call.
630        Connect PhoneA to Wifi.
631        Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
632        Make sure PhoneA is in 5G NSA.
633
634        Returns:
635            True if pass; False if fail.
636        """
637        return message_test(self.log,
638                            self.android_devices[0],
639                            self.android_devices[1],
640                            mo_rat='5g_volte',
641                            mt_rat='default',
642                            msg_type='mms',
643                            msg_in_call=True,
644                            wifi_ssid=self.wifi_network_ssid,
645                            wifi_pwd=self.wifi_network_pass)
646
647    @test_tracker_info(uuid="95472ce7-0947-4199-bb6a-8fbb189f3c5c")
648    @TelephonyBaseTest.tel_test_wrap
649    def test_5g_nsa_mms_mt_in_call_volte_wifi(self):
650        """ Test MT MMS during VoLTE call and WiFi connected
651
652        Make sure PhoneA is in 5G NSA (with VoLTE).
653        Make sure PhoneA is able to receive call.
654        Connect PhoneA to Wifi.
655        Call from PhoneB to PhoneA, accept on PhoneA, send MMS on PhoneB.
656        Make sure PhoneA is in 5G NSA.
657
658        Returns:
659            True if pass; False if fail.
660        """
661        return message_test(self.log,
662                            self.android_devices[1],
663                            self.android_devices[0],
664                            mo_rat='default',
665                            mt_rat='5g_volte',
666                            msg_type='mms',
667                            msg_in_call=True,
668                            wifi_ssid=self.wifi_network_ssid,
669                            wifi_pwd=self.wifi_network_pass)
670
671    @test_tracker_info(uuid="738e2d29-c82d-4a4a-9f4b-e8f8688151ee")
672    @TelephonyBaseTest.tel_test_wrap
673    def test_5g_nsa_mms_long_message_mo(self):
674        """Test MO long MMS basic function for 1 phone in nsa 5G network.
675
676        Airplane mode is off. PhoneA in nsa 5G.
677        Send long MMS from PhoneA to PhoneB.
678        Verify received message on PhoneB is correct.
679
680        Returns:
681            True if success.
682            False if failed.
683        """
684        return message_test(self.log,
685                            self.android_devices[0],
686                            self.android_devices[1],
687                            mo_rat='5g',
688                            mt_rat='default',
689                            msg_type='mms',
690                            long_msg=True)
691
692    @test_tracker_info(uuid="68f4f0d6-b798-4d0b-9500-ce49f009b61a")
693    @TelephonyBaseTest.tel_test_wrap
694    def test_5g_nsa_mms_long_message_mt(self):
695        """Test MT long MMS basic function for 1 phone in nsa 5G network.
696
697        Airplane mode is off. PhoneA in nsa 5G.
698        Send long MMS from PhoneB to PhoneA.
699        Verify received message on PhoneA is correct.
700
701        Returns:
702            True if success.
703            False if failed.
704        """
705        return message_test(self.log,
706                            self.android_devices[1],
707                            self.android_devices[0],
708                            mo_rat='default',
709                            mt_rat='5g',
710                            msg_type='mms',
711                            long_msg=True)
712
713    @test_tracker_info(uuid="a379fac4-1aa6-46e0-8cef-6d2452702e04")
714    @TelephonyBaseTest.tel_test_wrap
715    def test_5g_nsa_mms_mo_in_call_csfb_wifi(self):
716        """ Test MO MMS during a MO csfb call and device connects to Wifi.
717
718        Disable APM on PhoneA
719        Set up PhoneA in CSFB mode.
720        Provision PhoneA in 5g NSA.
721        Make sure PhoneA is able to make call.
722        Connect PhoneA to Wifi.
723        Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA,
724         receive MMS on B.
725
726        Returns:
727            True if pass; False if fail.
728        """
729        return message_test(self.log,
730                            self.android_devices[0],
731                            self.android_devices[1],
732                            mo_rat='5g_csfb',
733                            mt_rat='default',
734                            msg_type='mms',
735                            msg_in_call=True,
736                            wifi_ssid=self.wifi_network_ssid,
737                            wifi_pwd=self.wifi_network_pass)
738
739    @test_tracker_info(uuid="1a6543b1-b7d6-4260-8276-88aee649c4b2")
740    @TelephonyBaseTest.tel_test_wrap
741    def test_5g_nsa_mms_mt_in_call_csfb_wifi(self):
742        """ Test MT MMS during a MT csfb call and device connects to Wifi.
743
744        Disable APM on PhoneA
745        Set up PhoneA is CSFB mode.
746        Provision PhoneA in 5g NSA.
747        Make sure PhoneA is able to receive call.
748        Connect PhoneA to Wifi.
749        Call from PhoneB to PhoneA, accept on PhoneA, send MMS on PhoneB,
750         receive MMS on A.
751
752        Returns:
753            True if pass; False if fail.
754        """
755        return message_test(self.log,
756                            self.android_devices[1],
757                            self.android_devices[0],
758                            mo_rat='default',
759                            mt_rat='5g_csfb',
760                            msg_type='mms',
761                            msg_in_call=True,
762                            wifi_ssid=self.wifi_network_ssid,
763                            wifi_pwd=self.wifi_network_pass)
764
765    @test_tracker_info(uuid="536c8e25-2d72-46a6-89e1-03f70c5a28a3")
766    @TelephonyBaseTest.tel_test_wrap
767    def test_5g_nsa_mms_multiple_pdns_mo(self):
768        """Test 5G NSA for multiple pdns
769
770        Steps:
771            (1) UE supports EN-DC option 3.
772            (2) SIM with 5G service.
773            (3) UE is provisioned for 5G service and powered off.
774            (4) NR cell (Cell 2) that is within the coverage of LTE cell (Cell 1).
775            (5) UE is in near cell coverage for LTE (Cell 1) and NR (Cell 2).
776            (6) Power on the UE.
777            (7) Initiate data transfer while UE is in idle mode.
778            (8) During data transferring, send a MO MMS.
779            (9) End the data transfer
780
781        Returns:
782            True if pass; False if fail.
783        """
784        cell_1 = self.android_devices[0]
785        cell_2 = self.android_devices[1]
786        if not phone_setup_volte(self.log, cell_1):
787            cell_1.log.error("Failed to setup on VoLTE")
788            return False
789
790        if not verify_internet_connection(self.log, cell_1):
791            return False
792        if not provision_device_for_5g(self.log, cell_2, nr_type='nsa'):
793            cell_2.log.error("Failed to setup on 5G NSA")
794            return False
795        if not verify_internet_connection(self.log, cell_2):
796            return False
797        if not active_file_download_task(self.log, cell_2):
798            return False
799        download_task = active_file_download_task(self.log, cell_2, "10MB")
800        message_task = (message_test, (self.log, cell_2, cell_1, '5g', 'volte',
801                                       'mms'))
802        results = run_multithread_func(self.log, [download_task, message_task])
803
804        if ((results[0]) & (results[1])):
805            self.log.info(
806                "PASS - MO MMS test validated over active data transfer")
807        elif ((results[0] == False) & (results[1] == True)):
808            self.log.error("FAIL - Data Transfer failed")
809        elif ((results[0] == True) & (results[1] == False)):
810            self.log.error("FAIL - Sending MMS failed")
811        else:
812            self.log.error("FAILED - MO MMS test over active data transfer")
813
814        return results
815
816    @test_tracker_info(uuid="10212ab7-a03f-4e11-889e-236b8d1d8afc")
817    @TelephonyBaseTest.tel_test_wrap
818    def test_5g_nsa_mms_multiple_pdns_mt(self):
819        """Test 5G NSA for multiple pdns
820
821        Steps:
822            (1) UE supports EN-DC option 3.
823            (2) SIM with 5G service.
824            (3) UE is provisioned for 5G service and powered off.
825            (4) NR cell (Cell 2) that is within the coverage of LTE cell (Cell 1).
826            (5) UE is in near cell coverage for LTE (Cell 1) and NR (Cell 2).
827            (6) Power on the UE.
828            (7) Initiate data transfer while UE is in idle mode.
829            (8) During data transferring, send a MT MMS.
830            (9) End the data transfer.
831
832        Returns:
833            True if pass; False if fail.
834        """
835        cell_1 = self.android_devices[0]
836        cell_2 = self.android_devices[1]
837
838        if not phone_setup_volte(self.log, cell_1):
839            cell_1.log.error("Failed to setup on VoLTE")
840            return False
841        if not verify_internet_connection(self.log, cell_1):
842            return False
843        if not provision_device_for_5g(self.log, cell_2, nr_type='nsa'):
844            cell_2.log.error("Failed to setup on 5G NSA")
845            return False
846        if not verify_internet_connection(self.log, cell_2):
847            return False
848        if not active_file_download_task(self.log, cell_2):
849            return False
850
851        download_task = active_file_download_task(self.log, cell_2, "10MB")
852        message_task = (message_test, (self.log, cell_1, cell_2, 'volte', '5g',
853                                       'mms'))
854        results = run_multithread_func(self.log, [download_task, message_task])
855
856        if ((results[0]) & (results[1])):
857            self.log.info(
858                "PASS - MT MMS test validated over active data transfer")
859        elif ((results[0] == False) & (results[1] == True)):
860            self.log.error("FAIL - Data Transfer failed")
861        elif ((results[0] == True) & (results[1] == False)):
862            self.log.error("FAIL - Sending MMS failed")
863        else:
864            self.log.error("FAILED - MT MMS test over active data transfer")
865
866        return results
867
868    """ Tests End """
869