Loading core/java/com/android/internal/os/BatteryStatsImpl.java +14 −5 Original line number Diff line number Diff line Loading @@ -328,11 +328,13 @@ public final class BatteryStatsImpl extends BatteryStats { int mLastDischargeStepLevel; long mLastDischargeStepTime; int mMinDischargeStepLevel; int mNumDischargeStepDurations; final long[] mDischargeStepDurations = new long[MAX_LEVEL_STEPS]; int mLastChargeStepLevel; long mLastChargeStepTime; int mMaxChargeStepLevel; int mNumChargeStepDurations; final long[] mChargeStepDurations = new long[MAX_LEVEL_STEPS]; Loading Loading @@ -887,6 +889,7 @@ public final class BatteryStatsImpl extends BatteryStats { mLastTime = 0; mUnpluggedTime = in.readLong(); timeBase.add(this); if (DEBUG) Log.i(TAG, "**** READ TIMER #" + mType + ": mTotalTime=" + mTotalTime); } Timer(int type, TimeBase timeBase) { Loading Loading @@ -917,6 +920,8 @@ public final class BatteryStatsImpl extends BatteryStats { } public void writeToParcel(Parcel out, long elapsedRealtimeUs) { if (DEBUG) Log.i(TAG, "**** WRITING TIMER #" + mType + ": mTotalTime=" + computeRunTimeLocked(mTimeBase.getRealtime(elapsedRealtimeUs))); out.writeInt(mCount); out.writeInt(mLoadedCount); out.writeInt(mUnpluggedCount); Loading Loading @@ -5550,6 +5555,7 @@ public final class BatteryStatsImpl extends BatteryStats { for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) { mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, null, mOnBatteryTimeBase); } mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase); mLowPowerModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase); mPhoneOnTimer = new StopwatchTimer(null, -3, null, mOnBatteryTimeBase); for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) { Loading Loading @@ -5581,7 +5587,6 @@ public final class BatteryStatsImpl extends BatteryStats { } mAudioOnTimer = new StopwatchTimer(null, -7, null, mOnBatteryTimeBase); mVideoOnTimer = new StopwatchTimer(null, -8, null, mOnBatteryTimeBase); mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase); mOnBattery = mOnBatteryInternal = false; long uptime = SystemClock.uptimeMillis() * 1000; long realtime = SystemClock.elapsedRealtime() * 1000; Loading Loading @@ -5958,6 +5963,7 @@ public final class BatteryStatsImpl extends BatteryStats { mNumDischargeStepDurations = 0; } mLastDischargeStepLevel = level; mMinDischargeStepLevel = level; mLastDischargeStepTime = -1; pullPendingStateUpdatesLocked(); mHistoryCur.batteryLevel = (byte)level; Loading Loading @@ -5996,6 +6002,7 @@ public final class BatteryStatsImpl extends BatteryStats { updateTimeBasesLocked(false, !screenOn, uptime, realtime); mNumChargeStepDurations = 0; mLastChargeStepLevel = level; mMaxChargeStepLevel = level; mLastChargeStepTime = -1; } if (doWrite || (mLastWriteTime + (60 * 1000)) < mSecRealtime) { Loading Loading @@ -6117,19 +6124,21 @@ public final class BatteryStatsImpl extends BatteryStats { addHistoryRecordLocked(elapsedRealtime, uptime); } if (onBattery) { if (mLastDischargeStepLevel != level) { if (mLastDischargeStepLevel != level && mMinDischargeStepLevel > level) { mNumDischargeStepDurations = addLevelSteps(mDischargeStepDurations, mNumDischargeStepDurations, mLastDischargeStepTime, mLastDischargeStepLevel - level, elapsedRealtime); mLastDischargeStepLevel = level; mMinDischargeStepLevel = level; mLastDischargeStepTime = elapsedRealtime; } } else { if (mLastChargeStepLevel != level) { if (mLastChargeStepLevel != level && mMaxChargeStepLevel < level) { mNumChargeStepDurations = addLevelSteps(mChargeStepDurations, mNumChargeStepDurations, mLastChargeStepTime, level - mLastChargeStepLevel, elapsedRealtime); mLastChargeStepLevel = level; mMaxChargeStepLevel = level; mLastChargeStepTime = elapsedRealtime; } } Loading Loading @@ -7495,6 +7504,8 @@ public final class BatteryStatsImpl extends BatteryStats { mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, null, mOnBatteryTimeBase, in); } mInteractive = false; mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase, in); mPhoneOn = false; mLowPowerModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase, in); mPhoneOnTimer = new StopwatchTimer(null, -3, null, mOnBatteryTimeBase, in); Loading Loading @@ -7536,8 +7547,6 @@ public final class BatteryStatsImpl extends BatteryStats { mAudioOnTimer = new StopwatchTimer(null, -7, null, mOnBatteryTimeBase); mVideoOn = false; mVideoOnTimer = new StopwatchTimer(null, -8, null, mOnBatteryTimeBase); mInteractive = false; mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase, in); mDischargeUnplugLevel = in.readInt(); mDischargePlugLevel = in.readInt(); mDischargeCurrentLevel = in.readInt(); Loading services/core/java/com/android/server/ConnectivityService.java +5 −4 Original line number Diff line number Diff line Loading @@ -5750,10 +5750,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { // updateNetworkSettings(); } // notify battery stats service about this network // try { // TODO //BatteryStatsService.getService().noteNetworkInterfaceType(iface, netType); // } catch (RemoteException e) { } try { BatteryStatsService.getService().noteNetworkInterfaceType( newNetwork.linkProperties.getInterfaceName(), newNetwork.networkInfo.getType()); } catch (RemoteException e) { } notifyNetworkCallbacks(newNetwork, ConnectivityManager.CALLBACK_AVAILABLE); } else { if (DBG && newNetwork.networkRequests.size() != 0) { Loading services/core/java/com/android/server/NetworkManagementService.java +2 −3 Original line number Diff line number Diff line Loading @@ -240,9 +240,8 @@ public class NetworkManagementService extends INetworkManagementService.Stub mPhoneStateListener = new PhoneStateListener(mDaemonHandler.getLooper()) { public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { // Disabled for now, until we are getting good data. //notifyInterfaceClassActivity(ConnectivityManager.TYPE_MOBILE, // dcRtInfo.getDcPowerState(), dcRtInfo.getTime(), true); notifyInterfaceClassActivity(ConnectivityManager.TYPE_MOBILE, dcRtInfo.getDcPowerState(), dcRtInfo.getTime(), true); } }; Loading Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +14 −5 Original line number Diff line number Diff line Loading @@ -328,11 +328,13 @@ public final class BatteryStatsImpl extends BatteryStats { int mLastDischargeStepLevel; long mLastDischargeStepTime; int mMinDischargeStepLevel; int mNumDischargeStepDurations; final long[] mDischargeStepDurations = new long[MAX_LEVEL_STEPS]; int mLastChargeStepLevel; long mLastChargeStepTime; int mMaxChargeStepLevel; int mNumChargeStepDurations; final long[] mChargeStepDurations = new long[MAX_LEVEL_STEPS]; Loading Loading @@ -887,6 +889,7 @@ public final class BatteryStatsImpl extends BatteryStats { mLastTime = 0; mUnpluggedTime = in.readLong(); timeBase.add(this); if (DEBUG) Log.i(TAG, "**** READ TIMER #" + mType + ": mTotalTime=" + mTotalTime); } Timer(int type, TimeBase timeBase) { Loading Loading @@ -917,6 +920,8 @@ public final class BatteryStatsImpl extends BatteryStats { } public void writeToParcel(Parcel out, long elapsedRealtimeUs) { if (DEBUG) Log.i(TAG, "**** WRITING TIMER #" + mType + ": mTotalTime=" + computeRunTimeLocked(mTimeBase.getRealtime(elapsedRealtimeUs))); out.writeInt(mCount); out.writeInt(mLoadedCount); out.writeInt(mUnpluggedCount); Loading Loading @@ -5550,6 +5555,7 @@ public final class BatteryStatsImpl extends BatteryStats { for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) { mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, null, mOnBatteryTimeBase); } mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase); mLowPowerModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase); mPhoneOnTimer = new StopwatchTimer(null, -3, null, mOnBatteryTimeBase); for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) { Loading Loading @@ -5581,7 +5587,6 @@ public final class BatteryStatsImpl extends BatteryStats { } mAudioOnTimer = new StopwatchTimer(null, -7, null, mOnBatteryTimeBase); mVideoOnTimer = new StopwatchTimer(null, -8, null, mOnBatteryTimeBase); mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase); mOnBattery = mOnBatteryInternal = false; long uptime = SystemClock.uptimeMillis() * 1000; long realtime = SystemClock.elapsedRealtime() * 1000; Loading Loading @@ -5958,6 +5963,7 @@ public final class BatteryStatsImpl extends BatteryStats { mNumDischargeStepDurations = 0; } mLastDischargeStepLevel = level; mMinDischargeStepLevel = level; mLastDischargeStepTime = -1; pullPendingStateUpdatesLocked(); mHistoryCur.batteryLevel = (byte)level; Loading Loading @@ -5996,6 +6002,7 @@ public final class BatteryStatsImpl extends BatteryStats { updateTimeBasesLocked(false, !screenOn, uptime, realtime); mNumChargeStepDurations = 0; mLastChargeStepLevel = level; mMaxChargeStepLevel = level; mLastChargeStepTime = -1; } if (doWrite || (mLastWriteTime + (60 * 1000)) < mSecRealtime) { Loading Loading @@ -6117,19 +6124,21 @@ public final class BatteryStatsImpl extends BatteryStats { addHistoryRecordLocked(elapsedRealtime, uptime); } if (onBattery) { if (mLastDischargeStepLevel != level) { if (mLastDischargeStepLevel != level && mMinDischargeStepLevel > level) { mNumDischargeStepDurations = addLevelSteps(mDischargeStepDurations, mNumDischargeStepDurations, mLastDischargeStepTime, mLastDischargeStepLevel - level, elapsedRealtime); mLastDischargeStepLevel = level; mMinDischargeStepLevel = level; mLastDischargeStepTime = elapsedRealtime; } } else { if (mLastChargeStepLevel != level) { if (mLastChargeStepLevel != level && mMaxChargeStepLevel < level) { mNumChargeStepDurations = addLevelSteps(mChargeStepDurations, mNumChargeStepDurations, mLastChargeStepTime, level - mLastChargeStepLevel, elapsedRealtime); mLastChargeStepLevel = level; mMaxChargeStepLevel = level; mLastChargeStepTime = elapsedRealtime; } } Loading Loading @@ -7495,6 +7504,8 @@ public final class BatteryStatsImpl extends BatteryStats { mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, null, mOnBatteryTimeBase, in); } mInteractive = false; mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase, in); mPhoneOn = false; mLowPowerModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase, in); mPhoneOnTimer = new StopwatchTimer(null, -3, null, mOnBatteryTimeBase, in); Loading Loading @@ -7536,8 +7547,6 @@ public final class BatteryStatsImpl extends BatteryStats { mAudioOnTimer = new StopwatchTimer(null, -7, null, mOnBatteryTimeBase); mVideoOn = false; mVideoOnTimer = new StopwatchTimer(null, -8, null, mOnBatteryTimeBase); mInteractive = false; mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase, in); mDischargeUnplugLevel = in.readInt(); mDischargePlugLevel = in.readInt(); mDischargeCurrentLevel = in.readInt(); Loading
services/core/java/com/android/server/ConnectivityService.java +5 −4 Original line number Diff line number Diff line Loading @@ -5750,10 +5750,11 @@ public class ConnectivityService extends IConnectivityManager.Stub { // updateNetworkSettings(); } // notify battery stats service about this network // try { // TODO //BatteryStatsService.getService().noteNetworkInterfaceType(iface, netType); // } catch (RemoteException e) { } try { BatteryStatsService.getService().noteNetworkInterfaceType( newNetwork.linkProperties.getInterfaceName(), newNetwork.networkInfo.getType()); } catch (RemoteException e) { } notifyNetworkCallbacks(newNetwork, ConnectivityManager.CALLBACK_AVAILABLE); } else { if (DBG && newNetwork.networkRequests.size() != 0) { Loading
services/core/java/com/android/server/NetworkManagementService.java +2 −3 Original line number Diff line number Diff line Loading @@ -240,9 +240,8 @@ public class NetworkManagementService extends INetworkManagementService.Stub mPhoneStateListener = new PhoneStateListener(mDaemonHandler.getLooper()) { public void onDataConnectionRealTimeInfoChanged( DataConnectionRealTimeInfo dcRtInfo) { // Disabled for now, until we are getting good data. //notifyInterfaceClassActivity(ConnectivityManager.TYPE_MOBILE, // dcRtInfo.getDcPowerState(), dcRtInfo.getTime(), true); notifyInterfaceClassActivity(ConnectivityManager.TYPE_MOBILE, dcRtInfo.getDcPowerState(), dcRtInfo.getTime(), true); } }; Loading