[automerger skipped] config files has matching carrier id which passed to carrier Services.
am: cd4a6376e1 -s ours
am skip reason: change_id I9960d167005b3e23d30692074d877eca08606f7d with SHA1 eb8b3ba033 is in history

Change-Id: I2d519230e031607f018dea2b5e68b5620c51cd73
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e1a9592..bf95c74 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2030,14 +2030,18 @@
     /**
      * Returns the target SDK version number for a given package name.
      *
+     * This call MUST be invoked before clearing the calling UID.
+     *
      * @return target SDK if the package is found or INT_MAX.
      */
     private int getTargetSdk(String packageName) {
         try {
-            final ApplicationInfo ai = mApp.getPackageManager().getApplicationInfo(
-                            packageName, 0);
+            final ApplicationInfo ai = mApp.getPackageManager().getApplicationInfoAsUser(
+                    packageName, 0, UserHandle.getUserId(Binder.getCallingUid()));
             if (ai != null) return ai.targetSdkVersion;
         } catch (PackageManager.NameNotFoundException unexpected) {
+            loge("Failed to get package info for pkg="
+                    + packageName + ", uid=" + Binder.getCallingUid());
         }
         return Integer.MAX_VALUE;
     }
diff --git a/src/com/android/services/telephony/GsmConnection.java b/src/com/android/services/telephony/GsmConnection.java
index 999c6f5..47434c0 100644
--- a/src/com/android/services/telephony/GsmConnection.java
+++ b/src/com/android/services/telephony/GsmConnection.java
@@ -72,9 +72,8 @@
         int capabilities = super.buildConnectionCapabilities();
         capabilities |= CAPABILITY_MUTE;
         // Overwrites TelephonyConnection.buildConnectionCapabilities() and resets the hold options
-        // because all GSM calls should hold, even if the carrier config option is set to not show
-        // hold for IMS calls.
-        if (!shouldTreatAsEmergencyCall()) {
+        // because all GSM calls should hold.
+        if (!shouldTreatAsEmergencyCall() && !isImsConnection()) {
             capabilities |= CAPABILITY_SUPPORT_HOLD;
             if (isHoldable() && (getState() == STATE_ACTIVE || getState() == STATE_HOLDING)) {
                 capabilities |= CAPABILITY_HOLD;