Merge "Rename isConnectable()"
diff --git a/src/com/android/settings/network/ApnEditor.java b/src/com/android/settings/network/ApnEditor.java
index 9bc435a..c0a3420 100644
--- a/src/com/android/settings/network/ApnEditor.java
+++ b/src/com/android/settings/network/ApnEditor.java
@@ -241,7 +241,7 @@
         CarrierConfigManager configManager = (CarrierConfigManager)
                 getSystemService(Context.CARRIER_CONFIG_SERVICE);
         if (configManager != null) {
-            PersistableBundle b = configManager.getConfig();
+            PersistableBundle b = configManager.getConfigForSubId(mSubId);
             if (b != null) {
                 mReadOnlyApnTypes = b.getStringArray(
                         CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY);
diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java
index df0b1b4..beeaab3 100755
--- a/src/com/android/settings/network/ApnSettings.java
+++ b/src/com/android/settings/network/ApnSettings.java
@@ -186,7 +186,7 @@
 
         CarrierConfigManager configManager = (CarrierConfigManager)
                 getSystemService(Context.CARRIER_CONFIG_SERVICE);
-        PersistableBundle b = configManager.getConfig();
+        PersistableBundle b = configManager.getConfigForSubId(mSubId);
         mHideImsApn = b.getBoolean(CarrierConfigManager.KEY_HIDE_IMS_APN_BOOL);
         mAllowAddingApns = b.getBoolean(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL);
         if (mAllowAddingApns) {
diff --git a/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java b/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
index b18130a..f8cd0a7 100644
--- a/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
+++ b/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
@@ -100,12 +100,9 @@
         if (hapProfile != null && hfpProfile != null && device == null) {
             hfpProfile.setActiveDevice(null);
             hapProfile.setActiveDevice(null);
-            return;
-        }
-        if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
+        } else if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
             hapProfile.setActiveDevice(device);
-        }
-        if (hfpProfile != null) {
+        } else if (hfpProfile != null) {
             hfpProfile.setActiveDevice(device);
         }
     }
diff --git a/src/com/android/settings/sound/MediaOutputPreferenceController.java b/src/com/android/settings/sound/MediaOutputPreferenceController.java
index 8989de3..44130c7 100644
--- a/src/com/android/settings/sound/MediaOutputPreferenceController.java
+++ b/src/com/android/settings/sound/MediaOutputPreferenceController.java
@@ -112,12 +112,9 @@
         if (hapProfile != null && a2dpProfile != null && device == null) {
             hapProfile.setActiveDevice(null);
             a2dpProfile.setActiveDevice(null);
-            return;
-        }
-        if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
+        } else if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
             hapProfile.setActiveDevice(device);
-        }
-        if (a2dpProfile != null) {
+        } else if (a2dpProfile != null) {
             a2dpProfile.setActiveDevice(device);
         }
     }
diff --git a/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java
index a90f39d..c89c068 100644
--- a/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceControllerTest.java
@@ -24,6 +24,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -180,6 +181,7 @@
         mController.setActiveBluetoothDevice(mLeftBluetoothHapDevice);
 
         verify(mHearingAidProfile).setActiveDevice(mLeftBluetoothHapDevice);
+        verify(mHeadsetProfile, never()).setActiveDevice(mLeftBluetoothHapDevice);
     }
 
     /**
@@ -193,6 +195,7 @@
         mController.setActiveBluetoothDevice(mBluetoothDevice);
 
         verify(mHeadsetProfile).setActiveDevice(mBluetoothDevice);
+        verify(mHearingAidProfile, never()).setActiveDevice(mBluetoothDevice);
     }
 
     /**
diff --git a/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java
index 732affa..7ebc7bb 100644
--- a/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/sound/MediaOutputPreferenceControllerTest.java
@@ -26,6 +26,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -182,6 +183,7 @@
         mController.setActiveBluetoothDevice(mLeftBluetoothHapDevice);
 
         verify(mHearingAidProfile).setActiveDevice(mLeftBluetoothHapDevice);
+        verify(mA2dpProfile, never()).setActiveDevice(mLeftBluetoothHapDevice);
     }
 
     /**
@@ -195,6 +197,7 @@
         mController.setActiveBluetoothDevice(mBluetoothDevice);
 
         verify(mA2dpProfile).setActiveDevice(mBluetoothDevice);
+        verify(mHearingAidProfile, never()).setActiveDevice(mBluetoothDevice);
     }
 
     /**