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
This commit is contained in:
Wesley Cheng
2021-11-22 00:54:14 -08:00
parent c1e9c53fc3
commit ce66fa5757

View File

@@ -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;