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

Commit 242f3d91 authored by Irem Uguz's avatar Irem Uguz
Browse files

usb: Initialize restricted radio button for USB settings

Initialize the selector widget on RadioButtonPickerFragment.java as a
restricted selector to avoid the crash in the attached bug.

Recording - admin managed settings: https://drive.google.com/file/d/1PHBbgAqcMMUT1oOBMydNhCAByXZtrHQ4/view?usp=sharing&resourcekey=0-BMCFViZej4UAls309ijsFA
Recording: https://drive.google.com/file/d/1J-9rphVDPByn-LTlRb2WfByd-TZr8Tel/view?usp=drive_link&resourcekey=0-aXkIhmL6V8pMvvo_5K8l0A

Bug: 416640194
Test: Manual. See recordings for evidence.
Flag: EXEMPT bugfix

Change-Id: I48a74a4337a43d1c3b0ba85d4f8f4998800820fe
parent 6d31b4be
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment implements
            if (pref != null) {
                final boolean isSupported = mUsbBackend.areFunctionsSupported(option);
                pref.setEnabled(isSupported);
                String userRestriction = mUsbBackend.maybeGetUserRestriction(option);
                String userRestriction = UsbBackend.maybeGetUserRestriction(option);
                if (userRestriction != null) {
                    pref.checkRestrictionAndSetDisabled(userRestriction);
                }
+2 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settings.core.PreferenceXmlParserUtils;
import com.android.settings.core.PreferenceXmlParserUtils.MetadataFlag;
import com.android.settingslib.RestrictedSelectorWithWidgetPreference;
import com.android.settingslib.widget.CandidateInfo;
import com.android.settingslib.widget.IllustrationPreference;
import com.android.settingslib.widget.SelectorWithWidgetPreference;
@@ -178,7 +179,7 @@ public abstract class RadioButtonPickerFragment extends SettingsPreferenceFragme
     * A chance for subclasses to create a custom preference instance.
     */
    protected SelectorWithWidgetPreference createPreference() {
        return new SelectorWithWidgetPreference(getPrefContext());
        return new RestrictedSelectorWithWidgetPreference(getPrefContext());
    }

    public void updateCandidates() {