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

Commit 16769d7f authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android (Google) Code Review
Browse files

Merge "Null check when PowerStats HAL returns null instead of an empty array" into main

parents 751cbe44 98358899
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -568,6 +568,7 @@ public class PowerStatsService extends SystemService {
            int index = 0;

            Channel[] channels = getEnergyMeterInfo();
            if (channels != null) {
                for (Channel channel : channels) {
                    PowerMonitor monitor = new PowerMonitor(index++,
                            PowerMonitor.POWER_MONITOR_TYPE_MEASUREMENT,
@@ -575,8 +576,9 @@ public class PowerStatsService extends SystemService {
                    monitors.add(monitor);
                    states.add(new PowerMonitorState(monitor, channel.id));
                }

            }
            EnergyConsumer[] energyConsumers = getEnergyConsumerInfo();
            if (energyConsumers != null) {
                for (EnergyConsumer consumer : energyConsumers) {
                    PowerMonitor monitor = new PowerMonitor(index++,
                            PowerMonitor.POWER_MONITOR_TYPE_CONSUMER,
@@ -584,7 +586,7 @@ public class PowerStatsService extends SystemService {
                    monitors.add(monitor);
                    states.add(new PowerMonitorState(monitor, consumer.id));
                }

            }
            mPowerMonitors = monitors.toArray(new PowerMonitor[monitors.size()]);
            mPowerMonitorStates = states.toArray(new PowerMonitorState[monitors.size()]);
        }