Merge "IMS-VT: Fix race condition" into atel.lnx.2.0-dev
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
index 1efa3cc..1ff343c 100644
--- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java
+++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java
@@ -41,6 +41,7 @@
 import android.os.SystemClock;
 import android.telecom.Call.Details;
 import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
 import android.telecom.VideoProfile;
 import android.telephony.TelephonyManager;
@@ -50,6 +51,7 @@
 import android.text.TextDirectionHeuristics;
 import android.text.TextUtils;
 
+import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
 import com.android.contacts.common.ContactsUtils;
 import com.android.contacts.common.ContactsUtils.UserType;
 import com.android.contacts.common.GeoUtil;
@@ -360,10 +362,17 @@
         //set the content
         boolean isMultiSimDevice = mTelephonyManager.isMultiSimEnabled();
         if (isMultiSimDevice) {
-            SubscriptionInfo info =
-                    SubscriptionManager.from(mContext).getActiveSubscriptionInfo(call.getSubId());
-            if (info != null) {
-                content += " (" + info.getDisplayName() + ")";
+            PhoneAccountHandle ph = call.getAccountHandle();
+            String accountLabel = null;
+            if (ph != null) {
+                PhoneAccount account = TelecomManagerCompat.getPhoneAccount(
+                        InCallPresenter.getInstance().getTelecomManager(), ph);
+                if (account != null && !TextUtils.isEmpty(account.getLabel())) {
+                    accountLabel = account.getLabel().toString();
+                }
+            }
+            if (!TextUtils.isEmpty(accountLabel)) {
+                content += " (" + accountLabel + ")";
             }
         }