From 83a0d6fa577fab4d45aba38e3eb52b08b8123c17 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Fri, 18 Aug 2017 17:26:05 -0700 Subject: Overcome disconnect during oem override 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 --- services/usb/java/com/android/server/usb/UsbDeviceManager.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'services/usb/java') diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 774bf438995c..3d0536327259 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) { -- cgit v1.2.3-59-g8ed1b