Don't set settings titles for single SIM devices.

The seemingly most straightforward way to accomplish this is pass
a context into SubscriptionInfoHelper, and check TelephonyManager
for the device SIM capability before setting any title.

Leave the Context parameter in getIntent() because of how
CallFeaturesSetting may be creating an intent for a different
activity (handling the up arrow).

Bug: 18692675
Change-Id: I689e0db066a16ba06bda6e0fd68b6d25e9c698b9
diff --git a/src/com/android/phone/SubscriptionInfoHelper.java b/src/com/android/phone/SubscriptionInfoHelper.java
index f325b1a..9f0ebd0 100644
--- a/src/com/android/phone/SubscriptionInfoHelper.java
+++ b/src/com/android/phone/SubscriptionInfoHelper.java
@@ -22,6 +22,7 @@
 import android.content.res.Resources;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 
 import com.android.phone.PhoneGlobals;
@@ -45,24 +46,26 @@
     private static final String SUB_LABEL_EXTRA =
             "com.android.phone.settings.SubscriptionInfoHelper.SubscriptionLabel";
 
+    private static Context mContext;
+
     private static int mSubId = NO_SUB_ID;
     private static String mSubLabel;
 
     /**
      * Instantiates the helper, by extracting the subscription id and label from the intent.
      */
-    public SubscriptionInfoHelper(Intent intent) {
+    public SubscriptionInfoHelper(Context context, Intent intent) {
+        mContext = context;
         mSubId = intent.getIntExtra(SUB_ID_EXTRA, NO_SUB_ID);
         mSubLabel = intent.getStringExtra(SUB_LABEL_EXTRA);
     }
 
     /**
-     * @param context The context.
      * @param newActivityClass The class of the activity for the intent to start.
      * @return Intent containing extras for the subscription id and label if they exist.
      */
-    public Intent getIntent(Context context, Class newActivityClass) {
-        Intent intent = new Intent(context, newActivityClass);
+    public Intent getIntent(Class newActivityClass) {
+        Intent intent = new Intent(mContext, newActivityClass);
 
         if (hasSubId()) {
             intent.putExtra(SUB_ID_EXTRA, mSubId);
@@ -106,6 +109,10 @@
             return;
         }
 
+        if (!TelephonyManager.from(mContext).isMultiSimEnabled()) {
+            return;
+        }
+
         String title = String.format(res.getString(resId), mSubLabel);
         actionBar.setTitle(title);
     }