Make Usb Restrictor available if USB HAL 1.3+ is present
The new HAL exposes an identical interface Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com> Change-Id: Ic7a0862ca92dab5d25c11926235b2e8194cb7e62
This commit is contained in:
committed by
Michael Bestas
parent
55652b702a
commit
efe6d135bf
@@ -71,6 +71,7 @@ lineage_sdk_LOCAL_STATIC_ANDROID_LIBRARIES = [
|
||||
]
|
||||
|
||||
lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES = [
|
||||
"android.hardware.usb-V1.3-java",
|
||||
"vendor.lineage.livedisplay-V2.0-java",
|
||||
"vendor.lineage.livedisplay-V2.1-java",
|
||||
"vendor.lineage.touch-V1.0-java",
|
||||
|
||||
@@ -38,6 +38,7 @@ import lineageos.providers.LineageSettings;
|
||||
import lineageos.trust.ITrustInterface;
|
||||
import lineageos.trust.TrustInterface;
|
||||
|
||||
import android.hardware.usb.V1_3.IUsb;
|
||||
import vendor.lineage.trust.V1_0.IUsbRestrict;
|
||||
|
||||
import java.text.ParseException;
|
||||
@@ -65,6 +66,7 @@ public class TrustInterfaceService extends LineageSystemService {
|
||||
private NotificationManager mNotificationManager = null;
|
||||
|
||||
private IUsbRestrict mUsbRestrictor = null;
|
||||
private IUsb mUsb = null;
|
||||
|
||||
public TrustInterfaceService(Context context) {
|
||||
super(context);
|
||||
@@ -92,6 +94,7 @@ public class TrustInterfaceService extends LineageSystemService {
|
||||
mNotificationManager = mContext.getSystemService(NotificationManager.class);
|
||||
|
||||
try {
|
||||
mUsb = IUsb.getService();
|
||||
mUsbRestrictor = IUsbRestrict.getService();
|
||||
} catch (NoSuchElementException | RemoteException e) {
|
||||
// ignore, the hal is not available
|
||||
@@ -160,7 +163,7 @@ public class TrustInterfaceService extends LineageSystemService {
|
||||
}
|
||||
|
||||
private boolean hasUsbRestrictorInternal() {
|
||||
return mUsbRestrictor != null;
|
||||
return mUsb != null || mUsbRestrictor != null;
|
||||
}
|
||||
|
||||
private boolean postOnBoardingNotification() {
|
||||
|
||||
Reference in New Issue
Block a user