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

Commit 8d5570b9 authored by Jerry Zhang's avatar Jerry Zhang Committed by android-build-merger
Browse files

Merge "Remove ptp from persist config on boot" into oc-dev

am: 1d1cf130

Change-Id: I6c9afcc05fa88bbbbe63ddd3ab948e887c350505
parents 54376bbd 1d1cf130
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -407,13 +407,15 @@ public class UsbDeviceManager {
                        UsbManager.USB_FUNCTION_ADB);

                /**
                 * Remove MTP from persistent config, to bring usb to a good state
                 * after fixes to b/31814300. This block can be removed after the update
                 * Previous versions can set persist config to mtp/ptp but it does not
                 * get reset on OTA. Reset the property here instead.
                 */
                String persisted = SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY);
                if (UsbManager.containsFunction(persisted, UsbManager.USB_FUNCTION_MTP)) {
                if (UsbManager.containsFunction(persisted, UsbManager.USB_FUNCTION_MTP)
                        || UsbManager.containsFunction(persisted, UsbManager.USB_FUNCTION_PTP)) {
                    SystemProperties.set(USB_PERSISTENT_CONFIG_PROPERTY,
                            UsbManager.removeFunction(persisted, UsbManager.USB_FUNCTION_MTP));
                            UsbManager.removeFunction(UsbManager.removeFunction(persisted,
                                    UsbManager.USB_FUNCTION_MTP), UsbManager.USB_FUNCTION_PTP));
                }

                String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim();