From 65a6237243a794125b6596f9187dbaa84032f522 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Fri, 18 Aug 2017 17:26:05 -0700 Subject: [PATCH] Overcome disconnect during oem override Cherry-pick from 83a0d6fa577fab4d45aba38e3eb52b08b8123c17 While bootup, usb gets configured when the property triggers are run. While in oemOverride, the current configuration is persisted in sys.usb..config. Do not reconfigure the stack if the current configuration is same as the new configuration. Bug: 64225494 Change-Id: Id35d110bf3fa8f58d05e14941716d4ad2b196f8d --- .../usb/java/com/android/server/usb/UsbDeviceManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index c66810097486e..1b057f9b96817 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -434,6 +434,8 @@ public class UsbDeviceManager { try { // Restore default functions. + mCurrentOemFunctions = SystemProperties.get(UsbDeviceManager.getPersistProp(false), + UsbManager.USB_FUNCTION_NONE); if (isNormalBoot()) { mCurrentFunctions = SystemProperties.get(USB_CONFIG_PROPERTY, UsbManager.USB_FUNCTION_NONE); @@ -662,8 +664,7 @@ public class UsbDeviceManager { } if ((!functions.equals(oemFunctions) && - (mCurrentOemFunctions == null || - !mCurrentOemFunctions.equals(oemFunctions))) + !mCurrentOemFunctions.equals(oemFunctions)) || !mCurrentFunctions.equals(functions) || !mCurrentFunctionsApplied || forceRestart) {