Skip to content

Commit

Permalink
ChargingControl: No need to log a crash when not supported
Browse files Browse the repository at this point in the history
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
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
  • Loading branch information
BadDaemon authored and bheatleyyy committed Sep 28, 2023
1 parent fa16a38 commit 7fbaf08
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -254,7 +254,7 @@ public boolean reset() {

public boolean isChargingModeSupported(int mode) {
try {
return (mChargingControl.getSupportedMode() & mode) != 0;
return isSupported() && (mChargingControl.getSupportedMode() & mode) != 0;
} catch (RemoteException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 7fbaf08

Please sign in to comment.