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

Commit c78c5e11 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Restart the MTP connection when changing transcode enabled" am:...

Merge "Restart the MTP connection when changing transcode enabled" am: 8109ad80 am: df16e4b7 am: f5246d8a

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

Change-Id: I4d0f5d3bb5d11b1217de60f6b22e5544c8d00bfa
parents b254c625 f5246d8a
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;
    }