Introduce debounce to filter rapidly toggling type-c ports
Type-c ports can quickly toggle between connected/disconnected states. Introduce debounce to prevent sending spurious notifications. Cherry-pick: https://android-review.googlesource.com/#/c/338266/ Bug: 34972898 Test: notification should not be queued for a pixel-c charger not connected to the power outlet. Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
This commit is contained in:
committed by
Badhri Jagan Sridharan
parent
843aba7745
commit
abd229b71a
@@ -470,7 +470,10 @@ public class UsbDeviceManager {
|
||||
args.argi2 = sourcePower ? 1 :0;
|
||||
args.argi3 = sinkPower ? 1 :0;
|
||||
|
||||
obtainMessage(MSG_UPDATE_HOST_STATE, args).sendToTarget();
|
||||
removeMessages(MSG_UPDATE_HOST_STATE);
|
||||
Message msg = obtainMessage(MSG_UPDATE_HOST_STATE, args);
|
||||
// debounce rapid transitions of connect/disconnect on type-c ports
|
||||
sendMessageDelayed(msg, UPDATE_DELAY);
|
||||
}
|
||||
|
||||
private boolean waitForState(String state) {
|
||||
|
||||
Reference in New Issue
Block a user