ChargingControl: No need to log a crash when not supported

Instead of relying on catching the exception later on, check if
ChargingControl is actually supported before checking if a specific
mode is

Change-Id: Icaf8d333842c9847bea00bedb4b302b7acd49bb3
This commit is contained in:
Michael W
2023-06-25 18:38:00 +02:00
parent d487fb503f
commit 9ed93717cb

View File

@@ -254,7 +254,7 @@ public class ChargingControlController extends LineageHealthFeature {
public boolean isChargingModeSupported(int mode) {
try {
return (mChargingControl.getSupportedMode() & mode) != 0;
return isSupported() && (mChargingControl.getSupportedMode() & mode) != 0;
} catch (RemoteException e) {
throw new RuntimeException(e);
}