summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Xiao Lei <lei.xiao@sony.com> 2023-08-23 15:33:53 +0800
committer Henrik Baard <henrik.baard@sony.com> 2023-08-24 18:27:26 +0200
commit3763485e9c0df649bd3c78fa4ef1b09dea173ef1 (patch)
tree6055d38c3323475eb2631393dc6d5605804b495a
parent5908abd413b81b6bb100fe51481f9dd9fb53c17c (diff)
Fix CTS issue in BootControl HIDL
V1.2 version of BootControl HAL is unavailable in some devices. At this time, a NoSuchElementException exception will be thrown when getting service. We must catch this exception and handle it. Bug: 297229888 Change-Id: Ib108211c7146c53a6405cb9510e7d504e5f1ecfe
-rw-r--r--services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java b/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java
index 65325c297719..7c4d7875b76f 100644
--- a/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java
+++ b/services/core/java/com/android/server/recoverysystem/hal/BootControlHIDL.java
@@ -22,6 +22,8 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Slog;
+import java.util.NoSuchElementException;
+
public class BootControlHIDL implements IBootControl {
private static final String TAG = "BootControlHIDL";
@@ -32,7 +34,7 @@ public class BootControlHIDL implements IBootControl {
public static boolean isServicePresent() {
try {
android.hardware.boot.V1_0.IBootControl.getService(true);
- } catch (RemoteException e) {
+ } catch (RemoteException | NoSuchElementException e) {
return false;
}
return true;
@@ -41,7 +43,7 @@ public class BootControlHIDL implements IBootControl {
public static boolean isV1_2ServicePresent() {
try {
android.hardware.boot.V1_2.IBootControl.getService(true);
- } catch (RemoteException e) {
+ } catch (RemoteException | NoSuchElementException e) {
return false;
}
return true;