Remove ptp from persist config on boot
We got a report from a user in which ptp was set in the persistent config, likely from a previous version. This causes errors in the usb state and is not removed by an ota. To fix, remove ptp in the same place that mtp is removed from the persistent config. Bug: 62202885 Test: Add ptp to persistent config, verify removed. Change-Id: I5ebd93b9c8a49bcaca5a3362e49ed1e1acf50a9b
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user