1.获取记录各种设备耗电量的文件;
http://www.jb51.net/article/46875.htm
系统的设置–>电池–>使用情况中,统计的能耗的使用情况也是以power_profile.xml的value作为基础参数的
1、我的手机中power_profile.xml的内容: 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、获取的方法: 先从手机上获取framework-res.apk,然后使用apktool工具反编译
该文件位于手机目录: /system/framework/framework-res.apk,在linux下进入终端,执行一下命令:
adb pull /system/framework/framework-res.apk ./
这就将 framework-res.apk 拉到本地pc上了,下面使用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在framework-res.apk的目录:/res/xml/power_profile.xml
mac下APKtool的安装:
参考文章:
http://www.cnblogs.com/anee/p/4153411.html
http://blog.csdn.net/yanzi1225627/article/details/48215549
1,在官网链接里找到如下所示:
基本上按照上面的6个步骤就ok了。第一步是下载一个shell脚本,保存的名字就是”apktool”,不要带.sh后缀。可以复制到sublimetext,然后保存下。
第四步不是必须的,保存文件可以在任意目录下,但建议移动到/usr/local/bin目录,这样直接执行"apktool d ***.apk"命令即可,如果不移动需要进到目录下才能够执行apktool命令,且需要加"./apktool d **.apk" ,较为麻烦。需要注意的是Apktool2需要java1.7及以上版本,已验证java1.8可用。
具体步骤如下:
1、apktool文件内容如下,复制以下代码,保存到apktool(不要加任何后缀名)

#!/bin/bash # # Copyright (C) 2007 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This script is a wrapper for smali.jar, so you can simply call "smali", # instead of java -jar smali.jar. It is heavily based on the "dx" script # from the Android SDK # Set up prog to be the path of this script, including following symlinks, # and set up progdir to be the fully-qualified pathname of its directory. prog="$0" while [ -h "${prog}" ]; do newProg=`/bin/ls -ld "${prog}"` echo ${newProg} newProg=`expr "${newProg}" : ".* -> \(.*\)$"` if expr "x${newProg}" : 'x/' >/dev/null; then prog="${newProg}" else progdir=`dirname "${prog}"` prog="${progdir}/${newProg}" fi done oldwd=`pwd` progdir=`dirname "${prog}"` cd "${progdir}" progdir=`pwd` prog="${progdir}"/`basename "${prog}"` cd "${oldwd}" jarfile=apktool.jar libdir="$progdir" if [ ! -r "$libdir/$jarfile" ] then echo `basename "$prog"`": can't find $jarfile" exit 1 fi javaOpts="" # If you want DX to have more memory when executing, uncomment the following # line and adjust the value accordingly. Use "java -X" for a list of options # you can pass here. # javaOpts="-Xmx256M" # Alternatively, this will extract any parameter "-Jxxx" from the command line # and pass them to Java (instead of to dx). This makes it possible for you to # add a command-line parameter such as "-JXmx256M" in your ant scripts, for # example. while expr "x$1" : 'x-J' >/dev/null; do opt=`expr "$1" : '-J\(.*\)'` javaOpts="${javaOpts} -${opt}" shift done if [ "$OSTYPE" = "cygwin" ] ; then jarpath=`cygpath -w "$libdir/$jarfile"` else jarpath="$libdir/$jarfile" fi # add current location to path for aapt PATH=$PATH:`pwd`; export PATH; exec java $javaOpts -Djava.awt.headless=true -jar "$jarpath" "$@"
2(/3)、下载apktool2.jar,墙内的同学戳这里。解压,修改文件名为apktool.jar
4、将apktool和Apktool.jar文件移动到/usr/local/bin目录下;
5、chmod +x apktool,修改为可执行
6、apktool d xx.apk,执行
成功反编译出xml文件
运行 apktool version即可查看相关信息:
fangjun03deMBP:apktool maoxiaojie$ apk version
-bash: apk: command not found
fangjun03deMBP:apktool maoxiaojie$ apktool version
Apktool v2.0.0-RC3 - a tool for reengineering Android apk files
with smali v2.0.3 and baksmali v2.0.3
Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>
usage: apktool
-advance,--advanced prints advance information.
-version,--version prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
-p,--frame-path <dir> Stores framework files into <dir>.
-t,--tag <tag> Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
-f,--force Force delete destination directory.
-o,--output <dir> The name of folder that gets written. Default is apk.out
-p,--frame-path <dir> Uses framework files located in <dir>.
-r,--no-res Do not decode resources.
-s,--no-src Do not decode sources.
-t,--frame-tag <tag> Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
-f,--force-all Skip changes detection and build all files.
-o,--output <dir> The name of apk that gets written. Default is dist/name.apk
-p,--frame-path <dir> Uses framework files located in <dir>.
For additional info, see: http://code.google.com/p/android-apktool/
For smali/baksmali info, see: http://code.google.com/p/smali/
注意:apktool2必须jdk 1.7+
下载http://pan.baidu.com/s/1i302CAD
安装
java -version查看版本是否变化