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

Commit 451130fc authored by Jack Yu's avatar Jack Yu
Browse files

Removed unused method

Bug: 239607619
Test: atest FrameworksTelephonyTests
Merged-In: I3f250631cebdbce16c8f6fa343b740995aeca1df
Change-Id: I3f250631cebdbce16c8f6fa343b740995aeca1df
parent 02d5c309
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -1303,17 +1303,6 @@ public class SubscriptionController extends ISub.Stub {
                mTelephonyManager.getCardIdForDefaultEuicc(), callback);
    }

    /**
     * Add a new SubInfoRecord to subinfo database if needed
     * @param iccId the IccId of the SIM card
     * @param slotIndex the slot which the SIM is inserted
     * @return 0 if success, < 0 on error.
     */
    @Override
    public int addSubInfoRecord(String iccId, int slotIndex) {
        return addSubInfo(iccId, null, slotIndex, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
    }

    /**
     * Add a new subscription info record, if needed.
     * @param uniqueId This is the unique identifier for the subscription within the specific
+0 −13
Original line number Diff line number Diff line
@@ -329,19 +329,6 @@ public class SubscriptionManagerService extends ISub.Stub {

    }

    /**
     * Add a new subscription record to subscription database if needed.
     *
     * @param iccId the IccId of the SIM card
     * @param slotIndex the slot which the SIM is inserted
     *
     * @return 0 if success, negative if failed.
     */
    @Override
    public int addSubInfoRecord(@NonNull String iccId, int slotIndex) {
        return 0;
    }

    /**
     * Add a new subscription info record, if needed.
     *
+47 −20
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static android.telephony.TelephonyManager.SET_OPPORTUNISTIC_SUB_REMOTE_SE

import static com.android.internal.telephony.SubscriptionController.REQUIRE_DEVICE_IDENTIFIERS_FOR_GROUP_UUID;
import static com.android.internal.telephony.uicc.IccCardStatus.CardState.CARDSTATE_PRESENT;

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.assertEquals;
@@ -197,7 +198,8 @@ public class SubscriptionControllerTest extends TelephonyTest {

        int slotID = 0;
        //insert one Subscription Info
        mSubscriptionControllerUT.addSubInfoRecord("test", slotID);
        mSubscriptionControllerUT.addSubInfo("test", null, slotID,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        //verify there is one sim
        assertEquals(1, mSubscriptionControllerUT.getAllSubInfoCount(mCallingPackage,
@@ -761,7 +763,8 @@ public class SubscriptionControllerTest extends TelephonyTest {
                .notifyOpportunisticSubscriptionInfoChanged();

        testInsertSim();
        mSubscriptionControllerUT.addSubInfoRecord("test2", 0);
        mSubscriptionControllerUT.addSubInfo("test2", null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        // Neither sub1 or sub2 are opportunistic. So getOpportunisticSubscriptions
        // should return empty list and no callback triggered.
@@ -966,7 +969,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @SmallTest
    public void testSetSubscriptionGroupWithModifyPermission() throws Exception {
        testInsertSim();
        mSubscriptionControllerUT.addSubInfoRecord("test2", 0);
        mSubscriptionControllerUT.addSubInfo("test2", null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        mContextFixture.removeCallingOrSelfPermission(ContextFixture.PERMISSION_ENABLE_ALL);
        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE);

@@ -1029,7 +1034,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
        testInsertSim();
        // Adding a second profile and mark as embedded.
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("test2", 1);
        mSubscriptionControllerUT.addSubInfo("test2", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        ContentValues values = new ContentValues();
        values.put(SubscriptionManager.IS_EMBEDDED, 1);
        mFakeTelephonyProvider.update(SubscriptionManager.CONTENT_URI, values,
@@ -1071,7 +1078,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
        mContextFixture.addCallingOrSelfPermission(
                android.Manifest.permission.MODIFY_PHONE_STATE);
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("test3", 1);
        mSubscriptionControllerUT.addSubInfo("test3", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        mContextFixture.removeCallingOrSelfPermission(
                android.Manifest.permission.MODIFY_PHONE_STATE);
        // As sub2 is inactive, it will checks carrier privilege against access rules in the db.
@@ -1091,7 +1100,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
        testInsertSim();
        // Adding a second profile and mark as embedded.
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("test2", 1);
        mSubscriptionControllerUT.addSubInfo("test2", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        ContentValues values = new ContentValues();
        values.put(SubscriptionManager.IS_EMBEDDED, 1);
        mFakeTelephonyProvider.update(SubscriptionManager.CONTENT_URI, values,
@@ -1144,7 +1155,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
        testInsertSim();
        // Adding a second profile and mark as embedded.
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("test2", 1);
        mSubscriptionControllerUT.addSubInfo("test2", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        ContentValues values = new ContentValues();
        values.put(SubscriptionManager.IS_EMBEDDED, 1);
        mFakeTelephonyProvider.update(SubscriptionManager.CONTENT_URI, values,
@@ -1215,7 +1228,8 @@ public class SubscriptionControllerTest extends TelephonyTest {

        testInsertSim();
        // Adding a second profile and mark as embedded.
        mSubscriptionControllerUT.addSubInfoRecord("test2", 0);
        mSubscriptionControllerUT.addSubInfo("test2", null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        ContentValues values = new ContentValues();
        values.put(SubscriptionManager.IS_EMBEDDED, 1);
@@ -1266,7 +1280,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
    public void testSetSubscriptionGroup() throws Exception {
        testInsertSim();
        // Adding a second profile and mark as embedded.
        mSubscriptionControllerUT.addSubInfoRecord("test2", 1);
        mSubscriptionControllerUT.addSubInfo("test2", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        ContentValues values = new ContentValues();
        values.put(SubscriptionManager.IS_EMBEDDED, 1);
        mFakeTelephonyProvider.update(SubscriptionManager.CONTENT_URI, values,
@@ -1354,8 +1370,10 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @SmallTest
    public void testGetActiveSubIdList() throws Exception {
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("123", 1);   // sub 1
        mSubscriptionControllerUT.addSubInfoRecord("456", 0);   // sub 2
        mSubscriptionControllerUT.addSubInfo("123", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // sub 1
        mSubscriptionControllerUT.addSubInfo("456", null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // sub 2

        int[] subIds = mSubscriptionControllerUT.getActiveSubIdList(/*visibleOnly*/false);
        // Make sure the return sub ids are sorted by slot index
@@ -1618,7 +1636,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
        // the ICC ID and phone number.
        testInsertSim();
        doReturn(2).when(mTelephonyManager).getPhoneCount();
        mSubscriptionControllerUT.addSubInfoRecord("test2", 1);
        mSubscriptionControllerUT.addSubInfo("test2", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        int firstSubId = getFirstSubId();
        int secondSubId = getSubIdAtIndex(1);
        mSubscriptionControllerUT.setDisplayNumber(DISPLAY_NUMBER, secondSubId);
@@ -1645,7 +1665,8 @@ public class SubscriptionControllerTest extends TelephonyTest {
        // the ICC ID and phone number.
        testInsertSim();
        doReturn(2).when(mTelephonyManager).getPhoneCount();
        mSubscriptionControllerUT.addSubInfoRecord("test2", 1);
        mSubscriptionControllerUT.addSubInfo("test2", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
        int firstSubId = getFirstSubId();
        int secondSubId = getSubIdAtIndex(1);
        setupIdentifierCarrierPrivilegesTest();
@@ -1969,8 +1990,10 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @SmallTest
    public void testGetAvailableSubscriptionList() throws Exception {
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("123", 1);   // sub 1
        mSubscriptionControllerUT.addSubInfoRecord("456", 0);   // sub 2
        mSubscriptionControllerUT.addSubInfo("123", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // sub 1
        mSubscriptionControllerUT.addSubInfo("456", null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // sub 2

        List<SubscriptionInfo> infoList = mSubscriptionControllerUT
                .getAvailableSubscriptionInfoList(mCallingPackage, mCallingFeature);
@@ -2004,8 +2027,10 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @SmallTest
    public void testGetAvailableSubscriptionList_withTrailingF() throws Exception {
        // TODO b/123300875 slot index 1 is not expected to be valid
        mSubscriptionControllerUT.addSubInfoRecord("123", 1);   // sub 1
        mSubscriptionControllerUT.addSubInfoRecord("456", 0);   // sub 2
        mSubscriptionControllerUT.addSubInfo("123", null, 1,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // sub 1
        mSubscriptionControllerUT.addSubInfo("456", null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); // sub 2

        // Remove "123" from active sim list but have it inserted.
        UiccSlot[] uiccSlots = {mUiccSlot};
@@ -2052,7 +2077,8 @@ public class SubscriptionControllerTest extends TelephonyTest {
    @Test
    public void testSetSubscriptionEnabled_disableActivePsim_cardIdWithTrailingF() {
        String iccId = "123F";
        mSubscriptionControllerUT.addSubInfoRecord(iccId, 0);
        mSubscriptionControllerUT.addSubInfo(iccId, null, 0,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
        mSubscriptionControllerUT.registerForUiccAppsEnabled(mHandler, 0, null, false);
        UiccSlotInfo slot = getFakeUiccSlotInfo(true, 0, iccId + "FF", iccId);
        UiccSlotInfo[] uiccSlotInfos = {slot};
@@ -2090,8 +2116,9 @@ public class SubscriptionControllerTest extends TelephonyTest {
            fail("Unexpected exception: " + e);
        }

        mSubscriptionControllerUT.addSubInfoRecord("test3",
                SubscriptionManager.INVALID_SIM_SLOT_INDEX);
        mSubscriptionControllerUT.addSubInfo("test3", null,
                SubscriptionManager.INVALID_SIM_SLOT_INDEX,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);

        assertTrue(mSubscriptionControllerUT.checkPhoneIdAndIccIdMatch(0, "test"));
        assertTrue(mSubscriptionControllerUT.checkPhoneIdAndIccIdMatch(0, "test2"));