Set default sim name and carrier name from subinforecord object.

Changes for retrieving display name and carrier name from subinforecord
object.

Bug: 18247211
Bug: 17732079
Bug: 17321641
Change-Id: I718700648ddd5a2646c720591ce776bd30a03543

Conflicts:
	src/com/android/settings/sim/SimSettings.java
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index f09fb2b..412214e 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -115,33 +115,6 @@
     private PreferenceCategory mSimCards = null;
 
     private int mNumSims;
-    /**
-     * Standard projection for the interesting columns of a normal note.
-     */
-    private static final String[] sProjection = new String[] {
-            Telephony.Carriers._ID,     // 0
-            Telephony.Carriers.NAME,    // 1
-            Telephony.Carriers.APN,     // 2
-            Telephony.Carriers.PROXY,   // 3
-            Telephony.Carriers.PORT,    // 4
-            Telephony.Carriers.USER,    // 5
-            Telephony.Carriers.SERVER,  // 6
-            Telephony.Carriers.PASSWORD, // 7
-            Telephony.Carriers.MMSC, // 8
-            Telephony.Carriers.MCC, // 9
-            Telephony.Carriers.MNC, // 10
-            Telephony.Carriers.NUMERIC, // 11
-            Telephony.Carriers.MMSPROXY,// 12
-            Telephony.Carriers.MMSPORT, // 13
-            Telephony.Carriers.AUTH_TYPE, // 14
-            Telephony.Carriers.TYPE, // 15
-            Telephony.Carriers.PROTOCOL, // 16
-            Telephony.Carriers.CARRIER_ENABLED, // 17
-            Telephony.Carriers.BEARER, // 18
-            Telephony.Carriers.ROAMING_PROTOCOL, // 19
-            Telephony.Carriers.MVNO_TYPE,   // 20
-            Telephony.Carriers.MVNO_MATCH_DATA  // 21
-    };
 
     public SimSettings() {
         super(DISALLOW_CONFIG_SIM);
@@ -476,16 +449,10 @@
             final Resources res = getResources();
 
             if (mSubInfoRecord != null) {
-                if(TextUtils.isEmpty(mSubInfoRecord.getDisplayName())) {
-                    setTitle(getCarrierName());
-                    String displayName = getCarrierName();
-                    mSubInfoRecord.setDisplayName(displayName);
-                    SubscriptionManager.setDisplayName(displayName,
-                            mSubInfoRecord.getSubscriptionId());
-                } else {
-                    setTitle(mSubInfoRecord.getDisplayName());
-                }
-                setSummary(mSubInfoRecord.getNumber());
+                setTitle(String.format(res.getString(R.string.sim_editor_title),
+                        (mSubInfoRecord.getSimSlotIndex() + 1)));
+                setSummary(mSubInfoRecord.getDisplayName() + " - " +
+                        mSubInfoRecord.getNumber().toString());
                 setEnabled(true);
             } else {
                 setSummary(R.string.sim_slot_empty);
@@ -494,14 +461,6 @@
             }
         }
 
-        public String getCarrierName() {
-            Uri mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
-                    mSubInfoRecord.getSubscriptionId());
-            Cursor mCursor = getActivity().managedQuery(mUri, sProjection, null, null);
-            mCursor.moveToFirst();
-            return mCursor.getString(1);
-        }
-
         public String getFormattedPhoneNumber() {
             try{
                 final String rawNumber = PhoneFactory.getPhone(mSlotId).getLine1Number();
@@ -561,7 +520,7 @@
             numberView.setText(simPref.getFormattedPhoneNumber());
 
             TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier);
-            carrierView.setText(getCarrierName());
+            carrierView.setText(mSubInfoRecord.getCarrierName());
 
             builder.setTitle(String.format(res.getString(R.string.sim_editor_title),
                     (mSubInfoRecord.getSimSlotIndex() + 1)));