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

Commit bf1824dd authored by Betty Chang's avatar Betty Chang Committed by Android (Google) Code Review
Browse files

Merge "[Mainline] Move the setAlwaysAllowMmsData from SubscriptionManager to TelephonyManager"

parents 29a1bba8 d0453f44
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -3755,26 +3755,6 @@ public class SubscriptionController extends ISub.Stub {
        return true;
    }

    // TODO: This method should belong to Telephony manager like other data enabled settings and
    // override APIs. Remove this once TelephonyManager API is added.
    @Override
    public boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow) {
        if (DBG) logd("[setAlwaysAllowMmsData]+ alwaysAllow:" + alwaysAllow + " subId:" + subId);

        enforceModifyPhoneState("setAlwaysAllowMmsData");

        // Now that all security checks passes, perform the operation as ourselves.
        final long identity = Binder.clearCallingIdentity();
        try {
            validateSubId(subId);
            Phone phone = PhoneFactory.getPhone(getPhoneId(subId));
            if (phone == null) return false;
            return phone.getDataEnabledSettings().setAlwaysAllowMmsData(alwaysAllow);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    /**
     * Set allowing mobile data during voice call.
     *
+0 −13
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.times;
@@ -1069,18 +1068,6 @@ public class SubscriptionControllerTest extends TelephonyTest {
                UiccSlotInfo.CARD_STATE_INFO_PRESENT, logicalSlotIndex, true, true);
    }

    // TODO: Move this test once SubscriptionManager.setAlwaysAllowMmsData is moved to telephony
    // manager.
    @Test
    @SmallTest
    public void testSetAlwaysAllowMmsData() throws Exception {
        mSubscriptionControllerUT.setAlwaysAllowMmsData(0, true);
        verify(mDataEnabledSettings).setAlwaysAllowMmsData(eq(true));
        clearInvocations(mDataEnabledSettings);
        mSubscriptionControllerUT.setAlwaysAllowMmsData(0, false);
        verify(mDataEnabledSettings).setAlwaysAllowMmsData(eq(false));
    }

    @Test
    @SmallTest
    public void testNameSourcePriority() throws Exception {