summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-01-09 00:02:57 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-01-09 00:02:57 -0800
commit9eb904e01714660eb213a6ec04ff5fd3276bafa6 (patch)
treef5735b1bb6d71a9afe321e38fc392aa7ec27df96
parent1c3eb2ca249afa14e434e5fd025260127fef222e (diff)
parentabfcea0970186c36b69ce59719735775f07bb270 (diff)
downloadandroid_packages_apps_ContactsCommon-9eb904e01714660eb213a6ec04ff5fd3276bafa6.tar.gz
android_packages_apps_ContactsCommon-9eb904e01714660eb213a6ec04ff5fd3276bafa6.tar.bz2
android_packages_apps_ContactsCommon-9eb904e01714660eb213a6ec04ff5fd3276bafa6.zip
Merge "ContactsCommon: Fix operator name not displayed in call log"
-rwxr-xr-xsrc/com/android/contacts/common/MoreContactUtils.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/com/android/contacts/common/MoreContactUtils.java b/src/com/android/contacts/common/MoreContactUtils.java
index 0d24d771..ab9e6e1c 100755
--- a/src/com/android/contacts/common/MoreContactUtils.java
+++ b/src/com/android/contacts/common/MoreContactUtils.java
@@ -54,6 +54,7 @@ import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.provider.Settings;
+import android.telephony.SubInfoRecord;
import android.telephony.SubscriptionManager;
import android.telephony.PhoneNumberUtils;
import android.telecom.PhoneAccountHandle;
@@ -314,11 +315,11 @@ public class MoreContactUtils {
return simFilter.toString();
}
- public static boolean isShowOperator(Context context) {
+ public static boolean shouldShowOperator(Context context) {
return context.getResources().getBoolean(R.bool.config_show_operator);
}
- public static boolean isShowOperator(Resources resources) {
+ public static boolean shouldShowOperator(Resources resources) {
return resources.getBoolean(R.bool.config_show_operator);
}
@@ -793,19 +794,31 @@ public class MoreContactUtils {
/**
* Get Network SPN name, e.g. China Unicom
*/
- public static String getNetworkSpnName(Context context, int subscription) {
+ public static String getNetworkSpnName(Context context, long subscription) {
TelephonyManager tm = (TelephonyManager)
context.getSystemService(Context.TELEPHONY_SERVICE);
String netSpnName = "";
netSpnName = tm.getNetworkOperatorName(subscription);
if (TextUtils.isEmpty(netSpnName)) {
- // if could not get the operator name, use account name instead of
- netSpnName = getSimAccountName(subscription);
+ // if could not get the operator name, use sim name instead of
+ List<SubInfoRecord> subInfoList = SubscriptionManager.getActiveSubInfoList();
+ if (subInfoList != null) {
+ for (int i = 0; i < subInfoList.size(); ++i) {
+ final SubInfoRecord sir = subInfoList.get(i);
+ if (sir.subId == subscription) {
+ netSpnName = sir.displayName;
+ break;
+ }
+ }
+ }
}
return toUpperCaseFirstOne(netSpnName);
}
public static String toUpperCaseFirstOne(String s) {
+ if (TextUtils.isEmpty(s)) {
+ return s;
+ }
if (Character.isUpperCase(s.charAt(0))) {
return s;
} else {