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

Commit 8c743c5d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

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

Merge "code execution optimization for BatteryStatsImpl file." into main am: 2c957fb0 am: cb2bca5f

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3420400



Change-Id: I85898e72e18e917ee7ad5e78c2b8ae2f6e4f39d9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c9dec193 cb2bca5f
Loading
Loading
Loading
Loading
+14 −19
Original line number Original line Diff line number Diff line
@@ -759,19 +759,17 @@ public class BatteryStatsImpl extends BatteryStats {
        @Override
        @Override
        public void handleMessage(Message msg) {
        public void handleMessage(Message msg) {
            BatteryCallback cb = mCallback;
            BatteryCallback cb = mCallback;
            if (cb == null) {
                return;
            }
            switch (msg.what) {
            switch (msg.what) {
                case MSG_REPORT_CPU_UPDATE_NEEDED:
                case MSG_REPORT_CPU_UPDATE_NEEDED:
                    if (cb != null) {
                    cb.batteryNeedsCpuUpdate();
                    cb.batteryNeedsCpuUpdate();
                    }
                    break;
                    break;
                case MSG_REPORT_POWER_CHANGE:
                case MSG_REPORT_POWER_CHANGE:
                    if (cb != null) {
                    cb.batteryPowerChanged(msg.arg1 != 0);
                    cb.batteryPowerChanged(msg.arg1 != 0);
                    }
                    break;
                    break;
                case MSG_REPORT_CHARGING:
                case MSG_REPORT_CHARGING:
                    if (cb != null) {
                    final String action;
                    final String action;
                    synchronized (BatteryStatsImpl.this) {
                    synchronized (BatteryStatsImpl.this) {
                        action = mCharging ? BatteryManager.ACTION_CHARGING
                        action = mCharging ? BatteryManager.ACTION_CHARGING
@@ -780,15 +778,12 @@ public class BatteryStatsImpl extends BatteryStats {
                    Intent intent = new Intent(action);
                    Intent intent = new Intent(action);
                    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
                    intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
                    cb.batterySendBroadcast(intent);
                    cb.batterySendBroadcast(intent);
                    }
                    break;
                    break;
                case MSG_REPORT_RESET_STATS:
                case MSG_REPORT_RESET_STATS:
                    if (cb != null) {
                    cb.batteryStatsReset();
                    cb.batteryStatsReset();
            }
            }
        }
        }
    }
    }
    }
    public void postBatteryNeedsCpuUpdateMsg() {
    public void postBatteryNeedsCpuUpdateMsg() {
        mHandler.sendEmptyMessage(MSG_REPORT_CPU_UPDATE_NEEDED);
        mHandler.sendEmptyMessage(MSG_REPORT_CPU_UPDATE_NEEDED);