sdk: Add static isChargingControlSupported(ctx) method

This will let us use it without bothering to handle RuntimeException
from HealthInterface contructor.

Change-Id: I768c250d1e527b6fd8e49a40452b98404062cc18
This commit is contained in:
LuK1337
2023-06-13 14:24:16 +02:00
parent 95e2d729c9
commit 9a0fe3bea6

View File

@@ -119,6 +119,21 @@ public class HealthInterface {
return false;
}
/**
* Returns whether charging control is supported
*
* @return true if charging control is supported
*/
public static boolean isChargingControlSupported(Context context) {
try {
return getInstance(context).isChargingControlSupported();
} catch (RuntimeException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
return false;
}
/**
* Returns the charging control enabled status
*