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

Commit 7ea9d158 authored by YK Hung's avatar YK Hung Committed by Android Build Cherrypicker Worker
Browse files

Fix the NPE in the tryToFetchUsageData() method

Test: atest
Bug: 371490669
Fix: 371490669
Flag: EXEMPT for simple fix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:291e92d6493b9640bc87bc787b58daa0936bae8e)
Merged-In: I4167becf373a6279135261bbaff44ef0888728fa
Change-Id: I4167becf373a6279135261bbaff44ef0888728fa
parent 18eac4ef
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -106,6 +106,10 @@ public final class BatteryUsageBroadcastReceiver extends BroadcastReceiver {

    private void tryToFetchUsageData(Context context) {
        final Intent batteryIntent = BatteryUtils.getBatteryIntent(context);
        if (batteryIntent == null) {
            Log.w(TAG, "tryToFetchUsageData: ignore from null battery intent");
            return;
        }
        // Returns when battery is not fully charged.
        if (!BatteryStatus.isCharged(batteryIntent)) {
            return;