Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 1 | #/usr/bin/env python3.4 |
| 2 | # |
| 3 | # Copyright (C) 2016 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 6 | # use this file except in compliance with the License. You may obtain a copy of |
| 7 | # 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, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | # License for the specific language governing permissions and limitations under |
| 15 | # the License. |
| 16 | """Test script to test PBAP contact download between two devices which can run SL4A. |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 17 | """ |
| 18 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 19 | from time import sleep |
| 20 | from time import time |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 21 | |
| 22 | from acts.base_test import BaseTestClass |
Sanket Agarwal | bd9689b | 2016-08-24 11:14:53 -0700 | [diff] [blame] | 23 | from acts.test_utils.bt import bt_contacts_utils |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 24 | from acts.test_utils.bt import bt_test_utils |
Sanket Agarwal | bd9689b | 2016-08-24 11:14:53 -0700 | [diff] [blame] | 25 | from acts.test_utils.car import car_bt_utils |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 26 | from acts.utils import exe_cmd |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 27 | import acts.test_utils.bt.BtEnum as BtEnum |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 28 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 29 | # Offset call logs by 1 minute |
| 30 | CALL_LOG_TIME_OFFSET_IN_MSEC = 60000 |
| 31 | |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 32 | class BtCarPbapTest(BaseTestClass): |
| 33 | def __init__(self, controllers): |
| 34 | BaseTestClass.__init__(self, controllers) |
| 35 | self.pce = self.android_devices[0] |
| 36 | self.pse = self.android_devices[1] |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 37 | # Names for temporary files for contacts cards for import and export from PSE and PCE |
| 38 | global PSE_CONTACTS_FILE |
| 39 | global PCE_CONTACTS_FILE |
| 40 | global CONTACTS_DESTINATION_PATH |
| 41 | CONTACTS_DESTINATION_PATH = self.log_path + "/" |
| 42 | PSE_CONTACTS_FILE = "psecontacts.vcf" |
| 43 | PCE_CONTACTS_FILE = "pcecontacts.vcf" |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 44 | |
| 45 | def setup_class(self): |
| 46 | # Reset the devices in a clean state. |
Sanket Agarwal | bd9689b | 2016-08-24 11:14:53 -0700 | [diff] [blame] | 47 | bt_test_utils.setup_multiple_devices_for_bt_test([self.pce, self.pse]) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 48 | bt_test_utils.reset_bluetooth(self.android_devices) |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 49 | |
| 50 | for a in self.android_devices: |
| 51 | a.ed.clear_all_events() |
| 52 | |
| 53 | # Pair the devices. |
| 54 | # This call may block until some specified timeout in bt_test_utils.py. |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 55 | if not bt_test_utils.pair_pri_to_sec(self.pce.droid, self.pse.droid): |
| 56 | self.log.error("Failed to pair.") |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 57 | return False |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 58 | |
Sanket Agarwal | bd9689b | 2016-08-24 11:14:53 -0700 | [diff] [blame] | 59 | # Disable the HFP and A2DP profiles. This will ensure only PBAP |
| 60 | # gets connected. Also, this will eliminate the auto-connect loop. |
| 61 | car_bt_utils.set_car_profile_priorities_off(self.pce, self.pse) |
| 62 | |
| 63 | # Enable PBAP on PSE & PCE. |
| 64 | bt_test_utils.set_profile_priority( |
| 65 | self.pce, self.pse, [BtEnum.BluetoothProfile.PBAP_CLIENT], |
| 66 | BtEnum.BluetoothPriorityLevel.PRIORITY_ON) |
| 67 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 68 | self.pse.droid.bluetoothChangeProfileAccessPermission( |
| 69 | self.pce.droid.bluetoothGetLocalAddress(), |
| 70 | BtEnum.BluetoothProfile.PBAP_SERVER.value, |
| 71 | BtEnum.BluetoothAccessLevel.ACCESS_ALLOWED.value) |
| 72 | |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 73 | return True |
| 74 | |
| 75 | def setup_test(self): |
| 76 | bt_contacts_utils.set_logger(self.log) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 77 | self.pse.droid.callLogsEraseAll() |
| 78 | if not (bt_contacts_utils.erase_contacts(self.pse) and |
| 79 | bt_contacts_utils.erase_contacts(self.pce)): |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 80 | return False |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 81 | # Allow all content providers to synchronize. |
| 82 | sleep(1) |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 83 | return True |
| 84 | |
| 85 | def teardown_test(self): |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 86 | self.pce.droid.bluetoothPbapClientDisconnect( |
| 87 | self.pse.droid.bluetoothGetLocalAddress()) |
| 88 | bt_contacts_utils.erase_contacts(self.pse) |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 89 | return True |
| 90 | |
| 91 | def on_fail(self, test_name, begin_time): |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 92 | bt_test_utils.take_btsnoop_logs(self.android_devices, self, test_name, begin_time) |
| 93 | bt_test_utils.take_bugreport_logs(self.android_devices, self, test_name, begin_time) |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 94 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 95 | def verify_contacts_match(self): |
| 96 | bt_contacts_utils.export_device_contacts_to_vcf(self.pce, |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 97 | CONTACTS_DESTINATION_PATH, |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 98 | PCE_CONTACTS_FILE) |
| 99 | return bt_contacts_utils.count_contacts_with_differences( |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 100 | CONTACTS_DESTINATION_PATH, PCE_CONTACTS_FILE, PSE_CONTACTS_FILE) == 0 |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 101 | |
| 102 | def connect_and_verify(self, count): |
| 103 | bt_test_utils.connect_pri_to_sec( |
| 104 | self.log, self.pce, self.pse.droid, |
| 105 | set([BtEnum.BluetoothProfile.PBAP_CLIENT.value])) |
| 106 | bt_contacts_utils.wait_for_phone_number_update_complete(self.pce, |
| 107 | count) |
| 108 | contacts_added = self.verify_contacts_match() |
| 109 | self.pce.droid.bluetoothPbapClientDisconnect( |
| 110 | self.pse.droid.bluetoothGetLocalAddress()) |
| 111 | contacts_removed = bt_contacts_utils.wait_for_phone_number_update_complete( |
| 112 | self.pce, 0) |
| 113 | return contacts_added and contacts_removed |
| 114 | |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 115 | #@BluetoothTest(UUID=7dcdecfc-42d1-4f41-b66e-823c8f161356) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 116 | def test_pbap_connect_and_disconnect(self): |
| 117 | """Test Connectivity |
| 118 | |
| 119 | Test connecting with the server enabled and disabled |
| 120 | |
| 121 | Precondition: |
| 122 | 1. Devices are paired. |
| 123 | |
| 124 | Steps: |
| 125 | 1. Disable permission on PSE to prevent PCE from connecting |
| 126 | 2. Attempt to connect PCE to PSE |
| 127 | 3. Verify connection failed |
| 128 | 4. Enable permission on PSE to allow PCE to connect |
| 129 | 5. Attempt to connect PCE to PSE |
| 130 | 6. Verify connection succeeded |
| 131 | |
| 132 | Returns: |
| 133 | Pass if True |
| 134 | Fail if False |
| 135 | """ |
| 136 | self.pse.droid.bluetoothChangeProfileAccessPermission( |
| 137 | self.pce.droid.bluetoothGetLocalAddress(), |
| 138 | BtEnum.BluetoothProfile.PBAP_SERVER.value, |
| 139 | BtEnum.BluetoothAccessLevel.ACCESS_DENIED.value) |
| 140 | if bt_test_utils.connect_pri_to_sec( |
| 141 | self.log, self.pce, self.pse.droid, |
| 142 | set([BtEnum.BluetoothProfile.PBAP_CLIENT.value])): |
| 143 | self.log.error("Client connected and shouldn't be.") |
| 144 | return False |
Sanket Agarwal | bd9689b | 2016-08-24 11:14:53 -0700 | [diff] [blame] | 145 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 146 | self.pce.droid.bluetoothPbapClientDisconnect( |
| 147 | self.pse.droid.bluetoothGetLocalAddress()) |
| 148 | |
| 149 | self.pse.droid.bluetoothChangeProfileAccessPermission( |
| 150 | self.pce.droid.bluetoothGetLocalAddress(), |
| 151 | BtEnum.BluetoothProfile.PBAP_SERVER.value, |
| 152 | BtEnum.BluetoothAccessLevel.ACCESS_ALLOWED.value) |
Sanket Agarwal | bd9689b | 2016-08-24 11:14:53 -0700 | [diff] [blame] | 153 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 154 | if not bt_test_utils.connect_pri_to_sec( |
| 155 | self.log, self.pce, self.pse.droid, |
| 156 | set([BtEnum.BluetoothProfile.PBAP_CLIENT.value])): |
| 157 | self.log.error("No client connected and should be.") |
| 158 | return False |
| 159 | |
| 160 | return True |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 161 | |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 162 | #@BluetoothTest(UUID=1733efb9-71af-4956-bd3a-0d3167d94d0c) |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 163 | def test_contact_download(self): |
| 164 | """Test Contact Download |
| 165 | |
| 166 | Test download of contacts from a clean state. |
| 167 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 168 | Precondition: |
| 169 | 1. Devices are paired. |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 170 | |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 171 | Steps: |
| 172 | 1. Erase contacts from PSE and PCE. |
| 173 | 2. Add a predefined list of contacts to PSE. |
| 174 | 3. Connect PCE to PSE to perform transfer. |
| 175 | 4. Compare transfered contacts. |
| 176 | 5. Disconnect. |
| 177 | 6. Verify PCE cleaned up contact list. |
| 178 | |
| 179 | Returns: |
| 180 | Pass if True |
| 181 | Fail if False |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 182 | """ |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 183 | bt_contacts_utils.generate_contact_list(CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE, 100) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 184 | phone_numbers_added = bt_contacts_utils.import_device_contacts_from_vcf( |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 185 | self.pse, CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 186 | bt_test_utils.connect_pri_to_sec( |
| 187 | self.log, self.pce, self.pse.droid, |
| 188 | set([BtEnum.BluetoothProfile.PBAP_CLIENT.value])) |
| 189 | bt_contacts_utils.wait_for_phone_number_update_complete( |
| 190 | self.pce, phone_numbers_added) |
| 191 | if not self.verify_contacts_match(): |
| 192 | return False |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 193 | return bt_contacts_utils.erase_contacts(self.pce) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 194 | |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 195 | #@BluetoothTest(UUID=99dc6ac6-b7cf-45ce-927b-8c4ebf8ab664) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 196 | def test_modify_phonebook(self): |
| 197 | """Test Modify Phonebook |
| 198 | |
| 199 | Test changing contacts and reconnecting PBAP. |
| 200 | |
| 201 | Precondition: |
| 202 | 1. Devices are paired. |
| 203 | |
| 204 | Steps: |
| 205 | 1. Add a predefined list of contacts to PSE. |
| 206 | 2. Connect PCE to PSE to perform transfer. |
| 207 | 3. Verify that contacts match. |
| 208 | 4. Change some contacts on the PSE. |
| 209 | 5. Reconnect PCE to PSE to perform transfer. |
| 210 | 6. Verify that new contacts match. |
| 211 | |
| 212 | Returns: |
| 213 | Pass if True |
| 214 | Fail if False |
| 215 | """ |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 216 | bt_contacts_utils.generate_contact_list(CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE, 100) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 217 | phone_numbers_added = bt_contacts_utils.import_device_contacts_from_vcf( |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 218 | self.pse, CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 219 | if not self.connect_and_verify(phone_numbers_added): |
| 220 | return False |
| 221 | |
Joseph Pirozzo | 66fb3f6 | 2016-05-31 16:57:39 -0700 | [diff] [blame] | 222 | bt_contacts_utils.erase_contacts(self.pse) |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 223 | bt_contacts_utils.generate_contact_list(CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE, 110, 2) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 224 | phone_numbers_added = bt_contacts_utils.import_device_contacts_from_vcf( |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 225 | self.pse, CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 226 | return self.connect_and_verify(phone_numbers_added) |
| 227 | |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 228 | #@BluetoothTest(UUID=bbe31bf5-51e8-4175-b266-1c7750e44f5b) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 229 | def test_special_contacts(self): |
| 230 | """Test Special Contacts |
| 231 | |
| 232 | Test numerous special cases of contacts that could cause errors. |
| 233 | |
| 234 | Precondition: |
| 235 | 1. Devices are paired. |
| 236 | |
| 237 | Steps: |
| 238 | 1. Add a predefined list of contacts to PSE that includes special cases: |
| 239 | 2. Connect PCE to PSE to perform transfer. |
| 240 | 3. Verify that contacts match. |
| 241 | |
| 242 | Returns: |
| 243 | Pass if True |
| 244 | Fail if False |
| 245 | """ |
| 246 | |
| 247 | vcards = [] |
| 248 | |
| 249 | # Generate a contact with no email address |
| 250 | current_contact = bt_contacts_utils.VCard() |
| 251 | current_contact.first_name = "Mr." |
| 252 | current_contact.last_name = "Smiley" |
| 253 | current_contact.add_phone_number( |
| 254 | bt_contacts_utils.generate_random_phone_number()) |
| 255 | vcards.append(current_contact) |
| 256 | |
| 257 | # Generate a 2nd contact with the same name but different phone number |
| 258 | current_contact = bt_contacts_utils.VCard() |
| 259 | current_contact.first_name = "Mr." |
| 260 | current_contact.last_name = "Smiley" |
| 261 | current_contact.add_phone_number( |
| 262 | bt_contacts_utils.generate_random_phone_number()) |
| 263 | vcards.append(current_contact) |
| 264 | |
| 265 | # Generate a contact with no name |
| 266 | current_contact = bt_contacts_utils.VCard() |
| 267 | current_contact.email = "{}@gmail.com".format( |
| 268 | bt_contacts_utils.generate_random_string()) |
| 269 | current_contact.add_phone_number( |
| 270 | bt_contacts_utils.generate_random_phone_number()) |
| 271 | vcards.append(current_contact) |
| 272 | |
| 273 | # Generate a contact with random characters in its name |
| 274 | current_contact = bt_contacts_utils.VCard() |
| 275 | current_contact.first_name = bt_contacts_utils.generate_random_string() |
| 276 | current_contact.last_name = bt_contacts_utils.generate_random_string() |
| 277 | current_contact.add_phone_number( |
| 278 | bt_contacts_utils.generate_random_phone_number()) |
| 279 | vcards.append(current_contact) |
| 280 | |
| 281 | # Generate a contact with only a phone number |
| 282 | current_contact = bt_contacts_utils.VCard() |
| 283 | current_contact.add_phone_number( |
| 284 | bt_contacts_utils.generate_random_phone_number()) |
| 285 | vcards.append(current_contact) |
| 286 | |
| 287 | # Generate a 2nd contact with only a phone number |
| 288 | current_contact = bt_contacts_utils.VCard() |
| 289 | current_contact.add_phone_number( |
| 290 | bt_contacts_utils.generate_random_phone_number()) |
| 291 | vcards.append(current_contact) |
| 292 | |
| 293 | bt_contacts_utils.create_new_contacts_vcf_from_vcards( |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 294 | CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE, vcards) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 295 | |
| 296 | phone_numbers_added = bt_contacts_utils.import_device_contacts_from_vcf( |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 297 | self.pse, CONTACTS_DESTINATION_PATH, PSE_CONTACTS_FILE) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 298 | |
| 299 | return self.connect_and_verify(phone_numbers_added) |
| 300 | |
Phillip Walker | 827112a | 2016-09-08 16:27:19 -0700 | [diff] [blame^] | 301 | #@BluetoothTest(UUID=2aa2bd00-86cc-4f39-a06a-90b17ea5b320) |
Joseph Pirozzo | f304d36 | 2016-06-17 15:15:40 -0700 | [diff] [blame] | 302 | def test_call_log(self): |
| 303 | """Test Call Log |
| 304 | |
| 305 | Test that Call Logs are transfered |
| 306 | |
| 307 | Precondition: |
| 308 | 1. Devices are paired. |
| 309 | |
| 310 | Steps: |
| 311 | 1. Add a predefined list of calls to the PSE call log. |
| 312 | 2. Connect PCE to PSE to allow call log transfer |
| 313 | 3. Verify the Missed, Incoming, and Outgoing Call History |
| 314 | |
| 315 | Returns: |
| 316 | Pass if True |
| 317 | Fail if False |
| 318 | """ |
| 319 | |
| 320 | bt_contacts_utils.add_call_log( |
| 321 | self.pse, bt_contacts_utils.INCOMMING_CALL_TYPE, |
| 322 | bt_contacts_utils.generate_random_phone_number().phone_number, |
| 323 | int(time()) * 1000) |
| 324 | bt_contacts_utils.add_call_log( |
| 325 | self.pse, bt_contacts_utils.INCOMMING_CALL_TYPE, |
| 326 | bt_contacts_utils.generate_random_phone_number().phone_number, |
| 327 | int(time()) * 1000 - 4 * CALL_LOG_TIME_OFFSET_IN_MSEC) |
| 328 | bt_contacts_utils.add_call_log( |
| 329 | self.pse, bt_contacts_utils.OUTGOING_CALL_TYPE, |
| 330 | bt_contacts_utils.generate_random_phone_number().phone_number, |
| 331 | int(time()) * 1000 - CALL_LOG_TIME_OFFSET_IN_MSEC) |
| 332 | bt_contacts_utils.add_call_log( |
| 333 | self.pse, bt_contacts_utils.MISSED_CALL_TYPE, |
| 334 | bt_contacts_utils.generate_random_phone_number().phone_number, |
| 335 | int(time()) * 1000 - 2 * CALL_LOG_TIME_OFFSET_IN_MSEC) |
| 336 | bt_contacts_utils.add_call_log( |
| 337 | self.pse, bt_contacts_utils.MISSED_CALL_TYPE, |
| 338 | bt_contacts_utils.generate_random_phone_number().phone_number, |
| 339 | int(time()) * 1000 - 2 * CALL_LOG_TIME_OFFSET_IN_MSEC) |
| 340 | |
| 341 | bt_test_utils.connect_pri_to_sec( |
| 342 | self.log, self.pce, self.pse.droid, |
| 343 | set([BtEnum.BluetoothProfile.PBAP_CLIENT.value])) |
| 344 | pse_call_log_count = self.pse.droid.callLogGetCount() |
| 345 | self.log.info("Waiting for {} call logs to be transfered".format( |
| 346 | pse_call_log_count)) |
| 347 | bt_contacts_utils.wait_for_call_log_update_complete(self.pce, |
| 348 | pse_call_log_count) |
| 349 | |
| 350 | if not bt_contacts_utils.get_and_compare_call_logs( |
| 351 | self.pse, self.pce, bt_contacts_utils.INCOMMING_CALL_TYPE): |
| 352 | return False |
| 353 | if not bt_contacts_utils.get_and_compare_call_logs( |
| 354 | self.pse, self.pce, bt_contacts_utils.OUTGOING_CALL_TYPE): |
| 355 | return False |
| 356 | if not bt_contacts_utils.get_and_compare_call_logs( |
| 357 | self.pse, self.pce, bt_contacts_utils.MISSED_CALL_TYPE): |
| 358 | return False |
| 359 | |
| 360 | return True |