1#!/usr/bin/env python3 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""" 17Test script to automate the Bluetooth Audio Funhaus. 18""" 19import time 20 21from acts.test_decorators import test_tracker_info 22from acts.test_utils.bt.BtFunhausBaseTest import BtFunhausBaseTest 23 24 25class BtFunhausTest(BtFunhausBaseTest): 26 music_file_to_play = "" 27 device_fails_to_connect_list = [] 28 29 def setup_class(self): 30 super().setup_class() 31 32 @test_tracker_info(uuid='80a4cc4c-7c2a-428d-9eaf-46239a7926df') 33 def test_run_bt_audio_12_hours(self): 34 """Test audio quality over 12 hours. 35 36 This test is designed to run Bluetooth audio for 12 hours 37 and collect relevant logs. If all devices disconnect during 38 the test or Bluetooth is off on all devices, then fail the 39 test. 40 41 Steps: 42 1. For each Android device connected run steps 2-5. 43 2. Open and play media file of music pushed to device 44 3. Set media to loop indefinitely. 45 4. After 12 hours collect bluetooth_manager dumpsys information 46 5. Stop media player 47 48 Expected Result: 49 Audio plays for 12 hours over Bluetooth 50 51 Returns: 52 Pass if True 53 Fail if False 54 55 TAGS: Classic, A2DP 56 Priority: 1 57 """ 58 self.start_playing_music_on_all_devices() 59 60 sleep_interval = 120 61 #twelve_hours_in_seconds = 43200 62 #one_hour_in_seconds = 3600 63 one_min_in_sec = 60 64 end_time = time.time() + one_min_in_sec 65 if not self.monitor_music_play_util_deadline(end_time, sleep_interval): 66 return False 67 self._collect_bluetooth_manager_dumpsys_logs(self.android_devices) 68 self.ad.droid.mediaPlayStopAll() 69 self.collect_bluetooth_manager_metrics_logs(self.android_devices) 70 return True 71