Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f985da3 authored by Badhri Jagan Sridharan's avatar Badhri Jagan Sridharan
Browse files

Store as V1.0 reference by default

Store IUsb as V1.0 instance by default and downcast when
calling V1.2 methods.

Bug: 123498520
Test: Checked dumpsys usb to reflect port status for
V1.0, V1.2, V1.3 implementations.
Change-Id: Id55d930252bff39b3b86283f3b6ab33a5e935b24
parent 577c93bd
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -41,11 +41,11 @@ import android.hardware.usb.ParcelableUsbPort;
import android.hardware.usb.UsbManager;
import android.hardware.usb.UsbPort;
import android.hardware.usb.UsbPortStatus;
import android.hardware.usb.V1_0.IUsb;
import android.hardware.usb.V1_0.PortRole;
import android.hardware.usb.V1_0.PortRoleType;
import android.hardware.usb.V1_0.Status;
import android.hardware.usb.V1_1.PortStatus_1_1;
import android.hardware.usb.V1_2.IUsb;
import android.hardware.usb.V1_2.IUsbCallback;
import android.hardware.usb.V1_2.PortStatus;
import android.hidl.manager.V1_0.IServiceManager;
@@ -320,9 +320,12 @@ public class UsbPortManager {

        try {
            // Oneway call into the hal
            mProxy.enableContaminantPresenceDetection(portId, enable);
            android.hardware.usb.V1_2.IUsb proxy = (android.hardware.usb.V1_2.IUsb) mProxy;
            proxy.enableContaminantPresenceDetection(portId, enable);
        } catch (RemoteException e) {
            logAndPrintException(null, "Failed to set contaminant detection", e);
            logAndPrintException(pw, "Failed to set contaminant detection", e);
        } catch (ClassCastException e) {
            logAndPrintException(pw, "Method only applicable to V1.2 or above implementation", e);
        }
    }