diff --git a/java/com/android/bubble/Bubble.java b/java/com/android/bubble/Bubble.java
index 9abfa43..392daaf 100644
--- a/java/com/android/bubble/Bubble.java
+++ b/java/com/android/bubble/Bubble.java
@@ -124,9 +124,11 @@
 
   private BubbleExpansionStateListener bubbleExpansionStateListener;
 
+  /** Type of action after bubble collapse */
   @Retention(RetentionPolicy.SOURCE)
   @IntDef({CollapseEnd.NOTHING, CollapseEnd.HIDE})
-  private @interface CollapseEnd {
+  @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+  public @interface CollapseEnd {
     int NOTHING = 0;
     int HIDE = 1;
   }
@@ -210,18 +212,10 @@
   }
 
   /** Expands the main bubble menu. */
-  public void expand() {
-    if (expanded || textShowing || currentInfo.getActions().isEmpty()) {
-      try {
-        currentInfo.getPrimaryIntent().send();
-      } catch (CanceledException e) {
-        throw new RuntimeException(e);
-      }
-      return;
-    }
-
+  public void expand(boolean isUserAction) {
     if (bubbleExpansionStateListener != null) {
-      bubbleExpansionStateListener.onBubbleExpansionStateChanged(ExpansionState.START_EXPANDING);
+      bubbleExpansionStateListener.onBubbleExpansionStateChanged(
+          ExpansionState.START_EXPANDING, isUserAction);
     }
     doResize(
         () -> {
@@ -378,7 +372,7 @@
   public void showText(@NonNull CharSequence text) {
     textShowing = true;
     if (expanded) {
-      startCollapse(CollapseEnd.NOTHING);
+      startCollapse(CollapseEnd.NOTHING, false);
       doShowText(text);
     } else {
       // Need to transition from old bounds to new bounds manually
@@ -456,7 +450,7 @@
   }
 
   void onMoveStart() {
-    startCollapse(CollapseEnd.NOTHING);
+    startCollapse(CollapseEnd.NOTHING, true);
     viewHolder
         .getPrimaryButton()
         .animate()
@@ -474,7 +468,17 @@
   }
 
   void primaryButtonClick() {
-    expand();
+    // Send primary intent if not to expand.
+    if (expanded || textShowing || currentInfo.getActions().isEmpty()) {
+      try {
+        currentInfo.getPrimaryIntent().send();
+      } catch (CanceledException e) {
+        throw new RuntimeException(e);
+      }
+      return;
+    }
+
+    expand(true);
   }
 
   void onLeftRightSwitch(boolean onRight) {
@@ -534,7 +538,7 @@
     }
 
     if (expanded) {
-      startCollapse(CollapseEnd.HIDE);
+      startCollapse(CollapseEnd.HIDE, false);
       return;
     }
 
@@ -692,7 +696,8 @@
             });
   }
 
-  private void startCollapse(@CollapseEnd int endAction) {
+  @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+  public void startCollapse(@CollapseEnd int endAction, boolean isUserAction) {
     View expandedView = viewHolder.getExpandedView();
     if (expandedView.getVisibility() != View.VISIBLE || collapseAnimation != null) {
       // Drawer is already collapsed or animation is running.
@@ -706,7 +711,8 @@
       collapseEndAction = endAction;
     }
     if (bubbleExpansionStateListener != null && collapseEndAction == CollapseEnd.NOTHING) {
-      bubbleExpansionStateListener.onBubbleExpansionStateChanged(ExpansionState.START_COLLAPSING);
+      bubbleExpansionStateListener.onBubbleExpansionStateChanged(
+          ExpansionState.START_COLLAPSING, isUserAction);
     }
     collapseAnimation =
         expandedView
@@ -805,7 +811,7 @@
       root.setOnBackPressedListener(
           () -> {
             if (visibility == Visibility.SHOWING && expanded) {
-              startCollapse(CollapseEnd.NOTHING);
+              startCollapse(CollapseEnd.NOTHING, true);
               return true;
             }
             return false;
@@ -820,7 +826,7 @@
       root.setOnTouchListener(
           (v, event) -> {
             if (expanded && event.getActionMasked() == MotionEvent.ACTION_OUTSIDE) {
-              startCollapse(CollapseEnd.NOTHING);
+              startCollapse(CollapseEnd.NOTHING, true);
               return true;
             }
             return false;
@@ -910,6 +916,6 @@
 
   /** Listener for bubble expansion state change. */
   public interface BubbleExpansionStateListener {
-    void onBubbleExpansionStateChanged(@ExpansionState int expansionState);
+    void onBubbleExpansionStateChanged(@ExpansionState int expansionState, boolean isUserAction);
   }
 }
diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto
index f273a36..ed3866a 100644
--- a/java/com/android/dialer/logging/dialer_impression.proto
+++ b/java/com/android/dialer/logging/dialer_impression.proto
@@ -479,7 +479,7 @@
     // In in call UI
     UPGRADE_TO_VIDEO_CALL_BUTTON_SHOWN = 1236;
 
-    // Bubble primary button first click to expand bubble
+    // Bubble primary button first click to expand bubble (by user)
     BUBBLE_PRIMARY_BUTTON_EXPAND = 1237;
     // Bubble prinary button second click to return to call
     BUBBLE_PRIMARY_BUTTON_RETURN_TO_CALL = 1238;
diff --git a/java/com/android/incallui/ReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java
index fd48b37..89731bc 100644
--- a/java/com/android/incallui/ReturnToCallController.java
+++ b/java/com/android/incallui/ReturnToCallController.java
@@ -134,14 +134,36 @@
     returnToCallBubble.setBubbleExpansionStateListener(
         new BubbleExpansionStateListener() {
           @Override
-          public void onBubbleExpansionStateChanged(@ExpansionState int expansionState) {
+          public void onBubbleExpansionStateChanged(
+              @ExpansionState int expansionState, boolean isUserAction) {
+            if (!isUserAction) {
+              return;
+            }
+
+            DialerCall call = CallList.getInstance().getActiveOrBackgroundCall();
             switch (expansionState) {
               case ExpansionState.START_EXPANDING:
-                Logger.get(context)
-                    .logImpression(DialerImpression.Type.BUBBLE_PRIMARY_BUTTON_EXPAND);
+                if (call != null) {
+                  Logger.get(context)
+                      .logCallImpression(
+                          DialerImpression.Type.BUBBLE_PRIMARY_BUTTON_EXPAND,
+                          call.getUniqueCallId(),
+                          call.getTimeAddedMs());
+                } else {
+                  Logger.get(context)
+                      .logImpression(DialerImpression.Type.BUBBLE_PRIMARY_BUTTON_EXPAND);
+                }
                 break;
               case ExpansionState.START_COLLAPSING:
-                Logger.get(context).logImpression(DialerImpression.Type.BUBBLE_COLLAPSE_BY_USER);
+                if (call != null) {
+                  Logger.get(context)
+                      .logCallImpression(
+                          DialerImpression.Type.BUBBLE_COLLAPSE_BY_USER,
+                          call.getUniqueCallId(),
+                          call.getTimeAddedMs());
+                } else {
+                  Logger.get(context).logImpression(DialerImpression.Type.BUBBLE_COLLAPSE_BY_USER);
+                }
                 break;
               default:
                 break;
