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

Commit 74b88fb3 authored by Martin Brabham's avatar Martin Brabham Committed by Steve Kondik
Browse files

Settings: fix bad MTP uncheck behavior

Unchecking MTP will cause it to attempt to
set MTP again which never fires the callback
to re-enable the UI state.  So if the user unchecks it
don't disable UI.

Change-Id: I6d6f3f13cc91fe4df0126b1cf43e571ccb42d62c
parent 7832fce1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ public class UsbSettings extends SettingsPreferenceFragment {
        }

        //if choose none, we set the function as the default config
        operateInprogress = true;
        String function = USB_FUNCTION_DEFAULT;
        if (preference == mMtp && mMtp.isChecked()) {
            function = UsbManager.USB_FUNCTION_MTP;
@@ -269,9 +270,12 @@ public class UsbSettings extends SettingsPreferenceFragment {
            return true;
        } else if (preference == mSDCard && mSDCard.isChecked()) {
            function = UsbManager.USB_FUNCTION_MASS_STORAGE;
        } else if(preference == mMtp && !mMtp.isChecked()) {
            Log.w(TAG, "MTP is default and if you uncheck it, we will default back to it.  " +
                    "Skipping the work.");
            operateInprogress = false;
        }

        operateInprogress = true;
        mUsbManager.setCurrentFunction(function, true);
        updateToggles(function);