Program: 197644
Project: 197644
Buggy source:
/** 
 * Writes a summary of the statistics to a Parcel, in a format suitable to be written to disk.  This format does not allow a lossless round-trip.
 * @param out the Parcel to be written to.
 */
public void writeSummaryToParcel(Parcel out,boolean inclHistory){
  pullPendingStateUpdatesLocked();
  long startClockTime=getStartClockTime();
  final long NOW_SYS=SystemClock.uptimeMillis() * 1000;
  final long NOWREAL_SYS=SystemClock.elapsedRealtime() * 1000;
  out.writeInt(VERSION);
  writeHistory(out,inclHistory,true);
  out.writeInt(mStartCount);
  out.writeLong(computeUptime(NOW_SYS,STATS_SINCE_CHARGED));
  out.writeLong(computeRealtime(NOWREAL_SYS,STATS_SINCE_CHARGED));
  out.writeLong(startClockTime);
  out.writeString(mStartPlatformVersion);
  out.writeString(mEndPlatformVersion);
  mOnBatteryTimeBase.writeSummaryToParcel(out,NOW_SYS,NOWREAL_SYS);
  mOnBatteryScreenOffTimeBase.writeSummaryToParcel(out,NOW_SYS,NOWREAL_SYS);
  out.writeInt(mDischargeUnplugLevel);
  out.writeInt(mDischargePlugLevel);
  out.writeInt(mDischargeCurrentLevel);
  out.writeInt(mCurrentBatteryLevel);
  out.writeInt(getLowDischargeAmountSinceCharge());
  out.writeInt(getHighDischargeAmountSinceCharge());
  out.writeInt(getDischargeAmountScreenOnSinceCharge());
  out.writeInt(getDischargeAmountScreenOffSinceCharge());
  out.writeInt(mNumDischargeStepDurations);
  out.writeLongArray(mDischargeStepDurations);
  out.writeInt(mNumChargeStepDurations);
  out.writeLongArray(mChargeStepDurations);
  mScreenOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
    mScreenBrightnessTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mInteractiveTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mLowPowerModeEnabledTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mPhoneOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
    mPhoneSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mPhoneSignalScanningTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_DATA_CONNECTION_TYPES; i++) {
    mPhoneDataConnectionsTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
    mNetworkByteActivityCounters[i].writeSummaryFromParcelLocked(out);
    mNetworkPacketActivityCounters[i].writeSummaryFromParcelLocked(out);
  }
  mMobileRadioActiveTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mMobileRadioActivePerAppTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mMobileRadioActiveAdjustedTime.writeSummaryFromParcelLocked(out);
  mMobileRadioActiveUnknownTime.writeSummaryFromParcelLocked(out);
  mMobileRadioActiveUnknownCount.writeSummaryFromParcelLocked(out);
  mWifiOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mGlobalWifiRunningTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_WIFI_STATES; i++) {
    mWifiStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  for (int i=0; i < NUM_WIFI_SUPPL_STATES; i++) {
    mWifiSupplStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  for (int i=0; i < NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
    mWifiSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mBluetoothOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_BLUETOOTH_STATES; i++) {
    mBluetoothStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mFlashlightOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  out.writeInt(mKernelWakelockStats.size());
  for (  Map.Entry<String,SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
    Timer kwlt=ent.getValue();
    if (kwlt != null) {
      out.writeInt(1);
      out.writeString(ent.getKey());
      kwlt.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
  }
  out.writeInt(mWakeupReasonStats.size());
  for (  Map.Entry<String,LongSamplingCounter> ent : mWakeupReasonStats.entrySet()) {
    LongSamplingCounter counter=ent.getValue();
    if (counter != null) {
      out.writeInt(1);
      out.writeString(ent.getKey());
      counter.writeSummaryFromParcelLocked(out);
    }
 else {
      out.writeInt(0);
    }
  }
  out.writeInt(sNumSpeedSteps);
  final int NU=mUidStats.size();
  out.writeInt(NU);
  for (int iu=0; iu < NU; iu++) {
    out.writeInt(mUidStats.keyAt(iu));
    Uid u=mUidStats.valueAt(iu);
    if (u.mWifiRunningTimer != null) {
      out.writeInt(1);
      u.mWifiRunningTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mFullWifiLockTimer != null) {
      out.writeInt(1);
      u.mFullWifiLockTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mWifiScanTimer != null) {
      out.writeInt(1);
      u.mWifiScanTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    for (int i=0; i < Uid.NUM_WIFI_BATCHED_SCAN_BINS; i++) {
      if (u.mWifiBatchedScanTimer[i] != null) {
        out.writeInt(1);
        u.mWifiBatchedScanTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    if (u.mWifiMulticastTimer != null) {
      out.writeInt(1);
      u.mWifiMulticastTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mAudioTurnedOnTimer != null) {
      out.writeInt(1);
      u.mAudioTurnedOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mVideoTurnedOnTimer != null) {
      out.writeInt(1);
      u.mVideoTurnedOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mForegroundActivityTimer != null) {
      out.writeInt(1);
      u.mForegroundActivityTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    for (int i=0; i < Uid.NUM_PROCESS_STATE; i++) {
      if (u.mProcessStateTimer[i] != null) {
        out.writeInt(1);
        u.mProcessStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    if (u.mVibratorOnTimer != null) {
      out.writeInt(1);
      u.mVibratorOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mUserActivityCounters == null) {
      out.writeInt(0);
    }
 else {
      out.writeInt(1);
      for (int i=0; i < Uid.NUM_USER_ACTIVITY_TYPES; i++) {
        u.mUserActivityCounters[i].writeSummaryFromParcelLocked(out);
      }
    }
    if (u.mNetworkByteActivityCounters == null) {
      out.writeInt(0);
    }
 else {
      out.writeInt(1);
      for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
        u.mNetworkByteActivityCounters[i].writeSummaryFromParcelLocked(out);
        u.mNetworkPacketActivityCounters[i].writeSummaryFromParcelLocked(out);
      }
      u.mMobileRadioActiveTime.writeSummaryFromParcelLocked(out);
      u.mMobileRadioActiveCount.writeSummaryFromParcelLocked(out);
    }
    final ArrayMap<String,Uid.Wakelock> wakeStats=u.mWakelockStats.getMap();
    int NW=wakeStats.size();
    out.writeInt(NW);
    for (int iw=0; iw < NW; iw++) {
      out.writeString(wakeStats.keyAt(iw));
      Uid.Wakelock wl=wakeStats.valueAt(iw);
      if (wl.mTimerFull != null) {
        out.writeInt(1);
        wl.mTimerFull.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
      if (wl.mTimerPartial != null) {
        out.writeInt(1);
        wl.mTimerPartial.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
      if (wl.mTimerWindow != null) {
        out.writeInt(1);
        wl.mTimerWindow.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    final ArrayMap<String,StopwatchTimer> syncStats=u.mSyncStats.getMap();
    int NS=syncStats.size();
    out.writeInt(NS);
    for (int is=0; is < NS; is++) {
      out.writeString(syncStats.keyAt(is));
      syncStats.valueAt(is).writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
    final ArrayMap<String,StopwatchTimer> jobStats=u.mJobStats.getMap();
    int NJ=jobStats.size();
    out.writeInt(NJ);
    for (int ij=0; ij < NJ; ij++) {
      out.writeString(jobStats.keyAt(ij));
      jobStats.valueAt(ij).writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
    int NSE=u.mSensorStats.size();
    out.writeInt(NSE);
    for (int ise=0; ise < NSE; ise++) {
      out.writeInt(u.mSensorStats.keyAt(ise));
      Uid.Sensor se=u.mSensorStats.valueAt(ise);
      if (se.mTimer != null) {
        out.writeInt(1);
        se.mTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    int NP=u.mProcessStats.size();
    out.writeInt(NP);
    for (int ip=0; ip < NP; ip++) {
      out.writeString(u.mProcessStats.keyAt(ip));
      Uid.Proc ps=u.mProcessStats.valueAt(ip);
      out.writeLong(ps.mUserTime);
      out.writeLong(ps.mSystemTime);
      out.writeLong(ps.mForegroundTime);
      out.writeInt(ps.mStarts);
      final int N=ps.mSpeedBins.length;
      out.writeInt(N);
      for (int i=0; i < N; i++) {
        if (ps.mSpeedBins[i] != null) {
          out.writeInt(1);
          ps.mSpeedBins[i].writeSummaryFromParcelLocked(out);
        }
 else {
          out.writeInt(0);
        }
      }
      ps.writeExcessivePowerToParcelLocked(out);
    }
    NP=u.mPackageStats.size();
    out.writeInt(NP);
    if (NP > 0) {
      for (      Map.Entry<String,BatteryStatsImpl.Uid.Pkg> ent : u.mPackageStats.entrySet()) {
        out.writeString(ent.getKey());
        Uid.Pkg ps=ent.getValue();
        out.writeInt(ps.mWakeups);
        NS=ps.mServiceStats.size();
        out.writeInt(NS);
        if (NS > 0) {
          for (          Map.Entry<String,BatteryStatsImpl.Uid.Pkg.Serv> sent : ps.mServiceStats.entrySet()) {
            out.writeString(sent.getKey());
            BatteryStatsImpl.Uid.Pkg.Serv ss=sent.getValue();
            long time=ss.getStartTimeToNowLocked(mOnBatteryTimeBase.getUptime(NOW_SYS));
            out.writeLong(time);
            out.writeInt(ss.mStarts);
            out.writeInt(ss.mLaunches);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes a summary of the statistics to a Parcel, in a format suitable to be written to disk.  This format does not allow a lossless round-trip.
 * @param out the Parcel to be written to.
 */
public void writeSummaryToParcel(Parcel out,boolean inclHistory){
  pullPendingStateUpdatesLocked();
  long startClockTime=getStartClockTime();
  final long NOW_SYS=SystemClock.uptimeMillis() * 1000;
  final long NOWREAL_SYS=SystemClock.elapsedRealtime() * 1000;
  out.writeInt(VERSION);
  writeHistory(out,inclHistory,true);
  out.writeInt(mStartCount);
  out.writeLong(computeUptime(NOW_SYS,STATS_SINCE_CHARGED));
  out.writeLong(computeRealtime(NOWREAL_SYS,STATS_SINCE_CHARGED));
  out.writeLong(startClockTime);
  out.writeString(mStartPlatformVersion);
  out.writeString(mEndPlatformVersion);
  mOnBatteryTimeBase.writeSummaryToParcel(out,NOW_SYS,NOWREAL_SYS);
  mOnBatteryScreenOffTimeBase.writeSummaryToParcel(out,NOW_SYS,NOWREAL_SYS);
  out.writeInt(mDischargeUnplugLevel);
  out.writeInt(mDischargePlugLevel);
  out.writeInt(mDischargeCurrentLevel);
  out.writeInt(mCurrentBatteryLevel);
  out.writeInt(getLowDischargeAmountSinceCharge());
  out.writeInt(getHighDischargeAmountSinceCharge());
  out.writeInt(getDischargeAmountScreenOnSinceCharge());
  out.writeInt(getDischargeAmountScreenOffSinceCharge());
  out.writeInt(mNumDischargeStepDurations);
  out.writeLongArray(mDischargeStepDurations);
  out.writeInt(mNumChargeStepDurations);
  out.writeLongArray(mChargeStepDurations);
  mScreenOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
    mScreenBrightnessTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mInteractiveTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mLowPowerModeEnabledTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mPhoneOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
    mPhoneSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mPhoneSignalScanningTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_DATA_CONNECTION_TYPES; i++) {
    mPhoneDataConnectionsTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
    mNetworkByteActivityCounters[i].writeSummaryFromParcelLocked(out);
    mNetworkPacketActivityCounters[i].writeSummaryFromParcelLocked(out);
  }
  mMobileRadioActiveTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mMobileRadioActivePerAppTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mMobileRadioActiveAdjustedTime.writeSummaryFromParcelLocked(out);
  mMobileRadioActiveUnknownTime.writeSummaryFromParcelLocked(out);
  mMobileRadioActiveUnknownCount.writeSummaryFromParcelLocked(out);
  mWifiOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  mGlobalWifiRunningTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_WIFI_STATES; i++) {
    mWifiStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  for (int i=0; i < NUM_WIFI_SUPPL_STATES; i++) {
    mWifiSupplStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  for (int i=0; i < NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
    mWifiSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mBluetoothOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  for (int i=0; i < NUM_BLUETOOTH_STATES; i++) {
    mBluetoothStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  }
  mFlashlightOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
  out.writeInt(mKernelWakelockStats.size());
  for (  Map.Entry<String,SamplingTimer> ent : mKernelWakelockStats.entrySet()) {
    Timer kwlt=ent.getValue();
    if (kwlt != null) {
      out.writeInt(1);
      out.writeString(ent.getKey());
      kwlt.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
  }
  out.writeInt(mWakeupReasonStats.size());
  for (  Map.Entry<String,SamplingTimer> ent : mWakeupReasonStats.entrySet()) {
    SamplingTimer timer=ent.getValue();
    if (timer != null) {
      out.writeInt(1);
      out.writeString(ent.getKey());
      timer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
  }
  out.writeInt(sNumSpeedSteps);
  final int NU=mUidStats.size();
  out.writeInt(NU);
  for (int iu=0; iu < NU; iu++) {
    out.writeInt(mUidStats.keyAt(iu));
    Uid u=mUidStats.valueAt(iu);
    if (u.mWifiRunningTimer != null) {
      out.writeInt(1);
      u.mWifiRunningTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mFullWifiLockTimer != null) {
      out.writeInt(1);
      u.mFullWifiLockTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mWifiScanTimer != null) {
      out.writeInt(1);
      u.mWifiScanTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    for (int i=0; i < Uid.NUM_WIFI_BATCHED_SCAN_BINS; i++) {
      if (u.mWifiBatchedScanTimer[i] != null) {
        out.writeInt(1);
        u.mWifiBatchedScanTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    if (u.mWifiMulticastTimer != null) {
      out.writeInt(1);
      u.mWifiMulticastTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mAudioTurnedOnTimer != null) {
      out.writeInt(1);
      u.mAudioTurnedOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mVideoTurnedOnTimer != null) {
      out.writeInt(1);
      u.mVideoTurnedOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mForegroundActivityTimer != null) {
      out.writeInt(1);
      u.mForegroundActivityTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    for (int i=0; i < Uid.NUM_PROCESS_STATE; i++) {
      if (u.mProcessStateTimer[i] != null) {
        out.writeInt(1);
        u.mProcessStateTimer[i].writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    if (u.mVibratorOnTimer != null) {
      out.writeInt(1);
      u.mVibratorOnTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
 else {
      out.writeInt(0);
    }
    if (u.mUserActivityCounters == null) {
      out.writeInt(0);
    }
 else {
      out.writeInt(1);
      for (int i=0; i < Uid.NUM_USER_ACTIVITY_TYPES; i++) {
        u.mUserActivityCounters[i].writeSummaryFromParcelLocked(out);
      }
    }
    if (u.mNetworkByteActivityCounters == null) {
      out.writeInt(0);
    }
 else {
      out.writeInt(1);
      for (int i=0; i < NUM_NETWORK_ACTIVITY_TYPES; i++) {
        u.mNetworkByteActivityCounters[i].writeSummaryFromParcelLocked(out);
        u.mNetworkPacketActivityCounters[i].writeSummaryFromParcelLocked(out);
      }
      u.mMobileRadioActiveTime.writeSummaryFromParcelLocked(out);
      u.mMobileRadioActiveCount.writeSummaryFromParcelLocked(out);
    }
    final ArrayMap<String,Uid.Wakelock> wakeStats=u.mWakelockStats.getMap();
    int NW=wakeStats.size();
    out.writeInt(NW);
    for (int iw=0; iw < NW; iw++) {
      out.writeString(wakeStats.keyAt(iw));
      Uid.Wakelock wl=wakeStats.valueAt(iw);
      if (wl.mTimerFull != null) {
        out.writeInt(1);
        wl.mTimerFull.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
      if (wl.mTimerPartial != null) {
        out.writeInt(1);
        wl.mTimerPartial.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
      if (wl.mTimerWindow != null) {
        out.writeInt(1);
        wl.mTimerWindow.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    final ArrayMap<String,StopwatchTimer> syncStats=u.mSyncStats.getMap();
    int NS=syncStats.size();
    out.writeInt(NS);
    for (int is=0; is < NS; is++) {
      out.writeString(syncStats.keyAt(is));
      syncStats.valueAt(is).writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
    final ArrayMap<String,StopwatchTimer> jobStats=u.mJobStats.getMap();
    int NJ=jobStats.size();
    out.writeInt(NJ);
    for (int ij=0; ij < NJ; ij++) {
      out.writeString(jobStats.keyAt(ij));
      jobStats.valueAt(ij).writeSummaryFromParcelLocked(out,NOWREAL_SYS);
    }
    int NSE=u.mSensorStats.size();
    out.writeInt(NSE);
    for (int ise=0; ise < NSE; ise++) {
      out.writeInt(u.mSensorStats.keyAt(ise));
      Uid.Sensor se=u.mSensorStats.valueAt(ise);
      if (se.mTimer != null) {
        out.writeInt(1);
        se.mTimer.writeSummaryFromParcelLocked(out,NOWREAL_SYS);
      }
 else {
        out.writeInt(0);
      }
    }
    int NP=u.mProcessStats.size();
    out.writeInt(NP);
    for (int ip=0; ip < NP; ip++) {
      out.writeString(u.mProcessStats.keyAt(ip));
      Uid.Proc ps=u.mProcessStats.valueAt(ip);
      out.writeLong(ps.mUserTime);
      out.writeLong(ps.mSystemTime);
      out.writeLong(ps.mForegroundTime);
      out.writeInt(ps.mStarts);
      final int N=ps.mSpeedBins.length;
      out.writeInt(N);
      for (int i=0; i < N; i++) {
        if (ps.mSpeedBins[i] != null) {
          out.writeInt(1);
          ps.mSpeedBins[i].writeSummaryFromParcelLocked(out);
        }
 else {
          out.writeInt(0);
        }
      }
      ps.writeExcessivePowerToParcelLocked(out);
    }
    NP=u.mPackageStats.size();
    out.writeInt(NP);
    if (NP > 0) {
      for (      Map.Entry<String,BatteryStatsImpl.Uid.Pkg> ent : u.mPackageStats.entrySet()) {
        out.writeString(ent.getKey());
        Uid.Pkg ps=ent.getValue();
        out.writeInt(ps.mWakeups);
        NS=ps.mServiceStats.size();
        out.writeInt(NS);
        if (NS > 0) {
          for (          Map.Entry<String,BatteryStatsImpl.Uid.Pkg.Serv> sent : ps.mServiceStats.entrySet()) {
            out.writeString(sent.getKey());
            BatteryStatsImpl.Uid.Pkg.Serv ss=sent.getValue();
            long time=ss.getStartTimeToNowLocked(mOnBatteryTimeBase.getUptime(NOW_SYS));
            out.writeLong(time);
            out.writeInt(ss.mStarts);
            out.writeInt(ss.mLaunches);
          }
        }
      }
    }
  }
}