sdk: Add static isChargingControlSupported(ctx) method
This will let us use it without bothering to handle RuntimeException
from HealthInterface contructor.
Change-Id: I768c250d1e527b6fd8e49a40452b98404062cc18
diff --git a/sdk/src/omnirom/health/HealthInterface.java b/sdk/src/omnirom/health/HealthInterface.java
index 3a8e787..4589285 100644
--- a/sdk/src/omnirom/health/HealthInterface.java
+++ b/sdk/src/omnirom/health/HealthInterface.java
@@ -120,6 +120,21 @@
}
/**
+ * 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
*
* @return whether charging control has been enabled