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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user