1#!/usr/bin/env python3
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
17import re
18import time
19
20from acts import asserts
21from acts import signals
22from acts.test_decorators import test_tracker_info
23from acts_contrib.test_utils.tel.loggers.protos.telephony_metric_pb2 import \
24    TelephonyVoiceTestResult
25from acts_contrib.test_utils.tel.loggers.telephony_metric_logger import \
26    TelephonyMetricLogger
27from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
28from acts_contrib.test_utils.tel.tel_defines import CALL_CAPABILITY_MANAGE_CONFERENCE
29from acts_contrib.test_utils.tel.tel_defines import CALL_PROPERTY_CONFERENCE
30from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_ACTIVE
31from acts_contrib.test_utils.tel.tel_defines import CAPABILITY_CONFERENCE
32from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL
33from acts_contrib.test_utils.tel.tel_defines import INVALID_SUB_ID
34from acts_contrib.test_utils.tel.tel_subscription_utils import \
35    get_incoming_voice_sub_id
36from acts_contrib.test_utils.tel.tel_subscription_utils import \
37    get_outgoing_voice_sub_id
38from acts_contrib.test_utils.tel.tel_subscription_utils import get_subid_from_slot_index
39from acts_contrib.test_utils.tel.tel_subscription_utils import set_voice_sub_id
40from acts_contrib.test_utils.tel.tel_subscription_utils import set_dds_on_slot_0
41from acts_contrib.test_utils.tel.tel_subscription_utils import set_dds_on_slot_1
42from acts_contrib.test_utils.tel.tel_subscription_utils import \
43    get_subid_on_same_network_of_host_ad
44from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
45from acts_contrib.test_utils.tel.tel_test_utils import hangup_call
46from acts_contrib.test_utils.tel.tel_test_utils import multithread_func
47from acts_contrib.test_utils.tel.tel_test_utils import num_active_calls
48from acts_contrib.test_utils.tel.tel_test_utils import verify_incall_state
49from acts_contrib.test_utils.tel.tel_test_utils import get_capability_for_subscription
50from acts_contrib.test_utils.tel.tel_test_utils import verify_http_connection
51from acts_contrib.test_utils.tel.tel_test_utils import set_call_waiting
52from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle
53from acts_contrib.test_utils.tel.tel_test_utils import initiate_call
54from acts_contrib.test_utils.tel.tel_test_utils import \
55    wait_and_reject_call_for_subscription
56from acts_contrib.test_utils.tel.tel_test_utils import erase_call_forwarding_by_mmi
57from acts_contrib.test_utils.tel.tel_test_utils import get_operator_name
58from acts_contrib.test_utils.tel.tel_voice_utils import get_cep_conference_call_id
59from acts_contrib.test_utils.tel.tel_voice_utils import \
60    three_phone_call_forwarding_short_seq
61from acts_contrib.test_utils.tel.tel_voice_utils import \
62    three_phone_call_waiting_short_seq
63from acts_contrib.test_utils.tel.tel_voice_utils import swap_calls
64from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_on_rat
65from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_on_rat
66
67CallResult = TelephonyVoiceTestResult.CallResult.Value
68
69class TelLiveGFTDSDSSupplementaryServiceTest(TelephonyBaseTest):
70    def setup_class(self):
71        TelephonyBaseTest.setup_class(self)
72        self.message_lengths = (50, 160, 180)
73        self.tel_logger = TelephonyMetricLogger.for_test_case()
74        self.erase_call_forwarding(self.log, self.android_devices[0])
75        if not get_capability_for_subscription(
76            self.android_devices[0],
77            CAPABILITY_CONFERENCE,
78            get_outgoing_voice_sub_id(self.android_devices[0])):
79            self.android_devices[0].log.error(
80                "Conference call is not supported, abort test.")
81            raise signals.TestAbortClass(
82                "Conference call is not supported, abort test.")
83
84    def teardown_test(self):
85        ensure_phones_idle(self.log, self.android_devices)
86        self.erase_call_forwarding(self.log, self.android_devices[0])
87        set_call_waiting(self.log, self.android_devices[0], enable=1)
88
89    def _hangup_call(self, ad, device_description='Device'):
90        if not hangup_call(self.log, ad):
91            ad.log.error("Failed to hang up on %s", device_description)
92            return False
93        return True
94
95    def erase_call_forwarding(self, log, ad):
96        slot0_sub_id = get_subid_from_slot_index(log, ad, 0)
97        slot1_sub_id = get_subid_from_slot_index(log, ad, 1)
98        current_voice_sub_id = get_incoming_voice_sub_id(ad)
99        for sub_id in (slot0_sub_id, slot1_sub_id):
100            set_voice_sub_id(ad, sub_id)
101            get_operator_name(log, ad, sub_id)
102            erase_call_forwarding_by_mmi(log, ad)
103        set_voice_sub_id(ad, current_voice_sub_id)
104
105    def _three_phone_call_mo_add_mt(
106        self,
107        ads,
108        phone_setups,
109        verify_funcs,
110        reject_once=False):
111        """Use 3 phones to make MO call and MT call.
112
113        Call from PhoneA to PhoneB, accept on PhoneB.
114        Call from PhoneC to PhoneA, accept on PhoneA.
115
116        Args:
117            ads: list of ad object.
118                The list should have three objects.
119            phone_setups: list of phone setup functions.
120                The list should have three objects.
121            verify_funcs: list of phone call verify functions.
122                The list should have three objects.
123
124        Returns:
125            If success, return 'call_AB' id in PhoneA.
126            if fail, return None.
127        """
128
129        class _CallException(Exception):
130            pass
131
132        try:
133            verify_func_a, verify_func_b, verify_func_c = verify_funcs
134            tasks = []
135            for ad, setup_func in zip(ads, phone_setups):
136                if setup_func is not None:
137                    tasks.append((setup_func, (self.log, ad, get_incoming_voice_sub_id(ad))))
138            if tasks != [] and not multithread_func(self.log, tasks):
139                self.log.error("Phone Failed to Set Up Properly.")
140                raise _CallException("Setup failed.")
141            for ad in ads:
142                ad.droid.telecomCallClearCallList()
143                if num_active_calls(self.log, ad) != 0:
144                    ad.log.error("Phone Call List is not empty.")
145                    raise _CallException("Clear call list failed.")
146
147            self.log.info("Step1: Call From PhoneA to PhoneB.")
148            if not call_setup_teardown(
149                    self.log,
150                    ads[0],
151                    ads[1],
152                    ad_hangup=None,
153                    verify_caller_func=verify_func_a,
154                    verify_callee_func=verify_func_b):
155                raise _CallException("PhoneA call PhoneB failed.")
156
157            calls = ads[0].droid.telecomCallGetCallIds()
158            ads[0].log.info("Calls in PhoneA %s", calls)
159            if num_active_calls(self.log, ads[0]) != 1:
160                raise _CallException("Call list verify failed.")
161            call_ab_id = calls[0]
162
163            self.log.info("Step2: Call From PhoneC to PhoneA.")
164            if reject_once:
165                self.log.info("Step2-1: Reject incoming call once.")
166                if not initiate_call(
167                    self.log,
168                    ads[2],
169                    ads[0].telephony['subscription'][get_incoming_voice_sub_id(
170                        ads[0])]['phone_num']):
171                    ads[2].log.error("Initiate call failed.")
172                    raise _CallException("Failed to initiate call.")
173
174                if not wait_and_reject_call_for_subscription(
175                        self.log,
176                        ads[0],
177                        get_incoming_voice_sub_id(ads[0]),
178                        incoming_number= \
179                            ads[2].telephony['subscription'][
180                                get_incoming_voice_sub_id(
181                                    ads[2])]['phone_num']):
182                    ads[0].log.error("Reject call fail.")
183                    raise _CallException("Failed to reject call.")
184
185                self._hangup_call(ads[2], "PhoneC")
186                time.sleep(15)
187
188            if not call_setup_teardown(
189                    self.log,
190                    ads[2],
191                    ads[0],
192                    ad_hangup=None,
193                    verify_caller_func=verify_func_c,
194                    verify_callee_func=verify_func_a):
195                raise _CallException("PhoneA call PhoneC failed.")
196            if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]],
197                                       True):
198                raise _CallException("Not All phones are in-call.")
199
200        except Exception as e:
201            self.log.error(e)
202            setattr(ads[0], "exception", e)
203            return None
204
205        return call_ab_id
206
207    def _test_ims_conference_merge_drop_second_call_from_participant(
208            self, call_ab_id, call_ac_id):
209        """Test conference merge and drop in IMS (VoLTE or WiFi Calling) call.
210        (supporting both cases of CEP enabled and disabled).
211
212        PhoneA in IMS (VoLTE or WiFi Calling) call with PhoneB.
213        PhoneA in IMS (VoLTE or WiFi Calling) call with PhoneC.
214        Merge calls to conference on PhoneA.
215        Hangup on PhoneC, check call continues between AB.
216        Hangup on PhoneB, check A ends.
217
218        Args:
219            call_ab_id: call id for call_AB on PhoneA.
220            call_ac_id: call id for call_AC on PhoneA.
221
222        Returns:
223            True if succeed;
224            False if failed.
225        """
226        ads = self.android_devices
227
228        call_conf_id = self._merge_ims_conference_call(call_ab_id, call_ac_id)
229        if call_conf_id is None:
230            return False
231
232        self.log.info("Step5: End call on PhoneC and verify call continues.")
233        if not self._hangup_call(ads[2], "PhoneC"):
234            return False
235        time.sleep(WAIT_TIME_IN_CALL)
236        calls = ads[0].droid.telecomCallGetCallIds()
237        ads[0].log.info("Calls in PhoneA %s", calls)
238        if not verify_incall_state(self.log, [ads[0], ads[1]], True):
239            return False
240        if not verify_incall_state(self.log, [ads[2]], False):
241            return False
242
243        self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
244        if not self._hangup_call(ads[1], "PhoneB"):
245            return False
246        time.sleep(WAIT_TIME_IN_CALL)
247        if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
248            return False
249        return True
250
251    def _merge_ims_conference_call(self, call_ab_id, call_ac_id):
252        """Merge IMS conference call for both cases of CEP enabled and disabled.
253
254        PhoneA in IMS (VoLTE or WiFi Calling) call with PhoneB.
255        PhoneA in IMS (VoLTE or WiFi Calling) call with PhoneC.
256        Merge calls to conference on PhoneA.
257
258        Args:
259            call_ab_id: call id for call_AB on PhoneA.
260            call_ac_id: call id for call_AC on PhoneA.
261
262        Returns:
263            call_id for conference
264        """
265        ads = self.android_devices
266        self.log.info("Step4: Merge to Conf Call and verify Conf Call.")
267        ads[0].droid.telecomCallJoinCallsInConf(call_ab_id, call_ac_id)
268        time.sleep(WAIT_TIME_IN_CALL)
269        calls = ads[0].droid.telecomCallGetCallIds()
270        ads[0].log.info("Calls in PhoneA %s", calls)
271
272        call_conf_id = None
273        if num_active_calls(self.log, ads[0]) != 1:
274            ads[0].log.info("Total number of call ids is not 1.")
275            call_conf_id = get_cep_conference_call_id(ads[0])
276            if call_conf_id is not None:
277                self.log.info("New conference call id is found. CEP enabled.")
278                calls.remove(call_conf_id)
279                if (set(ads[0].droid.telecomCallGetCallChildren(
280                    call_conf_id)) != set(calls)):
281                    ads[0].log.error(
282                        "Children list %s for conference call is not correct.",
283                        ads[0].droid.telecomCallGetCallChildren(call_conf_id))
284                    return None
285
286                if (CALL_PROPERTY_CONFERENCE not in ads[0]
287                        .droid.telecomCallGetProperties(call_conf_id)):
288                    ads[0].log.error(
289                        "Conf call id % properties wrong: %s", call_conf_id,
290                        ads[0].droid.telecomCallGetProperties(call_conf_id))
291                    return None
292
293                if (CALL_CAPABILITY_MANAGE_CONFERENCE not in ads[0]
294                        .droid.telecomCallGetCapabilities(call_conf_id)):
295                    ads[0].log.error(
296                        "Conf call id %s capabilities wrong: %s", call_conf_id,
297                        ads[0].droid.telecomCallGetCapabilities(call_conf_id))
298                    return None
299
300                if (call_ab_id in calls) or (call_ac_id in calls):
301                    self.log.error("Previous call ids should not in new call"
302                    " list after merge.")
303                    return None
304        else:
305            for call_id in calls:
306                if call_id != call_ab_id and call_id != call_ac_id:
307                    call_conf_id = call_id
308                    self.log.info("CEP not enabled.")
309
310        if not call_conf_id:
311            self.log.error("Merge call fail, no new conference call id.")
312            raise signals.TestFailure(
313                "Calls were not merged. Failed to merge calls.",
314                extras={"fail_reason": "Calls were not merged."
315                    " Failed to merge calls."})
316        if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True):
317            return False
318
319        if ads[0].droid.telecomCallGetCallState(
320                call_conf_id) != CALL_STATE_ACTIVE:
321            ads[0].log.error(
322                "Call_ID: %s, state: %s, expected: STATE_ACTIVE", call_conf_id,
323                ads[0].droid.telecomCallGetCallState(call_conf_id))
324            return None
325
326        return call_conf_id
327
328    def _test_wcdma_conference_merge_drop(self, call_ab_id, call_ac_id):
329        """Test conference merge and drop in WCDMA/CSFB_WCDMA call.
330
331        PhoneA in WCDMA (or CSFB_WCDMA) call with PhoneB.
332        PhoneA in WCDMA (or CSFB_WCDMA) call with PhoneC.
333        Merge calls to conference on PhoneA.
334        Hangup on PhoneC, check call continues between AB.
335        Hangup on PhoneB, check A ends.
336
337        Args:
338            call_ab_id: call id for call_AB on PhoneA.
339            call_ac_id: call id for call_AC on PhoneA.
340
341        Returns:
342            True if succeed;
343            False if failed.
344        """
345        ads = self.android_devices
346
347        self.log.info("Step4: Merge to Conf Call and verify Conf Call.")
348        ads[0].droid.telecomCallJoinCallsInConf(call_ab_id, call_ac_id)
349        time.sleep(WAIT_TIME_IN_CALL)
350        calls = ads[0].droid.telecomCallGetCallIds()
351        ads[0].log.info("Calls in PhoneA %s", calls)
352        num_calls = num_active_calls(self.log, ads[0])
353        if num_calls != 3:
354            ads[0].log.error("Total number of call ids is not 3.")
355            if num_calls == 2:
356                if call_ab_id in calls and call_ac_id in calls:
357                    ads[0].log.error("Calls were not merged."
358                        " Failed to merge calls.")
359                    raise signals.TestFailure(
360                        "Calls were not merged. Failed to merge calls.",
361                        extras={"fail_reason": "Calls were not merged."
362                            " Failed to merge calls."})
363            return False
364        call_conf_id = None
365        for call_id in calls:
366            if call_id != call_ab_id and call_id != call_ac_id:
367                call_conf_id = call_id
368        if not call_conf_id:
369            self.log.error("Merge call fail, no new conference call id.")
370            return False
371        if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], True):
372            return False
373
374        if ads[0].droid.telecomCallGetCallState(
375                call_conf_id) != CALL_STATE_ACTIVE:
376            ads[0].log.error(
377                "Call_id: %s, state: %s, expected: STATE_ACTIVE", call_conf_id,
378                ads[0].droid.telecomCallGetCallState(call_conf_id))
379            return False
380
381        self.log.info("Step5: End call on PhoneC and verify call continues.")
382        if not self._hangup_call(ads[2], "PhoneC"):
383            return False
384        time.sleep(WAIT_TIME_IN_CALL)
385        calls = ads[0].droid.telecomCallGetCallIds()
386        ads[0].log.info("Calls in PhoneA %s", calls)
387        if num_active_calls(self.log, ads[0]) != 1:
388            return False
389        if not verify_incall_state(self.log, [ads[0], ads[1]], True):
390            return False
391        if not verify_incall_state(self.log, [ads[2]], False):
392            return False
393
394        self.log.info("Step6: End call on PhoneB and verify PhoneA end.")
395        if not self._hangup_call(ads[1], "PhoneB"):
396            return False
397        time.sleep(WAIT_TIME_IN_CALL)
398        if not verify_incall_state(self.log, [ads[0], ads[1], ads[2]], False):
399            return False
400        return True
401
402    def _test_msim_call_forwarding(
403            self,
404            caller_slot,
405            callee_slot,
406            forwarded_callee_slot,
407            dds_slot,
408            caller_rat=["", ""],
409            callee_rat=["", ""],
410            forwarded_callee_rat=["", ""],
411            call_forwarding_type="unconditional"):
412        """Make MO voice call to the primary device at specific slot in specific
413        RAT with DDS at specific slot, and then forwarded to 3rd device with
414        specific call forwarding type.
415
416        Test step:
417        1. Get sub IDs of specific slots of both MO and MT devices.
418        2. Switch DDS to specific slot.
419        3. Check HTTP connection after DDS switch.
420        4. Set up phones in desired RAT.
421        5. Register and enable call forwarding with specifc type.
422        5. Make voice call to the primary device and wait for being forwarded
423           to 3rd device.
424
425        Args:
426            caller_slot: Slot of 2nd device making MO call (0 or 1)
427            callee_slot: Slot of primary device receiving and forwarding MT call
428                         (0 or 1)
429            forwarded_callee_slot: Slot of 3rd device receiving forwarded call.
430            dds_slot: Preferred data slot
431            caller_rat: RAT for both slots of the 2nd device
432            callee_rat: RAT for both slots of the primary device
433            forwarded_callee_rat: RAT for both slots of the 3rd device
434            call_forwarding_type:
435                "unconditional"
436                "busy"
437                "not_answered"
438                "not_reachable"
439
440        Returns:
441            True or False
442        """
443        ads = self.android_devices
444
445        ad_caller = ads[1]
446        ad_callee = ads[0]
447        ad_forwarded_callee = ads[2]
448
449        if callee_slot is not None:
450            callee_sub_id = get_subid_from_slot_index(
451                self.log, ad_callee, callee_slot)
452            if callee_sub_id == INVALID_SUB_ID:
453                ad_callee.log.warning(
454                    "Failed to get sub ID at slot %s.", callee_slot)
455                return False
456            callee_other_sub_id = get_subid_from_slot_index(
457                self.log, ad_callee, 1-callee_slot)
458            set_voice_sub_id(ad_callee, callee_sub_id)
459        else:
460            callee_sub_id, _, _ = get_subid_on_same_network_of_host_ad(ads)
461            if callee_sub_id == INVALID_SUB_ID:
462                ad_callee.log.warning(
463                    "Failed to get sub ID at slot %s.", callee_slot)
464                return False
465            callee_slot = "auto"
466            set_voice_sub_id(ad_callee, callee_sub_id)
467        ad_callee.log.info(
468            "Sub ID for incoming call at slot %s: %s",
469            callee_slot, get_incoming_voice_sub_id(ad_callee))
470
471        if caller_slot is not None:
472            caller_sub_id = get_subid_from_slot_index(
473                self.log, ad_caller, caller_slot)
474            if caller_sub_id == INVALID_SUB_ID:
475                ad_caller.log.warning(
476                    "Failed to get sub ID at slot %s.", caller_slot)
477                return False
478            caller_other_sub_id = get_subid_from_slot_index(
479                self.log, ad_caller, 1-caller_slot)
480            set_voice_sub_id(ad_caller, caller_sub_id)
481        else:
482            _, caller_sub_id, _ = get_subid_on_same_network_of_host_ad(ads)
483            if caller_sub_id == INVALID_SUB_ID:
484                ad_caller.log.warning(
485                    "Failed to get sub ID at slot %s.", caller_slot)
486                return False
487            caller_slot = "auto"
488            set_voice_sub_id(ad_caller, caller_sub_id)
489        ad_caller.log.info(
490            "Sub ID for outgoing call at slot %s: %s",
491            caller_slot, get_outgoing_voice_sub_id(ad_caller))
492
493        if forwarded_callee_slot is not None:
494            forwarded_callee_sub_id = get_subid_from_slot_index(
495                self.log, ad_forwarded_callee, forwarded_callee_slot)
496            if forwarded_callee_sub_id == INVALID_SUB_ID:
497                ad_forwarded_callee.log.warning(
498                    "Failed to get sub ID at slot %s.", forwarded_callee_slot)
499                return False
500            forwarded_callee_other_sub_id = get_subid_from_slot_index(
501                self.log, ad_forwarded_callee, 1-forwarded_callee_slot)
502            set_voice_sub_id(
503                ad_forwarded_callee, forwarded_callee_sub_id)
504        else:
505            _, _, forwarded_callee_sub_id = \
506                get_subid_on_same_network_of_host_ad(ads)
507            if forwarded_callee_sub_id == INVALID_SUB_ID:
508                ad_forwarded_callee.log.warning(
509                    "Failed to get sub ID at slot %s.", forwarded_callee_slot)
510                return False
511            forwarded_callee_slot = "auto"
512            set_voice_sub_id(
513                ad_forwarded_callee, forwarded_callee_sub_id)
514        ad_forwarded_callee.log.info(
515            "Sub ID for incoming call at slot %s: %s",
516            forwarded_callee_slot,
517            get_incoming_voice_sub_id(ad_forwarded_callee))
518
519        self.log.info("Step 1: Switch DDS.")
520        if dds_slot:
521            if not set_dds_on_slot_1(ads[0]):
522                self.log.warning(
523                    "Failed to set DDS at eSIM on %s", ads[0].serial)
524                return False
525        else:
526            if not set_dds_on_slot_0(ads[0]):
527                self.log.warning(
528                    "Failed to set DDS at pSIM on %s", ads[0].serial)
529                return False
530
531        self.log.info("Step 2: Check HTTP connection after DDS switch.")
532        if not verify_http_connection(self.log,
533           ads[0],
534           url="https://www.google.com",
535           retry=5,
536           retry_interval=15,
537           expected_state=True):
538
539            self.log.error("Failed to verify http connection.")
540            return False
541        else:
542            self.log.info("Verify http connection successfully.")
543
544        if caller_slot == 1:
545            phone_setup_on_rat(
546                self.log,
547                ad_caller,
548                caller_rat[0],
549                caller_other_sub_id)
550
551        elif caller_slot == 0:
552            phone_setup_on_rat(
553                self.log,
554                ad_caller,
555                caller_rat[1],
556                caller_other_sub_id)
557        else:
558            phone_setup_on_rat(
559                self.log,
560                ad_caller,
561                'general')
562
563        if callee_slot == 1:
564            phone_setup_on_rat(
565                self.log,
566                ad_callee,
567                callee_rat[0],
568                callee_other_sub_id)
569
570        elif callee_slot == 0:
571            phone_setup_on_rat(
572                self.log,
573                ad_callee,
574                callee_rat[1],
575                callee_other_sub_id)
576        else:
577            phone_setup_on_rat(
578                self.log,
579                ad_callee,
580                'general')
581
582        if forwarded_callee_slot == 1:
583            phone_setup_on_rat(
584                self.log,
585                ad_forwarded_callee,
586                forwarded_callee_rat[0],
587                forwarded_callee_other_sub_id)
588
589        elif forwarded_callee_slot == 0:
590            phone_setup_on_rat(
591                self.log,
592                ad_forwarded_callee,
593                forwarded_callee_rat[1],
594                forwarded_callee_other_sub_id)
595        else:
596            phone_setup_on_rat(
597                self.log,
598                ad_forwarded_callee,
599                'general')
600
601        if caller_slot == 0 or caller_slot == 1:
602            caller_phone_setup_func = phone_setup_on_rat(
603                self.log, ad_caller, caller_rat[caller_slot], only_return_fn=True)
604        else:
605            caller_phone_setup_func = phone_setup_on_rat(
606                self.log, ad_caller, 'general', only_return_fn=True)
607
608        callee_phone_setup_func = phone_setup_on_rat(
609            self.log, ad_callee, callee_rat[callee_slot], only_return_fn=True)
610
611        if forwarded_callee_slot == 0 or forwarded_callee_slot == 1:
612            forwarded_callee_phone_setup_func = phone_setup_on_rat(
613                self.log,
614                ad_forwarded_callee,
615                forwarded_callee_rat[forwarded_callee_slot],
616                only_return_fn=True)
617        else:
618            forwarded_callee_phone_setup_func = phone_setup_on_rat(
619                self.log,
620                ad_forwarded_callee,
621                'general',
622                only_return_fn=True)
623
624        self.log.info("Step 3: Set up phones in desired RAT.")
625        tasks = [(caller_phone_setup_func, (self.log, ad_caller, caller_sub_id)),
626                 (callee_phone_setup_func, (self.log, ad_callee, callee_sub_id)),
627                 (forwarded_callee_phone_setup_func,
628                 (self.log, ad_forwarded_callee, forwarded_callee_sub_id))]
629        if not multithread_func(self.log, tasks):
630            self.log.error("Phone Failed to Set Up Properly.")
631            self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE"))
632            raise signals.TestFailure("Failed",
633                extras={"fail_reason": "Phone Failed to Set Up Properly."})
634
635        is_callee_in_call = is_phone_in_call_on_rat(
636            self.log, ad_callee, callee_rat[callee_slot], only_return_fn=True)
637
638        is_call_waiting = re.search(
639            "call_waiting (True (\d)|False)", call_forwarding_type, re.I)
640        if is_call_waiting:
641            if is_call_waiting.group(1) == "False":
642                call_waiting = False
643                scenario = None
644            else:
645                call_waiting = True
646                scenario = int(is_call_waiting.group(2))
647
648            self.log.info(
649                "Step 4: Make voice call with call waiting enabled = %s.",
650                call_waiting)
651            result = three_phone_call_waiting_short_seq(
652                self.log,
653                ads[0],
654                None,
655                is_callee_in_call,
656                ads[1],
657                ads[2],
658                call_waiting=call_waiting, scenario=scenario)
659        else:
660            self.log.info(
661                "Step 4: Make voice call with call forwarding %s.",
662                call_forwarding_type)
663            result = three_phone_call_forwarding_short_seq(
664                self.log,
665                ads[0],
666                None,
667                is_callee_in_call,
668                ads[1],
669                ads[2],
670                call_forwarding_type=call_forwarding_type)
671
672        if not result:
673            if is_call_waiting:
674                pass
675            else:
676                self.log.error(
677                    "Failed to make MO call from %s slot %s to %s slot %s"
678                    " and forward to %s slot %s",
679                    ad_caller.serial,
680                    caller_slot,
681                    ad_callee.serial,
682                    callee_slot,
683                    ad_forwarded_callee.serial,
684                    forwarded_callee_slot)
685
686        return result
687
688    def _test_msim_call_voice_conf(
689            self,
690            host_slot,
691            p1_slot,
692            p2_slot,
693            dds_slot,
694            host_rat=["volte", "volte"],
695            p1_rat="",
696            p2_rat="",
697            merge=True,
698            disable_cw=False):
699        """Make a voice conference call at specific slot in specific RAT with
700        DDS at specific slot.
701
702        Test step:
703        1. Get sub IDs of specific slots of both MO and MT devices.
704        2. Switch DDS to specific slot.
705        3. Check HTTP connection after DDS switch.
706        4. Set up phones in desired RAT and make 3-way voice call.
707        5. Swap calls.
708        6. Merge calls.
709
710        Args:
711            host_slot: Slot on the primary device to host the comference call.
712            0 or 1 (0 for pSIM or 1 for eSIM)
713            p1_slot: Slot on the participant device for the call
714            p2_slot: Slot on another participant device for the call
715            dds_slot: Preferred data slot
716            host_rat: RAT for both slots of the primary device
717            p1_rat: RAT for both slots of the participant device
718            p2_rat: RAT for both slots of another participant device
719            merge: True for merging 2 calls into the conference call. False for
720            not merging 2 separated call.
721            disable_cw: True for disabling call waiting and False on the
722            contrary.
723
724        Returns:
725            True of False
726        """
727        ads = self.android_devices
728        ad_host = ads[0]
729        ad_p1 = ads[1]
730        ad_p2 = ads[2]
731
732        if host_slot is not None:
733            host_sub_id = get_subid_from_slot_index(
734                self.log, ad_host, host_slot)
735            if host_sub_id == INVALID_SUB_ID:
736                ad_host.log.warning("Failed to get sub ID at slot.", host_slot)
737                return False
738            host_other_sub_id = get_subid_from_slot_index(
739                self.log, ad_host, 1-host_slot)
740            set_voice_sub_id(ad_host, host_sub_id)
741        else:
742            host_sub_id, _, _ = get_subid_on_same_network_of_host_ad(ads)
743            if host_sub_id == INVALID_SUB_ID:
744                ad_host.log.warning("Failed to get sub ID at slot.", host_slot)
745                return False
746            host_slot = "auto"
747            set_voice_sub_id(ad_host, host_sub_id)
748
749        ad_host.log.info("Sub ID for outgoing call at slot %s: %s",
750            host_slot, get_outgoing_voice_sub_id(ad_host))
751
752        if p1_slot is not None:
753            p1_sub_id = get_subid_from_slot_index(self.log, ad_p1, p1_slot)
754            if p1_sub_id == INVALID_SUB_ID:
755                ad_p1.log.warning("Failed to get sub ID at slot %s.", p1_slot)
756                return False
757            set_voice_sub_id(ad_p1, p1_sub_id)
758        else:
759            _, p1_sub_id, _ = get_subid_on_same_network_of_host_ad(ads)
760            if p1_sub_id == INVALID_SUB_ID:
761                ad_p1.log.warning("Failed to get sub ID at slot %s.", p1_slot)
762                return False
763            p1_slot = "auto"
764            set_voice_sub_id(ad_p1, p1_sub_id)
765        ad_p1.log.info("Sub ID for incoming call at slot %s: %s",
766            p1_slot, get_incoming_voice_sub_id(ad_p1))
767
768        if p2_slot is not None:
769            p2_sub_id = get_subid_from_slot_index(self.log, ad_p2, p2_slot)
770            if p2_sub_id == INVALID_SUB_ID:
771                ad_p2.log.warning("Failed to get sub ID at slot %s.", p2_slot)
772                return False
773            set_voice_sub_id(ad_p2, p2_sub_id)
774        else:
775            _, _, p2_sub_id = get_subid_on_same_network_of_host_ad(ads)
776            if p2_sub_id == INVALID_SUB_ID:
777                ad_p2.log.warning("Failed to get sub ID at slot %s.", p2_slot)
778                return False
779            p2_slot = "auto"
780            set_voice_sub_id(ad_p2, p2_sub_id)
781        ad_p2.log.info("Sub ID for incoming call at slot %s: %s",
782            p2_slot, get_incoming_voice_sub_id(ad_p2))
783
784        self.log.info("Step 1: Switch DDS.")
785        if dds_slot:
786            if not set_dds_on_slot_1(ads[0]):
787                self.log.warning(
788                    "Failed to set DDS at eSIM on %s", ads[0].serial)
789                return False
790        else:
791            if not set_dds_on_slot_0(ads[0]):
792                self.log.warning(
793                    "Failed to set DDS at pSIM on %s", ads[0].serial)
794                return False
795
796        self.log.info("Step 2: Check HTTP connection after DDS switch.")
797        if not verify_http_connection(self.log,
798           ads[0],
799           url="https://www.google.com",
800           retry=5,
801           retry_interval=15,
802           expected_state=True):
803
804            self.log.error("Failed to verify http connection.")
805            return False
806        else:
807            self.log.info("Verify http connection successfully.")
808
809        if disable_cw:
810            if not set_call_waiting(self.log, ad_host, enable=0):
811                return False
812        else:
813            if not set_call_waiting(self.log, ad_host, enable=1):
814                return False
815
816        if host_slot == 1:
817            phone_setup_on_rat(
818                self.log,
819                ad_host,
820                host_rat[0],
821                host_other_sub_id)
822
823        elif host_slot == 0:
824            phone_setup_on_rat(
825                self.log,
826                ad_host,
827                host_rat[1],
828                host_other_sub_id)
829
830        host_phone_setup_func = phone_setup_on_rat(
831            self.log, ad_host, host_rat[host_slot], only_return_fn=True)
832
833        is_host_in_call = is_phone_in_call_on_rat(
834            self.log, ad_host, host_rat[host_slot], only_return_fn=True)
835
836        if p1_rat:
837            p1_phone_setup_func = phone_setup_on_rat(
838                self.log, ad_p1, p1_rat, only_return_fn=True)
839            is_p1_in_call = is_phone_in_call_on_rat(
840                self.log, ad_p1, p1_rat, only_return_fn=True)
841        else:
842            p1_phone_setup_func = phone_setup_on_rat(
843                self.log, ad_p1, 'general', only_return_fn=True)
844            is_p1_in_call = is_phone_in_call_on_rat(
845                self.log, ad_p1, 'general', only_return_fn=True)
846
847        if p2_rat:
848            p2_phone_setup_func = phone_setup_on_rat(
849                self.log, ad_p2, p2_rat, only_return_fn=True)
850            is_p2_in_call = is_phone_in_call_on_rat(
851                self.log, ad_p2, p2_rat, only_return_fn=True)
852        else:
853            p2_phone_setup_func = phone_setup_on_rat(
854                self.log, ad_p2, 'general', only_return_fn=True)
855            is_p2_in_call = is_phone_in_call_on_rat(
856                self.log, ad_p2, 'general', only_return_fn=True)
857
858        self.log.info("Step 3: Set up phone in desired RAT and make 3-way"
859            " voice call.")
860        call_ab_id = self._three_phone_call_mo_add_mt(
861            [ad_host, ad_p1, ad_p2],
862            [host_phone_setup_func, p1_phone_setup_func, p2_phone_setup_func], [
863                is_host_in_call, is_p1_in_call,
864                is_p2_in_call
865            ])
866
867        if call_ab_id is None:
868            if disable_cw:
869                set_call_waiting(self.log, ad_host, enable=1)
870                if str(getattr(ad_host, "exception", None)) == \
871                    "PhoneA call PhoneC failed.":
872                    ads[0].log.info("PhoneA failed to call PhoneC due to call"
873                        " waiting being disabled.")
874                    delattr(ad_host, "exception")
875                    return True
876            self.log.error("Failed to get call_ab_id")
877            return False
878        else:
879            if disable_cw:
880                return False
881
882        calls = ads[0].droid.telecomCallGetCallIds()
883        ads[0].log.info("Calls in PhoneA %s", calls)
884        if num_active_calls(self.log, ads[0]) != 2:
885            return False
886        if calls[0] == call_ab_id:
887            call_ac_id = calls[1]
888        else:
889            call_ac_id = calls[0]
890
891        if call_ac_id is None:
892            self.log.error("Failed to get call_ac_id")
893            return False
894
895        num_swaps = 2
896        self.log.info("Step 4: Begin Swap x%s test.", num_swaps)
897        if not swap_calls(self.log, ads, call_ab_id, call_ac_id,
898                          num_swaps):
899            self.log.error("Swap test failed.")
900            return False
901
902        if not merge:
903            result = True
904            if not self._hangup_call(ads[1], "PhoneB"):
905                result =  False
906            if not self._hangup_call(ads[2], "PhoneC"):
907                result =  False
908            return result
909        else:
910            self.log.info("Step 5: Merge calls.")
911            if host_rat[host_slot] == "volte":
912                return self._test_ims_conference_merge_drop_second_call_from_participant(
913                    call_ab_id, call_ac_id)
914            else:
915                return self._test_wcdma_conference_merge_drop(
916                    call_ab_id, call_ac_id)
917
918    @test_tracker_info(uuid="ccaeff83-4b8c-488a-8c7f-6bb019528bf8")
919    @TelephonyBaseTest.tel_test_wrap
920    def test_msim_call_forwarding_unconditional_volte_psim_dds_slot_0(self):
921        return self._test_msim_call_forwarding(
922            None,
923            0,
924            None,
925            0,
926            callee_rat=["volte", "volte"],
927            call_forwarding_type="unconditional")
928
929    @test_tracker_info(uuid="a132bfa6-d545-4970-9a39-55aea7477f8c")
930    @TelephonyBaseTest.tel_test_wrap
931    def test_msim_call_forwarding_unconditional_volte_psim_dds_slot_1(self):
932        return self._test_msim_call_forwarding(
933            None,
934            0,
935            None,
936            1,
937            callee_rat=["volte", "volte"],
938            call_forwarding_type="unconditional")
939
940    @test_tracker_info(uuid="71a4db8a-d20f-4fcb-ac5f-5fe6b9fa36f5")
941    @TelephonyBaseTest.tel_test_wrap
942    def test_msim_call_forwarding_unconditional_volte_esim_dds_slot_0(self):
943        return self._test_msim_call_forwarding(
944            None,
945            1,
946            None,
947            0,
948            callee_rat=["volte", "volte"],
949            call_forwarding_type="unconditional")
950
951    @test_tracker_info(uuid="50b064e7-4bf6-4bb3-aed1-e4d78b0b6195")
952    @TelephonyBaseTest.tel_test_wrap
953    def test_msim_call_forwarding_unconditional_volte_esim_dds_slot_1(self):
954        return self._test_msim_call_forwarding(
955            None,
956            1,
957            None,
958            1,
959            callee_rat=["volte", "volte"],
960            call_forwarding_type="unconditional")
961
962
963
964    @test_tracker_info(uuid="b1cfe07f-f4bf-49c4-95f1-f0973f32940e")
965    @TelephonyBaseTest.tel_test_wrap
966    def test_msim_call_forwarding_unconditional_volte_csfb_psim_dds_slot_0(self):
967        return self._test_msim_call_forwarding(
968            None,
969            0,
970            None,
971            0,
972            callee_rat=["volte", "csfb"],
973            call_forwarding_type="unconditional")
974
975    @test_tracker_info(uuid="668bd2c6-beee-4c38-a9e5-8b0cc5937c28")
976    @TelephonyBaseTest.tel_test_wrap
977    def test_msim_call_forwarding_unconditional_volte_csfb_psim_dds_slot_1(self):
978        return self._test_msim_call_forwarding(
979            None,
980            0,
981            None,
982            1,
983            callee_rat=["volte", "csfb"],
984            call_forwarding_type="unconditional")
985
986    @test_tracker_info(uuid="d69e86f3-f279-4cc8-8c1f-8a9dce0acfdf")
987    @TelephonyBaseTest.tel_test_wrap
988    def test_msim_call_forwarding_unconditional_volte_csfb_esim_dds_slot_0(self):
989        return self._test_msim_call_forwarding(
990            None,
991            1,
992            None,
993            0,
994            callee_rat=["volte", "csfb"],
995            call_forwarding_type="unconditional")
996
997    @test_tracker_info(uuid="6156c374-7b07-473b-84f7-45de633f9681")
998    @TelephonyBaseTest.tel_test_wrap
999    def test_msim_call_forwarding_unconditional_volte_csfb_esim_dds_slot_1(self):
1000        return self._test_msim_call_forwarding(
1001            None,
1002            1,
1003            None,
1004            1,
1005            callee_rat=["volte", "csfb"],
1006            call_forwarding_type="unconditional")
1007
1008
1009
1010    @test_tracker_info(uuid="29e36a21-9c94-418b-8628-e601e56fb168")
1011    @TelephonyBaseTest.tel_test_wrap
1012    def test_msim_call_forwarding_unconditional_csfb_volte_psim_dds_slot_0(self):
1013        return self._test_msim_call_forwarding(
1014            None,
1015            0,
1016            None,
1017            0,
1018            callee_rat=["csfb", "volte"],
1019            call_forwarding_type="unconditional")
1020
1021    @test_tracker_info(uuid="36ebf549-e64e-4093-bebf-c9ca56289477")
1022    @TelephonyBaseTest.tel_test_wrap
1023    def test_msim_call_forwarding_unconditional_csfb_volte_psim_dds_slot_1(self):
1024        return self._test_msim_call_forwarding(
1025            None,
1026            0,
1027            None,
1028            1,
1029            callee_rat=["csfb", "volte"],
1030            call_forwarding_type="unconditional")
1031
1032    @test_tracker_info(uuid="cfb973d7-aa3b-4e59-9f00-501e42c99947")
1033    @TelephonyBaseTest.tel_test_wrap
1034    def test_msim_call_forwarding_unconditional_csfb_volte_esim_dds_slot_0(self):
1035        return self._test_msim_call_forwarding(
1036            None,
1037            1,
1038            None,
1039            0,
1040            callee_rat=["csfb", "volte"],
1041            call_forwarding_type="unconditional")
1042
1043    @test_tracker_info(uuid="a347c3db-e128-4deb-9009-c8b8e8145f67")
1044    @TelephonyBaseTest.tel_test_wrap
1045    def test_msim_call_forwarding_unconditional_csfb_volte_esim_dds_slot_1(self):
1046        return self._test_msim_call_forwarding(
1047            None,
1048            1,
1049            None,
1050            1,
1051            callee_rat=["csfb", "volte"],
1052            call_forwarding_type="unconditional")
1053
1054
1055
1056    @test_tracker_info(uuid="7040e929-eb1d-4dc6-a404-2c185dc8a0a0")
1057    @TelephonyBaseTest.tel_test_wrap
1058    def test_msim_call_forwarding_unconditional_csfb_psim_dds_slot_0(self):
1059        return self._test_msim_call_forwarding(
1060            None,
1061            0,
1062            None,
1063            0,
1064            callee_rat=["csfb", "csfb"],
1065            call_forwarding_type="unconditional")
1066
1067    @test_tracker_info(uuid="b88a2ce3-74c7-41df-8114-71b6c3d0b050")
1068    @TelephonyBaseTest.tel_test_wrap
1069    def test_msim_call_forwarding_unconditional_csfb_psim_dds_slot_1(self):
1070        return self._test_msim_call_forwarding(
1071            None,
1072            0,
1073            None,
1074            1,
1075            callee_rat=["csfb", "csfb"],
1076            call_forwarding_type="unconditional")
1077
1078    @test_tracker_info(uuid="0ffd2391-ec5a-4a48-b0a8-fceba0c922d3")
1079    @TelephonyBaseTest.tel_test_wrap
1080    def test_msim_call_forwarding_unconditional_csfb_esim_dds_slot_0(self):
1081        return self._test_msim_call_forwarding(
1082            None,
1083            1,
1084            None,
1085            0,
1086            callee_rat=["csfb", "csfb"],
1087            call_forwarding_type="unconditional")
1088
1089    @test_tracker_info(uuid="44937439-2d0a-4aea-bb4d-263e5ed634b4")
1090    @TelephonyBaseTest.tel_test_wrap
1091    def test_msim_call_forwarding_unconditional_csfb_esim_dds_slot_1(self):
1092        return self._test_msim_call_forwarding(
1093            None,
1094            1,
1095            None,
1096            1,
1097            callee_rat=["csfb", "csfb"],
1098            call_forwarding_type="unconditional")
1099
1100
1101
1102    @TelephonyBaseTest.tel_test_wrap
1103    @test_tracker_info(uuid="73ac948b-5260-44f1-a0a6-e4a410cb3283")
1104    def test_msim_voice_conf_call_host_volte_psim_dds_slot_0(self):
1105        return self._test_msim_call_voice_conf(
1106            0, None, None, 0, host_rat=["volte", "volte"])
1107
1108    @TelephonyBaseTest.tel_test_wrap
1109    @test_tracker_info(uuid="75d7fb2c-aa62-4b4f-9e70-8f6b1647f816")
1110    def test_msim_voice_conf_call_host_volte_psim_dds_slot_1(self):
1111        return self._test_msim_call_voice_conf(
1112            0, None, None, 1, host_rat=["volte", "volte"])
1113
1114    @TelephonyBaseTest.tel_test_wrap
1115    @test_tracker_info(uuid="2343369e-0240-4adc-bc01-7c08f9327737")
1116    def test_msim_voice_conf_call_host_volte_esim_dds_slot_0(self):
1117        return self._test_msim_call_voice_conf(
1118            1, None, None, 0, host_rat=["volte", "volte"])
1119
1120    @TelephonyBaseTest.tel_test_wrap
1121    @test_tracker_info(uuid="3a28e621-1d47-432c-a7e8-20d2d9f82588")
1122    def test_msim_voice_conf_call_host_volte_esim_dds_slot_1(self):
1123        return self._test_msim_call_voice_conf(
1124            1, None, None, 1, host_rat=["volte", "volte"])
1125
1126
1127
1128    @TelephonyBaseTest.tel_test_wrap
1129    @test_tracker_info(uuid="378f24cf-bb96-45e1-8150-02f08d7417b6")
1130    def test_msim_voice_conf_call_host_volte_csfb_psim_dds_slot_0(self):
1131        return self._test_msim_call_voice_conf(
1132            0, None, None, 0, host_rat=["volte", "csfb"])
1133
1134    @TelephonyBaseTest.tel_test_wrap
1135    @test_tracker_info(uuid="e3fdf5ec-eafe-4825-acd3-5d4ff03df1d2")
1136    def test_msim_voice_conf_call_host_volte_csfb_psim_dds_slot_1(self):
1137        return self._test_msim_call_voice_conf(
1138            0, None, None, 1, host_rat=["volte", "csfb"])
1139
1140    @TelephonyBaseTest.tel_test_wrap
1141    @test_tracker_info(uuid="221da988-e8c7-43e5-ae3a-414e8f01e872")
1142    def test_msim_voice_conf_call_host_volte_csfb_esim_dds_slot_0(self):
1143        return self._test_msim_call_voice_conf(
1144            1, None, None, 0, host_rat=["volte", "csfb"])
1145
1146    @TelephonyBaseTest.tel_test_wrap
1147    @test_tracker_info(uuid="ea5f0254-59b8-4f63-8a4a-6f0ecb55ddbf")
1148    def test_msim_voice_conf_call_host_volte_csfb_esim_dds_slot_1(self):
1149        return self._test_msim_call_voice_conf(
1150            1, None, None, 1, host_rat=["volte", "csfb"])
1151
1152
1153
1154    @TelephonyBaseTest.tel_test_wrap
1155    @test_tracker_info(uuid="90abbc8a-d492-45f9-9919-fae7e44c877a")
1156    def test_msim_voice_conf_call_host_csfb_volte_psim_dds_slot_0(self):
1157        return self._test_msim_call_voice_conf(
1158            0, None, None, 0, host_rat=["csfb", "volte"])
1159
1160    @TelephonyBaseTest.tel_test_wrap
1161    @test_tracker_info(uuid="da98268a-a94a-4fc7-8fb9-8e8573baed50")
1162    def test_msim_voice_conf_call_host_csfb_volte_psim_dds_slot_1(self):
1163        return self._test_msim_call_voice_conf(
1164            0, None, None, 1, host_rat=["csfb", "volte"])
1165
1166    @TelephonyBaseTest.tel_test_wrap
1167    @test_tracker_info(uuid="df46bcf5-48a3-466f-ba37-9519f5a671cf")
1168    def test_msim_voice_conf_call_host_csfb_volte_esim_dds_slot_0(self):
1169        return self._test_msim_call_voice_conf(
1170            1, None, None, 0, host_rat=["csfb", "volte"])
1171
1172    @TelephonyBaseTest.tel_test_wrap
1173    @test_tracker_info(uuid="f0c82ae0-c659-45e3-9a00-419e2da55739")
1174    def test_msim_voice_conf_call_host_csfb_volte_esim_dds_slot_1(self):
1175        return self._test_msim_call_voice_conf(
1176            1, None, None, 1, host_rat=["csfb", "volte"])
1177
1178
1179
1180    @TelephonyBaseTest.tel_test_wrap
1181    @test_tracker_info(uuid="4831c07a-9a38-4ccd-8fa0-beaf52a2751e")
1182    def test_msim_voice_conf_call_host_csfb_psim_dds_slot_0(self):
1183        return self._test_msim_call_voice_conf(
1184            0, None, None, 0, host_rat=["csfb", "csfb"])
1185
1186    @TelephonyBaseTest.tel_test_wrap
1187    @test_tracker_info(uuid="79cbf768-88ea-4d03-b798-2097789ee456")
1188    def test_msim_voice_conf_call_host_csfb_psim_dds_slot_1(self):
1189        return self._test_msim_call_voice_conf(
1190            0, None, None, 1, host_rat=["csfb", "csfb"])
1191
1192    @TelephonyBaseTest.tel_test_wrap
1193    @test_tracker_info(uuid="68b0a15f-62e4-419d-948a-d74d763a736c")
1194    def test_msim_voice_conf_call_host_csfb_esim_dds_slot_0(self):
1195        return self._test_msim_call_voice_conf(
1196            1, None, None, 0, host_rat=["csfb", "csfb"])
1197
1198    @TelephonyBaseTest.tel_test_wrap
1199    @test_tracker_info(uuid="a93af289-98a8-4d4b-bdbd-54478f273fea")
1200    def test_msim_voice_conf_call_host_csfb_esim_dds_slot_1(self):
1201        return self._test_msim_call_voice_conf(
1202            1, None, None, 1, host_rat=["csfb", "csfb"])
1203
1204
1205
1206    @TelephonyBaseTest.tel_test_wrap
1207    @test_tracker_info(uuid="43e450c8-8a0b-4dfc-8c59-d0865c4c6399")
1208    def test_msim_call_waiting_volte_psim_dds_slot_0(self):
1209        result = True
1210        if not self._test_msim_call_voice_conf(
1211            0,
1212            None,
1213            None,
1214            0,
1215            host_rat=["volte", "volte"],
1216            merge=False, disable_cw=False):
1217        	result = False
1218        if not self._test_msim_call_voice_conf(
1219            0,
1220            None,
1221            None,
1222            0,
1223            host_rat=["volte", "volte"],
1224            merge=False,
1225            disable_cw=True):
1226        	result = False
1227        return result
1228
1229    @TelephonyBaseTest.tel_test_wrap
1230    @test_tracker_info(uuid="7d05525e-8fcf-4630-9248-22803a14209d")
1231    def test_msim_call_waiting_volte_psim_dds_slot_1(self):
1232        result = True
1233        if not self._test_msim_call_voice_conf(
1234            0,
1235            None,
1236            None,
1237            1,
1238            host_rat=["volte", "volte"],
1239            merge=False,
1240            disable_cw=False):
1241            result = False
1242        if not self._test_msim_call_voice_conf(
1243            0,
1244            None,
1245            None,
1246            1,
1247            host_rat=["volte", "volte"],
1248            merge=False,
1249            disable_cw=True):
1250            result = False
1251        return result
1252
1253    @TelephonyBaseTest.tel_test_wrap
1254    @test_tracker_info(uuid="caec880c-948a-4fcd-b57e-e64fd3048b08")
1255    def test_msim_call_waiting_volte_esim_dds_slot_0(self):
1256        result = True
1257        if not self._test_msim_call_voice_conf(
1258            1,
1259            None,
1260            None,
1261            0,
1262            host_rat=["volte", "volte"],
1263            merge=False,
1264            disable_cw=False):
1265            result = False
1266        if not self._test_msim_call_voice_conf(
1267            1,
1268            None,
1269            None,
1270            0,
1271            host_rat=["volte", "volte"],
1272            merge=False,
1273            disable_cw=True):
1274            result = False
1275        return result
1276
1277    @TelephonyBaseTest.tel_test_wrap
1278    @test_tracker_info(uuid="72ec685d-6c36-40cd-81fd-dd97e32b1e48")
1279    def test_msim_call_waiting_volte_esim_dds_slot_1(self):
1280        result = True
1281        if not self._test_msim_call_voice_conf(
1282            1,
1283            None,
1284            None,
1285            1,
1286            host_rat=["volte", "volte"],
1287            merge=False,
1288            disable_cw=False):
1289            result = False
1290        if not self._test_msim_call_voice_conf(
1291            1,
1292            None,
1293            None,
1294            1,
1295            host_rat=["volte", "volte"],
1296            merge=False,
1297            disable_cw=True):
1298            result = False
1299        return result
1300
1301
1302
1303    @TelephonyBaseTest.tel_test_wrap
1304    @test_tracker_info(uuid="3cef5c80-b15f-45fa-8376-5252e61d7849")
1305    def test_msim_call_waiting_volte_csfb_psim_dds_slot_0(self):
1306        result = True
1307        if not self._test_msim_call_voice_conf(
1308            0,
1309            None,
1310            None,
1311            0,
1312            host_rat=["volte", "csfb"],
1313            merge=False,
1314            disable_cw=False):
1315            result = False
1316        if not self._test_msim_call_voice_conf(
1317            0,
1318            None,
1319            None,
1320            0,
1321            host_rat=["volte", "csfb"],
1322            merge=False,
1323            disable_cw=True):
1324            result = False
1325        return result
1326
1327    @TelephonyBaseTest.tel_test_wrap
1328    @test_tracker_info(uuid="5da5c799-5349-4cf3-b683-c7372aadfdfa")
1329    def test_msim_call_waiting_volte_csfb_psim_dds_slot_1(self):
1330        result = True
1331        if not self._test_msim_call_voice_conf(
1332            0,
1333            None,
1334            None,
1335            1,
1336            host_rat=["volte", "csfb"],
1337            merge=False,
1338            disable_cw=False):
1339            result = False
1340        if not self._test_msim_call_voice_conf(
1341            0,
1342            None,
1343            None,
1344            1,
1345            host_rat=["volte", "csfb"],
1346            merge=False,
1347            disable_cw=True):
1348            result = False
1349        return result
1350
1351    @TelephonyBaseTest.tel_test_wrap
1352    @test_tracker_info(uuid="30c06bb3-a62f-4dba-90c2-1b00c515034a")
1353    def test_msim_call_waiting_volte_csfb_esim_dds_slot_0(self):
1354        result = True
1355        if not self._test_msim_call_voice_conf(
1356            1,
1357            None,
1358            None,
1359            0,
1360            host_rat=["volte", "csfb"],
1361            merge=False,
1362            disable_cw=False):
1363            result = False
1364        if not self._test_msim_call_voice_conf(
1365            1,
1366            None,
1367            None,
1368            0,
1369            host_rat=["volte", "csfb"],
1370            merge=False,
1371            disable_cw=True):
1372            result = False
1373        return result
1374
1375    @TelephonyBaseTest.tel_test_wrap
1376    @test_tracker_info(uuid="d2b0fdb1-5ea6-4958-a34f-6f701801e3c9")
1377    def test_msim_call_waiting_volte_csfb_esim_dds_slot_1(self):
1378        result = True
1379        if not self._test_msim_call_voice_conf(
1380            1,
1381            None,
1382            None,
1383            1,
1384            host_rat=["volte", "csfb"],
1385            merge=False,
1386            disable_cw=False):
1387            result = False
1388        if not self._test_msim_call_voice_conf(
1389            1,
1390            None,
1391            None,
1392            1,
1393            host_rat=["volte", "csfb"],
1394            merge=False,
1395            disable_cw=True):
1396            result = False
1397        return result
1398
1399
1400
1401    @TelephonyBaseTest.tel_test_wrap
1402    @test_tracker_info(uuid="b239d4be-9a36-4791-84df-ecebae645c84")
1403    def test_msim_call_waiting_csfb_volte_psim_dds_slot_0(self):
1404        result = True
1405        if not self._test_msim_call_voice_conf(
1406            0,
1407            None,
1408            None,
1409            0,
1410            host_rat=["csfb", "volte"],
1411            merge=False,
1412            disable_cw=False):
1413            result = False
1414        if not self._test_msim_call_voice_conf(
1415            0,
1416            None,
1417            None,
1418            0,
1419            host_rat=["csfb", "volte"],
1420            merge=False,
1421            disable_cw=True):
1422            result = False
1423        return result
1424
1425    @TelephonyBaseTest.tel_test_wrap
1426    @test_tracker_info(uuid="51a368e6-83d8-46af-8a85-56aaed787f9f")
1427    def test_msim_call_waiting_csfb_volte_psim_dds_slot_1(self):
1428        result = True
1429        if not self._test_msim_call_voice_conf(
1430            0,
1431            None,
1432            None,
1433            1,
1434            host_rat=["csfb", "volte"],
1435            merge=False,
1436            disable_cw=False):
1437            result = False
1438        if not self._test_msim_call_voice_conf(
1439            0,
1440            None,
1441            None,
1442            1,
1443            host_rat=["csfb", "volte"],
1444            merge=False,
1445            disable_cw=True):
1446            result = False
1447        return result
1448
1449    @TelephonyBaseTest.tel_test_wrap
1450    @test_tracker_info(uuid="73646014-1ead-4bd9-bd8f-2c21da3d596a")
1451    def test_msim_call_waiting_csfb_volte_esim_dds_slot_0(self):
1452        result = True
1453        if not self._test_msim_call_voice_conf(
1454            1,
1455            None,
1456            None,
1457            0,
1458            host_rat=["csfb", "volte"],
1459            merge=False,
1460            disable_cw=False):
1461            result = False
1462        if not self._test_msim_call_voice_conf(
1463            1,
1464            None,
1465            None,
1466            0,
1467            host_rat=["csfb", "volte"],
1468            merge=False,
1469            disable_cw=True):
1470            result = False
1471        return result
1472
1473    @TelephonyBaseTest.tel_test_wrap
1474    @test_tracker_info(uuid="0d520b78-20b8-4be7-833a-40179114cbce")
1475    def test_msim_call_waiting_csfb_volte_esim_dds_slot_1(self):
1476        result = True
1477        if not self._test_msim_call_voice_conf(
1478            1,
1479            None,
1480            None,
1481            1,
1482            host_rat=["csfb", "volte"],
1483            merge=False,
1484            disable_cw=False):
1485            result = False
1486        if not self._test_msim_call_voice_conf(
1487            1,
1488            None,
1489            None,
1490            1,
1491            host_rat=["csfb", "volte"],
1492            merge=False,
1493            disable_cw=True):
1494            result = False
1495        return result
1496
1497    @TelephonyBaseTest.tel_test_wrap
1498    @test_tracker_info(uuid="0544abec-7a59-4de0-be45-0b9b9d706b17")
1499    def test_msim_call_waiting_csfb_psim_dds_slot_0(self):
1500        result = True
1501        if not self._test_msim_call_voice_conf(
1502            0,
1503            None,
1504            None,
1505            0,
1506            host_rat=["csfb", "csfb"],
1507            merge=False,
1508            disable_cw=False):
1509            result = False
1510        if not self._test_msim_call_voice_conf(
1511            0,
1512            None,
1513            None,
1514            0,
1515            host_rat=["csfb", "csfb"],
1516            merge=False,
1517            disable_cw=True):
1518            result = False
1519        return result
1520
1521    @TelephonyBaseTest.tel_test_wrap
1522    @test_tracker_info(uuid="4329319b-0503-4c51-8792-2f36090b8071")
1523    def test_msim_call_waiting_csfb_psim_dds_slot_1(self):
1524        result = True
1525        if not self._test_msim_call_voice_conf(
1526            0,
1527            None,
1528            None,
1529            1,
1530            host_rat=["csfb", "csfb"],
1531            merge=False,
1532            disable_cw=False):
1533            result = False
1534        if not self._test_msim_call_voice_conf(
1535            0,
1536            None,
1537            None,
1538            1,
1539            host_rat=["csfb", "csfb"],
1540            merge=False,
1541            disable_cw=True):
1542            result = False
1543        return result
1544
1545    @TelephonyBaseTest.tel_test_wrap
1546    @test_tracker_info(uuid="d612ce5c-b4cd-490c-bc6c-7f67c25264aa")
1547    def test_msim_call_waiting_csfb_esim_dds_slot_0(self):
1548        result = True
1549        if not self._test_msim_call_voice_conf(
1550            1,
1551            None,
1552            None,
1553            0,
1554            host_rat=["csfb", "csfb"],
1555            merge=False,
1556            disable_cw=False):
1557            result = False
1558        if not self._test_msim_call_voice_conf(
1559            1,
1560            None,
1561            None,
1562            0,
1563            host_rat=["csfb", "csfb"],
1564            merge=False,
1565            disable_cw=True):
1566            result = False
1567        return result
1568
1569    @TelephonyBaseTest.tel_test_wrap
1570    @test_tracker_info(uuid="fb4869da-a346-4275-a742-d2c653bfc39a")
1571    def test_msim_call_waiting_csfb_esim_dds_slot_1(self):
1572        result = True
1573        if not self._test_msim_call_voice_conf(
1574            1,
1575            None,
1576            None,
1577            1,
1578            host_rat=["csfb", "csfb"],
1579            merge=False,
1580            disable_cw=False):
1581            result = False
1582        if not self._test_msim_call_voice_conf(
1583            1,
1584            None,
1585            None,
1586            1,
1587            host_rat=["csfb", "csfb"],
1588            merge=False,
1589            disable_cw=True):
1590            result = False
1591        return result