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

Commit 0f61efb2 authored by Kholoud Mohamed's avatar Kholoud Mohamed Committed by Android (Google) Code Review
Browse files

Merge "Migrate the setUsbDataSignalingEnabled api to the device policy engine."

parents 7936f53f 813d12dd
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -82,8 +82,7 @@ public class ConnectedUsbDeviceUpdaterTest {

    @Test
    public void initUsbPreference_preferenceInit() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(true);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(true);

        mDeviceUpdater.initUsbPreference(mContext);

+4 −8
Original line number Diff line number Diff line
@@ -71,8 +71,7 @@ public class DefaultUsbConfigurationPreferenceControllerTest {

    @Test
    public void updateState_usbDataSignalingEnabled_shouldNotDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(true);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(true);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.updateState(mPreference);
@@ -82,8 +81,7 @@ public class DefaultUsbConfigurationPreferenceControllerTest {

    @Test
    public void updateState_usbDataSignalingDisabled_shouldDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(false);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(false);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.updateState(mPreference);
@@ -94,8 +92,7 @@ public class DefaultUsbConfigurationPreferenceControllerTest {

    @Test
    public void onDeveloperOptionsSwitchEnabled_usbEnabled_shouldNotDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(true);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(true);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.onDeveloperOptionsSwitchEnabled();
@@ -105,8 +102,7 @@ public class DefaultUsbConfigurationPreferenceControllerTest {

    @Test
    public void onDeveloperOptionsSwitchEnabled_usbDisabled_shouldDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(false);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(false);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.onDeveloperOptionsSwitchEnabled();
+5 −10
Original line number Diff line number Diff line
@@ -75,8 +75,7 @@ public class UsbAudioRoutingPreferenceControllerTest {

    @Test
    public void updateState_usbAudioRoutingEnabled_shouldCheckedPreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(true);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(true);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);
        Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
@@ -89,8 +88,7 @@ public class UsbAudioRoutingPreferenceControllerTest {

    @Test
    public void updateState_usbAudioRoutingDisabled_shouldUncheckedPreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(true);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(true);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);
        Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
@@ -103,8 +101,7 @@ public class UsbAudioRoutingPreferenceControllerTest {

    @Test
    public void updateState_usbDataSignalingDisabled_shouldDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(false);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(false);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.updateState(mPreference);
@@ -150,8 +147,7 @@ public class UsbAudioRoutingPreferenceControllerTest {

    @Test
    public void onDeveloperOptionsSwitchEnabled_usbEnabled_shouldNotDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(true);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(true);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.onDeveloperOptionsSwitchEnabled();
@@ -161,8 +157,7 @@ public class UsbAudioRoutingPreferenceControllerTest {

    @Test
    public void onDeveloperOptionsSwitchEnabled_usbDisabled_shouldDisablePreference() {
        when(mDevicePolicyManager.isUsbDataSignalingEnabledForUser(
                UserHandle.myUserId())).thenReturn(false);
        when(mDevicePolicyManager.isUsbDataSignalingEnabled()).thenReturn(false);
        when(mDevicePolicyManager.getProfileOwner()).thenReturn(TEST_COMPONENT_NAME);

        mController.onDeveloperOptionsSwitchEnabled();