1#  Copyright (C) 2023 The Android Open Source Project
2#
3#  Licensed under the Apache License, Version 2.0 (the "License");
4#  you may not use this file except in compliance with the License.
5#  You may obtain a copy of the License at
6#
7#       http://www.apache.org/licenses/LICENSE-2.0
8#
9#  Unless required by applicable law or agreed to in writing, software
10#  distributed under the License is distributed on an "AS IS" BASIS,
11#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12#  See the License for the specific language governing permissions and
13#  limitations under the License.
14
15"""Test of basic calling with given digits
16 Steps include:
17        1) Precall state check on devices. (OK)
18        2) Enable the drive mode in IVI device
19        3) Make a call to any digits number using IVI device
20        4) Assert calling number on IVI device same as called
21        5) End call on IVI device
22        6) Get latest dialed number from the IVI device
23        7) Assert dialed number on the IVI device same as called ten digits number
24        8) Enable the Park Mode in IVI device
25"""
26
27from bluetooth_test import bluetooth_base_test
28from utilities import constants
29from utilities.main_utils import common_main
30
31
32class UxRestrictionBluetoothCallFromDialerTest(bluetooth_base_test.BluetoothBaseTest):
33
34    def setup_test(self):
35        # Pair the devices
36        self.bt_utils.pair_primary_to_secondary()
37        #set driving mode
38        self.call_utils.enable_driving_mode()
39
40    def test_call_from_dialer_during_drive_mode(self):
41        #Tests the calling ten digits number functionality during drive mode.
42        #Variable
43        dialer_test_phone_number = constants.DIALER_THREE_DIGIT_NUMBER;
44
45        self.call_utils.dial_a_number(dialer_test_phone_number)
46        self.call_utils.make_call()
47        self.call_utils.wait_with_log(5)
48        self.call_utils.verify_dialing_number(dialer_test_phone_number)
49        self.call_utils.end_call()
50        self.call_utils.wait_with_log(5)
51        self.call_utils.open_call_history()
52        self.call_utils.verify_last_dialed_number(dialer_test_phone_number)
53
54    def teardown_test(self):
55        #Disable driving mode
56        self.call_utils.disable_driving_mode()
57        super().teardown_test()
58
59if __name__ == '__main__':
60    common_main()