Merge "Update SubscriptionManager API as per API council." into lmp-mr1-dev
diff --git a/sip/src/com/android/services/telephony/sip/SipUtil.java b/sip/src/com/android/services/telephony/sip/SipUtil.java
index df1a03a..54bdc1e 100644
--- a/sip/src/com/android/services/telephony/sip/SipUtil.java
+++ b/sip/src/com/android/services/telephony/sip/SipUtil.java
@@ -119,9 +119,7 @@
                 .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
                 .setAddress(Uri.parse(profile.getUriString()))
                 .setShortDescription(profile.getDisplayName())
-                .setIconBitmap(BitmapFactory.decodeResource(
-                        context.getResources(),
-                        R.drawable.ic_dialer_sip_black_24dp))
+                .setIcon(context, R.drawable.ic_dialer_sip_black_24dp)
                 .setSupportedUriSchemes(supportedUriSchemes);
 
         return builder.build();
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 3c385f9..bbef032 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -252,8 +252,9 @@
 
         boolean isLteOnCdma = mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
         mIsGlobalCdma = isLteOnCdma && getResources().getBoolean(R.bool.config_show_cdma);
-        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
-        if (tm.getSimplifiedNetworkSettingsEnabledForSubscriber(SubscriptionManager.getDefaultSubId())) {
+        int shouldHideCarrierSettings = android.provider.Settings.Global.getInt(mPhone.getContext().
+                getContentResolver(), android.provider.Settings.Global.HIDE_CARRIER_NETWORK_SETTINGS, 0);
+        if (shouldHideCarrierSettings == 1) {
             prefSet.removePreference(mButtonPreferredNetworkMode);
             prefSet.removePreference(mButtonEnabledNetworks);
             prefSet.removePreference(mLteDataServicePref);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e8dcdcf..8e79366 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -140,8 +140,6 @@
     SharedPreferences mTelephonySharedPreferences;
     private static final String PREF_CARRIERS_ALPHATAG_PREFIX = "carrier_alphtag_";
     private static final String PREF_CARRIERS_NUMBER_PREFIX = "carrier_number_";
-    private static final String PREF_CARRIERS_SIMPLIFIED_NETWORK_SETTINGS_PREFIX =
-            "carrier_simplified_network_settings_";
     private static final String PREF_ENABLE_VIDEO_CALLING = "enable_video_calling";
 
     /**
@@ -1943,34 +1941,6 @@
     }
 
     @Override
-    public void enableSimplifiedNetworkSettingsForSubscriber(int subId, boolean enable) {
-        enforceModifyPermissionOrCarrierPrivilege();
-
-        String iccId = getIccId(subId);
-        if (iccId != null) {
-            String snsPrefKey = PREF_CARRIERS_SIMPLIFIED_NETWORK_SETTINGS_PREFIX + iccId;
-            SharedPreferences.Editor editor = mTelephonySharedPreferences.edit();
-            if (enable) {
-                editor.putBoolean(snsPrefKey, true);
-            } else {
-                editor.remove(snsPrefKey);
-            }
-            editor.commit();
-        }
-    }
-
-    @Override
-    public boolean getSimplifiedNetworkSettingsEnabledForSubscriber(int subId) {
-        enforceReadPermission();
-        String iccId = getIccId(subId);
-        if (iccId != null) {
-            String snsPrefKey = PREF_CARRIERS_SIMPLIFIED_NETWORK_SETTINGS_PREFIX + iccId;
-            return mTelephonySharedPreferences.getBoolean(snsPrefKey, false);
-        }
-        return false;
-    }
-
-    @Override
     public void setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number) {
         enforceModifyPermissionOrCarrierPrivilege();
 
diff --git a/src/com/android/services/telephony/CdmaConference.java b/src/com/android/services/telephony/CdmaConference.java
index 5372548..2d5ee47 100755
--- a/src/com/android/services/telephony/CdmaConference.java
+++ b/src/com/android/services/telephony/CdmaConference.java
@@ -37,15 +37,15 @@
 
     private int mCapabilities = PhoneCapabilities.MUTE;
 
-    public CdmaConference(PhoneAccountHandle phoneAccount, int capabilities) {
+    public CdmaConference(PhoneAccountHandle phoneAccount) {
         super(phoneAccount);
-        setCapabilities(mCapabilities | capabilities);
         setActive();
     }
 
     private void updateCapabilities() {
         setCapabilities(mCapabilities);
     }
+
     /**
      * Invoked when the Conference and all it's {@link Connection}s should be disconnected.
      */
diff --git a/src/com/android/services/telephony/CdmaConferenceController.java b/src/com/android/services/telephony/CdmaConferenceController.java
index d6d5659..e2f0b50 100644
--- a/src/com/android/services/telephony/CdmaConferenceController.java
+++ b/src/com/android/services/telephony/CdmaConferenceController.java
@@ -149,18 +149,20 @@
             // 1) Create a new conference connection if it doesn't exist.
             if (mConference == null) {
                 Log.i(this, "Creating new Cdma conference call");
-                CdmaConnection newConnection = mCdmaConnections.get(mCdmaConnections.size() - 1);
-                if (newConnection.isOutgoing()) {
-                    // Only an outgoing call can be merged with an ongoing call.
-                    mConference = new CdmaConference(null, PhoneCapabilities.MERGE_CONFERENCE);
-                } else {
-                    // If the most recently added connection was an incoming call, enable
-                    // swap instead of merge.
-                    mConference = new CdmaConference(null, PhoneCapabilities.SWAP_CONFERENCE);
-                }
+                mConference = new CdmaConference(null);
                 isNewlyCreated = true;
             }
 
+            CdmaConnection newConnection = mCdmaConnections.get(mCdmaConnections.size() - 1);
+            if (newConnection.isOutgoing()) {
+                // Only an outgoing call can be merged with an ongoing call.
+                mConference.setCapabilities(PhoneCapabilities.MERGE_CONFERENCE);
+            } else {
+                // If the most recently added connection was an incoming call, enable
+                // swap instead of merge.
+                mConference.setCapabilities(PhoneCapabilities.SWAP_CONFERENCE);
+            }
+
             // 2) Add any new connections to the conference
             List<Connection> existingChildConnections =
                     new ArrayList<>(mConference.getConnections());
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index fc72cc6..7bd396b 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -166,10 +166,7 @@
                     .setSubscriptionAddress(
                             Uri.fromParts(PhoneAccount.SCHEME_TEL, subNumber, null))
                     .setCapabilities(capabilities)
-                    .setIconBitmap(BitmapFactory.decodeResource(
-                            mContext.getResources(),
-                            getPhoneAccountIcon(slotId)))
-                    .setColor(color)
+                    .setIcon(mContext, getPhoneAccountIcon(slotId), color)
                     .setShortDescription(description)
                     .setSupportedUriSchemes(Arrays.asList(
                             PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))