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

Commit c78e20bc authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Encapsulate PowerStats layout inside corresponding PowerStatsLayouts

Bug: 333941740
Test: atest PowerStatsTests; atest PowerStatsTestsRavenwood
Flag: EXEMPT_refactor
Change-Id: If9acd8ae8e5c0d3572e1c50b7b27e1297a9fc542
parent 88fed38d
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -131,13 +131,7 @@ public class BluetoothPowerStatsCollector extends PowerStatsCollector {
        mLastConsumedEnergyUws = new long[mEnergyConsumerIds.length];
        Arrays.fill(mLastConsumedEnergyUws, ENERGY_UNSPECIFIED);

        mLayout = new BluetoothPowerStatsLayout();
        mLayout.addDeviceBluetoothControllerActivity();
        mLayout.addDeviceSectionEnergyConsumers(mEnergyConsumerIds.length);
        mLayout.addDeviceSectionUsageDuration();
        mLayout.addDeviceSectionPowerEstimate();
        mLayout.addUidTrafficStats();
        mLayout.addUidSectionPowerEstimate();
        mLayout = new BluetoothPowerStatsLayout(mEnergyConsumerIds.length);

        PersistableBundle extras = new PersistableBundle();
        mLayout.toExtras(extras);
+2 −8
Original line number Diff line number Diff line
@@ -133,14 +133,8 @@ public class CpuPowerStatsCollector extends PowerStatsCollector {
        mTempCpuTimeByScalingStep = new long[cpuScalingStepCount];
        int[] scalingStepToPowerBracketMap = initPowerBrackets();

        mLayout = new CpuPowerStatsLayout();
        mLayout.addDeviceSectionCpuTimeByScalingStep(cpuScalingStepCount);
        mLayout.addDeviceSectionCpuTimeByCluster(mCpuScalingPolicies.getPolicies().length);
        mLayout.addDeviceSectionUsageDuration();
        mLayout.addDeviceSectionEnergyConsumers(mCpuEnergyConsumerIds.length);
        mLayout.addDeviceSectionPowerEstimate();
        mLayout.addUidSectionCpuTimeByPowerBracket(scalingStepToPowerBracketMap);
        mLayout.addUidSectionPowerEstimate();
        mLayout = new CpuPowerStatsLayout(mCpuEnergyConsumerIds.length,
                mCpuScalingPolicies.getPolicies().length, scalingStepToPowerBracketMap);

        PersistableBundle extras = new PersistableBundle();
        mLayout.toExtras(extras);
+1 −8
Original line number Diff line number Diff line
@@ -158,14 +158,7 @@ public class MobileRadioPowerStatsCollector extends PowerStatsCollector {
        mLastConsumedEnergyUws = new long[mEnergyConsumerIds.length];
        Arrays.fill(mLastConsumedEnergyUws, ENERGY_UNSPECIFIED);

        mLayout = new MobileRadioPowerStatsLayout();
        mLayout.addDeviceMobileActivity();
        mLayout.addDeviceSectionEnergyConsumers(mEnergyConsumerIds.length);
        mLayout.addStateStats();
        mLayout.addUidNetworkStats();
        mLayout.addDeviceSectionUsageDuration();
        mLayout.addDeviceSectionPowerEstimate();
        mLayout.addUidSectionPowerEstimate();
        mLayout = new MobileRadioPowerStatsLayout(mEnergyConsumerIds.length);

        SparseArray<String> stateLabels = new SparseArray<>();
        for (int rat = 0; rat < BatteryStats.RADIO_ACCESS_TECHNOLOGY_COUNT; rat++) {
+2 −7
Original line number Diff line number Diff line
@@ -104,13 +104,8 @@ public class ScreenPowerStatsCollector extends PowerStatsCollector {
        mLastConsumedEnergyUws = new long[mEnergyConsumerIds.length];
        Arrays.fill(mLastConsumedEnergyUws, ENERGY_UNSPECIFIED);

        mLayout = new ScreenPowerStatsLayout();
        mLayout.addDeviceScreenUsageDurationSection(mInjector.getDisplayCount());
        mLayout.addDeviceSectionEnergyConsumers(mEnergyConsumerIds.length);
        mLayout.addDeviceSectionUsageDuration();
        mLayout.addDeviceSectionPowerEstimate();
        mLayout.addUidTopActivitiyDuration();
        mLayout.addUidSectionPowerEstimate();
        mLayout = new ScreenPowerStatsLayout(mEnergyConsumerIds.length,
                mInjector.getDisplayCount());

        PersistableBundle extras = new PersistableBundle();
        mLayout.toExtras(extras);
+1 −7
Original line number Diff line number Diff line
@@ -141,13 +141,7 @@ public class WifiPowerStatsCollector extends PowerStatsCollector {
        mLastConsumedEnergyUws = new long[mEnergyConsumerIds.length];
        Arrays.fill(mLastConsumedEnergyUws, ENERGY_UNSPECIFIED);

        mLayout = new WifiPowerStatsLayout();
        mLayout.addDeviceWifiActivity(mPowerReportingSupported);
        mLayout.addDeviceSectionEnergyConsumers(mEnergyConsumerIds.length);
        mLayout.addUidNetworkStats();
        mLayout.addDeviceSectionUsageDuration();
        mLayout.addDeviceSectionPowerEstimate();
        mLayout.addUidSectionPowerEstimate();
        mLayout = new WifiPowerStatsLayout(mEnergyConsumerIds.length, mPowerReportingSupported);

        PersistableBundle extras = new PersistableBundle();
        mLayout.toExtras(extras);
Loading