Merge "Restart the MTP connection when changing transcode enabled" am: 8109ad8033 am: df16e4b74c am: f5246d8a8c

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1882150

Change-Id: I4d0f5d3bb5d11b1217de60f6b22e5544c8d00bfa
This commit is contained in:
Treehugger Robot
2022-02-16 13:52:02 +00:00
committed by Automerger Merge Worker

View File

@@ -77,6 +77,12 @@ public class UsbDetailsTranscodeMtpController extends UsbDetailsController
public boolean onPreferenceClick(Preference preference) {
SystemProperties.set(TRANSCODE_MTP_SYS_PROP_KEY,
Boolean.toString(mSwitchPreference.isChecked()));
final long previousFunctions = mUsbBackend.getCurrentFunctions();
// Toggle the MTP connection to reload file sizes for files shared via MTP clients
mUsbBackend.setCurrentFunctions(previousFunctions & ~UsbManager.FUNCTION_MTP);
mUsbBackend.setCurrentFunctions(previousFunctions);
return true;
}