Merge "Do not post notifications for logged self-managed connections" into oc-dr1-dev
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 0ff258e..aaa3466 100755
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -149,12 +149,12 @@
         //    should be logged in its PhoneAccount
         if (isNewlyDisconnected &&
                 (oldState != CallState.SELECT_PHONE_ACCOUNT &&
-                 !call.isConference() &&
-                 !isCallCanceled) &&
+                        !call.isConference() &&
+                        !isCallCanceled) &&
                 !call.isExternalCall() &&
                 (!call.isSelfManaged() ||
-                call.isLoggedSelfManaged() &&
-                        call.getHandoverState() != HandoverState.HANDOVER_FAILED)) {
+                        (call.isLoggedSelfManaged() &&
+                                call.getHandoverState() != HandoverState.HANDOVER_FAILED))) {
             int type;
             if (!call.isIncoming()) {
                 type = Calls.OUTGOING_TYPE;
@@ -167,7 +167,10 @@
             } else {
                 type = Calls.INCOMING_TYPE;
             }
-            logCall(call, type, true /*showNotificationForMissedCall*/);
+            // Always show the notification for managed calls. For self-managed calls, it is up to
+            // the app to show the notification, so suppress the notification when logging the call.
+            boolean showNotification = !call.isLoggedSelfManaged();
+            logCall(call, type, showNotification);
         }
     }