耗电详情-校准文件PowerProfile

本文解析了Android系统的PowerProfile机制,详细介绍了各种设备组件如屏幕、Wi-Fi等的功耗参数,并展示了如何从系统中导出及反编译相关文件。

0. PowerProfile 作用

提供设置->电池->耗电详情的UI数据来源,且为耗电数据的校准系数文件。

例如电池电量大小在这里配置,待机的电流、wifi扫网电流参数

1. 手机文件导出方法

adb pull /system/framework/framework-res.apk 本地路径

2. 反编译 framework-res.apk

例如我的AndroidO 8.1 的机器 反编译如下:

<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2009, 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.
*/
-->

<device name="Android">
  <!-- Most values are the incremental current used by a feature,
       in mA (measured at nominal voltage).
       The default values are deliberately incorrect dummy values.
       OEM's must measure and provide actual values before
       shipping a device.
       Example real-world values are given in comments, but they
       are totally dependent on the platform and can vary
       significantly, so should be measured on the shipping platform
       with a power meter. -->
  <item name="none">0</item>
  <item name="screen.on">200</item>  <!-- ~200mA -->
  <item name="screen.full">300</item>  <!-- ~300mA -->
  <item name="bluetooth.active">80</item> <!-- Bluetooth data transfer, ~10mA -->
  <item name="bluetooth.on">1</item>  <!-- Bluetooth on & connectable, but not connected, ~0.1mA -->
  <item name="wifi.on">3</item>  <!-- ~3mA -->
  <item name="wifi.active">200</item>  <!-- WIFI data transfer, ~200mA -->
  <item name="wifi.scan">100</item>  <!-- WIFI network scanning, ~100mA -->
  <item name="dsp.audio">10</item> <!-- ~10mA -->
  <item name="dsp.video">50</item> <!-- ~50mA -->
  <item name="camera.flashlight">160</item> <!-- Avg. power for camera flash, ~160mA -->
  <item name="camera.avg">550</item> <!-- Avg. power use of camera in standard usecases, ~550mA -->
  <item name="gps.on">50</item> <!-- ~50mA -->

  <!-- Radio related values. For modems without energy reporting support in firmware, use
       radio.active, radio.scanning, and radio.on. -->
  <item name="radio.active">200</item> <!-- ~200mA -->
  <item name="radio.scanning">10</item> <!-- cellular radio scanning for signal, ~10mA -->
  <!-- Current consumed by the radio at different signal strengths, when paging -->
  <array name="radio.on"> <!-- Strength 0 to BINS-1 -->
      <value>2</value> <!-- ~2mA -->
      <value>1</value> <!-- ~1mA -->
  </array>


  <!-- Radio related values. For modems WITH energy reporting support in firmware, use
       modem.controller.idle, modem.controller.tx, modem.controller.rx, modem.controller.voltage.
       -->
  <item name="modem.controller.idle">0</item>
  <item name="modem.controller.rx">0</item>
  <item name="modem.controller.tx">0</item>
  <item name="modem.controller.voltage">0</item>

  <!-- A list of heterogeneous CPU clusters, where the value for each cluster represents the
       number of CPU cores for that cluster.

       Ex:
       <array name="cpu.clusters.cores">
         <value>4</value> // cluster 0 has cpu0, cpu1, cpu2, cpu3
         <value>2</value> // cluster 1 has cpu4, cpu5, cpu6, cpu7
       </array> -->
  <array name="cpu.clusters.cores">
    <value>4</value>
    <value>4</value>
  </array>

    <!-- Different CPU speeds for cluster 0 as reported in
       /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state.

       There must be one of these for each cluster, labeled:
       cpu.speeds.cluster0, cpu.speeds.cluster1, etc... -->
    <array name="cpu.speeds.cluster0">
        <value>900000</value>
        <value>979000</value>
        <value>1085000</value>
        <value>1218000</value>
        <value>1351000</value>
        <value>1484000</value>
        <value>1617000</value>
        <value>1750000</value>
        <value>1779000</value>
        <value>1809000</value>
        <value>1838000</value>
        <value>1868000</value>
        <value>1897000</value>
        <value>1927000</value>
        <value>1961000</value>
        <value>2001000</value>
    </array>

    <array name="cpu.speeds.cluster1">
        <value>900000</value>
        <value>979000</value>
        <value>1085000</value>
        <value>1218000</value>
        <value>1351000</value>
        <value>1484000</value>
        <value>1617000</value>
        <value>1750000</value>
        <value>1779000</value>
        <value>1809000</value>
        <value>1838000</value>
        <value>1868000</value>
        <value>1897000</value>
        <value>1927000</value>
        <value>1961000</value>
        <value>2001000</value>
    </array>

  <!-- Current at each CPU speed for cluster 0, as per 'cpu.speeds.cluster0'.
       Like cpu.speeds.cluster0, there must be one of these present for
       each heterogeneous CPU cluster. -->
    <array name="cpu.active.cluster0">
         <value>254.95</value>
         <value>354.95</value>
         <value>387.15</value>
         <value>442.86</value>
         <value>510.20</value>
         <value>582.65</value>
         <value>631.99</value>
         <value>812.02</value>
         <value>858.84</value>
         <value>943.23</value>
         <value>992.45</value>
         <value>1086.32</value>
         <value>1151.96</value>
         <value>1253.80</value>
         <value>1397.67</value>
         <value>1450.67</value>
    </array>

    <array name="cpu.active.cluster1">
        <value>254.95</value>
        <value>354.95</value>
        <value>387.15</value>
        <value>442.86</value>
        <value>510.20</value>
        <value>582.65</value>
        <value>631.99</value>
        <value>812.02</value>
        <value>858.84</value>
        <value>943.23</value>
        <value>992.45</value>
        <value>1086.32</value>
        <value>1151.96</value>
        <value>1253.80</value>
        <value>1397.67</value>
        <value>1450.67</value>
    </array>

  <!-- Current when CPU is idle -->
  <item name="cpu.idle">10</item>

  <!-- Memory bandwidth power values in mA at the rail. There must be one value
       for each bucket defined in the device tree. -->
  <array name="memory.bandwidths">
    <value>22.7</value> <!-- mA for bucket: 100mb/s-1.5 GB/s memory bandwidth -->
  </array>

  <!-- This is the battery capacity in mAh (measured at nominal voltage) -->
  <item name="battery.capacity">3000</item>

  <!-- Wifi related values. -->
  <!-- Idle Receive current for wifi radio in mA. 0 by default-->
  <item name="wifi.controller.idle">10</item>
  <!-- Rx current for wifi radio in mA. 0 by default-->
  <item name="wifi.controller.rx">150</item>
  <!-- Tx current for wifi radio in mA. 0 by default-->
  <item name="wifi.controller.tx">150</item>
  <!-- Current at each of the wifi Tx levels in mA. The number of tx levels varies per device
       and is available only of wifi chipsets which support the tx level reporting. Use
        wifi.tx for other chipsets. none by default -->
  <array name="wifi.controller.tx_levels"> <!-- mA -->
  </array>
  <!-- Operating volatage for wifi radio in mV. 0 by default-->
  <item name="wifi.controller.voltage">0</item>

  <array name="wifi.batchedscan"> <!-- mA -->
    <value>.2</value> <!-- 1-8/hr -->
    <value>2</value>  <!-- 9-64/hr -->
    <value>20</value>   <!-- 65-512/hr -->
    <value>200</value>    <!-- 513-4,096/hr -->
    <value>500</value>    <!-- 4097-/hr -->
  </array>

</device>

3.系统源码

系统源码位置\frameworks\base\core\res\res\xml\PowerProfile.xml

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

法迪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值