mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-22 23:57:30 +01:00
Always short backoff on charging
This commit is contained in:
@@ -37,6 +37,7 @@ import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
@@ -423,6 +424,18 @@ public class Helper {
|
||||
return null;
|
||||
}
|
||||
|
||||
static boolean isCharging(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
|
||||
return false;
|
||||
try {
|
||||
BatteryManager bm = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
|
||||
return bm.isCharging();
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isPlayStoreInstall() {
|
||||
return BuildConfig.PLAY_STORE_RELEASE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user