Loading src/java/com/android/internal/telephony/SubscriptionController.java +14 −15 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.telephony.RadioAccessFamily; import android.telephony.Rlog; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager.SimDisplayNameSource; import android.telephony.TelephonyManager; import android.telephony.UiccAccessRule; import android.telephony.UiccSlotInfo; Loading Loading @@ -1538,30 +1539,28 @@ public class SubscriptionController extends ISub.Stub { * @param nameSource Source of display name * @return int representing the priority. Higher value means higher priority. */ public static int getNameSourcePriority(int nameSource) { switch (nameSource) { case SubscriptionManager.NAME_SOURCE_USER_INPUT: return 3; case SubscriptionManager.NAME_SOURCE_CARRIER: return 2; case SubscriptionManager.NAME_SOURCE_SIM_SOURCE: return 1; case SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE: default: return 0; } public static int getNameSourcePriority(@SimDisplayNameSource int nameSource) { int index = Arrays.binarySearch( new int[] { SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE, SubscriptionManager.NAME_SOURCE_SIM_PNN, SubscriptionManager.NAME_SOURCE_SIM_SPN, SubscriptionManager.NAME_SOURCE_CARRIER, SubscriptionManager.NAME_SOURCE_USER_INPUT // user has highest priority. }, nameSource); return (index < 0) ? 0 : index; } /** * 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, 3: NAME_SOURCE_CARRIER * @param nameSource SIM display name source * @return the number of records updated */ @Override public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) { public int setDisplayNameUsingSrc(String displayName, int subId, @SimDisplayNameSource int nameSource) { if (DBG) { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); Loading src/java/com/android/internal/telephony/uicc/UiccProfile.java +12 −4 Original line number Diff line number Diff line Loading @@ -372,8 +372,8 @@ public class UiccProfile extends IccCard { String ccName = config.getString(CarrierConfigManager.KEY_CARRIER_NAME_STRING); String newCarrierName = null; String currSpn = getServiceProviderName(); int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SOURCE; String currSpn = getServiceProviderName(); // Get the name from EF_SPN. int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SPN; // If carrier config is priority, use it regardless - the preference // and the name were both set by the carrier, so this is safe; // otherwise, if the SPN is priority but we don't have one *and* we have Loading @@ -382,10 +382,18 @@ public class UiccProfile extends IccCard { newCarrierName = ccName; nameSource = SubscriptionManager.NAME_SOURCE_CARRIER; } else if (TextUtils.isEmpty(currSpn)) { // currSpn is empty and could not get name from carrier config; get name from carrier id // currSpn is empty and could not get name from carrier config; get name from PNN or // carrier id Phone phone = PhoneFactory.getPhone(mPhoneId); if (phone != null) { newCarrierName = phone.getCarrierName(); String currPnn = phone.getPlmn(); // Get the name from EF_PNN. if (!TextUtils.isEmpty(currPnn)) { newCarrierName = currPnn; nameSource = SubscriptionManager.NAME_SOURCE_SIM_PNN; } else { newCarrierName = phone.getCarrierName(); // Get the name from carrier id. nameSource = SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE; } } } Loading tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ public class SubscriptionControllerTest extends TelephonyTest { /* Setting */ String disName = "TESTING"; int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SOURCE; int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SPN; mSubscriptionControllerUT.setDisplayNameUsingSrc(disName, subID, nameSource); SubscriptionInfo subInfo = mSubscriptionControllerUT .getActiveSubscriptionInfo(subID, mCallingPackage, mCallingFeature); Loading Loading @@ -475,12 +475,12 @@ public class SubscriptionControllerTest extends TelephonyTest { // Changing non-opportunistic sub1 shouldn't trigger callback. mSubscriptionControllerUT.setDisplayNameUsingSrc("DisplayName", 1, SubscriptionManager.NAME_SOURCE_SIM_SOURCE); SubscriptionManager.NAME_SOURCE_SIM_SPN); verify(mTelephonyRegisteryMock, times(1)) .notifyOpportunisticSubscriptionInfoChanged(); mSubscriptionControllerUT.setDisplayNameUsingSrc("DisplayName", 2, SubscriptionManager.NAME_SOURCE_SIM_SOURCE); SubscriptionManager.NAME_SOURCE_SIM_SPN); verify(mTelephonyRegisteryMock, times(2)) .notifyOpportunisticSubscriptionInfoChanged(); } Loading Loading
src/java/com/android/internal/telephony/SubscriptionController.java +14 −15 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.telephony.RadioAccessFamily; import android.telephony.Rlog; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager.SimDisplayNameSource; import android.telephony.TelephonyManager; import android.telephony.UiccAccessRule; import android.telephony.UiccSlotInfo; Loading Loading @@ -1538,30 +1539,28 @@ public class SubscriptionController extends ISub.Stub { * @param nameSource Source of display name * @return int representing the priority. Higher value means higher priority. */ public static int getNameSourcePriority(int nameSource) { switch (nameSource) { case SubscriptionManager.NAME_SOURCE_USER_INPUT: return 3; case SubscriptionManager.NAME_SOURCE_CARRIER: return 2; case SubscriptionManager.NAME_SOURCE_SIM_SOURCE: return 1; case SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE: default: return 0; } public static int getNameSourcePriority(@SimDisplayNameSource int nameSource) { int index = Arrays.binarySearch( new int[] { SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE, SubscriptionManager.NAME_SOURCE_SIM_PNN, SubscriptionManager.NAME_SOURCE_SIM_SPN, SubscriptionManager.NAME_SOURCE_CARRIER, SubscriptionManager.NAME_SOURCE_USER_INPUT // user has highest priority. }, nameSource); return (index < 0) ? 0 : index; } /** * 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, 3: NAME_SOURCE_CARRIER * @param nameSource SIM display name source * @return the number of records updated */ @Override public int setDisplayNameUsingSrc(String displayName, int subId, int nameSource) { public int setDisplayNameUsingSrc(String displayName, int subId, @SimDisplayNameSource int nameSource) { if (DBG) { logd("[setDisplayName]+ displayName:" + displayName + " subId:" + subId + " nameSource:" + nameSource); Loading
src/java/com/android/internal/telephony/uicc/UiccProfile.java +12 −4 Original line number Diff line number Diff line Loading @@ -372,8 +372,8 @@ public class UiccProfile extends IccCard { String ccName = config.getString(CarrierConfigManager.KEY_CARRIER_NAME_STRING); String newCarrierName = null; String currSpn = getServiceProviderName(); int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SOURCE; String currSpn = getServiceProviderName(); // Get the name from EF_SPN. int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SPN; // If carrier config is priority, use it regardless - the preference // and the name were both set by the carrier, so this is safe; // otherwise, if the SPN is priority but we don't have one *and* we have Loading @@ -382,10 +382,18 @@ public class UiccProfile extends IccCard { newCarrierName = ccName; nameSource = SubscriptionManager.NAME_SOURCE_CARRIER; } else if (TextUtils.isEmpty(currSpn)) { // currSpn is empty and could not get name from carrier config; get name from carrier id // currSpn is empty and could not get name from carrier config; get name from PNN or // carrier id Phone phone = PhoneFactory.getPhone(mPhoneId); if (phone != null) { newCarrierName = phone.getCarrierName(); String currPnn = phone.getPlmn(); // Get the name from EF_PNN. if (!TextUtils.isEmpty(currPnn)) { newCarrierName = currPnn; nameSource = SubscriptionManager.NAME_SOURCE_SIM_PNN; } else { newCarrierName = phone.getCarrierName(); // Get the name from carrier id. nameSource = SubscriptionManager.NAME_SOURCE_DEFAULT_SOURCE; } } } Loading
tests/telephonytests/src/com/android/internal/telephony/SubscriptionControllerTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ public class SubscriptionControllerTest extends TelephonyTest { /* Setting */ String disName = "TESTING"; int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SOURCE; int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SPN; mSubscriptionControllerUT.setDisplayNameUsingSrc(disName, subID, nameSource); SubscriptionInfo subInfo = mSubscriptionControllerUT .getActiveSubscriptionInfo(subID, mCallingPackage, mCallingFeature); Loading Loading @@ -475,12 +475,12 @@ public class SubscriptionControllerTest extends TelephonyTest { // Changing non-opportunistic sub1 shouldn't trigger callback. mSubscriptionControllerUT.setDisplayNameUsingSrc("DisplayName", 1, SubscriptionManager.NAME_SOURCE_SIM_SOURCE); SubscriptionManager.NAME_SOURCE_SIM_SPN); verify(mTelephonyRegisteryMock, times(1)) .notifyOpportunisticSubscriptionInfoChanged(); mSubscriptionControllerUT.setDisplayNameUsingSrc("DisplayName", 2, SubscriptionManager.NAME_SOURCE_SIM_SOURCE); SubscriptionManager.NAME_SOURCE_SIM_SPN); verify(mTelephonyRegisteryMock, times(2)) .notifyOpportunisticSubscriptionInfoChanged(); } Loading