mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 13:44:40 +00:00
Log battery level
This commit is contained in:
parent
6f60234833
commit
b89a3e9935
2 changed files with 12 additions and 1 deletions
|
@ -424,6 +424,16 @@ public class Helper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Integer getBatteryLevel(Context context) {
|
||||||
|
try {
|
||||||
|
BatteryManager bm = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
|
||||||
|
return bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isCharging(Context context) {
|
static boolean isCharging(Context context) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1479,7 +1479,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
new Exception(state.getUnrecoverable()));
|
new Exception(state.getUnrecoverable()));
|
||||||
|
|
||||||
// Sends store NOOP
|
// Sends store NOOP
|
||||||
EntityLog.log(this, account.name + " checking store");
|
EntityLog.log(this, account.name + " checking store" +
|
||||||
|
" battery=" + Helper.getBatteryLevel(this));
|
||||||
if (!iservice.getStore().isConnected())
|
if (!iservice.getStore().isConnected())
|
||||||
throw new StoreClosedException(iservice.getStore(), "NOOP");
|
throw new StoreClosedException(iservice.getStore(), "NOOP");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue