1.获取记录各种设备耗电量的文件;
http://www.jb51.net/article/46875.htm
系统的设置–>电池–>使用情况中,统计的能耗的使用情况也是以power_profile.xml的value作为基础参数的
1、我的手机中power_profile.xml的内容: HTC t328w
2、获取的方法: 先从手机上获取framework-res.apk,然后使用apktool工具反编译
该文件位于手机目录: /system/framework/framework-res.apk,在linux下进入终端,执行一下命令:
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
Updated by Connor Tumbleson
usage: apktool
-advance,--advanced prints advance information.
-version,--version prints the version then exits
usage: apktool if|install-framework [options]
-p,--frame-path
-t,--tag
usage: apktool d[ecode] [options]
-f,--force Force delete destination directory.
-o,--output
-p,--frame-path
-r,--no-res Do not decode resources.
-s,--no-src Do not decode sources.
-t,--frame-tag
usage: apktool b[uild] [options]
-f,--force-all Skip changes detection and build all files.
-o,--output
-p,--frame-path
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查看版本是否变化