Fix Usb Restrictor if USB HAL 1.3+ is not present
Change-Id: Ic80f07161b24676e1697d29fea00219267a6fe81
diff --git a/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java b/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java
index 961a49c..5a7475b 100644
--- a/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java
+++ b/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2021 The LineageOS Project
+ * Copyright (C) 2018-2022 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,6 +95,11 @@
try {
mUsb = IUsb.getService();
+ } catch (NoSuchElementException | RemoteException e) {
+ // ignore, the hal is not available
+ }
+
+ try {
mUsbRestrictor = IUsbRestrict.getService();
} catch (NoSuchElementException | RemoteException e) {
// ignore, the hal is not available