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

Commit 2c957fb0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "code execution optimization for BatteryStatsImpl file." into main

parents 7983ce95 2acbf9e7
Loading
Loading
Loading
Loading
+14 −19
Original line number Diff line number Diff line
@@ -703,19 +703,17 @@ public class BatteryStatsImpl extends BatteryStats {
        @Override
        public void handleMessage(Message msg) {
            BatteryCallback cb = mCallback;
            if (cb == null) {
                return;
            }
            switch (msg.what) {
                case MSG_REPORT_CPU_UPDATE_NEEDED:
                    if (cb != null) {
                    cb.batteryNeedsCpuUpdate();
                    }
                    break;
                case MSG_REPORT_POWER_CHANGE:
                    if (cb != null) {
                    cb.batteryPowerChanged(msg.arg1 != 0);
                    }
                    break;
                case MSG_REPORT_CHARGING:
                    if (cb != null) {
                    final String action;
                    synchronized (BatteryStatsImpl.this) {
                        action = mCharging ? BatteryManager.ACTION_CHARGING
@@ -724,15 +722,12 @@ public class BatteryStatsImpl extends BatteryStats {
                    Intent intent = new Intent(action);
                    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
                    cb.batterySendBroadcast(intent);
                    }
                    break;
                case MSG_REPORT_RESET_STATS:
                    if (cb != null) {
                    cb.batteryStatsReset();
            }
        }
    }
    }
    public void postBatteryNeedsCpuUpdateMsg() {
        mHandler.sendEmptyMessage(MSG_REPORT_CPU_UPDATE_NEEDED);