• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
20import time
21
22from acts.test_decorators import test_tracker_info
23from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
24from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING
25from acts_contrib.test_utils.tel.tel_defines import SMS_OVER_WIFI_PROVIDERS
26from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
27from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle
28from acts_contrib.test_utils.tel.tel_test_utils import ensure_wifi_connected
29from acts_contrib.test_utils.tel.tel_test_utils import ensure_phone_default_state
30from acts_contrib.test_utils.tel.tel_test_utils import multithread_func
31from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
32from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte
33from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb
34from acts_contrib.test_utils.tel.tel_5g_test_utils import connect_both_devices_to_wifi
35from acts_contrib.test_utils.tel.tel_5g_test_utils import disable_apm_mode_both_devices
36from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_device_for_5g
37from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_volte
38from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_wfc_cell_pref
39from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_wfc_wifi_pref
40from acts_contrib.test_utils.tel.tel_5g_test_utils import verify_5g_attach_for_both_devices
41from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_csfb
42from acts_contrib.test_utils.tel.tel_5g_utils import is_current_network_5g_nsa
43from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mo
44from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mt
45from acts_contrib.test_utils.tel.tel_mms_utils import _long_mms_test_mo
46from acts_contrib.test_utils.tel.tel_mms_utils import test_mms_mo_in_call
47
48
49class Nsa5gMmsTest(TelephonyBaseTest):
50    def setup_class(self):
51        super().setup_class()
52        self.number_of_devices = 2
53        self.message_lengths = (50, 160, 180)
54
55        is_roaming = False
56        for ad in self.android_devices:
57            ad.sms_over_wifi = False
58            # verizon supports sms over wifi. will add more carriers later
59            for sub in ad.telephony["subscription"].values():
60                if sub["operator"] in SMS_OVER_WIFI_PROVIDERS:
61                    ad.sms_over_wifi = True
62            if getattr(ad, 'roaming', False):
63                is_roaming = True
64        if is_roaming:
65            # roaming device does not allow message of length 180
66            self.message_lengths = (50, 160)
67
68    def setup_test(self):
69        TelephonyBaseTest.setup_test(self)
70
71    def teardown_test(self):
72        ensure_phones_idle(self.log, self.android_devices)
73
74
75    """ Tests Begin """
76
77
78    @test_tracker_info(uuid="bc484c2c-8086-42db-94cd-a1e4a35f35cf")
79    @TelephonyBaseTest.tel_test_wrap
80    def test_5g_nsa_mms_mo_mt(self):
81        """Test MMS between two phones in 5g NSA
82
83        Provision devices in 5g NSA
84        Send and Verify MMS from PhoneA to PhoneB
85        Verify both devices are still on 5g NSA
86
87        Returns:
88            True if success.
89            False if failed.
90        """
91        ads = self.android_devices
92        if not provision_device_for_5g(self.log, ads):
93            return False
94
95        if not _mms_test_mo(self.log, ads):
96            return False
97
98        if not verify_5g_attach_for_both_devices(self.log, ads):
99            return False
100
101        self.log.info("PASS - mms test over 5g nsa validated")
102        return True
103
104
105    @test_tracker_info(uuid="51d42104-cb87-4c9b-9a16-302e246a21dc")
106    @TelephonyBaseTest.tel_test_wrap
107    def test_5g_nsa_mms_mo_mt_volte(self):
108        """Test MMS between two phones with VoLTE on 5G NSA
109
110        Provision devices on VoLTE
111        Provision devices in 5g NSA
112        Send and Verify MMS from PhoneA to PhoneB
113        Verify both devices are still on 5g NSA
114
115        Returns:
116            True if success.
117            False if failed.
118        """
119
120        ads = self.android_devices
121        if not provision_both_devices_for_volte(self.log, ads):
122            return False
123
124        if not provision_device_for_5g(self.log, ads):
125            return False
126
127        if not _mms_test_mo(self.log, ads):
128            return False
129
130        if not verify_5g_attach_for_both_devices(self.log, ads):
131            return False
132
133        self.log.info("PASS - volte mms test over 5g nsa validated")
134        return True
135
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        ads = self.android_devices
152        if not provision_both_devices_for_volte(self.log, ads):
153            return False
154
155        if not provision_device_for_5g(self.log, ads):
156            return False
157
158        self.log.info("Begin Incall mms test.")
159        if not call_setup_teardown(
160                self.log,
161                ads[0],
162                ads[1],
163                ad_hangup=None,
164                verify_caller_func=is_phone_in_call_volte,
165                verify_callee_func=None):
166            return False
167
168        if not _mms_test_mo(self.log, ads):
169            return False
170
171        if not verify_5g_attach_for_both_devices(self.log, ads):
172            return False
173        self.log.info("PASS - Incall volte mms test over 5g nsa validated")
174        return True
175
176
177    @test_tracker_info(uuid="bbb4b80c-fc1b-4377-b3c7-eeed642c5980")
178    @TelephonyBaseTest.tel_test_wrap
179    def test_5g_nsa_mms_mo_mt_iwlan(self):
180        """ Test MMS text function between two phones,
181        Phones in APM, WiFi connected, WFC Cell Preferred mode.
182
183        Disable APM on both devices
184        Provision devices in 5g NSA
185        Provision devices for WFC Cell Pref with APM ON
186        Send and Verify MMS from PhoneA to PhoneB
187
188        Returns:
189            True if pass; False if fail.
190        """
191
192        ads = self.android_devices
193        if not disable_apm_mode_both_devices(self.log, ads):
194            return False
195
196        if not provision_device_for_5g(self.log, ads):
197            return False
198
199        if not provision_both_devices_for_wfc_cell_pref(self.log,
200                                                        ads,
201                                                        self.wifi_network_ssid,
202                                                        self.wifi_network_pass,
203                                                        apm_mode=True):
204            return False
205        time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
206
207        if not _mms_test_mo(self.log, ads):
208            return False
209
210        self.log.info("PASS - iwlan mms test over 5g nsa validated")
211        return True
212
213
214    @test_tracker_info(uuid="d36d95dc-0973-4711-bb08-c29ce23495e4")
215    @TelephonyBaseTest.tel_test_wrap
216    def test_5g_nsa_mms_mo_mt_iwlan_apm_off(self):
217        """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
218
219        Disable APM on both devices
220        Provision devices in 5g NSA
221        Provision devices for WFC Wifi Pref with APM OFF
222        Send and Verify MMS from PhoneA to PhoneB
223        Verify 5g NSA attach for both devices
224
225        Returns:
226            True if pass; False if fail.
227        """
228
229        ads = self.android_devices
230        if not disable_apm_mode_both_devices(self.log, ads):
231            return False
232
233        if not provision_device_for_5g(self.log, ads):
234            return False
235
236        if not provision_both_devices_for_wfc_wifi_pref(self.log,
237                                                        ads,
238                                                        self.wifi_network_ssid,
239                                                        self.wifi_network_pass,
240                                                        apm_mode=False):
241            return False
242        time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
243
244        if not _mms_test_mo(self.log, ads):
245            self.log.error("Failed to send receive sms over 5g nsa")
246            return False
247        self.log.info("PASS - iwlan mms test over 5g nsa validated")
248
249        if not verify_5g_attach_for_both_devices(self.log, ads):
250            return False
251        return True
252
253
254    @test_tracker_info(uuid="74ffb79e-f1e9-4087-a9d2-e07878e47869")
255    @TelephonyBaseTest.tel_test_wrap
256    def test_5g_nsa_mms_mo_mt_in_call_iwlan(self):
257        """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
258
259        Disable APM on both devices
260        Provision devices in 5g NSA
261        Provision devices for WFC Wifi Pref with APM ON
262        Make a Voice call from PhoneA to PhoneB
263        Send and Verify MMS from PhoneA to PhoneB
264
265        Returns:
266            True if pass; False if fail.
267        """
268
269        ads = self.android_devices
270
271        if not disable_apm_mode_both_devices(self.log, ads):
272            return False
273
274        if not provision_device_for_5g(self.log, ads):
275            return False
276
277        if not provision_both_devices_for_wfc_wifi_pref(self.log,
278                                                        ads,
279                                                        self.wifi_network_ssid,
280                                                        self.wifi_network_pass,
281                                                        apm_mode=True):
282            return False
283        time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
284
285        self.log.info("Begin Incall mms test")
286        if not call_setup_teardown(
287                self.log,
288                ads[0],
289                ads[1],
290                ad_hangup=None,
291                verify_caller_func=is_phone_in_call_iwlan,
292                verify_callee_func=None):
293            return False
294
295        return _mms_test_mo(self.log, ads)
296
297
298    @test_tracker_info(uuid="68c8e0ca-bea4-45e4-92cf-19424ee47ca4")
299    @TelephonyBaseTest.tel_test_wrap
300    def test_5g_nsa_mms_mo_mt_in_call_volte_wifi(self):
301        """ Test MMS during VoLTE call and WiFi connected
302
303        Make sure PhoneA/B are in 5G NSA (with VoLTE).
304        Make sure PhoneA/B are able to make/receive call.
305        Connect PhoneA/B to Wifi.
306        Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
307        Make sure PhoneA/B are in 5G NSA.
308
309        Returns:
310            True if pass; False if fail.
311        """
312        ads = self.android_devices
313        if not provision_both_devices_for_volte(self.log, ads):
314            return False
315
316        if not provision_device_for_5g(self.log, ads):
317            return False
318
319        if not connect_both_devices_to_wifi(self.log,
320                                            ads,
321                                            self.wifi_network_ssid,
322                                            self.wifi_network_pass):
323            return False
324
325        self.log.info("Begin In Call MMS Test.")
326        if not call_setup_teardown(
327                self.log,
328                ads[0],
329                ads[1],
330                ad_hangup=None,
331                verify_caller_func=is_phone_in_call_volte,
332                verify_callee_func=None):
333            return False
334
335        if not _mms_test_mo(self.log, ads):
336            return False
337
338        if not verify_5g_attach_for_both_devices(self.log, ads):
339            return False
340        return True
341
342
343    @test_tracker_info(uuid="8c795c3a-59d4-408c-9b99-5287e79ba00b")
344    @TelephonyBaseTest.tel_test_wrap
345    def test_5g_nsa_mms_long_message_mo_mt(self):
346        """Test MMS basic function between two phone. Phones in nsa 5G network.
347
348        Airplane mode is off. Phone in nsa 5G.
349        Send MMS from PhoneA to PhoneB.
350        Verify received message on PhoneB is correct.
351
352        Returns:
353            True if success.
354            False if failed.
355        """
356
357        ads = self.android_devices
358
359        if not disable_apm_mode_both_devices(self.log, ads):
360            return False
361
362        if not provision_device_for_5g(self.log, ads):
363            return False
364
365        return _long_mms_test_mo(self.log, ads)
366
367
368    @test_tracker_info(uuid="e09b82ab-69a9-4eae-8cbe-b6f2cff993ad")
369    @TelephonyBaseTest.tel_test_wrap
370    def test_5g_nsa_mms_mo_wifi(self):
371        """Test MMS basic function between two phone. Phones in nsa 5g network.
372
373        Airplane mode is off. Phone in nsa 5G.
374        Connect to Wifi.
375        Send MMS from PhoneA to PhoneB.
376        Verify received message on PhoneB is correct.
377
378        Returns:
379            True if success.
380            False if failed.
381        """
382
383        ads = self.android_devices
384
385        if not disable_apm_mode_both_devices(self.log, ads):
386            return False
387
388        if not provision_device_for_5g(self.log, ads):
389            return False
390
391        ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
392                              self.wifi_network_pass)
393
394        return _mms_test_mo(self.log, ads)
395
396
397    @test_tracker_info(uuid="fedae24f-2577-4f84-9d76-53bbbe109d48")
398    @TelephonyBaseTest.tel_test_wrap
399    def test_5g_nsa_mms_mt_wifi(self):
400        """Test MMS basic function between two phone. Phones in nsa 5g network.
401
402        Airplane mode is off. Phone in nsa 5G.
403        Connect to Wifi.
404        Send MMS from PhoneB to PhoneA.
405        Verify received message on PhoneA is correct.
406
407        Returns:
408            True if success.
409            False if failed.
410        """
411
412        ads = self.android_devices
413
414        if not disable_apm_mode_both_devices(self.log, ads):
415            return False
416
417        if not provision_device_for_5g(self.log, ads):
418            return False
419
420        ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
421                              self.wifi_network_pass)
422
423        return _mms_test_mt(self.log, ads)
424
425
426    @test_tracker_info(uuid="156bf832-acc2-4729-a69d-b471cd5cfbde")
427    @TelephonyBaseTest.tel_test_wrap
428    def test_5g_nsa_mms_mo_mt_in_call_csfb_wifi(self):
429        """ Test MO/MT MMS during a MO csfb call and devices connect to Wifi.
430
431        Disable APM on both devices
432        Set up PhoneA/PhoneB are in CSFB mode.
433        Provision PhoneA/B in 5g NSA.
434        Make sure PhoneA/B is able to make/receive call.
435        Connect PhoneA/B to Wifi.
436        Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA,
437         receive MMS on B.
438
439        Returns:
440            True if pass; False if fail.
441        """
442        ads = self.android_devices
443
444        if not disable_apm_mode_both_devices(self.log, ads):
445            return False
446
447        if not provision_both_devices_for_csfb(self.log, ads):
448            return False
449        time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
450
451        if not provision_both_devices_for_5g(self.log, ads):
452            return False
453
454        if not connect_both_devices_to_wifi(self.log,
455                                            ads,
456                                            self.wifi_network_ssid,
457                                            self.wifi_network_pass):
458            return False
459        if not test_mms_mo_in_call(self.log,
460                                   ads,
461                                   wifi=True,
462                                   caller_func=is_phone_in_call_csfb):
463            return False
464
465
466    @test_tracker_info(uuid="88bd6658-30fa-41b1-b5d9-0f9dadd83219")
467    @TelephonyBaseTest.tel_test_wrap
468    def test_5g_nsa_mms_mo_general(self):
469        """Test MO MMS for 1 phone in 5g NSA. The other phone in any network
470
471        Provision PhoneA in 5g NSA
472        Send and Verify MMS from PhoneA to PhoneB
473        Verify phoneA is still on 5g NSA
474
475        Returns:
476            True if success.
477            False if failed.
478        """
479        ads = self.android_devices
480        tasks = [(provision_device_for_5g, (self.log, ads[0])),
481                 (ensure_phone_default_state, (self.log, ads[1]))]
482        if not multithread_func(self.log, tasks):
483            return Fals
484
485        if not _mms_test_mo(self.log, ads):
486            return False
487
488        if not is_current_network_5g_nsa(ads[0]):
489            return False
490
491        self.log.info("PASS - MO mms test over 5g nsa validated")
492        return True
493
494
495    @test_tracker_info(uuid="11f2e2c8-bb63-43fa-b279-e7bb32f80596")
496    @TelephonyBaseTest.tel_test_wrap
497    def test_5g_nsa_mms_mt_general(self):
498        """Test MT MMS for 1 phone in 5g NSA. The other phone in any network
499
500        Provision PhoneA in 5g NSA
501        Send and Verify MMS from PhoneB to PhoneA
502        Verify phoneA is still on 5g NSA
503
504        Returns:
505            True if success.
506            False if failed.
507        """
508        ads = self.android_devices
509        tasks = [(provision_device_for_5g, (self.log, ads[0])),
510                 (ensure_phone_default_state, (self.log, ads[1]))]
511        if not multithread_func(self.log, tasks):
512            return False
513
514        if not _mms_test_mt(self.log, ads):
515            return False
516
517        if not is_current_network_5g_nsa(ads[0]):
518            return False
519
520        self.log.info("PASS - MT mms test over 5g nsa validated")
521        return True
522
523    """ Tests End """
524