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

Updater: Fix EXTRA_PLUGGED check in isBatteryLevelOk

* EXTRA_PLUGGED is not a boolean.

Change-Id: I3c2869cc4e08b48e396e5bae5ef22383fcbf7260
parent c548bdf1
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment