Merge "Restart the MTP connection when changing transcode enabled"

This commit is contained in:
Treehugger Robot
2022-02-16 09:58:58 +00:00
committed by Gerrit Code Review

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;
}