Fix UsbPortStatus constructor arguments

USB V1.2 hal adds new parameters for the UsbPortStatus constructor.
The constructor changes from:

public UsbPortStatus(int currentMode, @UsbPowerRole int currentPowerRole,
            @UsbDataRole int currentDataRole, int supportedRoleCombinations)

To:

public UsbPortStatus(int currentMode, int currentPowerRole, int currentDataRole,
            int supportedRoleCombinations, int contaminantProtectionStatus,
            int contaminantDetectionStatus)

Initialize the construtor with contaminant presence disabled.

Bug: 119642987
Bug: 117330206
Bug: 77606903

Test: Ran roboelectric tests
Change-Id: I8e1b29785e07abffa1f6ae7656ca697425f446e6
This commit is contained in:
Badhri Jagan Sridharan
2019-01-17 10:14:54 -08:00
parent 1fe41d44fe
commit cf7f3dafbc

View File

@@ -15,6 +15,8 @@
*/ */
package com.android.settings.connecteddevice.usb; package com.android.settings.connecteddevice.usb;
import static android.hardware.usb.UsbPortStatus.CONTAMINANT_DETECTION_NOT_SUPPORTED;
import static android.hardware.usb.UsbPortStatus.CONTAMINANT_PROTECTION_NONE;
import static android.hardware.usb.UsbPortStatus.DATA_ROLE_DEVICE; import static android.hardware.usb.UsbPortStatus.DATA_ROLE_DEVICE;
import static android.hardware.usb.UsbPortStatus.DATA_ROLE_NONE; import static android.hardware.usb.UsbPortStatus.DATA_ROLE_NONE;
import static android.hardware.usb.UsbPortStatus.POWER_ROLE_NONE; import static android.hardware.usb.UsbPortStatus.POWER_ROLE_NONE;
@@ -101,7 +103,8 @@ public class UsbConnectionBroadcastReceiverTest {
final Intent intent = new Intent(); final Intent intent = new Intent();
intent.setAction(UsbManager.ACTION_USB_PORT_CHANGED); intent.setAction(UsbManager.ACTION_USB_PORT_CHANGED);
final UsbPortStatus status = new UsbPortStatus(0, POWER_ROLE_SINK, final UsbPortStatus status = new UsbPortStatus(0, POWER_ROLE_SINK,
DATA_ROLE_DEVICE, 0); DATA_ROLE_DEVICE, 0, CONTAMINANT_PROTECTION_NONE,
CONTAMINANT_DETECTION_NOT_SUPPORTED);
intent.putExtra(UsbManager.EXTRA_PORT_STATUS, status); intent.putExtra(UsbManager.EXTRA_PORT_STATUS, status);
mReceiver.onReceive(mContext, intent); mReceiver.onReceive(mContext, intent);