??????????????~??????????????????????https://github.com/pdhxxj/HATT
????????????????3??
????<?>???powerprofile????
????android???н??Щ???趨??????????????????????????power_profile.xml????У??????????????????framework-res.apk?У??????????????????????????xml?????????????????????·???????
????a)pull???????
????import tempfile
????from Core.Action.app import LocalAction
????la=LocalAction()
????apkpath=tempfile.gettempdir()
????la.pullFile(“/system/framework/framework-res.apk”??apkpath )
????b).???????????
????from _winreg import *
????import os
????key=OpenKey(HKEY_CLASSES_ROOT??r"ApplicationsWinRAR.exeshellopen")
????value=QueryValue(key??"command")
????winpath= str(value)[1:len(str(value))-6]
????apk=apkpath+"framework-res.apk"
????command=winpath+" e "+apk+" resxmlpower_profile.xml"
????os.popen(command)
????c).???????
????xmlpath=winpath[0:len(winpath)-10]+"power_profile.xml"
????f=open(xmlpath??'rb')
????ff=f.read()
????f.close()
????print ff
????<??>?????????????????????
?????????????????????????о?2???????????????????
????a)???cpu?????г?????????????????????й??????
????from Core.Utils.adb_interface import AdbInterface
????shell=AdbInterface()
????shell.SendShellCommand("dumpsys batterystats "+packagename)
????b)???wakelock?????г?????????????????????й??????
????shell.SendShellCommand("dumpsys alarm ^|grep "+packagename)
????<??>???????????
????????????????(https://github.com/BaiduQA/Cafe/blob/master/testservice/src/com/baidu/cafe/remote/SystemLib.java)
???????????processAppBatteryUsage?????а???
???????
????????????????????????????????????????????????????????????????????????????????????????????????????£?
????1????????????????仯??????????????????仯????????????????????????????????????в??
????2???????漰?????????????WiFi??3G????????????????????????????????????????????????????????????2???????
????3??CPU???????????????????????????????÷???????????????????????????????????
????4??????????????????????????????????????????????????????????
?????????????????????????????????????????ο????????????Щ?????????????????
????PS:android 5.0??????????????????????Battery Historian Tool ????????????????????????????????????????????????????????????https://github.com/google/battery-historian/blob/master/historian.py