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

Commit db8d2e7f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Explicitly specify the name source" into qt-dev

parents 15af0649 24eb1874
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -1550,27 +1550,16 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    /**
     * Set display name by simInfo index
     * @param displayName the display name of SIM card
     * @param subId the unique SubInfoRecord index in database
     * @return the number of records updated
     */
    @Override
    public int setDisplayName(String displayName, int subId) {
        return setDisplayNameUsingSrc(displayName, subId, -1);
    }

    /**
     * Set display name by simInfo index with name source
     * @param displayName the display name of SIM card
     * @param subId the unique SubInfoRecord index in database
     * @param nameSource 0: NAME_SOURCE_DEFAULT_SOURCE, 1: NAME_SOURCE_SIM_SOURCE,
     *                   2: NAME_SOURCE_USER_INPUT, -1 NAME_SOURCE_UNDEFINED
     *                   2: NAME_SOURCE_USER_INPUT
     * @return the number of records updated
     */
    @Override
    public int setDisplayNameUsingSrc(String displayName, int subId, long nameSource) {
    public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) {
        if (DBG) {
            logd("[setDisplayName]+  displayName:" + displayName + " subId:" + subId
                + " nameSource:" + nameSource);
+2 −1
Original line number Diff line number Diff line
@@ -451,7 +451,8 @@ public class SubscriptionInfoUpdater extends Handler {
                        nameToSet = "CARD " + Integer.toString(slotId + 1);
                    }
                    logd("sim name = " + nameToSet);
                    SubscriptionController.getInstance().setDisplayName(nameToSet, subId);
                    SubscriptionController.getInstance().setDisplayNameUsingSrc(nameToSet, subId,
                            SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE);
                }

                /* Update preferred network type and network selection mode on SIM change.
+2 −1
Original line number Diff line number Diff line
@@ -405,7 +405,8 @@ public class UiccProfile extends IccCard {

        if (!TextUtils.isEmpty(newCarrierName) && !newCarrierName.equals(oldSubName)) {
            log("sim name[" + mPhoneId + "] = " + newCarrierName);
            subCon.setDisplayName(newCarrierName, subId);
            subCon.setDisplayNameUsingSrc(newCarrierName, subId,
                    SubscriptionManager.NAME_SOURCE_SIM_SOURCE);
        }
    }

+7 −4
Original line number Diff line number Diff line
@@ -162,7 +162,8 @@ public class SubscriptionControllerTest extends TelephonyTest {
                .getActiveSubscriptionInfo(subID, mCallingPackage);

        /* Setting */
        mSubscriptionControllerUT.setDisplayName(disName, subID);
        mSubscriptionControllerUT.setDisplayNameUsingSrc(disName, subID,
                SubscriptionManager.NAME_SOURCE_USER_INPUT);
        mSubscriptionControllerUT.setDataRoaming(dataRoaming, subID);
        mSubscriptionControllerUT.setDisplayNumber(disNum, subID);
        mSubscriptionControllerUT.setIconTint(iconTint, subID);
@@ -196,7 +197,7 @@ public class SubscriptionControllerTest extends TelephonyTest {

        /* Setting */
        String disName = "TESTING";
        long nameSource = 1;
        int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SOURCE;
        mSubscriptionControllerUT.setDisplayNameUsingSrc(disName, subID, nameSource);
        SubscriptionInfo subInfo = mSubscriptionControllerUT
                .getActiveSubscriptionInfo(subID, mCallingPackage);
@@ -406,11 +407,13 @@ public class SubscriptionControllerTest extends TelephonyTest {
        assertEquals("test2", opptSubList.get(0).getIccId());

        // Changing non-opportunistic sub1 shouldn't trigger callback.
        mSubscriptionControllerUT.setDisplayName("DisplayName", 1);
        mSubscriptionControllerUT.setDisplayNameUsingSrc("DisplayName", 1,
                SubscriptionManager.NAME_SOURCE_SIM_SOURCE);
        verify(mTelephonyRegisteryMock, times(1))
                .notifyOpportunisticSubscriptionInfoChanged();

        mSubscriptionControllerUT.setDisplayName("DisplayName", 2);
        mSubscriptionControllerUT.setDisplayNameUsingSrc("DisplayName", 2,
                SubscriptionManager.NAME_SOURCE_SIM_SOURCE);
        verify(mTelephonyRegisteryMock, times(2))
                .notifyOpportunisticSubscriptionInfoChanged();
    }
+1 −5
Original line number Diff line number Diff line
@@ -162,11 +162,7 @@ public class SubscriptionControllerMock extends SubscriptionController {
        throw new RuntimeException("not implemented");
    }
    @Override
    public int setDisplayName(String displayName, int subId) {
        throw new RuntimeException("not implemented");
    }
    @Override
    public int setDisplayNameUsingSrc(String displayName, int subId, long nameSource) {
    public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) {
        throw new RuntimeException("not implemented");
    }
    @Override