Log IMS_MERGED call based on if the conference supports participants
am: 817e539883

Change-Id: Ic62b8c8c381e3972a0fbee993d69d3b681366726
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 7ca3a73..7c31bca 100755
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -16,6 +16,8 @@
 
 package com.android.server.telecom;
 
+import static android.telephony.CarrierConfigManager.KEY_SUPPORT_IMS_CONFERENCE_EVENT_PACKAGE_BOOL;
+
 import android.annotation.Nullable;
 import android.content.Context;
 import android.content.Intent;
@@ -35,10 +37,12 @@
 import android.telecom.VideoProfile;
 import android.telephony.CarrierConfigManager;
 import android.telephony.PhoneNumberUtils;
+import android.telephony.SubscriptionManager;
 
 // TODO: Needed for move to system service: import com.android.internal.R;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.CallerInfo;
+import com.android.internal.telephony.SubscriptionController;
 import com.android.server.telecom.callfiltering.CallFilteringResult;
 
 import java.util.Arrays;
@@ -129,6 +133,7 @@
     private static final String TAG = CallLogManager.class.getSimpleName();
 
     private final Context mContext;
+    private final CarrierConfigManager mCarrierConfigManager;
     private final PhoneAccountRegistrar mPhoneAccountRegistrar;
     private final MissedCallNotifier mMissedCallNotifier;
     private static final String ACTION_CALLS_TABLE_ADD_ENTRY =
@@ -144,6 +149,8 @@
     public CallLogManager(Context context, PhoneAccountRegistrar phoneAccountRegistrar,
             MissedCallNotifier missedCallNotifier) {
         mContext = context;
+        mCarrierConfigManager = (CarrierConfigManager) mContext
+                .getSystemService(Context.CARRIER_CONFIG_SERVICE);
         mPhoneAccountRegistrar = phoneAccountRegistrar;
         mMissedCallNotifier = missedCallNotifier;
         mLock = new Object();
@@ -193,7 +200,7 @@
      * should be logged in its PhoneAccount
      */
     @VisibleForTesting
-    public boolean shouldLogDisconnectedCall(Call call, int oldState, boolean isCallCanceled) {
+    public boolean shouldLogDisconnectedCall(Call call, int oldState, boolean isCallCancelled) {
         // "Choose account" phase when disconnected
         if (oldState == CallState.SELECT_PHONE_ACCOUNT) {
             return false;
@@ -211,7 +218,7 @@
         }
 
         DisconnectCause cause = call.getDisconnectCause();
-        if (isCallCanceled) {
+        if (isCallCancelled) {
             // No log when disconnecting to simulate a single party conference.
             if (cause != null
                     && DisconnectCause.REASON_EMULATING_SINGLE_CALL.equals(cause.getReason())) {
@@ -228,11 +235,25 @@
             return false;
         }
 
-        // Call merged into conferences.
+        // Call merged into conferences and marked with IMS_MERGED_SUCCESSFULLY.
         if (cause != null && android.telephony.DisconnectCause.toString(
                 android.telephony.DisconnectCause.IMS_MERGED_SUCCESSFULLY)
                 .equals(cause.getReason())) {
-            return false;
+            int subscriptionId = mPhoneAccountRegistrar
+                    .getSubscriptionIdForPhoneAccount(call.getTargetPhoneAccount());
+            // By default, the conference should return a list of participants.
+            if (subscriptionId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+                return false;
+            }
+
+            PersistableBundle b = mCarrierConfigManager.getConfigForSubId(subscriptionId);
+            if (b == null) {
+                return false;
+            }
+
+            if (b.getBoolean(KEY_SUPPORT_IMS_CONFERENCE_EVENT_PACKAGE_BOOL, true)) {
+                return false;
+            }
         }
 
         boolean shouldCallSelfManagedLogged = call.isLoggedSelfManaged()