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 to verify Reply sms sync in IVI device when replied from phone 16 17 Steps include: 18 1) Precall state check on IVI and phone devices. 19 2) Send sms to paired phone from unpaired phone 20 3) Reply to the sms from paired phone 21 4) Verify the reply sms sync in IVI device 22""" 23from utilities import constants 24from utilities.main_utils import common_main 25from utilities.common_utils import CommonUtils 26from bluetooth_sms_test import bluetooth_sms_base_test 27from mobly.controllers import android_device 28 29class SMSReplyFromPhoneSync(bluetooth_sms_base_test.BluetoothSMSBaseTest): 30 31 def setup_class(self): 32 super().setup_class() 33 self.common_utils = CommonUtils(self.target, self.discoverer) 34 35 def setup_test(self): 36 37 # pair the devices 38 self.bt_utils.pair_primary_to_secondary() 39 40 def test_reply_from_phone_sms_sync(self): 41 42 # wait for user permissions popup & give contacts and sms permissions 43 self.call_utils.wait_with_log(20) 44 self.common_utils.click_on_ui_element_with_text('Allow') 45 46 # send a new sms 47 target_phone_number = self.target.mbs.getPhoneNumber() 48 self.phone_notpaired.mbs.sendSms(target_phone_number,constants.SMS_REPLY_TEXT) 49 self.call_utils.wait_with_log(10) 50 # Verify the new UNREAD sms in IVI device 51 self.call_utils.open_sms_app() 52 self.call_utils.verify_sms_app_unread_message(True) 53 54 # REPLY to the message on paired phone 55 self.call_utils.open_notification_on_phone(self.target) 56 self.call_utils.wait_with_log(3) 57 self.target.mbs.clickUIElementWithText(constants.REPLY_SMS) 58 59 # Verify the SYNC Reply sms in IVI device 60 self.call_utils.press_home() 61 self.call_utils.open_sms_app() 62 self.call_utils.verify_sms_app_unread_message(False) 63 self.call_utils.verify_sms_preview_text(True, constants.REPLY_SMS) 64 65 def teardown_test(self): 66 # Go to home screen 67 self.call_utils.press_home() 68 super().teardown_test() 69 70if __name__ == '__main__': 71 common_main()