Simplification

pull/204/head
M66B 3 years ago
parent e28a10120f
commit 5e98c65c95

@ -42,7 +42,6 @@ import android.net.Network;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.BadParcelableException; import android.os.BadParcelableException;
import android.os.BatteryManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.DeadObjectException; import android.os.DeadObjectException;
@ -1761,9 +1760,8 @@ public class Log {
sb.append(String.format("Battery optimizations: %s\r\n", sb.append(String.format("Battery optimizations: %s\r\n",
ignoring == null ? null : Boolean.toString(!ignoring))); ignoring == null ? null : Boolean.toString(!ignoring)));
BatteryManager bm = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE); sb.append(String.format("Charging: %b; level: %d\r\n",
int batlevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY); Helper.isCharging(context), Helper.getBatteryLevel(context)));
sb.append(String.format("Charging: %b; level: %d\r\n", Helper.isCharging(context), batlevel));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
UsageStatsManager usm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); UsageStatsManager usm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);

Loading…
Cancel
Save