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

Commit 4d3a9f2b authored by Blake Kragten's avatar Blake Kragten
Browse files

Modem power monitor

This is an AOSP carry over for the frameworks base CL. This change is needed here to allow telephony changes to be added to AOSP with no issues.

Adding monitored power rail as a new cellular battery stats component. This will be used to better determine actual power usage of the modem rather than relying on battery reduction rates.

If the device does not support rail power monitoring then this value
will always remain at 0.

Test: adb shell dumpsys activity service TelephonyDebugService --metrics
Results Examples:
	Energy consumed by modem (mAh): 2.41

Change-Id: If85af2f2e1b255661e189c5375ecc5825be84c58
parent 32bfd77b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public final class CellularBatteryStats implements Parcelable {
  private long[] mTimeInRatMs;
  private long[] mTimeInRxSignalStrengthLevelMs;
  private long[] mTxTimeMs;
  private long mMonitoredRailChargeConsumedMaMs;

  public static final Parcelable.Creator<CellularBatteryStats> CREATOR = new
      Parcelable.Creator<CellularBatteryStats>() {
@@ -74,6 +75,7 @@ public final class CellularBatteryStats implements Parcelable {
    out.writeLongArray(mTimeInRatMs);
    out.writeLongArray(mTimeInRxSignalStrengthLevelMs);
    out.writeLongArray(mTxTimeMs);
    out.writeLong(mMonitoredRailChargeConsumedMaMs);
  }

  public void readFromParcel(Parcel in) {
@@ -90,6 +92,7 @@ public final class CellularBatteryStats implements Parcelable {
    in.readLongArray(mTimeInRatMs);
    in.readLongArray(mTimeInRxSignalStrengthLevelMs);
    in.readLongArray(mTxTimeMs);
    mMonitoredRailChargeConsumedMaMs = in.readLong();
  }

  public long getLoggingDurationMs() {
@@ -144,6 +147,10 @@ public final class CellularBatteryStats implements Parcelable {
    return mTxTimeMs;
  }

  public long getMonitoredRailChargeConsumedMaMs() {
    return mMonitoredRailChargeConsumedMaMs;
  }

  public void setLoggingDurationMs(long t) {
    mLoggingDurationMs = t;
    return;
@@ -211,6 +218,11 @@ public final class CellularBatteryStats implements Parcelable {
    return;
  }

  public void setMonitoredRailChargeConsumedMaMs(long monitoredRailEnergyConsumedMaMs) {
    mMonitoredRailChargeConsumedMaMs = monitoredRailEnergyConsumedMaMs;
    return;
  }

  public int describeContents() {
    return 0;
  }
@@ -237,6 +249,7 @@ public final class CellularBatteryStats implements Parcelable {
    Arrays.fill(mTimeInRxSignalStrengthLevelMs, 0);
    mTxTimeMs = new long[ModemActivityInfo.TX_POWER_LEVELS];
    Arrays.fill(mTxTimeMs, 0);
    mMonitoredRailChargeConsumedMaMs = 0;
    return;
  }
}
 No newline at end of file