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

Commit 2acbf9e7 authored by lijilou's avatar lijilou Committed by Jilou li
Browse files

code execution optimization for BatteryStatsImpl file.

Bug: none
Flag: EXEMPT minor optimization
Change-Id: I8281f01cba4b0152cd9bd14d0438bc830e33f083
parent 7b641717
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);