Always force set functions on disconnect

Functionfs no_disconnect mode will close the function on
disconnect so the current handling won't suffice for cases
where the mtp process is killed while MtpService is running.
This can happen when anything in Media/DownloadProvider ANRs
or similar.

Solve this by always setting the config at disconnect time.

Bug: 38010151
Test: Connect with MTP, am force-stop com.android.providers.media,
reconnect

Change-Id: Iaf012f6e2f11151f34d834efe08777dd02c0aec5
This commit is contained in:
Jerry Zhang
2017-05-08 15:13:50 -07:00
parent 5f0e436548
commit f706fe2f60

View File

@@ -855,7 +855,7 @@ public class UsbDeviceManager {
if (!mConnected) {
// restore defaults when USB is disconnected
Slog.i(TAG, "Disconnect, setting usb functions to null");
setEnabledFunctions(null, false, false);
setEnabledFunctions(null, true, false);
}
updateUsbFunctions();
} else {