diff options
author | Sriharsha Allenki <quic_sallenki@quicinc.com> | 2021-01-05 14:09:40 +0530 |
---|---|---|
committer | Badhri Jagan Sridharan <badhri@google.com> | 2021-01-08 05:12:13 +0000 |
commit | 5a14ba686170b0475a546df66ad8c7e0c6ee6abc (patch) | |
tree | b3dfbd9bac3f130c34601a6df6bf0464172d89b4 /services/usb | |
parent | 80df223aed264116aad0e45e90752ade7b2eefbf (diff) |
Increase debounce time for DISCONNECT processing
During composition switch, some host PCs are taking more
time in processing the disconnect of previous functions and
enumerating the new functions. This causes the delay in
receiving the CONNECTED uevent which triggers the fallback
to default composition. Prevent this by increasing the
debounce time from 1s to 3s (which is the average time
taken by these PCs to enumerate the new functions) for
device mode state update, while keeping the debounce time
for host mode as is at 1s.
Bug: 176779207
Test: Verified enumeration of device with the delay
Change-Id: I7ff58a1a9755939ccb26dad61969902ec91f2225
Diffstat (limited to 'services/usb')
-rw-r--r-- | services/usb/java/com/android/server/usb/UsbDeviceManager.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 98b9dcd2cc2f..477592ba4129 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -170,7 +170,10 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser // Delay for debouncing USB disconnects. // We often get rapid connect/disconnect events when enabling USB functions, // which need debouncing. - private static final int UPDATE_DELAY = 1000; + private static final int DEVICE_STATE_UPDATE_DELAY = 3000; + + // Delay for debouncing USB disconnects on Type-C ports in host mode + private static final int HOST_STATE_UPDATE_DELAY = 1000; // Timeout for entering USB request mode. // Request is cancelled if host does not configure device within 10 seconds. @@ -583,7 +586,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser msg.arg1 = connected; msg.arg2 = configured; // debounce disconnects to avoid problems bringing up USB tethering - sendMessageDelayed(msg, (connected == 0) ? UPDATE_DELAY : 0); + sendMessageDelayed(msg, (connected == 0) ? DEVICE_STATE_UPDATE_DELAY : 0); } public void updateHostState(UsbPort port, UsbPortStatus status) { @@ -598,7 +601,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser removeMessages(MSG_UPDATE_PORT_STATE); Message msg = obtainMessage(MSG_UPDATE_PORT_STATE, args); // debounce rapid transitions of connect/disconnect on type-c ports - sendMessageDelayed(msg, UPDATE_DELAY); + sendMessageDelayed(msg, HOST_STATE_UPDATE_DELAY); } private void setAdbEnabled(boolean enable) { |