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

Commit b735393c authored by Zim's avatar Zim Committed by Kevin Rocard
Browse files

Restart the MTP connection when changing transcode enabled

To workaround some issues with transcoded file sizes transferred
via MTP on Windows machines, we restart the MTP connection after
changing the transcode flag.

Test: Manual
Bug: 184117074
Bug: 190422448
Change-Id: I8d151117e1f5d23c3ec20e8c7a4b4546c96f2c84
parent c2647199
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
    }