Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b747d31 authored by Howard Yen's avatar Howard Yen
Browse files

Make sure mCurrentUsbFunctionsRequested flag be updated currectly



There is a situation that getCurrentUsbFunctions callback function will
be invoked before mCurrentUsbFunctionsRequested flag updated, thus, gadget
will be reset during boot completed. Make sure mCurrentUsbFunctionsRequested
flag be updated before getCurrentUsbFunctions callback function invoked.

Bug: 119688133
Test: Verified that gadget reset does not happen
Change-Id: Id8b58d9ccd3f62c976d1292575a06554bef622a4
Signed-off-by: default avatarHoward Yen <howardyen@google.com>
parent b78f9295
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1739,8 +1739,8 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
                    mGadgetProxy.linkToDeath(new UsbGadgetDeathRecipient(),
                            USB_GADGET_HAL_DEATH_COOKIE);
                    mCurrentFunctions = UsbManager.FUNCTION_NONE;
                    mGadgetProxy.getCurrentUsbFunctions(new UsbGadgetCallback());
                    mCurrentUsbFunctionsRequested = true;
                    mGadgetProxy.getCurrentUsbFunctions(new UsbGadgetCallback());
                }
                String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim();
                updateState(state);