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

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

Merge "Fix NPE when registering BatteryTrigger before first BATTERY_CHANGED broadcast" into udc-dev

parents 5c3928ac 2bf8a781
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -59,7 +59,9 @@ public final class BatteryTrigger extends PowerStatsLogTrigger {
        if (triggerEnabled) {
            IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
            Intent batteryStatus = mContext.registerReceiver(mBatteryLevelReceiver, filter);
            if (batteryStatus != null) {
                mBatteryLevel = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
            }
        }
    }
}