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

Commit 7ad6b615 authored by LuK1337's avatar LuK1337 Committed by Łukasz Patron
Browse files

Updater: Fix EXTRA_PLUGGED check in isBatteryLevelOk

* EXTRA_PLUGGED is not a boolean.

Change-Id: I3c2869cc4e08b48e396e5bae5ef22383fcbf7260
parent c548bdf1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -556,7 +556,8 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
        }
        int percent = Math.round(100.f * intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 100) /
                intent.getIntExtra(BatteryManager.EXTRA_SCALE, 100));
        int required = intent.getBooleanExtra(BatteryManager.EXTRA_PLUGGED, false) ?
        int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
        int required = (plugged & BatteryManager.BATTERY_PLUGGED_ANY) != 0 ?
                mActivity.getResources().getInteger(R.integer.battery_ok_percentage_charging) :
                mActivity.getResources().getInteger(R.integer.battery_ok_percentage_discharging);
        return percent >= required;