From ce66fa5757e72d1ba1a2326122b35850c16cff5f Mon Sep 17 00:00:00 2001 From: Wesley Cheng Date: Mon, 22 Nov 2021 00:54:14 -0800 Subject: Avoid removing USB state changes during CONFIGURED uevent In order to avoid missing the CONNECTED uevent, skip removing previous events if moving into the CONFIGURED state. The Tethering class relies on the CONNECTED state change to tear down the USB RNDIS adapter. If this is skipped, the Tethering class will see no change to the USB state, and avoid restarting of the dependent tethering services. Bug: http://b/207317644 Test: USB RNDIS IP assigned to PC Change-Id: Iab800ee6b995f1ed8bb1f98934245dd010f4e560 --- services/usb/java/com/android/server/usb/UsbDeviceManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 1579aaf9a571..84878cd5852b 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -633,7 +633,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser Slog.e(TAG, "unknown state " + state); return; } - removeMessages(MSG_UPDATE_STATE); + if (configured == 0) removeMessages(MSG_UPDATE_STATE); if (connected == 1) removeMessages(MSG_FUNCTION_SWITCH_TIMEOUT); Message msg = Message.obtain(this, MSG_UPDATE_STATE); msg.arg1 = connected; -- cgit v1.2.3-59-g8ed1b