Merge "Increase debounce time for DISCONNECT processing" am: a1be0e120a am: 91c1b1c056
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1539944 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ie945dd56a4d77a8da4a7b9b0e4c60e76718e4b6b
This commit is contained in:
@@ -170,7 +170,10 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
|
|||||||
// Delay for debouncing USB disconnects.
|
// Delay for debouncing USB disconnects.
|
||||||
// We often get rapid connect/disconnect events when enabling USB functions,
|
// We often get rapid connect/disconnect events when enabling USB functions,
|
||||||
// which need debouncing.
|
// 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.
|
// Timeout for entering USB request mode.
|
||||||
// Request is cancelled if host does not configure device within 10 seconds.
|
// 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.arg1 = connected;
|
||||||
msg.arg2 = configured;
|
msg.arg2 = configured;
|
||||||
// debounce disconnects to avoid problems bringing up USB tethering
|
// 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) {
|
public void updateHostState(UsbPort port, UsbPortStatus status) {
|
||||||
@@ -598,7 +601,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
|
|||||||
removeMessages(MSG_UPDATE_PORT_STATE);
|
removeMessages(MSG_UPDATE_PORT_STATE);
|
||||||
Message msg = obtainMessage(MSG_UPDATE_PORT_STATE, args);
|
Message msg = obtainMessage(MSG_UPDATE_PORT_STATE, args);
|
||||||
// debounce rapid transitions of connect/disconnect on type-c ports
|
// 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) {
|
private void setAdbEnabled(boolean enable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user