Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61698140 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Utilize per RAT info to calculate modem power consumption"

parents 3da5fbb2 6f1a65aa
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -158,11 +158,11 @@ public class ModemPowerProfile {

    private static final SparseArray<String> MODEM_TX_LEVEL_NAMES = new SparseArray<>(5);
    static {
        MODEM_DRAIN_TYPE_NAMES.put(MODEM_TX_LEVEL_0, "0");
        MODEM_DRAIN_TYPE_NAMES.put(MODEM_TX_LEVEL_1, "1");
        MODEM_DRAIN_TYPE_NAMES.put(MODEM_TX_LEVEL_2, "2");
        MODEM_DRAIN_TYPE_NAMES.put(MODEM_TX_LEVEL_3, "3");
        MODEM_DRAIN_TYPE_NAMES.put(MODEM_TX_LEVEL_4, "4");
        MODEM_TX_LEVEL_NAMES.put(MODEM_TX_LEVEL_0, "0");
        MODEM_TX_LEVEL_NAMES.put(MODEM_TX_LEVEL_1, "1");
        MODEM_TX_LEVEL_NAMES.put(MODEM_TX_LEVEL_2, "2");
        MODEM_TX_LEVEL_NAMES.put(MODEM_TX_LEVEL_3, "3");
        MODEM_TX_LEVEL_NAMES.put(MODEM_TX_LEVEL_4, "4");
    }

    private static final int[] MODEM_TX_LEVEL_MAP = new int[]{
@@ -418,7 +418,10 @@ public class ModemPowerProfile {
        return Double.NaN;
    }

    private static String keyToString(int key) {
    /**
     * Returns a human readable version of a key.
     */
    public static String keyToString(int key) {
        StringBuilder sb = new StringBuilder();
        final int drainType = key & MODEM_DRAIN_TYPE_MASK;
        appendFieldToString(sb, "drain", MODEM_DRAIN_TYPE_NAMES, drainType);
@@ -427,6 +430,7 @@ public class ModemPowerProfile {
        if (drainType == MODEM_DRAIN_TYPE_TX) {
            final int txLevel = key & MODEM_TX_LEVEL_MASK;
            appendFieldToString(sb, "level", MODEM_TX_LEVEL_NAMES, txLevel);
            sb.append(",");
        }

        final int ratType = key & MODEM_RAT_TYPE_MASK;
+1 −0
Original line number Diff line number Diff line
@@ -12229,6 +12229,7 @@ public class BatteryStatsImpl extends BatteryStats {
    @GuardedBy("this")
    private void incrementPerRatDataLocked(ModemActivityInfo deltaInfo, long elapsedRealtimeMs) {
        final int infoSize = deltaInfo.getSpecificInfoLength();
        if (infoSize == 1 && deltaInfo.getSpecificInfoRat(0)
                == AccessNetworkConstants.AccessNetworkType.UNKNOWN
                && deltaInfo.getSpecificInfoFrequencyRange(0)
+369 −99

File changed.

Preview size limit exceeded, changes collapsed.

+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 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">
    <!-- Cellular modem related values. These constants are deprecated, but still supported and
         need to be tested -->
    <item name="radio.scanning">720</item>
    <item name="modem.controller.sleep">70</item>
    <item name="modem.controller.idle">360</item>
    <item name="modem.controller.rx">1440</item>
    <array name="modem.controller.tx"> <!-- Strength 0 to 4 -->
        <value>720</value>
        <value>1080</value>
        <value>1440</value>
        <value>1800</value>
        <value>2160</value>
    </array>
</device>
 No newline at end of file
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 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">
    <modem>
        <sleep>70</sleep>
        <idle>360</idle>
        <active rat="DEFAULT">
            <receive>1440</receive>
            <transmit level="0">720</transmit>
            <transmit level="1">1080</transmit>
            <transmit level="2">1440</transmit>
            <transmit level="3">1800</transmit>
            <transmit level="4">2160</transmit>
        </active>
    </modem>
</device>
 No newline at end of file
Loading