From 5e98c65c95fb93f6c1010910b55743e757a1a60d Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 15 Aug 2021 21:11:47 +0200 Subject: [PATCH] Simplification --- app/src/main/java/eu/faircode/email/Log.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 11d573ce8d..278deaf1ea 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -42,7 +42,6 @@ import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.os.BadParcelableException; -import android.os.BatteryManager; import android.os.Build; import android.os.Bundle; import android.os.DeadObjectException; @@ -1761,9 +1760,8 @@ public class Log { sb.append(String.format("Battery optimizations: %s\r\n", ignoring == null ? null : Boolean.toString(!ignoring))); - BatteryManager bm = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE); - int batlevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY); - sb.append(String.format("Charging: %b; level: %d\r\n", Helper.isCharging(context), batlevel)); + sb.append(String.format("Charging: %b; level: %d\r\n", + Helper.isCharging(context), Helper.getBatteryLevel(context))); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { UsageStatsManager usm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);