android development tutorial for getting the power_profile.xml file method of android runtime power consumption
- 2020-05-27 07:08:56
- OfStack
System Settings
>
Battery �
>
In the usage case, the statistical usage of energy consumption is also based on value of power_profile.xml
1. The content of power_profile. xml in my mobile phone: HTC t328w
<?xml version="1.0" encoding="utf-8"?>
<device name="Android">
<item name="none">0</item>
<item name="screen.on">100</item>
<item name="bluetooth.active">142</item>
<item name="bluetooth.on">0.3</item>
<item name="bluetooth.at">35690</item>
<item name="screen.full">160</item>
<item name="wifi.on">4</item>
<item name="wifi.active">120</item>
<item name="wifi.scan">220</item>
<item name="dsp.audio">88</item>
<item name="dsp.video">88</item>
<item name="radio.active">300</item>
<item name="gps.on">170</item>
<item name="battery.capacity">1390</item>
<item name="radio.scanning">70</item>
<array name="radio.on">
<value>3</value>
<value>3</value>
</array>
<array name="cpu.speeds">
<value>245000</value>
<value>384000</value>
<value>460800</value>
<value>499200</value>
<value>576000</value>
<value>614400</value>
<value>652800</value>
<value>691200</value>
<value>768000</value>
<value>806400</value>
<value>844800</value>
<value>998400</value>
</array>
<item name="cpu.idle">2.8</item>
<array name="cpu.active">
<value>66.6</value>
<value>84</value>
<value>90.8</value>
<value>96</value>
<value>105</value>
<value>111.5</value>
<value>117.3</value>
<value>123.6</value>
<value>134.5</value>
<value>141.8</value>
<value>148.5</value>
<value>168.4</value>
</array>
</device>
2. Get method: first get framework-res. apk from the mobile phone, and then decompile it using apktool tool
This file is located in the mobile phone directory: /system/framework/ framework-res.apk, enter the terminal under linux, and execute the following command:
adb pull /system/framework/framework-res.apk ./
This pulls framework-res.apk onto the local pc, which is then decompiled using apktool.
dell@OptiPlex-7010:~/apktool/apktool-install-linux-r05-ibot$ ls
aapt apktool apktool.jar framework-res.apk
dell@OptiPlex-7010:~/apktool/apktool-install-linux-r05-ibot$ ./apktool d framework-res.apk newapk
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
dell@OptiPlex-7010:~/apktool/apktool-install-linux-r05-ibot$ ls
aapt apktool apktool.jar framework-res.apk newapk
dell@OptiPlex-7010:~/apktool/apktool-install-linux-r05-ibot/newapk/res/xml$ ls
apns.xml password_kbd_qwerty_shifted.xml storage_list.xml
autotext.xml password_kbd_qwerty.xml time_zones_by_country.xml
eri.xml password_kbd_symbols_shift.xml zzz_cdmaapns.xml
password_kbd_extension.xml password_kbd_symbols.xml zzz_m_pdp_limit.xml
password_kbd_numeric.xml power_profile.xml
password_kbd_popup_template.xml preferred_time_zones.xml
power_profile.xml in the framework-res.apk directory: /res/xml/ power_profile.xml