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

Commit aaea2d22 authored by Alex Johnston's avatar Alex Johnston
Browse files

SettingsLib: Disable USB debugging if USB signaling is off

* When developer options is turned
  off and on again,'USB debugging'
  should not be enabled if USB data
  signaling is disabled.

Manual testing:
* Disable USB data signaling
* Verify preferences are disabled
* Turn developer options off and on
* Verify preferences remain disabled

Bug: 180711035
Test: manual testing
      make RunSettingsLibRoboTests -j ROBOTEST_FILTER=EnableAdbPreferenceControllerTest
Change-Id: Ic667a8998de10f1cd8493806aa555e1b499b469f
parent 3203531c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -86,6 +86,15 @@ public abstract class AbstractEnableAdbPreferenceController extends
        }
    }

    @Override
    protected void onDeveloperOptionsSwitchEnabled() {
        super.onDeveloperOptionsSwitchEnabled();
        if (isAvailable()) {
            mPreference.setDisabledByAdmin(
                    checkIfUsbDataSignalingIsDisabled(mContext, UserHandle.myUserId()));
        }
    }

    public void enablePreference(boolean enabled) {
        if (isAvailable()) {
            mPreference.setEnabled(enabled);