xref: /aosp_15_r20/platform_testing/tests/automotive/mobly_tests/dialer/dialer_test_active_call_off.py (revision dd0948b35e70be4c0246aabd6c72554a5eb8b22a)
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"""
151. Launch Dialer -Settings -  Turn Active Call ON
16https://screenshot.googleplex.com/3QDmSzeiis4TH92
172. Switch to Launcher or Maps or any page
183. Call to Paired Device and Answer an incoming call
194. Verify the  dialer - dial in progress page displayed in Full view when user tap to Answer phone call
20Video Demo: https://drive.google.com/file/d/15HK77k47j8oDonbjY0IegoJnJESEcvwM/view?usp=sharing&resourcekey=0-CUtdhL4Y0z_uwnjl2QMjew
21"""
22
23from bluetooth_sms_test import bluetooth_sms_base_test
24import logging
25from mobly import asserts
26from utilities import phone_device_utils
27from utilities import constants
28from utilities.main_utils import common_main
29
30
31class DialerActiveCallOff(bluetooth_sms_base_test.BluetoothSMSBaseTest):
32
33    def setup_class(self):
34        super().setup_class()
35        self.phone_utils = (phone_device_utils.PhoneDeviceUtils(self.phone_notpaired))
36
37    def setup_test(self):
38        # Pair the devices
39        self.bt_utils.pair_primary_to_secondary()
40        super().enable_recording()
41
42    def test_active_call_off(self):
43
44        # Navigate to dialer settings
45        self.call_utils.open_phone_app()
46        self.call_utils.open_dialer_settings()
47        # Enable Active Call
48        asserts.assert_false(self.call_utils.is_active_call_enabled(),
49                            "Expected Active Call to be disabled by default, but it was enabled.")
50        self.call_utils.press_home()
51
52        # Call the paired phone device (from an unpaired phone) and answer the call.
53        # call from the unpaired phone to the paired phone
54        callee_number = self.target.mbs.getPhoneNumber()
55        self.phone_utils.call_number_from_home_screen(callee_number)
56
57        # Receive and answer the call
58        self.call_utils.wait_with_log(5)
59        self.discoverer.mbs.clickUIElementWithText(constants.ANSWER_CALL_TEXT)
60        self.call_utils.wait_with_log(2)
61        # Verify that the in-progress call is displayed in full-screen view.
62        asserts.assert_false(
63            self.call_utils.is_active_call_ongoing_full_screen(),
64            "Without enabling Active Call, accepted phone calls was displayed in fullscreen."
65        )
66
67    def teardown_test(self):
68        # Navigate to dialer settings
69        self.call_utils.end_call_using_adb_command(self.phone_notpaired)
70        super().teardown_test()
71
72if __name__ == '__main__':
73    common_main()