1#!/usr/bin/env python3 2# 3# Copyright 2018 - The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the 'License'); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of 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, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17import time 18 19import acts_contrib.test_utils.tel.anritsu_utils as anritsu_utils 20import acts.controllers.anritsu_lib.md8475a as md8475a 21 22import acts_contrib.test_utils.power.cellular.cellular_power_base_test as PWCEL 23from acts_contrib.test_utils.tel.tel_test_utils import set_phone_silent_mode 24from acts_contrib.test_utils.tel.tel_voice_utils import initiate_call, hangup_call 25 26 27class PowerTelVoLTECallTest(PWCEL.PowerCellularLabBaseTest): 28 """ VoLTE call power test. 29 30 Inherits from PowerCellularLabBaseTest. Contains methods to initiate 31 a voice call from the IMS server and pick up on the UE. 32 33 """ 34 35 # Waiting time before trying to pick up from the phone 36 CALL_INITIATING_TIME = 10 37 38 def setup_class(self): 39 """ Executed only once when initializing the class. """ 40 41 super().setup_class() 42 43 # Set voice call volume to minimum 44 set_phone_silent_mode(self.log, self.dut) 45 46 def power_volte_call_test(self): 47 """ Measures power during a VoLTE call. 48 49 Measurement step in this test. Starts the voice call and 50 initiates power measurement. Pass or fail is decided with a 51 threshold value. """ 52 53 # Initiate the voice call 54 self.anritsu.ims_cscf_call_action( 55 anritsu_utils.DEFAULT_IMS_VIRTUAL_NETWORK_ID, 56 md8475a.ImsCscfCall.MAKE.value) 57 58 # Wait for the call to be started 59 time.sleep(self.CALL_INITIATING_TIME) 60 61 # Pickup the call 62 self.dut.adb.shell('input keyevent KEYCODE_CALL') 63 64 # Mute the call 65 self.dut.droid.telecomCallMute() 66 67 # Turn of screen 68 self.dut.droid.goToSleepNow() 69 70 # Measure power 71 self.collect_power_data() 72 73 # End the call 74 hangup_call(self.log, self.dut) 75 76 # Check if power measurement is within the required values 77 self.pass_fail_check() 78