Loading core/java/com/android/internal/os/LongArrayMultiStateCounter.java +7 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ public final class LongArrayMultiStateCounter implements Parcelable { public void setValues(long[] array) { if (array.length != mLength) { throw new IllegalArgumentException( "Invalid array length: " + mLength + ", expected: " + mLength); "Invalid array length: " + array.length + ", expected: " + mLength); } native_setValues(mNativeObject, array); } Loading @@ -116,7 +116,7 @@ public final class LongArrayMultiStateCounter implements Parcelable { public void getValues(long[] array) { if (array.length != mLength) { throw new IllegalArgumentException( "Invalid array length: " + mLength + ", expected: " + mLength); "Invalid array length: " + array.length + ", expected: " + mLength); } native_getValues(mNativeObject, array); } Loading Loading @@ -347,6 +347,11 @@ public final class LongArrayMultiStateCounter implements Parcelable { throw new IllegalArgumentException( "State: " + state + ", outside the range: [0-" + mStateCount + "]"); } if (longArrayContainer.mLength != mLength) { throw new IllegalArgumentException( "Invalid array length: " + longArrayContainer.mLength + ", expected: " + mLength); } native_getCounts(mNativeObject, longArrayContainer.mNativeObject, state); } Loading services/core/java/com/android/server/power/stats/BatteryStatsImpl.java +0 −3 Original line number Diff line number Diff line Loading @@ -11509,9 +11509,6 @@ public class BatteryStatsImpl extends BatteryStats { mOnBatteryTimeBase); } mPerDisplayBatteryStats = new DisplayBatteryStats[1]; mPerDisplayBatteryStats[0] = new DisplayBatteryStats(mClock, mOnBatteryTimeBase); mInteractiveTimer = new StopwatchTimer(mClock, null, -10, null, mOnBatteryTimeBase); mPowerSaveModeEnabledTimer = new StopwatchTimer(mClock, null, -2, null, mOnBatteryTimeBase); Loading services/core/java/com/android/server/power/stats/processor/AmbientDisplayPowerStatsProcessor.java +7 −5 Original line number Diff line number Diff line Loading @@ -50,12 +50,14 @@ class AmbientDisplayPowerStatsProcessor extends PowerStatsProcessor { return; } if (mScreenPowerStatsDescriptor == null) { mScreenPowerStatsDescriptor = screenStats.getPowerStatsDescriptor(); if (mScreenPowerStatsDescriptor == null) { PowerStats.Descriptor screenDescriptor = screenStats.getPowerStatsDescriptor(); if (screenDescriptor == null) { return; } if (mScreenPowerStatsDescriptor == null || !mScreenPowerStatsDescriptor.equals(screenDescriptor)) { mScreenPowerStatsDescriptor = screenDescriptor; mScreenPowerStatsLayout = new ScreenPowerStatsLayout(mScreenPowerStatsDescriptor); mTmpScreenStats = new long[mScreenPowerStatsDescriptor.statsArrayLength]; } Loading services/core/java/com/android/server/power/stats/processor/ScreenPowerStatsProcessor.java +5 −4 Original line number Diff line number Diff line Loading @@ -89,14 +89,15 @@ class ScreenPowerStatsProcessor extends PowerStatsProcessor { return true; } mLastUsedDescriptor = descriptor; mStatsLayout = new ScreenPowerStatsLayout(descriptor); if (mStatsLayout.getDisplayCount() != mDisplayCount) { Slog.e(TAG, "Incompatible number of displays: " + mStatsLayout.getDisplayCount() ScreenPowerStatsLayout statsLayout = new ScreenPowerStatsLayout(descriptor); if (statsLayout.getDisplayCount() != mDisplayCount) { Slog.e(TAG, "Incompatible number of displays: " + statsLayout.getDisplayCount() + ", expected: " + mDisplayCount); return false; } mLastUsedDescriptor = descriptor; mStatsLayout = statsLayout; mTmpDeviceStatsArray = new long[descriptor.statsArrayLength]; mTmpUidStatsArray = new long[descriptor.uidStatsArrayLength]; return true; Loading services/tests/powerstatstests/src/com/android/server/power/stats/MockBatteryStatsImpl.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.power.stats; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.annotation.NonNull; import android.app.usage.NetworkStatsManager; Loading Loading @@ -80,7 +81,7 @@ public class MockBatteryStatsImpl extends BatteryStatsImpl { Handler handler, PowerStatsUidResolver powerStatsUidResolver) { super(config, clock, new MonotonicClock(0, clock), historyDirectory, handler, mock(PlatformIdleStateCallback.class), mock(EnergyStatsRetriever.class), mock(UserInfoProvider.class), mock(PowerProfile.class), mock(UserInfoProvider.class), mockPowerProfile(), new CpuScalingPolicies(new SparseArray<>(), new SparseArray<>()), powerStatsUidResolver, mock(FrameworkStatsLogger.class), mock(BatteryStatsHistory.TraceDelegate.class), Loading @@ -96,6 +97,12 @@ public class MockBatteryStatsImpl extends BatteryStatsImpl { mKernelWakelockReader = null; } private static PowerProfile mockPowerProfile() { PowerProfile powerProfile = mock(PowerProfile.class); when(powerProfile.getNumDisplays()).thenReturn(1); return powerProfile; } public void initMeasuredEnergyStats(String[] customBucketNames) { final boolean[] supportedStandardBuckets = new boolean[EnergyConsumerStats.NUMBER_STANDARD_POWER_BUCKETS]; Loading Loading
core/java/com/android/internal/os/LongArrayMultiStateCounter.java +7 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ public final class LongArrayMultiStateCounter implements Parcelable { public void setValues(long[] array) { if (array.length != mLength) { throw new IllegalArgumentException( "Invalid array length: " + mLength + ", expected: " + mLength); "Invalid array length: " + array.length + ", expected: " + mLength); } native_setValues(mNativeObject, array); } Loading @@ -116,7 +116,7 @@ public final class LongArrayMultiStateCounter implements Parcelable { public void getValues(long[] array) { if (array.length != mLength) { throw new IllegalArgumentException( "Invalid array length: " + mLength + ", expected: " + mLength); "Invalid array length: " + array.length + ", expected: " + mLength); } native_getValues(mNativeObject, array); } Loading Loading @@ -347,6 +347,11 @@ public final class LongArrayMultiStateCounter implements Parcelable { throw new IllegalArgumentException( "State: " + state + ", outside the range: [0-" + mStateCount + "]"); } if (longArrayContainer.mLength != mLength) { throw new IllegalArgumentException( "Invalid array length: " + longArrayContainer.mLength + ", expected: " + mLength); } native_getCounts(mNativeObject, longArrayContainer.mNativeObject, state); } Loading
services/core/java/com/android/server/power/stats/BatteryStatsImpl.java +0 −3 Original line number Diff line number Diff line Loading @@ -11509,9 +11509,6 @@ public class BatteryStatsImpl extends BatteryStats { mOnBatteryTimeBase); } mPerDisplayBatteryStats = new DisplayBatteryStats[1]; mPerDisplayBatteryStats[0] = new DisplayBatteryStats(mClock, mOnBatteryTimeBase); mInteractiveTimer = new StopwatchTimer(mClock, null, -10, null, mOnBatteryTimeBase); mPowerSaveModeEnabledTimer = new StopwatchTimer(mClock, null, -2, null, mOnBatteryTimeBase); Loading
services/core/java/com/android/server/power/stats/processor/AmbientDisplayPowerStatsProcessor.java +7 −5 Original line number Diff line number Diff line Loading @@ -50,12 +50,14 @@ class AmbientDisplayPowerStatsProcessor extends PowerStatsProcessor { return; } if (mScreenPowerStatsDescriptor == null) { mScreenPowerStatsDescriptor = screenStats.getPowerStatsDescriptor(); if (mScreenPowerStatsDescriptor == null) { PowerStats.Descriptor screenDescriptor = screenStats.getPowerStatsDescriptor(); if (screenDescriptor == null) { return; } if (mScreenPowerStatsDescriptor == null || !mScreenPowerStatsDescriptor.equals(screenDescriptor)) { mScreenPowerStatsDescriptor = screenDescriptor; mScreenPowerStatsLayout = new ScreenPowerStatsLayout(mScreenPowerStatsDescriptor); mTmpScreenStats = new long[mScreenPowerStatsDescriptor.statsArrayLength]; } Loading
services/core/java/com/android/server/power/stats/processor/ScreenPowerStatsProcessor.java +5 −4 Original line number Diff line number Diff line Loading @@ -89,14 +89,15 @@ class ScreenPowerStatsProcessor extends PowerStatsProcessor { return true; } mLastUsedDescriptor = descriptor; mStatsLayout = new ScreenPowerStatsLayout(descriptor); if (mStatsLayout.getDisplayCount() != mDisplayCount) { Slog.e(TAG, "Incompatible number of displays: " + mStatsLayout.getDisplayCount() ScreenPowerStatsLayout statsLayout = new ScreenPowerStatsLayout(descriptor); if (statsLayout.getDisplayCount() != mDisplayCount) { Slog.e(TAG, "Incompatible number of displays: " + statsLayout.getDisplayCount() + ", expected: " + mDisplayCount); return false; } mLastUsedDescriptor = descriptor; mStatsLayout = statsLayout; mTmpDeviceStatsArray = new long[descriptor.statsArrayLength]; mTmpUidStatsArray = new long[descriptor.uidStatsArrayLength]; return true; Loading
services/tests/powerstatstests/src/com/android/server/power/stats/MockBatteryStatsImpl.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.power.stats; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.annotation.NonNull; import android.app.usage.NetworkStatsManager; Loading Loading @@ -80,7 +81,7 @@ public class MockBatteryStatsImpl extends BatteryStatsImpl { Handler handler, PowerStatsUidResolver powerStatsUidResolver) { super(config, clock, new MonotonicClock(0, clock), historyDirectory, handler, mock(PlatformIdleStateCallback.class), mock(EnergyStatsRetriever.class), mock(UserInfoProvider.class), mock(PowerProfile.class), mock(UserInfoProvider.class), mockPowerProfile(), new CpuScalingPolicies(new SparseArray<>(), new SparseArray<>()), powerStatsUidResolver, mock(FrameworkStatsLogger.class), mock(BatteryStatsHistory.TraceDelegate.class), Loading @@ -96,6 +97,12 @@ public class MockBatteryStatsImpl extends BatteryStatsImpl { mKernelWakelockReader = null; } private static PowerProfile mockPowerProfile() { PowerProfile powerProfile = mock(PowerProfile.class); when(powerProfile.getNumDisplays()).thenReturn(1); return powerProfile; } public void initMeasuredEnergyStats(String[] customBucketNames) { final boolean[] supportedStandardBuckets = new boolean[EnergyConsumerStats.NUMBER_STANDARD_POWER_BUCKETS]; Loading