From dcbd8deae644f22615717d250ed5285dab61ea11 Mon Sep 17 00:00:00 2001 From: Chirayu Desai Date: Thu, 7 Mar 2024 03:48:00 +0530 Subject: [PATCH] Drop support for legacy USB restrictor * Doesn't compile after 14 QPR2 / AP1A * Has always been an issue for CTS [CIRCULAR REFERENCE: com.android.tools.r8.internal.h: Library class vendor.lineage.trust.V1_0.IUsbRestrict implements program class android.hidl.base.V1_0.IBase] Change-Id: Id2a4ccc60d7cae6bca02e302725d982d50311278 --- Android.bp | 3 +-- .../internal/TrustInterfaceService.java | 17 ++--------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/Android.bp b/Android.bp index 9a35f3bb..aaa0eb8e 100644 --- a/Android.bp +++ b/Android.bp @@ -1,5 +1,5 @@ // -// Copyright (C) 2018-2023 The LineageOS Project +// Copyright (C) 2018-2024 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. @@ -70,7 +70,6 @@ lineage_sdk_LOCAL_STATIC_JAVA_LIBRARIES = [ "vendor.lineage.livedisplay-V2.0-java", "vendor.lineage.livedisplay-V2.1-java", "vendor.lineage.touch-V1.0-java", - "vendor.lineage.trust-V1.0-java", ] // READ ME: ######################################################## 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 473bfe08..3cb8e5e7 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-2022 The LineageOS Project + * Copyright (C) 2018-2024 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. @@ -27,7 +27,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.os.IBinder; -import android.os.RemoteException; import android.os.SELinux; import android.os.SystemProperties; import android.util.Log; @@ -39,13 +38,10 @@ import lineageos.providers.LineageSettings; import lineageos.trust.ITrustInterface; import lineageos.trust.TrustInterface; -import vendor.lineage.trust.V1_0.IUsbRestrict; - import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; -import java.util.NoSuchElementException; /** @hide **/ public class TrustInterfaceService extends LineageSystemService { @@ -67,8 +63,6 @@ public class TrustInterfaceService extends LineageSystemService { private Context mContext; private NotificationManager mNotificationManager = null; - private IUsbRestrict mUsbRestrictor = null; - public TrustInterfaceService(Context context) { super(context); mContext = context; @@ -94,12 +88,6 @@ public class TrustInterfaceService extends LineageSystemService { if (phase == PHASE_BOOT_COMPLETED) { mNotificationManager = mContext.getSystemService(NotificationManager.class); - try { - mUsbRestrictor = IUsbRestrict.getService(); - } catch (NoSuchElementException | RemoteException e) { - // ignore, the hal is not available - } - // Onboard if (!hasOnboardedUser()) { postOnBoardingNotification(); @@ -165,8 +153,7 @@ public class TrustInterfaceService extends LineageSystemService { private boolean hasUsbRestrictorInternal() { DevicePolicyManager policyManager = mContext.getSystemService(DevicePolicyManager.class); - return mUsbRestrictor != null || - (policyManager != null && policyManager.canUsbDataSignalingBeDisabled()); + return policyManager != null && policyManager.canUsbDataSignalingBeDisabled(); } private boolean postOnBoardingNotification() {