1#!/usr/bin/env python3.4
2#
3#   Copyright 2018 - Google
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17from acts_contrib.test_utils.tel.tel_voice_utils \
18        import two_phone_call_msim_short_seq, phone_setup_voice_general_for_slot
19from acts.test_decorators import test_tracker_info
20from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
21from acts_contrib.test_utils.tel.tel_test_utils import multithread_func
22from acts_contrib.test_utils.tel.tel_defines import MULTI_SIM_CONFIG
23
24
25class TelLiveMSIMVoiceTest(TelephonyBaseTest):
26    def setup_class(self):
27        super().setup_class()
28        self.sim_config = {
29                            "config":MULTI_SIM_CONFIG,
30                            "number_of_sims":2
31                           }
32
33    @TelephonyBaseTest.tel_test_wrap
34    @test_tracker_info(uuid="3639cd85-7dba-4a81-8723-4f554e3ddcf8")
35    def test_msim_voice_general(self):
36        """ DSDS voice to voice call.
37
38        1. Make Sure PhoneA attached to voice network.
39        2. Make Sure PhoneB attached to voice network.
40        3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
41        4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
42        5. Perform steps 3 and 4 with both sub_ids
43
44        Returns:
45            True if pass; False if fail.
46        """
47        ads = self.android_devices
48
49        tasks = [(phone_setup_voice_general_for_slot, (self.log, ads[0], 0)),
50                 (phone_setup_voice_general_for_slot, (self.log, ads[1], 0)),
51                 (phone_setup_voice_general_for_slot, (self.log, ads[0], 1)),
52                 (phone_setup_voice_general_for_slot, (self.log, ads[1], 1))
53                 ]
54
55        if not multithread_func(self.log, tasks):
56            self.log.error("Phone Failed to Set Up Properly.")
57            return False
58
59        return two_phone_call_msim_short_seq(self.log, ads[0], None, None,
60                                             ads[1], None, None, None)
61